Skip to content

Commit

Permalink
Merge pull request #10321 from gem/org
Browse files Browse the repository at this point in the history
Fixed checkers.check to generate .org files
  • Loading branch information
micheles authored Feb 7, 2025
2 parents 2036bd8 + 794f1a8 commit 52501f9
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion openquake/calculators/checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def check(ini, hc_id=None, exports='', what='', prefix=''):
print('Spent %.1f seconds' % (time.time() - t0))
if what:
calc_id = calc.datastore.calc_id
fname = outdir / ('%s_%s.txt' % (what.replace(':', ''), calc_id))
fname = outdir / ('%s_%s.org' % (what.replace(':', ''), calc_id))
try:
tbl = view(what, calc.datastore)
except KeyError:
Expand Down
2 changes: 1 addition & 1 deletion openquake/calculators/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ def _aggexp_tags(dstore):
if not oq.aggregate_by:
raise InvalidFile(f'{dstore.filename}: missing aggregate_by')
if len(oq.aggregate_by) > 1: # i.e. [['ID_0'], ['OCCUPANCY']]
aggby = ['|'.join(a[0] for a in oq.aggregate_by)]
aggby = [','.join(a[0] for a in oq.aggregate_by)]
else: # i.e. [['ID_0', 'OCCUPANCY']]
[aggby] = oq.aggregate_by
keys = numpy.array([line.decode('utf8').split('\t')
Expand Down
42 changes: 42 additions & 0 deletions openquake/engine/tests/impact1/aggrisk_tags.org

Large diffs are not rendered by default.

42 changes: 0 additions & 42 deletions openquake/engine/tests/impact1/aggrisk_tags.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
| ID_1 | number | contents | nonstructural | structural | residents | area | occupants_day | occupants_night | occupants_transit | occupants_avg | contents_q05 | contents_q95 | nonstructural_q05 | nonstructural_q95 | structural_q05 | structural_q95 | occupants_q05 | occupants_q95 | area_q05 | area_q95 | number_q05 | number_q95 | residents_q05 | residents_q95 | contents_mean | nonstructural_mean | structural_mean | occupants_mean | area_mean | number_mean | residents_mean |
| ID_1,OCCUPANCY | number | contents | nonstructural | structural | residents | area | occupants_day | occupants_night | occupants_transit | occupants_avg | contents_q05 | contents_q95 | nonstructural_q05 | nonstructural_q95 | structural_q05 | structural_q95 | occupants_q05 | occupants_q95 | area_q05 | area_q95 | number_q05 | number_q95 | residents_q05 | residents_q95 | contents_mean | nonstructural_mean | structural_mean | occupants_mean | area_mean | number_mean | residents_mean |
|-------------------------+----------+------------+---------------+------------+-----------+---------+---------------+-----------------+-------------------+---------------+--------------+--------------+-------------------+-------------------+----------------+----------------+---------------+---------------+----------+----------+------------+------------+---------------+---------------+---------------+--------------------+-----------------+----------------+-----------+-------------+----------------|
| ETH-ADM1-1590546715-B3 | 5_384 | 10_203_206 | 12_663_548 | 26_374_970 | 25_558 | 335_577 | 6_065 | 25_059 | 15_196 | 15_440 | 510.7 | 107_847 | 122.5454 | 80_499 | 356.3 | 395_562 | 2.187E-05 | 1.4278 | 1.4511 | 1_359 | 0.0042 | 11.7145 | 0.0268 | 82.5611 | 36_009 | 26_706 | 108_301 | 0.3986 | 482.3 | 2.8620 | 22.8782 |
| ETH-ADM1-1590546715-B4 | 526.0 | 1_575_449 | 2_070_279 | 1_656_214 | 2_483 | 32_256 | 547.5 | 2_434 | 1_475 | 1_486 | 800.8 | 368_916 | 760.5 | 772_153 | 1_926 | 64_292 | 0.0090 | 0.2748 | 14.4107 | 323.5 | 0.2395 | 3.8460 | 2.5255 | 23.9290 | 164_016 | 218_309 | 19_602 | 0.1310 | 129.1188 | 1.7516 | 10.4421 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
| ID_1 | number | contents | nonstructural | structural | residents | area | occupants_day | occupants_night | occupants_transit | occupants_avg | contents_q05 | contents_q95 | nonstructural_q05 | nonstructural_q95 | structural_q05 | structural_q95 | occupants_q05 | occupants_q95 | area_q05 | area_q95 | number_q05 | number_q95 | residents_q05 | residents_q95 | contents_mean | nonstructural_mean | structural_mean | occupants_mean | area_mean | number_mean | residents_mean |
| ID_1,OCCUPANCY | number | contents | nonstructural | structural | residents | area | occupants_day | occupants_night | occupants_transit | occupants_avg | contents_q05 | contents_q95 | nonstructural_q05 | nonstructural_q95 | structural_q05 | structural_q95 | occupants_q05 | occupants_q95 | area_q05 | area_q95 | number_q05 | number_q95 | residents_q05 | residents_q95 | contents_mean | nonstructural_mean | structural_mean | occupants_mean | area_mean | number_mean | residents_mean |
|-------------------------+----------+-------------+---------------+-------------+-----------+-----------+---------------+-----------------+-------------------+---------------+--------------+--------------+-------------------+-------------------+----------------+----------------+---------------+---------------+-----------+-----------+------------+------------+---------------+---------------+---------------+--------------------+-----------------+----------------+-----------+-------------+----------------|
| ESP.11_1 | 1_177 | 66_596_376 | 165_296_960 | 99_194_792 | 3_880 | 227_475 | 853.2 | 3_663 | 1_948 | 2_155 | 0.0 | 1_571_112 | 0.0 | 1_722_173 | 0.0 | 824_819 | 0.0 | 0.0109 | 0.0 | 277.9 | 0.0 | 0.2730 | 0.0 | 15.2794 | 332_705 | 372_413 | 204_556 | 0.0066 | 74.3387 | 0.3290 | 3.4483 |
| ESP.1_1 | 442.0 | 54_987_324 | 73_771_768 | 44_729_352 | 1_972 | 117_498 | 2_339 | 2_037 | 1_322 | 1_899 | 0.0 | 420_643 | 0.0 | 732_763 | 0.0 | 326_217 | 0.0 | 0.0290 | 0.0 | 161.6992 | 0.0 | 0.3665 | 0.0 | 11.4188 | 84_910 | 147_677 | 87_038 | 0.0137 | 63.7446 | 0.0598 | 3.6996 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
| ID_1 | number | contents | nonstructural | structural | residents | area | occupants_day | occupants_night | occupants_transit | occupants_avg | contents_q05 | contents_q95 | nonstructural_q05 | nonstructural_q95 | structural_q05 | structural_q95 | occupants_q05 | occupants_q95 | area_q05 | area_q95 | number_q05 | number_q95 | residents_q05 | residents_q95 | contents_mean | nonstructural_mean | structural_mean | occupants_mean | area_mean | number_mean | residents_mean |
| ID_1,OCCUPANCY | number | contents | nonstructural | structural | residents | area | occupants_day | occupants_night | occupants_transit | occupants_avg | contents_q05 | contents_q95 | nonstructural_q05 | nonstructural_q95 | structural_q05 | structural_q95 | occupants_q05 | occupants_q95 | area_q05 | area_q95 | number_q05 | number_q95 | residents_q05 | residents_q95 | contents_mean | nonstructural_mean | structural_mean | occupants_mean | area_mean | number_mean | residents_mean |
|------------------------+---------+---------------+---------------+-------------+-----------+---------+---------------+-----------------+-------------------+---------------+--------------+--------------+-------------------+-------------------+----------------+----------------+---------------+---------------+----------+-----------+------------+------------+---------------+---------------+---------------+--------------------+-----------------+----------------+-----------+-------------+----------------|
| NZL-ADM1-1590546715-B2 | 3_274 | 1_552_800_128 | 930_776_064 | 623_760_704 | 10_787 | 927_158 | 1_678 | 10_002 | 4_280 | 5_320 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| NZL-ADM1-1590546715-B3 | 9.0000 | 1_458_235 | 991_579 | 546_923 | 64.6873 | 1_111 | 19.8044 | 61.0051 | 27.8610 | 36.2235 | 0.0 | 20.9065 | 0.0 | 0.0038 | 0.0 | 0.0024 | 0.0 | 3.176E-07 | 0.0 | 4.149E-06 | 0.0 | 3.000E-08 | 0.0 | 6.469E-07 | 4.1815 | 0.0011 | 6.633E-04 | 6.700E-08 | 1.194E-06 | 7.000E-09 | 1.294E-07 |
Expand Down
2 changes: 1 addition & 1 deletion openquake/server/tests/test_impact_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def impact_run_then_remove(
for job_id in js:
ret = self.get('%s/aggrisk_tags' % job_id)
# NOTE: the get utility decodes the json and returns a dict
self.assertIn('ID_1', ret)
self.assertIn('structural', ret)
ret = self.post('%s/remove' % job_id)
if ret.status_code != 200:
raise RuntimeError(
Expand Down

0 comments on commit 52501f9

Please sign in to comment.