Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

padding regions #23

Merged
merged 13 commits into from
Jul 4, 2024
Merged

padding regions #23

merged 13 commits into from
Jul 4, 2024

Conversation

keewis
Copy link
Member

@keewis keewis commented Jul 4, 2024

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:

  • constant: pad with a constant value
  • edge: "nearest neighbour" padding
  • linear_ramp: linearly interpolate from the nearest neighbour to a constant value
  • symmetric: mirror along the edge of the domain

@keewis
Copy link
Member Author

keewis commented Jul 4, 2024

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

@keewis keewis merged commit 6a05e20 into IAOCEA:main Jul 4, 2024
6 checks passed
@keewis keewis deleted the pad branch July 4, 2024 15:10
@keewis keewis mentioned this pull request Jul 4, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant