Skip to content
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

Adding 0.8 1.2 GWLs into cava_data options #481

Merged
merged 15 commits into from
Jan 6, 2025
Merged

Conversation

vicford
Copy link
Contributor

@vicford vicford commented Jan 1, 2025

Description of PR

Adds historical GWLs as viable options into cava_data functionality in the vulnerability_assessment.ipynb notebook. I also went ahead and changed the language of the anom parameter in warming.py to be clearer, but did not modify the underlying code as to how anom is calculated.

IMPORTANT: I added two new constants to constants.py of which models should not be returned if the warming level is selected as 0.8°C. This should be implemented more broadly across the code base for 0.8°C in general.

How to test:

  • Try to retrieve 0.8 and 1.2 as warming_level options in cava_data function and
  • Ensure that for a 0.8°C GWL for WRF EC-Earth3-Veg is not returned, and for LOCA EC-Earth3_r4i1ip1f1 all ssps, EC-Earth3-Veg_ri1p1f1 all ssps, and EC-Earth3-Veg_r5i1p1f1 ssp245 are not returned.

Example:

data = cava_data(
    ## Set-up
    example_locs.iloc[:1], # select a single location
    downscaling_method="Dynamical",  # WRF data
    approach="Warming Level",
    warming_level=0.8,
    wrf_bias_adjust=False, # return all WRF models
    
    ## Likely seasonal event specific arguments
    variable="Air Temperature at 2m", 
    metric_calc="max", # daily high temperature
    percentile=50, # likeliness percentile
    season="summer", # season
    units="degC", # change units
    
    ## Export
    export_method="None",
    file_format="NetCDF",
)

To check # of sims:

data['calc_data']

Summary of changes and related issue

Requested by partners.

Relevant motivation and context

Requested by partners.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Definition of Done Checklist

Practical

  • 80% unit test coverage
  • Documentation
    • All functions/adjusted functions documented in the readthedocs.
    • Documentation is pushed
  • Complex code commented
  • Naming conventions followed
    • Helper functions hidden with _ before the name
  • Context of function is clearly provided
    • Intent of function is provided
    • How to test, so that it is not siloed on scientists and anyone can review
    • Appropriate manual testing was completed
  • Any notebooks known to utilize the affected functions are still working
  • Linting completed and resolved

Conceptual

  • Doesn't replicate existing functionality
  • Aligns with general coding standard of existing functions
  • Matches desired functionality from users/scientists

@vicford
Copy link
Contributor Author

vicford commented Jan 1, 2025

Waiting on #480 to be merged in.
Associated notebook PR: cal-adapt/cae-notebooks#141

@vicford vicford marked this pull request as ready for review January 1, 2025 20:59
@vicford
Copy link
Contributor Author

vicford commented Jan 1, 2025

Tagging @claalmve for reference.

Copy link
Collaborator

@nicolejkeeney nicolejkeeney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 1.2 WL, LOCA2_EC-Earth3-Veg_r5i1p1f1_historical+ssp245 is retrieved.
For 1.2 WL, WRF_EC-Earth3-Veg_r1i1p1f1_historical+ssp370 is returned.

@vicford
Copy link
Contributor Author

vicford commented Jan 3, 2025

For 1.2 WL, LOCA2_EC-Earth3-Veg_r5i1p1f1_historical+ssp245 is retrieved.
For 1.2 WL, WRF_EC-Earth3-Veg_r1i1p1f1_historical+ssp370 is returned.

Sorry @nicolejkeeney bad guidance on my part: those simulations listed in the instructions should only be dropped in 0.8°C! All are kept for 1.2

Base automatically changed from fix-vuln-test-nk to main January 6, 2025 17:40
@vicford vicford merged commit 7d05ae7 into main Jan 6, 2025
5 checks passed
@vicford vicford deleted the add-hist-gwls-cava branch January 6, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants