geotiff

Reads geotiff files into an xarray.Dataset

Source code

General Attributes and Methods

IceAdvect.io.geotiff.open_mfdataset(filenames: list[str] | list[Path], mapping: dict, **kwargs) Dataset[source]

Open a geotiff file as an xarray Dataset

Parameters:
filenames: list of str or pathlib.Path

Path to geotiff file

mapping: dict

Dictionary mapping standard variable names to patterns for the file

chunks: int, dict, str, or None, default None

variable chunk sizes for dask (see rioxarray.open_rasterio)

Returns:
ds: xr.Dataset

xarray Dataset

IceAdvect.io.geotiff.open_dataset(filename: list, variable: str = 'variable', **kwargs) Dataset[source]

Open a geotiff file as an xarray Dataset

Parameters:
filename: str

Path to geotiff file

variable: str, default “variable”

variable name for the file

mapping: dict or None, default None

Dictionary mapping standard variable names to those in the file

chunks: int, dict, str, or None, default None

variable chunk sizes for dask (see rioxarray.open_rasterio)

Returns:
ds: xr.Dataset

xarray Dataset

IceAdvect.io.geotiff.open_mfdataarray(filenames: list[str] | list[Path], parallel: bool = False, **kwargs)[source]

Open multiple geotiff files

Parameters:
filenames: list of str or pathlib.Path

list of files

parallel: bool, default False

Open files in parallel using dask.delayed

kwargs: dict

additional keyword arguments for opening files

Returns:
darr: xarray.DataArray

xarray DataArray

IceAdvect.io.geotiff.open_dataarray(filename: str, longterm: bool = False, pattern: str | None = None, chunks: int | dict | str | None = None, **kwargs) DataArray[source]

Open a geotiff file as an xarray DataArray

Parameters:
filename: str

Path to geotiff file

longterm: bool, default False

Datafile is a long-term average

pattern: str or None, default None

Regular expression pattern for extracting time information

chunks: int, dict, str, or None, default None

variable chunk sizes for dask (see rioxarray.open_rasterio)

Returns:
darr: xr.DataArray

xarray DataArray

IceAdvect.io.geotiff.parse_file(filename: str | Path, mapping: dict)[source]

Determine variable name from filename using mapping

Parameters:
filename: str or pathlib.Path

Path to file

mapping: dict

Dictionary mapping standard variable names to patterns for the file

Returns:
variable: str

Variable name for the file

pattern: str or None

Regular expression pattern for extracting time information