I would like to make a feature request to the foundry-transforms-lib-python
library.
Current it only supports tabular data and I would like it to support array data.
I would like the API to be like Dataset.get("air_temperature").read_array(format="xarray")
I think it should be easy to copy the read_table
code to a read_array
version.
For examples, you could have files
_array_dataset/_array_dataset.py and _array_dataset/_xarray_dataset.py
which would look like
class ArrayDataset(ABC, Generic[T]):
def open(self) -> T:
schema_to_readers = {
# could expand to anything xarray.open_dataset can read e.g.
# netcdf, grib etc.
FileType.ZARR: "zarr",
}
@abstractmethod
def open_dataset(self, engine: str = "zarr") -> T:
pass
class XarrayDataset(ArrayDataset):
def open_dataset(self, engine: str = "zarr) -> "xarray.Dataset":
return self._xarray().open_dataset(self._path, engine=self._engine)