healpix_analyse.resample#
Resampling helpers for HEALPix and regular latitude/longitude grids.
Classes#
Reusable NESTED HEALPix resampler based on |
Functions#
|
One-shot NESTED HEALPix resampling convenience function. |
|
Resample HEALPix data onto a regular latitude/longitude grid. |
Module Contents#
- class healpix_analyse.resample.HealPixResampler(in_level: int, out_level: int, in_cell_ids=None, out_cell_ids=None, *, ellipsoid: str = 'WGS84', radius_deg: float | None = None, sigma_deg: float | None = None, weight_norm: str = 'l1', up_norm: str = 'col_l1', dtype: torch.dtype = torch.float32, device: str | torch.device | None = None, eps: float = 1e-12)[source]#
Bases:
torch.nn.ModuleReusable NESTED HEALPix resampler based on
HealPixDown/Up.- Parameters:
in_level, out_level (
int) – Input and output Grid4Earth/HEALPix levels. The corresponding NSIDE values are2**in_leveland2**out_level.in_cell_ids (
array-like, optional) – NESTED identifiers matching the last dimension of the input data.Nonemeans that the input is a complete sphere in canonical NESTED order.in_levelis still mandatory.out_cell_ids (
array-like, optional) – Exact output cells, in the desired output order.Nonerequests the complete output sphere in canonical NESTED order.ellipsoid (
str, default"WGS84") – Geometry passed to every Down/Up operator.radius_deg, sigma_deg (
float, optional) – Optional fixed Gaussian parameters passed to each resolution step. When omitted, every step uses its native resolution-dependent values.weight_norm (
{"l1", "l2", "none"}, default"l1") – Normalisation used byHealPixDown.up_norm (
{"adjoint", "col_l1", "diag_l2"}, default"col_l1") – Normalisation used byHealPixUp.dtype, device (optional) – PyTorch computation options. CUDA is selected when available.
Notes
Data may have shape
[..., N_in]. NumPy input returns NumPy output; Torch input remains differentiable and returns a tensor ondevice.Missing or non-finite samples are excluded through normalised convolution. A target with at least one non-zero weighted support remains calculable; a target with no support is filled with NaN.
Upsampling a requested subset first maps every requested output cell to its NESTED ancestor at
in_level. Only available ancestors and their full descendant trees are propagated, after which the exact requested cells are gathered in their original order.- in_level#
- out_level#
- dtype = Ellipsis#
- eps#
- ellipsoid = ''#
- weight_norm = ''#
- up_norm = ''#
- input_full_sphere#
- output_full_sphere#
- n_input#
- n_output#
- layers#
- empty_route = False#
- property device: torch.device#
- property in_cell_ids: numpy.ndarray | None#
Input identifiers, or
Nonefor a full-sphere input.
- property out_cell_ids: numpy.ndarray#
Exact output identifiers in returned-data order.
- healpix_analyse.resample.resample_healpix(in_data: ArrayLike, *, in_level: int, out_level: int, in_cell_ids=None, out_cell_ids=None, ellipsoid: str = 'WGS84', radius_deg: float | None = None, sigma_deg: float | None = None, weight_norm: str = 'l1', up_norm: str = 'col_l1', dtype: torch.dtype = torch.float32, device: str | torch.device | None = None, eps: float = 1e-12) tuple[ArrayLike, numpy.ndarray][source]#
One-shot NESTED HEALPix resampling convenience function.
Construct
HealPixResamplerdirectly when several maps share the same input/output geometry, so the sparse operators can be reused.