Ouranosinc / xscen

A climate change scenario-building analysis framework.
https://xscen.readthedocs.io/
Apache License 2.0
17 stars 2 forks source link

More robust subsetting for periods #361

Open RondeauG opened 8 months ago

RondeauG commented 8 months ago

Addressing a Problem?

In multiple functions, we use a periods argument to subset the Dataset. However we simply do ds_subset = ds.sel(time=slice(period[0], period[1])), which never checks that the entire period is contained within ds.

Potential Solution

A wrapper function in xs.utils that checks that the entire period is contained within ds, and raises an error if it doesn't.

Additional context

Linked to an issue in #360.

Contribution