IAOCEA / healpix-convolution

Other
1 stars 2 forks source link

padding regions #23

Closed keewis closed 2 months ago

keewis commented 2 months ago

This PR adds a pad function that allows padding regional healpix maps. That function will compute the necessary indices purely based on the cell ids and return an object with a apply method. This allows significantly speeding up padding multiple arrays in the same way without recomputing these indices.

The typical usage is:

hc.pad(cell_ids, grid_info=grid_info, ring=2, mode="constant", constant_value=0).apply(data)
# or
padder = hc.pad(cell_ids, grid_info=grid_info, ring=2, mode="constant", constant_value=0)
padder.apply(data)

The only mode that is currently implemented is constant, but the planned modes are:

keewis commented 2 months ago

merging since the basic functionality exists, and the other modes can be added in separate PRs (starting with mode="edge")