Skip to content

Utilities

Coordinate Utilities

A collection of utilities to manipulate and check coordinate systems dictionaries.

handshake_dimSimple check to see if coordinate system has a dimension in a particular index
handshake_coordsSimple check to see if the required dimensions have the same coordinate system
handshake_sizeSimple check to see if a coordinate system of a given dimension is a required size
map_coordsA basic interpolation util to map between coordinate systems with common dimensions.
split_coordsA utility function to split a dimension from a (x,coords) pair and convert it into a list of tensors, a CoordSystem, and the dimension that extract from coords.

Grid Interpolation

LatLonInterpolationBilinear interpolation between arbitrary grids.

Vertical Interpolation

hybrid_pressurePressure on hybrid sigma-pressure levels, `p = a + b * surface_pressure`.
interpolate_verticalInterpolate `x` linearly along a vertical coordinate onto `target` levels.

Regridders

Implementations of the earth2studio.grids.Regridder protocol, which map fields between grid definitions.

BilinearRegridderInterpolate between the four source points surrounding each target point.
NearestRegridderMap each target point to its nearest source point.
list_regriddersAPI reference page.
register_regridderAPI reference page.
resolve_regridderAPI reference page.
same_geometryWhether two grid definitions describe the same points.
select_subsetSelect `target_grid` from a field on `source_grid`, when it is an exact crop.

Data Source Wrappers

Compositions that stand in for a data or forecast source.

CompositeForecastSourceForecast source assembled from components that provide disjoint variables.
CompositeSourceData source assembled from analysis sources that provide disjoint variables.
RegriddedSourceData or forecast source whose fields are regridded onto a target grid.

Observation Utilities

ObsGridMappingMaps point observations to and from a 2-D model grid.

Time Utilities

timearray_to_datetimeSimple converter from numpy datetime64 array into a list of datetimes.
to_time_arrayA general converter for various time iterables into a numpy datetime64 array

Checkpoint Classes

CheckpointCatalog of restart checkpoints for a named inference run.
CheckpointSessionActive checkpoint row or new checkpoint session.
CheckpointStateBound checkpoint state proxy returned by `bind_checkpoint_state`.
NullCheckpointNo-op checkpoint used when checkpointing is disabled.

Checkpoint Helpers

bind_checkpoint_stateBind a dataclass instance to checkpoint state metadata.

Data Utilities

datasource_to_fileUtility function that can be used for building a local data store needed for an inference request.
fetch_dataFetch field DataArrays with temporal statistics, optionally regridded.
fetch_dataframeUtility function to fetch data frames from particular sources
fetch_dataframesAPI reference page.
prep_data_arrayPrepares a data array from a data source for inference workflows by converting the data array to a torch tensor and the coordinate system to an OrderedDict.

STAC Utilities

Shared layer for lazy, cloud-native access to STAC-cataloged rasters that collection-specific data sources build on.

searchSearch a STAC catalog and open the results as one lazy array.
search_itemsSearch a STAC API and return the matching items.
open_assetOpen one item asset as a lazy, dask-backed [`xarray.DataArray`][xarray.DataArray].
collectionsList a catalog's collections with their asset keys and extents.
StacProviderA STAC API endpoint and how to turn its asset hrefs into GDAL paths.

Model Utilities

PackageA generic file system abstraction with local caching, uses Fsspec WholeFileCacheFileSystem to manage files.
batch_funcBatch utility decorator which can be added to prognostic and diagnostic models to help enable support for automatic batching of data.