cal-adapt / climakitae

A Python toolkit for retrieving, visualizing, and performing scientific analyses with data from the Cal-Adapt Analytics Engine.
https://climakitae.readthedocs.io
BSD 3-Clause "New" or "Revised" License
19 stars 2 forks source link

Making slight modifications to `agnostic.py` to show all 8 WRF models #344

Closed claalmve closed 4 months ago

claalmve commented 4 months ago

Description of PR

Currently, agnostic.py pulls 3km monthly data to create aggregations for LOCA/WRF simulations (V1). However, this may be a bit misleading since we have 8 WRF simulations to pull from rather than 4 WRF simulations shown in later visualizations in agnostic_tools.ipynb. So, this PR fixes that to allow for more timescales of data to be used for WRF data (hourly, daily, monthly), but not for LOCA, since the LOCA simulations in total are more data intensive.

Additionally, this PR upgrades the climate response plots at the end of the notebook by converting them from matplotlib plots to hvplots. This allows the users to toggle GCMs/simulations as desired, and save the figure if they would like.

This PR also makes a slight change to the plot_WRF function, allowing 4 WRF simulations or 8 WRF simulations to be visualized properly without overlapping x-labels.

Summary of changes and related issue

  1. Showing all 8 WRF simulations depending on timescale.
  2. Upgrading climate response plot from matplotlib to hvplot
  3. Plotting 4 vs 8 WRF simulations correctly respectively.

Relevant motivation and context We want to show all 8 WRF simulations, we want to toggle simulations/GCMs, we want more visually appealing plots.

Type of change

Checklist:

claalmve commented 4 months ago

Okay, so this works for monthly 100% fine, but on testing for hourly setting in WRF it retrieves data fine but the last plotting cell fails because there are a different number of simulations retrieved.

  • Either we force only selection of monthly (eh)
  • Add in "guardrails" and only return simulations that overlap in both variables in the backend

    • This is curious to me because there should be 8 simulations for hourly precipitation and there's not being returned here Screenshot 2024-05-01 at 5 25 02 PM

This is a good point! I did some debugging and realize the wrf_timescale wasn't being passed into results_gridcell2, allowing the timescales to be different for each results aggregation. The timescale is now passed in so it should be consistent!