lair.geo#

Grids, maps and distances.

BaseGrid and the functions it wraps work on gridded xarray data: clip to a region (clip()), grid-cell areas on the WGS84 ellipsoid (gridcell_area()), and regridding with xESMF (regrid(), resample(); Total an inventory over a region says which method a flux needs). plot_grid() and the tick and inset-map helpers draw maps with cartopy (Draw a map of an inventory), and haversine() and bearing() measure on the sphere. Importing the module needs the geo extra, and regridding needs ESMF as well (see Optional dependencies).

Attributes

PC

plain longitude and latitude.

Functions

add_lat_ticks

Add latitude ticks to the map.

add_latlon_ticks

Add latitude and longitude ticks to the map.

add_locator_map

Add a small locator map inside a map that shows where the main map is.

add_lon_ticks

Add longitude ticks to the map.

bbox2extent

Bounding box to extent.

bearing

Great-circle bearing from point 1 to point 2 on a sphere.

clip

Clip the data to the given bounds.

cosine_weights

Calculate cosine weights from latitude.

dms2dd

Degree-minute-second to decimal degree

earth_radius

Calculate radius of Earth assuming oblate spheroid defined by WGS84

extent2bbox

Extent to bounding box.

generate_regular_grid

Generate a regular grid.

gridcell_area

Calculate the area of each grid cell in a grid.

gridcell_area_from_latlon

Calculate the area of each grid cell in a lat-lon grid.

haversine

Great-circle distance between two points on a sphere (haversine formula).

plot_grid

Plot a grid.

points_along_line

Generate points spaced along a line or a network of lines.

regrid

Regrid data to a new grid.

resample

Resample the data to a new resolution.

round_latlon

Round latitude and longitude values to a specified number of decimal places.

wrap_lons

Transform the longitude values into the half-open interval [base, base + period).

write_rio_crs

Write the CRS and coordinate system to the rioxarray accessor.

Classes

BaseGrid

Base class for working with gridded data.

CRS

Coordinate Reference System (CRS) class.