oq-engine
oq-engine copied to clipboard
The GED4ALL importer is broken
riskinput.asset.Exposure.read(fnames, asset_nodes=True) does not return asset nodes anymore, thus breaking @pslh importer. We need to add a test.
PS: here is how Exposure.read is used: https://github.com/gem/ged4all/blob/master/python/import_exposure_nrml.py
Here are then things to do on the importer side:
- change the line
al = list(readinput.Exposure.read(nrml_file, asset_nodes=True))
with
al = asset.Exposure.read([nrml_file]).assets
- change in _import_asset
asset.attrib.get('id') -> asset.asset_id
asset.attrib.get('taxonomy') -> asset.tags['taxonomy']
asset.attrib.get('number') -> asset.number
asset.attrib.get('area') -> asset.area
loc['lon'], loc['lat'] -> asset.location[0], asset.location[1]
_get_full_geom(asset) -> asset.tags.get('geometry')
- change in _get_tags
asset.tags.attrib->asset.tags
Michele, let's talk - this code works for NRML files using CSV but not for those using XML only. Previously the code worked with both.
Paul says that this is not relevant anymore