io
titiler.xarray.io ¶
titiler.xarray.io
Reader ¶
Bases: XarrayReader
Reader: Open Zarr file and access DataArray.
_arrange_dims ¶
_arrange_dims(da: DataArray) -> DataArray
Arrange coordinates and time dimensions.
An rioxarray.exceptions.InvalidDimensionOrder error is raised if the coordinates are not in the correct order time, y, and x. See: corteva/rioxarray?674
We conform to using x and y as the spatial dimension names..
get_variable ¶
get_variable(
ds: Dataset,
variable: str,
sel: Optional[List[str]] = None,
method: Optional[Literal["nearest", "pad", "ffill", "backfill", "bfill"]] = None,
) -> DataArray
Get Xarray variable as DataArray.
Parameters:
-
ds
(Dataset
) –Xarray Dataset.
-
variable
(str
) –Variable to extract from the Dataset.
-
sel
(list of str
, default:None
) –List of Xarray Indexes.
-
method
(str
, default:None
) –Xarray indexing method.
Returns:
-
DataArray
–xarray.DataArray: 2D or 3D DataArray.
xarray_open_dataset ¶
xarray_open_dataset(
src_path: str, group: Optional[str] = None, decode_times: bool = True
) -> Dataset
Open Xarray dataset with fsspec.
Parameters:
-
src_path
(str
) –dataset path.
-
group
((Optional, str)
, default:None
) –path to the netCDF/Zarr group in the given file to open given as a str.
-
decode_times
(bool
, default:True
) –If True, decode times encoded in the standard NetCDF datetime format into datetime objects. Otherwise, leave them encoded as numbers.
Returns:
-
Dataset
–xarray.Dataset