toad.regridding.healpix

Classes

HealPixRegridder([nside])

Regrid data onto a equal-area HEALPix grid to avoid polar bias in clustering

class toad.regridding.healpix.HealPixRegridder(nside=None)

Bases: BaseRegridder

Regrid data onto a equal-area HEALPix grid to avoid polar bias in clustering

Parameters:

nside (int | None)

healpix_to_latlon(pix)

Convert a HEALPix pixel index back to its center latitude and longitude.

Parameters:

pix (int)

Return type:

tuple

latlon_to_healpix(lats, lons)

Convert arrays of latitude and longitude to HEALPix pixel indices.

Parameters:
  • lats (ndarray)

  • lons (ndarray)

Return type:

ndarray

map_orig_to_regrid(coords_2d)

Map (lat, lon) to a HEALPix pixel index. coords_2d must be array (N, 2): [(lat, lon), …]

Parameters:

coords_2d (ndarray)

Return type:

ndarray

regrid(coords, weights, space_dims_size)

Regrid data to new coordinate system.

Parameters:
  • coords (ndarray) – 3dArray of coordinates (time, lat, lon) in that order

  • weights (ndarray) – 1dArray of weights

  • space_dims_size (tuple[int, int]) – Tuple of (nlat, nlon) sizes of the original grid dimensions

Returns:

3dArray of coordinates (time, lat, lon) in that order 1dArray of weights

Return type:

tuple[ndarray, ndarray]

regrid_clusters_back(cluster_labels)

Map cluster labels back to original grid.

Parameters:

cluster_labels (ndarray)

Return type:

ndarray