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..
_parse_dsl ¶
fs_open_dataset ¶
fs_open_dataset(
src_path: str,
group: str | None = None,
decode_times: bool = True,
decode_coords: str = "all",
**kwargs
) -> 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
get_variable ¶
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.
Returns:
-
DataArray–xarray.DataArray: 2D or 3D DataArray.
open_zarr
cached
¶
open_zarr(
src_path: str,
group: str | None = None,
decode_times: bool = True,
decode_coords: str = "all",
infer_region: bool = True,
**kwargs: Any
) -> 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