Skip to content
Open
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
297 commits
Select commit Hold shift + click to select a range
d92730b
Complete moving make_impact_report to openquake.calculators.postproc …
ptormene Feb 23, 2026
f49d2aa
Empty ShakeMap version selector before sending the request to retriev…
ptormene Feb 23, 2026
763c046
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Feb 24, 2026
4571490
Merge remote-tracking branch 'origin/postproc' into impact_report
ptormene Feb 24, 2026
6f5698c
Run make_impact_report as postrisk_func
ptormene Feb 24, 2026
d45cbc5
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Feb 24, 2026
f178ed7
Replace some remaining occurrences of 'aristotle' to 'impact'
ptormene Feb 24, 2026
b9435f6
Pep8, docstrings, minor fixes
ptormene Feb 24, 2026
107d3dc
Handle multi-country case
ptormene Feb 24, 2026
0b4001a
Use a separate button for each country impact report
ptormene Feb 24, 2026
e53740b
Change a label
ptormene Feb 24, 2026
e39715e
Replace a print with a logging.warning
ptormene Feb 24, 2026
aeba3b2
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Feb 25, 2026
2334c2a
Minor improvements to bin/extract_impact_reports.py
ptormene Feb 25, 2026
8f36175
Fix corner case in which the hypocenter is close to a country within …
ptormene Feb 25, 2026
6a7edb5
Add extractor for avg_losses and extract avg_losses mean instead of e…
ptormene Feb 25, 2026
5f4f900
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Feb 26, 2026
04e6e4d
Merge remote-tracking branch 'origin/warnings' into impact_report
ptormene Feb 26, 2026
08c6cea
Fix a deprecation warning using a timezone-aware object to represent …
ptormene Feb 26, 2026
9b9991e
Test that impact reports are generated, stored into the datastore and…
ptormene Feb 26, 2026
25ab4a4
Extract the common parts of views impact_run and impact_run_with_shak…
ptormene Feb 26, 2026
6c71405
Make it possible to use either geoBoundaries or the admin1 gpkg provi…
ptormene Feb 27, 2026
3efc515
Avoid storing plots for individual variables into the datastore, and …
ptormene Feb 27, 2026
6eca4f7
Fix a regression in aggregate_losses
ptormene Feb 27, 2026
7b3fb97
Raise an exception if no boundaries are available for the country obj…
ptormene Mar 3, 2026
08d80cb
Show the hypocenter in the 3 maps as a yellow star and add the corres…
ptormene Mar 3, 2026
c908f7e
Reduce the size of hypocenter marker
ptormene Mar 3, 2026
67dc41b
Set threshold_deg dynamically depending from the magnitude of the eve…
ptormene Mar 3, 2026
01f6281
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 4, 2026
7a4b9f1
Remove countries_info.csv and make it configurable from openquake.cfg…
ptormene Mar 4, 2026
6303e0c
Use adjustText package to automatically resolve text collisions in ma…
ptormene Mar 4, 2026
80d99ad
Remove arrows (that caused an annoying warning) and increase the top_…
ptormene Mar 4, 2026
bd1eb4d
Display top N cities (in terms of population) instead of using a thre…
ptormene Mar 4, 2026
9724fe7
Adjust the viewport to include the affected geographic area and inclu…
ptormene Mar 4, 2026
f61c992
Replace n with num_cities and num_regions
ptormene Mar 4, 2026
b59da4f
Increase city_font_size from 8 to 10
ptormene Mar 4, 2026
3432659
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 6, 2026
7e5289b
Cache reading admin boundaries, so it is done only once; log warnings…
ptormene Mar 6, 2026
deff2e2
In case of no uncertainty, display no ranges and add a note to the table
ptormene Mar 6, 2026
f821751
Do not generate the report for countries that have lossmea almost zer…
ptormene Mar 9, 2026
d36ccc3
Zoom maps to the actually affected regions
ptormene Mar 9, 2026
f7460a1
Move the call to save_most_affected_regions before the generation of …
ptormene Mar 9, 2026
9479f7a
Assume all variables required for the report are present
ptormene Mar 9, 2026
d9905ae
Avoid collisions with the legend
ptormene Mar 9, 2026
5ee3e4e
Write 'Summary of impact for <country name> instead of for <iso3>
ptormene Mar 9, 2026
e2a057e
Make region fill slightly transparent, so it does not completely hide…
ptormene Mar 9, 2026
eed1779
Use DejaVu unicode font to make it possible to display non-asci chara…
ptormene Mar 9, 2026
8218403
Make sure also the text containing the time of the calculation is dis…
ptormene Mar 9, 2026
813d2bb
Use a dot (instead of a semicolon) as separator between the event nam…
ptormene Mar 9, 2026
9c292bb
Handle cases in which the shakemap_version or the job title are not a…
ptormene Mar 9, 2026
fa2ecd9
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 11, 2026
a732a0e
Always use the user-provided event description, instead of the origin…
ptormene Mar 11, 2026
8d60dee
Exclude some recently-added params from those visible in the email no…
ptormene Mar 11, 2026
d151e52
In the text of email notifcations, avoid printing twice elements that…
ptormene Mar 11, 2026
432d032
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 11, 2026
c81c410
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 11, 2026
a58f36a
Fix typo in impact_rupture_params_from.html -> impact_rupture_params_…
ptormene Mar 11, 2026
897090c
Change the way some form elements are shown/hidden depending from the…
ptormene Mar 12, 2026
f489a65
Fix closing a couple of comments
ptormene Mar 12, 2026
342cfe0
Reduce the figsize of shakemap plots to show in the impact workflow, …
ptormene Mar 12, 2026
30634d4
Handle case trying to retrieve ShakeMap data when no ShakeMap is avai…
ptormene Mar 12, 2026
6b3cd5d
Fallback using title when description is unavailable; raise test time…
ptormene Mar 12, 2026
e6f4d43
Do not override the default settings via local_settings.py while runn…
ptormene Mar 12, 2026
18fce21
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 13, 2026
016ec61
Handle most unicode characters in event name, notes and most affected…
ptormene Mar 13, 2026
d1c1b81
Include font support for Japanese Hiregana and Katakana
ptormene Mar 16, 2026
6b6a0ba
Make it possible to configure a different source for country geometri…
ptormene Mar 16, 2026
9226023
Add optional requirements files for aelo and impact
ptormene Mar 17, 2026
9664af3
Add a missing dollar sign in artifact names
ptormene Mar 17, 2026
a254ebb
In github actions for aelo and impact install requirements from corre…
ptormene Mar 17, 2026
7996459
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 18, 2026
66fac5d
Reduce maxsize to 1 for _read_admin_layer and add a comment
ptormene Mar 18, 2026
e52286e
Remove a function that is not used anymore
ptormene Mar 18, 2026
77c2b58
Add some logging to differentiate between countries with no losses or…
ptormene Mar 18, 2026
e447384
In maps use the median avg_losses instead of the mean
ptormene Mar 18, 2026
d27c091
Pass images to _build_grid explicitly to avoid implicit ordering depe…
ptormene Mar 18, 2026
32f2bea
Make it possible to avoid having config.directory.admin0_boundaries_f…
ptormene Mar 18, 2026
978997b
Downgrade rasterio to 1.4.4
ptormene Mar 18, 2026
89c9309
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 18, 2026
d25ca68
Improve some comments and variable names
ptormene Mar 18, 2026
d71a536
Better check the consistency between available colors and classifier …
ptormene Mar 18, 2026
88eb539
Draw the basemap first so all vector layers render on top of it
ptormene Mar 18, 2026
d369cee
Collect city scatters instead of relying on ax.collections[-1]
ptormene Mar 18, 2026
7baa08f
Do not reserve right-side space, because the legend is placed inside …
ptormene Mar 18, 2026
b207697
add wheel for rasterio
vot4anto Mar 18, 2026
1422758
add wheel for pure python requirements
vot4anto Mar 18, 2026
f999724
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 24, 2026
ed879ae
Fix propagation of email_file_path in the unified _run_impact_job
ptormene Mar 24, 2026
2f580e8
Raise some timeouts
ptormene Mar 24, 2026
c3def8f
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 25, 2026
05e5114
While testing aelo and impact runs, abort/remove by job_id (not lates…
ptormene Mar 25, 2026
de2bf3e
Test also downloading the datastore
ptormene Mar 25, 2026
d8cc804
Make sure to include also the epicenter within the viewport of the im…
ptormene Mar 27, 2026
7b7c960
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 27, 2026
d485e90
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 27, 2026
db208ec
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Mar 31, 2026
32ef28a
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Apr 1, 2026
bd73d0b
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Apr 21, 2026
f0490ea
Set region_kind explicitly
ptormene Apr 22, 2026
13b115f
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Apr 22, 2026
5b0a1f1
Fix a couple of missing imports
ptormene Apr 22, 2026
83776f9
Merge remote-tracking branch 'origin/master' into impact_report
ptormene May 14, 2026
d65b2bd
Merge remote-tracking branch 'origin/master' into impact_report
ptormene May 15, 2026
a6fc2be
Merge remote-tracking branch 'origin/master' into impact_report
ptormene May 18, 2026
77f2c23
Merge remote-tracking branch 'origin/master' into impact_report
ptormene May 19, 2026
dd977fe
Merge remote-tracking branch 'origin/master' into impact_report
ptormene May 26, 2026
5f43774
Save the impact report also as PNG and make it downloadable through t…
ptormene May 26, 2026
e462226
Merge remote-tracking branch 'origin/master' into impact_report
ptormene May 29, 2026
16ff65e
Merge remote-tracking branch 'origin/master' into impact_report
ptormene May 29, 2026
964d338
Merge remote-tracking branch 'origin/master' into impact_report
ptormene May 29, 2026
e22803e
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jun 1, 2026
5daa710
Move the timezonefinder requirement from the general linux requiremen…
ptormene Jun 1, 2026
7bcf8b3
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jun 3, 2026
b9ea856
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jun 4, 2026
51f6971
In the impact requirements get PyMuPDF from openquake weelhouse
ptormene Jun 5, 2026
8360646
Remove unused import
ptormene Jun 5, 2026
139c488
Log an error message instead of raising an exception in case basemap_…
ptormene Jun 5, 2026
e6e2d6f
Rename requirement files for impact and aelo
ptormene Jun 5, 2026
ddf6e00
Fix requirements names referenced by engine_pr_test.yml
ptormene Jun 5, 2026
26fd24f
Fix requirements for impact referenced by engine_pr_test.yml
ptormene Jun 5, 2026
699e061
Use a couple of dataclasses to better organize report parameters and …
ptormene Jun 5, 2026
599e081
Refactor plot_variable into shorter functions
ptormene Jun 5, 2026
6a8ebb6
Add two dataclasses to reduce function arguments, grouping map conf p…
ptormene Jun 5, 2026
8c33224
Reduce length of make_impact_report functions main and _build_grid
ptormene Jun 5, 2026
24f8475
Fix assert syntax in test_impact_mode
ptormene Jun 5, 2026
fb7ba95
Generate the report even if estimated losses are negligible (but not …
ptormene Jun 5, 2026
9031ab6
If worldcities.csv, countries_info.csv or fonts_dir are not in the cf…
ptormene Jun 9, 2026
6434856
Use try..except when reading report-related files from config.directory
ptormene Jun 9, 2026
92c05b0
Update actions weekly and nightly
ptormene Jun 9, 2026
ce962a0
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jun 19, 2026
96f3d5c
Use wget to obtain some files needed by impact PDF tests
ptormene Jun 19, 2026
d7efdff
Wget also admin1_boundaries_file for testing
ptormene Jun 19, 2026
2338697
Fix file format
ptormene Jun 19, 2026
8b8aa50
Fix file format also in the wget calls
ptormene Jun 19, 2026
912922d
Add a note [ci skip]
ptormene Jun 22, 2026
2d303a1
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jun 22, 2026
0723298
Cache reading the basemap
ptormene Jun 22, 2026
9db4297
Cache reading countries info
ptormene Jun 22, 2026
5dd51b7
Cache reading world cities file
ptormene Jun 22, 2026
0c16dc6
Add a comment [ci skip]
ptormene Jun 22, 2026
8ddc92a
Give a better error message in case admin2_boundaries_file is needed …
ptormene Jun 22, 2026
e7c6658
Improve a docstring [ci skip]
ptormene Jun 22, 2026
a705cee
Revert to using get_close_mosaic_models and add get_close_countries c…
ptormene Jun 22, 2026
80795db
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jun 24, 2026
4893337
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 1, 2026
4188613
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 6, 2026
e29240c
Do not add the usgs_id to the job description but display them togeth…
ptormene Jul 6, 2026
390c417
Add header 'Impact metric' to the left column of table 'summary of im…
ptormene Jul 6, 2026
dc79cb3
Replace 'Most affected regions' with 'Regions with highest number of …
ptormene Jul 6, 2026
a596580
Complete rupdic from rup_data metadata (including local timestamp) wi…
ptormene Jul 6, 2026
2843e53
Skip country report generation if country estimated losses are neglig…
ptormene Jul 6, 2026
158c897
Skip irrelevant countries earlier; use comma-separator for thousands …
ptormene Jul 6, 2026
f76aaca
Refactor the long get_rup_dic function into smaller ones
ptormene Jul 7, 2026
283ed56
Refactor _finalize_rupdic to return a new dict instead of mutating th…
ptormene Jul 7, 2026
ab26902
Fix encoding issue and use in test_impact_mode a case that needs to h…
ptormene Jul 7, 2026
91aba6d
Fix a regression introduced while refactoring the long get_rup_dic fu…
ptormene Jul 8, 2026
0618857
Raise a timeout for more reliability
ptormene Jul 8, 2026
9463be8
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 8, 2026
01d55fe
Avoid breaking in headless mode while waiting for browser tab with th…
ptormene Jul 8, 2026
139f359
Update the disclaimer on top of the impact report
ptormene Jul 9, 2026
abaea08
Add to 'Range of losses' the values (5% - 95%)
ptormene Jul 9, 2026
e550796
Remove legend titles from impact report maps (already present in map …
ptormene Jul 9, 2026
d5ba525
Show also the metric (median or mean) in map titles (e.g. Median fata…
ptormene Jul 9, 2026
df85e54
Change report notes layout using a full-width header for user notes a…
ptormene Jul 9, 2026
7181d62
Make the 'Show impact report' button open the report in PNG format by…
ptormene Jul 9, 2026
841ee88
Change report header to have 1st line with event description, 2nd wit…
ptormene Jul 9, 2026
88d1d0e
Make fonts in the impact report more consistent
ptormene Jul 10, 2026
c3773d1
Add colon to summary of impact and regions with highest number of fat…
ptormene Jul 10, 2026
8c0fa6f
Refactor the _build_grid function into many smaller functions
ptormene Jul 10, 2026
f17223e
In the impact report make maps look square, for more uniformity acros…
ptormene Jul 10, 2026
fa30b74
Add to the impact profile notes a link to the corresponding country p…
ptormene Jul 10, 2026
86289a0
Display mosaic model and trt in the notes if the approach is not use_…
ptormene Jul 13, 2026
1369cc1
Improve the workflow to determine the country profile link, being tol…
ptormene Jul 13, 2026
2ccb7b1
Use the GEM_REGION field from the countries_info file to determine th…
ptormene Jul 13, 2026
6481797
Convert rupture data only when available (get local timestamp with sh…
ptormene Jul 13, 2026
56c0914
Add to the summary of impact another column 'Exposed value' and resty…
ptormene Jul 13, 2026
d2a1fd5
Align numeric columns of the summary impact to the right
ptormene Jul 13, 2026
eda3b8b
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 13, 2026
331c73c
In exposed values use 'residents' for both 'Fatalities' and 'Displaced'
ptormene Jul 14, 2026
1089641
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 14, 2026
0e8018d
Do not generate the impact report for a country if all the estimated …
ptormene Jul 14, 2026
7868ecd
Add some comments [ci skip]
ptormene Jul 14, 2026
743e981
Make the generation of impact reports optional via an additional chec…
ptormene Jul 15, 2026
39b8fb3
Replace one-pager one-page
ptormene Jul 15, 2026
f5ba39b
Add the make_impact_reports parameter also to impact.py to be used fr…
ptormene Jul 16, 2026
49b7222
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 27, 2026
86f148b
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 27, 2026
24989b6
Split make_impact_reports.py main function into functions shorter tha…
ptormene Jul 27, 2026
ebe9922
In impact_run_with_shakemap use also the make_impact_reports boolean …
ptormene Jul 27, 2026
2c38170
In impact_run_with_shakemap do not overwrite the initial contents of …
ptormene Jul 27, 2026
49d0e68
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 28, 2026
9d0d2f7
Merge branch 'fix_export_asce' into impact_report
ptormene Jul 28, 2026
354ec3d
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 29, 2026
b53f372
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Jul 30, 2026
970ae2d
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 3, 2026
f19416e
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 3, 2026
d2ffd9d
Raise some timeouts
ptormene Aug 3, 2026
8561432
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 4, 2026
32b297d
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 6, 2026
4e4b80a
Merge branch 'fixexpbylse' into impact_report
ptormene Aug 6, 2026
279b9a5
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 7, 2026
16c4d44
Use spatial correlation also in impact jobs
ptormene Aug 7, 2026
d6d1bcf
Raise a few timeouts in playwright tests
ptormene Aug 7, 2026
0ee559d
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 8, 2026
c69fcb4
Merge branch 'use_spatial_corr' into impact_report
ptormene Aug 8, 2026
26a96dd
Revert "Use spatial correlation also in impact jobs"
ptormene Aug 8, 2026
64a0da2
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 11, 2026
4845712
Get local timestamp from shakemap properties instead of from the unre…
ptormene Aug 11, 2026
38d5a42
Fix test_get_close_mosaic_models
ptormene Aug 11, 2026
5b6719f
In parsers.py replace docstrings of private functions with comments
ptormene Aug 11, 2026
b9e3e6e
Replace obsolete syntax in MapStyleConfig and MapDataElements
ptormene Aug 11, 2026
7b9b2de
Split make_impact_reports.py into 3 modules (adding a module with the…
ptormene Aug 12, 2026
7522700
Fix some comments and logging
ptormene Aug 12, 2026
39d1fcb
Change the default relative paths of files needed to build country im…
ptormene Aug 13, 2026
34953b8
Guard against a stale/fading .modal-backdrop from a prior modal inter…
ptormene Aug 13, 2026
2c00a88
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 13, 2026
d86d9d7
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 18, 2026
3fc81af
Replace 'Buildings lost' -> 'Buildings destroyed' and 'buildings beyo…
ptormene Aug 18, 2026
b0ae30a
Add to impact requirements affine 2.4.0
ptormene Aug 18, 2026
d21d392
Fix reading hypocenter details from json metadata
ptormene Aug 21, 2026
669d33d
Fix pep8
ptormene Aug 21, 2026
f0645ac
Specify that the aggrisk table on top of the impact outputs page curr…
ptormene Aug 21, 2026
0477a4b
Add to output_impact a button 'Show summary impact table' and rename …
ptormene Aug 21, 2026
9285407
Rename 'Show full impact table' -> 'Show impact full table' and 'Sho…
ptormene Aug 21, 2026
d22d185
Refine the impact summary table, excluding embodied_carbon, displayin…
ptormene Aug 21, 2026
3144cc1
In the show_table template (e.g. impact summary table) align numeric …
ptormene Aug 21, 2026
db15c78
Write a longer explanation on top of the losses table and avoid repea…
ptormene Aug 21, 2026
051b50d
Avoid animations/transitions in playwright UI tests to prevent Bootst…
ptormene Aug 22, 2026
eb566aa
Revert "Guard against a stale/fading .modal-backdrop from a prior mod…
ptormene Aug 22, 2026
3c392af
Reapply "Guard against a stale/fading .modal-backdrop from a prior mo…
ptormene Aug 24, 2026
dd62a71
Revert "Avoid animations/transitions in playwright UI tests to preven…
ptormene Aug 24, 2026
b87d86a
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 24, 2026
f3b98d2
Add to the impact outputs page a table with job input parameters that…
ptormene Aug 25, 2026
d75ff3e
Add the possibility to run impact ui tests without aborting/removing …
ptormene Aug 25, 2026
81d78c4
Wait for visible 'has been aborted/removed' before clicking the 'Clos…
ptormene Aug 25, 2026
0379db1
Add a note about the fact that it would be useless to show to the use…
ptormene Aug 25, 2026
cc323d6
Move the inputs table on top, to avoid displaying losses -> inputs ->…
ptormene Aug 25, 2026
5321c35
Reduce the vertical size of the rows of the impact inputs table
ptormene Aug 25, 2026
172152a
Reduce even more the vertical size of the rows of the impact input table
ptormene Aug 25, 2026
1653cff
Get the local timestamp and time of the event also for the impact app…
ptormene Aug 26, 2026
d365267
Wait for network/DOM stability so that asynchronous table loads compl…
ptormene Aug 26, 2026
327187b
Minor pep8 fixes
ptormene Aug 26, 2026
b41bbf5
Filter rows using exact text matching on td:first-child to avoid ambi…
ptormene Aug 26, 2026
c6609de
Fix case running impact with ShakeMap programmatically in case of mis…
ptormene Aug 26, 2026
8fbe907
Replace 'Number of people living in buildings with moderate or higher…
ptormene Aug 27, 2026
9c61e89
Keep 'Make one-page country reports' unchecked by default
ptormene Aug 27, 2026
9aeaf9a
Below the impact summary table add a section with the explanation of …
ptormene Aug 31, 2026
7ac5840
Merge remote-tracking branch 'origin/master' into impact_report
ptormene Aug 31, 2026
fbb6c70
If a field explanation contains a link, make it clickable
ptormene Aug 31, 2026
d21edb0
Minor changes to AGGRISK_FIELD_EXPLANATION texts
ptormene Sep 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/engine_nightly_webui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,16 @@ jobs:
set -x
date
wget https://downloads.openquake.org/test_data/exposure.hdf5
wget https://downloads.openquake.org/test_data/worldcities.csv
wget https://downloads.openquake.org/test_data/countries_info.csv
wget https://downloads.openquake.org/test_data/World_Adm1_updated.gpkg
wget https://downloads.openquake.org/test_data/fonts.zip
unzip fonts.zip
date
mv exposure.hdf5 openquake/qa_tests_data/mosaic/
source ~/openquake/bin/activate
PY_VER=$(echo "${{ matrix.python-version }}" | tr -d '.')
pip install -r requirements-impact-py${PY_VER}-linux64.txt
oq engine --upgrade-db
touch ~/webui-access.log
pip install https://wheelhouse.openquake.org/v3/py/pytest_django-4.9.0-py3-none-any.whl
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/engine_pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
set -e
source ~/openquake/bin/activate
pip install https://wheelhouse.openquake.org/v3/py/rtgmpy-1.0.1-py3-none-any.whl
pip install -r requirements-aelo-py-linux64.txt
oq engine --upgrade-db
pytest --doctest-modules -x --disable-warnings --color=yes --durations=10 openquake/calculators -k "not classical"

Expand Down Expand Up @@ -70,7 +70,8 @@ jobs:
run: |
set -e
source ~/openquake/bin/activate
pip install pyshp pytest flake8 ruff https://wheelhouse.openquake.org/v3/py/rtgmpy-1.0.1-py3-none-any.whl
pip install -r requirements-aelo-py-linux64.txt
pip install pyshp pytest flake8 ruff
oq engine --upgrade-db
ruff check openquake
curl https://downloads.openquake.org/test_data/exposure.hdf5 -o openquake/qa_tests_data/mosaic/exposure.hdf5
Expand Down Expand Up @@ -110,7 +111,14 @@ jobs:
source ~/openquake/bin/activate
oq engine --upgrade-db
pip install https://wheelhouse.openquake.org/v3/py/pytest_django-4.9.0-py3-none-any.whl
pip install -r requirements-impact-py311-linux64.txt
pip install -r requirements-aelo-py-linux64.txt
curl https://downloads.openquake.org/test_data/exposure.hdf5 -o openquake/qa_tests_data/mosaic/exposure.hdf5; ln -s openquake/qa_tests_data/mosaic/exposure.hdf5
wget https://downloads.openquake.org/test_data/worldcities.csv
wget https://downloads.openquake.org/test_data/countries_info.csv
wget https://downloads.openquake.org/test_data/World_Adm1_updated.gpkg
wget https://downloads.openquake.org/test_data/fonts.zip
unzip fonts.zip
OQ_APPLICATION_MODE=PUBLIC pytest -vx openquake/server/tests/test_public_mode.py
OQ_APPLICATION_MODE=RESTRICTED pytest -vx openquake/server/tests/test_restricted_mode.py
OQ_APPLICATION_MODE=READ_ONLY pytest -vx openquake/server/tests/test_read_only_mode.py
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/engine_weekly_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ jobs:
else
python install.py devel --version master
fi
PY_VER=`echo py${{ matrix.python-version }} | tr -d .`
echo $PY_VER
pip3 install -r requirements-impact-$PY_VER-linux64.txt
- name: Actualize 'impact' templates for email notifications
run: |
for file in ./openquake/server/templates/registration/*.impact.tmpl; do
Expand All @@ -429,6 +432,11 @@ jobs:
set -x
date
wget https://downloads.openquake.org/test_data/exposure.hdf5
wget https://downloads.openquake.org/test_data/worldcities.csv
wget https://downloads.openquake.org/test_data/countries_info.csv
wget https://downloads.openquake.org/test_data/World_Adm1_updated.gpkg
wget https://downloads.openquake.org/test_data/fonts.zip
unzip fonts.zip
date
mv exposure.hdf5 openquake/qa_tests_data/mosaic/
source ~/openquake/bin/activate
Expand Down
35 changes: 35 additions & 0 deletions bin/extract_impact_reports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import sys
import subprocess
from pathlib import Path
from openquake.commonlib import datastore


def main(calc_id: int):
dstore = datastore.read(calc_id)
if "impact" not in dstore:
raise RuntimeError("No 'impact' group found in datastore")
impact_group = dstore["impact"]
iso3_codes = list(impact_group.keys())
if not iso3_codes:
raise RuntimeError("No ISO3 reports found under 'impact/'")
print(f"Found ISO3 reports: {iso3_codes}")
for iso3 in iso3_codes:
country_group = impact_group[iso3]
if "report_pdf" not in country_group:
print(f"No report_pdf found for {iso3}")
continue
pdf_bytes = country_group["report_pdf"][()]
fname = Path(f"impact_report_{calc_id}_{iso3}.pdf")
with open(fname, "wb") as f:
f.write(pdf_bytes)
print(f"Wrote {fname}")
subprocess.Popen(["xdg-open", str(fname)])
dstore.close()


if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: extract_impact_reports.py <calc_id>")
sys.exit(1)

main(int(sys.argv[1]))
3 changes: 2 additions & 1 deletion openquake/calculators/event_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
RuptureProxy, EBRupture, get_ruptures_aw)
from openquake.hazardlib.shakemap.parsers import adjust_hypocenter
from openquake.commonlib import util, logs, readinput, datastore
from openquake.commonlib.readinput import get_close_mosaic_models
from openquake.commonlib.calc import (
gmvs_to_poes, make_hmaps, slice_dt, build_slice_by_event, RuptureImporter,
SLICE_BY_EVENT_NSITES, get_proxies, get_model_lts)
Expand Down Expand Up @@ -589,7 +590,7 @@ def read_gsim_lt(oq):
elif oq.rupture_xml:
hypo = readinput.get_rupture(oq).hypocenter
lon, lat = [hypo.x, hypo.y]
mosaic_models = readinput.get_close_mosaic_models(lon, lat, 5)
mosaic_models = get_close_mosaic_models(lon, lat, 5)
# NOTE: using the first mosaic model
oq.mosaic_model = mosaic_models[0]
if len(mosaic_models) > 1:
Expand Down
33 changes: 4 additions & 29 deletions openquake/calculators/export/risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
from openquake.baselib import hdf5, writers, general, node
from openquake.baselib.general import decode
from openquake.hazardlib import nrml
from openquake.hazardlib.stats import compute_stats2, mean_curve
from openquake.hazardlib.stats import mean_curve
from openquake.risklib import scientific
from openquake.commonlib import readinput
from openquake.calculators.extract import (
extract, sanitize, avglosses, aggexp_tags)
extract, sanitize, _get_data, aggexp_tags)
from openquake.calculators import base, post_risk
from openquake.calculators.export import export, loss_curves
from openquake.calculators.export.hazard import savez
Expand Down Expand Up @@ -225,32 +225,6 @@ def export_exposure_by_lse(ekey, dstore):
return [dest]


def _get_data(dstore, dskey, loss_types, stats):
name, kind = dskey.split('-') # i.e. ('avg_losses', 'stats')
if kind == 'stats':
try:
weights = dstore['weights'][()]
except KeyError:
# there is single realization, like in classical_risk/case_2
weights = [1.]
if dskey in set(dstore): # precomputed
rlzs_or_stats = list(stats)
statfuncs = [stats[ros] for ros in stats]
value = avglosses(dstore, loss_types, 'stats') # shape (A, S, L)
elif dstore['oqparam'].collect_rlzs:
rlzs_or_stats = list(stats)
value = avglosses(dstore, loss_types, 'rlzs')
else: # compute on the fly
rlzs_or_stats, statfuncs = zip(*stats.items())
value = compute_stats2(
avglosses(dstore, loss_types, 'rlzs'), statfuncs, weights)
else: # rlzs
value = avglosses(dstore, loss_types, kind) # shape (A, R, L)
R = value.shape[1]
rlzs_or_stats = ['rlz-%03d' % r for r in range(R)]
return name, value, rlzs_or_stats


# this is used by event_based_risk, classical_risk and scenario_risk
@export.add(('avg_losses-rlzs', 'csv'), ('avg_losses-stats', 'csv'))
def export_avg_losses(ekey, dstore):
Expand Down Expand Up @@ -856,7 +830,8 @@ def export_fragility_xml(dstore):
crm = dstore.read_df('crm')
ddic = {peril: {} for peril in crm.peril.unique()}
for (peril, loss_type), df in crm.groupby(['peril', 'loss_type']):
nodeobj = convert_df_to_fragility(peril, loss_type, oq.limit_states, df)
nodeobj = convert_df_to_fragility(
peril, loss_type, oq.limit_states, df)
dest = dstore.export_path('%s_%s_fragility.xml' % (peril, loss_type))
with open(dest, 'wb') as out:
nrml.write([nodeobj], out)
Expand Down
58 changes: 52 additions & 6 deletions openquake/calculators/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from openquake.hazardlib.contexts import (
ContextMaker, read_cmakers, read_ctx_by_grp)
from openquake.hazardlib.calc import disagg, stochastic, filters
from openquake.hazardlib.stats import calc_stats
from openquake.hazardlib.stats import calc_stats, compute_stats2
from openquake.hazardlib.source import rupture
from openquake.risklib.scientific import LOSSTYPE, LOSSID
from openquake.risklib.asset import tagset
Expand Down Expand Up @@ -867,15 +867,15 @@ def extract_mmi_tags(dstore, what):

def ensure_npy_serializable(df):
"""
Cast object-dtype columns of a DataFrame to fixed-width numpy byte
strings (dtype ``|S<n>``) so that a structured array built from it
is serializable with ``allow_pickle=False``.
Cast object-dtype and categorical columns of a DataFrame to fixed-width
numpy byte strings (dtype ``|S<n>``) so that a structured array built
from it is serializable with ``allow_pickle=False``.

:param df: a :class:`pandas.DataFrame`
:returns: the same DataFrame with object columns replaced in-place
:returns: the same DataFrame with string columns replaced in-place
"""
for col in df.columns:
if df[col].dtype != object:
if df[col].dtype != object and df[col].dtype.name != 'category':
continue
# Explicitly encode strings to UTF-8 bytes to handle non-ASCII
# characters (e.g., 'é', 'ñ') before casting to the fixed-width byte
Expand Down Expand Up @@ -1942,6 +1942,52 @@ def extract_high_sites(dstore, what):
return (max_hazard > .2).all(axis=1) # shape N


def _get_data(dstore, dskey, loss_types, stats):
name, kind = dskey.split('-') # i.e. ('avg_losses', 'stats')
if kind == 'stats':
try:
weights = dstore['weights'][()]
except KeyError:
# there is single realization, like in classical_risk/case_2
weights = [1.]
if dskey in set(dstore): # precomputed
rlzs_or_stats = list(stats)
statfuncs = [stats[ros] for ros in stats]
value = avglosses(dstore, loss_types, 'stats') # shape (A, S, L)
elif dstore['oqparam'].collect_rlzs:
rlzs_or_stats = list(stats)
value = avglosses(dstore, loss_types, 'rlzs')
else: # compute on the fly
rlzs_or_stats, statfuncs = zip(*stats.items())
value = compute_stats2(
avglosses(dstore, loss_types, 'rlzs'), statfuncs, weights)
else: # rlzs
value = avglosses(dstore, loss_types, kind) # shape (A, R, L)
R = value.shape[1]
rlzs_or_stats = ['rlz-%03d' % r for r in range(R)]
return name, value, rlzs_or_stats


@extract.add('avg_losses')
def extract_avg_losses(dstore, what):
"""
Example:
http://127.0.0.1:8800/v1/calc/30/extract/avg_losses?kind=stats
"""
oq = dstore['oqparam']
qdict = parse(what)
dskey = f"avg_losses-{qdict['kind'][0]}"
name, value, rlzs_or_stats = _get_data(
dstore, dskey, oq.ext_loss_types, oq.hazard_stats())
assets = util.get_assets(dstore)
dt = [(lt, F32) for lt in oq.ext_loss_types]
for ros, values in zip(rlzs_or_stats, value.transpose(1, 0, 2)):
array = numpy.zeros(len(values), dt)
for lt, ln in enumerate(oq.ext_loss_types):
array[ln] = values[:, lt]
yield ros, util.compose_arrays(assets, array)


# ##################### extraction from the WebAPI ###################### #

class WebAPIError(RuntimeError):
Expand Down
Loading
Loading