pacificclimate / scip-frontend

Salmon Climate Impacts Portal
GNU General Public License v3.0
1 stars 1 forks source link

Make data displayed on a graph downloadable as a CSV file #53

Closed corviday closed 11 months ago

corviday commented 11 months ago

Adds a GraphDownloadButton to each graph. This button receives the same data as the graph and formats it as a CSV for download, plus an extra object (graphMetadata) containing contextual metadata like the emissions scenario and

It looks like more code than it is - the only functional changes to the *Graph.js files was to add the button; the only functional change to the *Display components was to create the metadata object. I did linting on every file I "touched", so it looks like there's a lot of changes, but most can be ignored.

New functional code is all in GraphDownloadButton.js.

Resolves #50

corviday commented 11 months ago

Demo is here.

Here is a CSV from each graph, currently they contain no model or experiment metadata.

Mean_Long_Term_annual_peak_flow_date__RXI1P1.csv stream_flow_by_calendar_month.csv stream_flow_by_calendar_day.csv

corviday commented 11 months ago

After discussion with @rod-glover and @jameshiebert , we've decided to include metadata like model and experiment as a second table in the CSV.

corviday commented 11 months ago

This is now ready for review. Demo is here. To see the new functionality, pick a watershed or conservation unit under the map (the first one on each list is valid), select one of the "indicator" tabs, and pick an indicator (variable) under ths tabs. The graph should load, including a button to download graph contents.

corviday commented 11 months ago

Is there a case when more than one run (rXi1p1) is present?

I have checked and there isn't, but there should be. We have 8 CanESM runs! This is suspicious and needs looking into. At a guess, I hardcoded the graph to one run when our data set was smaller for some reason and need to undo that now. Thank you for catching this!