Ouranosinc / xscen

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

Extract Features that would be nice with RDRS #180

Closed juliettelavoie closed 1 year ago

juliettelavoie commented 1 year ago

Addressing a Problem?

In the extract step of my ESPO-G workflow, I add a few steps to handle RDRS.

  1. I want to cut my region on rlat and rlon. From what I understand, clisops only cuts on lat and lon.
  2. I want to add nans from my mask.

Potential Solution

  1. Add a method sel to region that would not be a call to clisops, just
arg_sel = {dim:slice(*map(float, bounds)) for dim, bounds in region['sel'].items()}
ds= ds.sel(**arg_sel )
  1. Add a mask arg to add NaNs. Ideally, I would want to be able to ask for the mask in search_data_catalogs with {mask:fx} in variables_and_freq. Then, if mask is True. Apply mask on the other variables. mask could also be a dataarray if the mask is not in a catalogue.
    ds= ds.where(mask == True)

Additional context

Let me know you thoughts on the best way to implement the mask.

Right now, this is all in my ESPO-G workflow, but it is not very clean... It would be better in extract.

Contribution