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
21 stars 2 forks source link

Debugging Beyond End of Century WL Behavior #412

Closed claalmve closed 3 months ago

claalmve commented 3 months ago

Description of PR

Summary of changes and related issue Addressing small bug with warming levels when slicing warming level data that goes beyond 2100. Currently, it creates smaller slices and centered the years incorrectly. Instead of -180 to 168 for a 30-year monthly WL that is centered around 2086 (so missing the last year), it creates a time index that is from -174 to 174 instead (wrong).

This PR addresses this issue and centers the warming level slices correctly.

You can see this behavior by changing the default lat/lon params in warming_levels.ipynb to:

wl.wl_params.latitude=(34.0,34.03)
wl.wl_params.longitude=(-117.5,-117.45)

and checking out warming level slice 4.0. You can also see this behavior in a larger lat/lon subset, this just filters down the data to two gridcells so you can more easily see where the NaNs are for missing time-based data vs missing spatial data (due to how the xarray grids behave with our data).

Relevant motivation and context Debug incorrect WL behavior.

Type of change

Checklist:

vicford commented 3 months ago

@claalmve I cannot reproduce the nans and a time index not -180 to 180 in either main or in this branch; can you provide some more guidance on how to test? The lat-lon bounds provided for me also do not retrieve any data -- is there a specific spatial resolution you are testing with?