Welcome to easepy’s documentation!

easepy allows for gridding into the Equal Area Scaleable Earth (EASE) grids. These grids are popular for global-scale earth observation data. More details on the EASE grids can be found at https://nsidc.org/data/ease.

To install:

pip install easepy

Example usage

import easepy
ease = easepy.EaseGrid(resolution_m=25000, projection="Global")
# Fetch grid cell centroids
grid_lats, grid_lons = ease.geodetic_grid
# Find corresponding cell indices for particular location(s)
ease_indices, _ = ease.geodetic2ease(lat=46.7, lon=132.1)
class easepy.EaseGrid(resolution_m: int, projection: str)

EASE Grid class

The Equal Area Scaleable Earth (EASE2.0) grids are equal area grids for earth observation data. There are three different projections:

  • Northern Hemisphere

  • Southern Hemisphere

  • Global (not defined for abs(lat) > 84 degrees)

The EASE2.0 grids are defined using two-dimensional coordinate systems. The coordinates are referred to as the x and y coordinates in this package. They are defined in such a way that a regular grid produces a high-quality equal area grid within the region of validity. The EASE2.0 grid indices (here denoted col_ix, row_iy) are therefore determined as follows:

  • Convert geodetic coordinate to requested EASE2.0 coordinate system

  • Determine grid indices in the x and y coordinates using a regular grid

The geodetic centroids of the grid cells are stored in the geodetic_grid member after this class is initialised. Due to this procedure, there is some ambiguity in what we mean by conversion functions such as geodetic2ease and ease2geodetic: is the user requesting a conversion to the EASE coordinate system (or back), or are they working with grid indices? The geodetic2ease conversion returns both the grid indices and the coordinates in the EASE coordinate system. This is done because the common use-case is to grid values into EASE grids, but the EASE coordinates have to be calculated as part of this, and it is therefore unnecessary to maintain separate functions. When converting back to geodetic, two functions are instead provided:

  • ease_coord2geodetic

  • ease_index2geodetic

These convert EASE2.0 coordinates back to geodetic (always correct, regardless of the setup of the grid, as long as the same projection is used) or the EASE2.0 grid index back to geodetic (only correct if the current grid is set up with the same projection AND resolution). Description and further info: https://nsidc.org/ease/ease-grid-projection-gt

Values are assumed to be in meters and degrees.

Parameters
  • resolution_m (int) – Grid resolution in meters

  • projection (str) – Grid projection to be used (NorthHemi, SouthHemi, or Global)

ease_coord2geodetic(xx: numpy.ndarray, yy: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray]

Function to find corresponding lat/lon point for given EASE point. Valid as long as the projection used is consistent.

Parameters
  • xx (np.ndarray) – x coordinate in EASE grid coordinate system

  • yy (np.ndarray) – y coordinate in EASE grid coordinate system

Returns

lat, lon – lat and lon values in geodetic coordinate system

Return type

tuple[np.ndarray, np.ndarray]

ease_index2geodetic(xcol_id: numpy.ndarray, yrow_id: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray]

Function to find corresponding lat/lon point for given EASE grid index pair. Valid only if the projection and resolution used are the same. Returns the location of the approximate midpoint of the grid cell.

Parameters
  • col_ix (np.ndarray) – x coordinate in EASE grid coordinate system

  • row_iy (np.ndarray) – y coordinate in EASE grid coordinate system

Returns

lat, lon – lat and lon values in geodetic coordinate system

Return type

tuple[np.ndarray, np.ndarray]

geodetic2ease(lat: numpy.ndarray, lon: numpy.ndarray) Tuple[Tuple[numpy.ndarray, numpy.ndarray], Tuple[numpy.ndarray, numpy.ndarray]]

Function to find corresponding EASE coordinates and grid index for given lat/lon point.

Parameters
  • lat (np.ndarray) – latitude(s) of the point(s) (in degrees)

  • lon (np.ndarray) – longitude(s) of the point(s) (in degrees)

Returns

ease_coords – EASE grid indices of the point(s), and corresponding EASE projection coordinates. Take same shape as input values.

Return type

tuple[xcol_id, yrow_id], tuple[xx, yy]

Indices and tables