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

Adding dummy time index conversion function for warming levels #375

Closed claalmve closed 5 months ago

claalmve commented 5 months ago

Description of PR

Summary of changes and related issue For several tools in our codebase (and for many external library calculations), there is a need for a dimension named time in a given DataArray for calculations. However, warming levels code removes this time index and replaces it with a hours/days/months_from_center dimension, since that is more accurate name than just time. This also does create some challenges with computing on this DataArray, since the hours/days/months_from_center dimension is filled with timedeltas and no longer timestamps. So, this PR is focused on including a helper function in utils that allows a user to toggle from WL indexing to a dummy time-based indexing to allow for potential metric calculations to still occur as desired.

This function is aimed to be used in vulnerability.py and warming_levels_approach.ipynb (included in https://github.com/cal-adapt/cae-notebooks/pull/103)

Type of change

Checklist: