oq-engine icon indicating copy to clipboard operation
oq-engine copied to clipboard

The GED4ALL importer is broken

Open micheles opened this issue 5 years ago • 2 comments

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

micheles avatar Apr 10 '20 07:04 micheles

Here are then things to do on the importer side:

  1. change the line
al = list(readinput.Exposure.read(nrml_file, asset_nodes=True))

with

al = asset.Exposure.read([nrml_file]).assets
  1. 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')
  1. change in _get_tags asset.tags.attrib -> asset.tags

micheles avatar Apr 21 '20 08:04 micheles

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.

pslh avatar Apr 21 '20 16:04 pslh

Paul says that this is not relevant anymore

micheles avatar Jul 05 '23 13:07 micheles