-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visualize losses produced by an aristotle calculation #9529
Conversation
…s table, separating sums with a thicker line above
…ing them into the legend title
openquake/commands/plot_assets.py
Outdated
iso_codes = [ | ||
iso_code.decode('utf8') | ||
for iso_code in | ||
dstore['assetcol/tagcol/ID_0'][numpy.unique(assetcol['ID_0'])]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For performance reasons, the right way to do this is as follows:
ALL_ID_0 = dstore['assetcol/tagcol/ID_0'][:]
ID_0 = ALL_ID_0[numpy.unique(assetcol['ID_0'])]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1264,6 +1263,75 @@ def web_engine_get_outputs_aelo(request, calc_id, **kwargs): | |||
warnings=warnings)) | |||
|
|||
|
|||
def get_aggrisk(calc_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring should say something like "Converting the aggrisk dataframe into a table like this:
..." and add an example table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
openquake/server/views.py
Outdated
content_type="text/csv", | ||
headers={ | ||
"Content-Disposition": | ||
'attachment; filename="aggrisk.csv"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check what happens when downloading the other aggrisk output (i.e. is the name "aggrisk.csv" already taken or not?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the csv file created downloading the standard aggrisk outputs is something like output-101-aggrisk-_45.csv, I suppose we might use a similar approach here, adding the calc_id, and we might decide to further differentiate the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add the calc_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
openquake/commands/plot_assets.py
Outdated
except KeyError: # ID_0 might be missing | ||
ax.legend() | ||
else: | ||
id_0_str = ', '.join([id_0.decode('utf8') for id_0 in ID_0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The square brackets are not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
The outputs in aristotle mode are displayed using a new template that we can further customize.
For now, all outputs and all export formats are available, and the losses table is presented on top (see the screenshot).
Below the table I also added a button to download the table as csv.
TODO:
Part of #9227