Closed ptormene closed 5 years ago
This is probably closely related (extracting 'agg_losses'):
Unable to extract http://localhost:8800/v1/calc/1/extract/agg_losses/nonstructural with parameters None (Internal Server Error):
KeyError: "Can't open attribute (can't locate attribute: 'stats')"
Fi[...]
[...]le "/home/paolo/projects/oq-engine/openquake/server/views.py", line 679, in extract
aw = _extract(ds, what + query_string)
File "/home/paolo/projects/oq-engine/openquake/calculators/extract.py", line 170, in __call__
data = self[k](dstore, v)
File "/home/paolo/projects/oq-engine/openquake/calculators/extract.py", line 533, in extract_agg_losses
stats = dstore['avg_losses-stats'].attrs['stats']
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "/home/paolo/py36/lib/python3.6/site-packages/h5py/_hl/attrs.py", line 60, in __getitem__
attr = h5a.open(self._id, self._e(name))
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5a.pyx", line 77, in h5py.h5a.open
I've also tried to call the extract without passing the loss_type, as it is done for other output types, but it does not work either:
Unable to extract http://localhost:8800/v1/calc/1/extract/agg_losses with parameters None (Internal Server Error):
ValueError: loss_type not passed in agg_losses/<loss_type>
File "/home/paolo/projects/oq-engine/openquake/server/views.py", line 679, in extract
aw = _extract(ds, what + query_string)
File "/home/paolo/projects/oq-engine/openquake/calculators/extract.py", line 175, in __call__
data = self[key](dstore, '')
File "/home/paolo/projects/oq-engine/openquake/calculators/extract.py", line 527, in extract_agg_losses
raise ValueError('loss_type not passed in agg_losses/<loss_type>')
Plugin side I have a note stating that it is fine to extract 'losses_by_asset' for both output types 'losses_by_asset' and 'avg_losses-stats'.
This is also breaking the integration tests (see https://travis-ci.org/gem/oq-irmt-qgis/jobs/568489251#L766)