Updating drought metrics notebook to using new core#245
Conversation
Co-authored-by: Calvin Chen <33679281+claalmve@users.noreply.github.com>
Co-authored-by: Calvin Chen <33679281+claalmve@users.noreply.github.com>
Co-authored-by: Calvin Chen <33679281+claalmve@users.noreply.github.com>
Co-authored-by: Calvin Chen <33679281+claalmve@users.noreply.github.com>
Co-authored-by: Calvin Chen <33679281+claalmve@users.noreply.github.com>
Co-authored-by: Calvin Chen <33679281+claalmve@users.noreply.github.com>
Co-authored-by: Calvin Chen <33679281+claalmve@users.noreply.github.com>
Co-authored-by: Nicole Keeney <nicolejkeeney@gmail.com>
Co-authored-by: Will Krantz <krantz.w@gmail.com>
Co-authored-by: Will Krantz <krantz.w@gmail.com>
|
I've had the notebook running on a medium Hub instance for ~ 35 minutes and it seems to be hanging in this cell in Section 21 - notebook issue or Hub issue? |
Hmm, I think that cell only takes 5-10 min for me. Could you try restarting your kernel and running it again? |
Still hanging, when I hit keyboard interrupt I get this: |
acordonez
left a comment
There was a problem hiding this comment.
Review doesn't include looking at the output files yet, but once I can get the notebook running end-to-end I'll also look at that. Mostly documentation comments here
| "# Define the lat/lon for the location of interest and the variables needed for the Penman-Monteith PET method\n", | ||
| "LAT = 37.787964\n", | ||
| "LON = -122.065063\n", | ||
| "WARMING_LEVELS = [0.8, 2.0]" |
There was a problem hiding this comment.
Since this is currently hard-coded to run on only two WLs, it either needs a warning and check to make sure only 2 WLs are set or needs flexibility to work with any number of WLs.
| "outputs": [], | ||
| "source": [ | ||
| "# Define the lat/lon for the location of interest and the variables needed for the Penman-Monteith PET method\n", | ||
| "LAT = 37.787964\n", |
There was a problem hiding this comment.
Not as familiar with these drought indices, but if it's appropriate to use them over areas like a watershed it'd be nice to give users the option to use areas other than lat/lon.
| "metadata": {}, | ||
| "source": [ | ||
| "**Variables needed:**\n", | ||
| "- `t2` (hourly) → daily `tasmin` and `tasmax` derived via resample\n", |
There was a problem hiding this comment.
Curious why the notebook resamples hourly rather than pulling t2min and t2max with new core?
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Call xclim.indicies.potential_evapotranspiration on the entire dataset as it is\n", |
There was a problem hiding this comment.
"on the entire dataset as it is" - unclear on what the takeaway is for users from this part of the comment. Is there something about the data formatting we should be aware of?
| "id": "50d973f5-8d03-48a7-9ac6-4ac36ef4b120", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "#### Helper Function" |
There was a problem hiding this comment.
Add a little more information beyond the Helper Function heading
There was a problem hiding this comment.
Including motivation - it looks like this would help speed up the calculation for PDSI later in the notebook?
| "id": "f0645679", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "EDDI is computed as a standardized anomaly using `xclim`'s `standardized_index`, calibrated over the 0.8°C warming level period (2000–2029), with values clipped to [−2.5, 2.5]." |
There was a problem hiding this comment.
Is it required to use 0.8 as the baseline? Also the (2000-2029) range gives me the impression that the warming level is linked to those years in the models as opposed to being the dummy time range.
| "id": "3dc2e324", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### 2.2. Calculate EDDI" |
There was a problem hiding this comment.
It'd be great to have an intro about what the EDDI is, along with a reference.
| "source": [ | ||
| "This notebook demonstrates how you can use `climakitae` variables to compute and export two drought indices for a given location, broken down in the table below:\n", | ||
| "\n", | ||
| "| Index | Method | Output file |\n", |
There was a problem hiding this comment.
Nice table, wondering if there's somewhere in the intro where this table would fit in.
| "id": "64641b82", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "This notebook calculates two drought metrics, the Palmer Drought Severity Index (PDSI) and the Evaporative Demand Drought Index (EDDI), using WRF data in the AE catalog. PDSI relies on Potential Evapotranspiration (PET), which is computed using the Penman-Monteith method. At the end of the notebook, the user will be able to export monthly PDSI and EDDI under different global warming levels for a specific lat/lon as netcdf files for further analysis." |
There was a problem hiding this comment.
Is there any drought metrics guidance on AE website to link here?
| "metadata": {}, | ||
| "source": [ | ||
| "### Penman-Monteith PET Method (most physically consistent)\n", | ||
| "We will be using the PET method for calculating PDSI, since it is the most physically consistent method. Below, we list out the variables we will need." |
There was a problem hiding this comment.
Would be helpful to see a little more explanation and maybe a link to a good source about these methods. I'm a little thrown off just seeing "most physically consistent method" without any other background.
acordonez
left a comment
There was a problem hiding this comment.
Got the EDDI section to run, just not PDSI. I'm finding the warming level dimension on the output dataset confusing. If it only contains the WL 2.0 data, it'd be great to change the warming level dimension name to 2.0 and change "wl" to "warming_level" or whatever the exact equivalent is in the data returned by ClimateData.
A figure that shows the EDDI timeseries for one sim with a little explanation about how to read the figure would be a nice-to-have but not required item.
The slowdown seems to ultimately be coming from calculating |
nicolejkeeney
left a comment
There was a problem hiding this comment.
Getting this error from the following cell:
# Call xclim.indicies.potential_evapotranspiration on the entire dataset as it is
pet_pm = xclim.indices.potential_evapotranspiration(
tasmin=tasmin.t2min,
tasmax=tasmax.t2max,
hurs=hurs_frac.rh,
rsds=sw_dwn.sw_dwn,
rsus=rsus_daily.swupb,
rlds=lw_dwn.lw_dwn,
rlus=rlus_daily.lwupb,
sfcWind=wspd10mean.wspd10mean,
method="FAO_PM98",
)Error:
ValueError: potential_evapotranspiration could not find latitude coordinate in DataArray. Try passing it explicitly (`lat=ds.lat`).
I got this error, too, today. Small instance on the Hub. If I set lat=tasmin.lat I then get the following error: |
|
Ok, I think my |
Summary of changes
Making updates to drought_metrics notebook to use new core functionality, as well as redo some organization of the notebook to make it more concise and clear.
Link to corresponding Jira ticket(s)
Jira ticket
Content & Documentation
Runtime Information
Output Management
Code Quality