NCAS-CMS / cf-python

A CF-compliant Earth Science data analysis library
http://ncas-cms.github.io/cf-python
MIT License
119 stars 19 forks source link

Allow a halo to be added by `indices` and `subspace` #759

Closed davidhassell closed 4 months ago

davidhassell commented 5 months ago

It would be useful if the indices and subspace methods of cf.Field and cf.Domain could be configured to add a halo to the selected subspace.

The use case for this is regridding. For instance, when regridding global data to a smaller region it will improve performance if a subspace of the global data that contains the smaller region is regridded, rather than the global field. The easiest way to find the smallest such a subspace is to calculate the bounding box of the smaller region and then extract that "plus a halo" from the global data. The halo is needed to ensure that the subspace is a bit larger (as opposed to a bit smaller) than the target region.