hypso.grid.areas#

pyresample geometry for hypso products: the swath a product was imaged in, the grid a regridded product is on, and new grids to regrid onto.

Grids from grid_area() have their extent snapped to whole multiples of the pixel size, so two captures regridded to the same CRS and resolution share pixel boundaries and can be compared pixel by pixel.

Functions#

area_definition(tree)

AreaDefinition of a gridded product, from its x/y coordinates

area_from_grid(crs_attrs, x, y, size_x, size_y[, name])

AreaDefinition from a CF grid-mapping variable's attributes, the x/y

coordinate_attrs(crs)

CF attributes for the x and y coordinate variables of a grid in crs.

geolocation(tree[, direct])

(latitude, longitude) arrays of a product; ValueError if it has none.

grid_area(crs, resolution, latitudes, longitudes[, ...])

A grid covering the given coordinates, snapped to the pixel size.

grid_name(crs, size_x, size_y)

File-name token for a grid (io/naming.py GRID_TOKEN): utm33n_880m,

resolution(tree)

Ground resolution (m): a gridded product's pixel size (converted from

source_definition(tree)

What to resample from: a gridded product's AreaDefinition, else its

swath_definition(tree[, direct])

SwathDefinition of a product's per-pixel geolocation (direct or not).

utm_crs(latitudes, longitudes)

The WGS84 UTM CRS of the zone containing the scene centre.

Module Contents#

hypso.grid.areas.area_definition(tree)[source]#

AreaDefinition of a gridded product, from its x/y coordinates (pixel centres) and crs grid-mapping variable.

Parameters:

tree (xarray.DataTree)

Return type:

pyresample.geometry.AreaDefinition

hypso.grid.areas.area_from_grid(crs_attrs, x, y, size_x, size_y, name='hypso_grid')[source]#

AreaDefinition from a CF grid-mapping variable’s attributes, the x/y pixel-centre coordinates and the pixel size - what a gridded product file holds (also used by the Satpy readers).

Parameters:
Return type:

pyresample.geometry.AreaDefinition

hypso.grid.areas.coordinate_attrs(crs)[source]#

CF attributes for the x and y coordinate variables of a grid in crs.

Return type:

tuple

hypso.grid.areas.geolocation(tree, direct=False)[source]#

(latitude, longitude) arrays of a product; ValueError if it has none.

Parameters:
Return type:

tuple

hypso.grid.areas.grid_area(crs, resolution, latitudes, longitudes, area_id='hypso_grid')[source]#

A grid covering the given coordinates, snapped to the pixel size.

Parameters:
  • crs (str, int or pyproj.CRS) – Anything pyproj accepts, e.g. "EPSG:32633".

  • resolution (float) – Square pixel size in the CRS’s units.

  • latitudes (array_like) – Coordinates to cover (NaN ignored).

  • longitudes (array_like) – Coordinates to cover (NaN ignored).

  • area_id (str, default "hypso_grid")

Returns:

Extent snapped to whole multiples of resolution, so grids of two captures in the same CRS and resolution share pixel boundaries.

Return type:

pyresample.geometry.AreaDefinition

hypso.grid.areas.grid_name(crs, size_x, size_y)[source]#

File-name token for a grid (io/naming.py GRID_TOKEN): utm33n_880m, epsg4326_0p01deg, custom_30m; “AxB” for non-square pixels.

Parameters:
Return type:

str

hypso.grid.areas.resolution(tree)[source]#

Ground resolution (m): a gridded product’s pixel size (converted from degrees for a geographic grid), else the larger of the mean along- and across-track GSD.

Parameters:

tree (xarray.DataTree)

Return type:

float

hypso.grid.areas.source_definition(tree)[source]#

What to resample from: a gridded product’s AreaDefinition, else its swath (as numpy arrays, which pyresample’s kd-tree needs).

Parameters:

tree (xarray.DataTree)

hypso.grid.areas.swath_definition(tree, direct=False)[source]#

SwathDefinition of a product’s per-pixel geolocation (direct or not).

Parameters:
Return type:

pyresample.geometry.SwathDefinition

hypso.grid.areas.utm_crs(latitudes, longitudes)[source]#

The WGS84 UTM CRS of the zone containing the scene centre.

EPSG 326xx (north) or 327xx (south); standard 6-degree zones, without the Norway and Svalbard exceptions.

Parameters:
  • latitudes (array_like)

  • longitudes (array_like)

Return type:

pyproj.CRS