Buckets:
| from pathlib import Path | |
| from typing import Any, List, Optional, Union | |
| import xarray | |
| from tiled.adapters.table import TableAdapter | |
| from ..catalog.orm import Node | |
| from ..structures.data_source import DataSource | |
| from ..utils import path_from_uri | |
| from .xarray import DatasetAdapter | |
| def read_netcdf(filepath: Union[str, List[str], Path]) -> DatasetAdapter: | |
| """ | |
| Parameters | |
| ---------- | |
| filepath : | |
| Returns | |
| ------- | |
| """ | |
| ds = xarray.open_dataset(filepath, decode_times=False) | |
| return DatasetAdapter.from_dataset(ds) | |
| class NetCDFAdapter(TableAdapter): | |
| def from_catalog( | |
| cls, | |
| data_source: DataSource[None], | |
| node: Node, | |
| /, | |
| **kwargs: Optional[Any], | |
| ) -> "NetCDFAdapter": | |
| filepath = path_from_uri(data_source.assets[0].data_uri) | |
| return read_netcdf(filepath) # type: ignore | |
Xet Storage Details
- Size:
- 885 Bytes
- Xet hash:
- 2de284d0774151d11571cb0fd6254d567fed97f7fb5bdc6fcc5408b24d9e91d7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.