roocs / clisops

Climate Simulation Operations
https://clisops.readthedocs.io/en/latest/
Other
21 stars 9 forks source link

Implement subset by level #58

Closed agstephens closed 4 years ago

agstephens commented 4 years ago

Discuss with Ouranos how we should implement this. Maybe inside clisops.core.subset.

Zeitsperre commented 4 years ago

@agstephens Interesting. You mean how best to implement subset along a z/elevation axis? I think it would make the most sense there as well. I don't imagine it would be too difficult to implement.

agstephens commented 4 years ago

@Zeitsperre: yes, we are talking about the "z" axis. Let's discuss when we meet how to set this up in clisops.core.subset.

I am hoping that the Xarray/Dask lazy evaluation means that we can chain a subset_level function with the other existing functions rather than modifying what already works.

agstephens commented 4 years ago

I think that we should consider this in the same way subset_time is addressed within the subset_bbox function:

https://github.com/roocs/clisops/blob/999a34fee79af216fdeb6cf6969199dfd1e42944/clisops/core/subset.py#L650

subset_bbox has the optional arguments start_date and end_date, at the end of the function there is optionally a call to subset_time.

We could imagine that the 'z' axis could be handled in the same way, by adding (and integrating) the following:

def subset_level(ds, start_level, end_level)

This would need to:

Zeitsperre commented 4 years ago

I realize that the number of existing decorators is getting a bit unwieldy but given that checks exist for X and Y dims, the best option I would suggest for the start_level and end_level checks would be to write a check_levels decorator (or expand the check_lons as I mentioned in #65) to be able to add this easily to other subsetting functions.

If a function is written to perform the Z-axis subsetting, it can be added to all other subsetting functions, as needed. In-depth level check could be added to either function or the decorator, I imagine.

With all these different functions, it would be interesting to consider alternative means of calling these functions down-the-line Perhaps something to consider if clisops proceeds with #37.

agstephens commented 4 years ago

Now merged into master.