Utilities#

empty_2d(dx, xmin, xmax, dy, ymin, ymax)

Create an empty 2D (x, y) DataArray.

empty_2d_transient(dx, xmin, xmax, dy, ymin, ...)

Create an empty transient 2D (time, x, y) DataArray.

empty_3d(dx, xmin, xmax, dy, ymin, ymax, layer)

Create an empty 2D (x, y) DataArray.

empty_3d_transient(dx, xmin, xmax, dy, ymin, ...)

Create an empty transient 3D (time, layer, x, y) DataArray.

where(condition, if_true, if_false[, keep_nan])

Wrapped version of xarray's .where.

cd(path)

Change directory, and change it back after the with block.

ignore_warnings()

Contextmanager to ignore RuntimeWarnings as they are frequently raised by the Dask delayed scheduler.

print_if_error(exception_type)

Prints error instead of raising it.

to_datetime(s)

Convert string to datetime.

coord_reference(da_coord)

Extracts dx, xmin, xmax for a coordinate DataArray, where x is any coordinate.

spatial_reference(a)

Extracts spatial reference from DataArray.

transform(a)

Extract the spatial reference information from the DataArray coordinates, into an affine.Affine object for writing to e.g. rasterio supported formats.

to_ugrid2d(data)

Convert a structured DataArray or Dataset into its UGRID-2D quadrilateral equivalent.

mdal_compliant_ugrid2d(dataset[, crs])

Ensures the xarray Dataset will be written to a UGRID netCDF that will be accepted by MDAL.

from_mdal_compliant_ugrid2d(dataset)

Undo some of the changes of mdal_compliant_ugrid2d: re-stack the layers.