Sources (rojak.core.sources)#
Describe where gridded input data lives, and open it as a single xarray.Dataset
This module only answers “which files/stores make up this dataset, and how are they opened”. Adapting the opened
dataset into rojak’s variables (e.g. CATData) is the job of a
MetData subclass, selected via rojak.datalib.registry.
A location is one of the following, distinguished by its type key in the configuration (a pydantic
discriminated union, see DataLocation):
FilesLocation(type: files): every file matching a glob pattern under a root. This is the behaviour rojak has always had (data_dir+glob_pattern).TemplateLocation(type: template): files named by astr.format()template over a time window, e.g."{time:%Y}/{time:%m}/{time:%Y-%m-%d}.nc". Selects data by time rather than by folder layout, in the spirit of satpy/trollsift, ESMValTool’sinput_dirtemplates and Pangeo Forge’sFilePattern.ZarrLocation(type: zarr): a single (local or remote) zarr store.
Every root/store is an fsspec URL path, so a plain local path (~/data/era5), an explicit file://
URL and remote URLs (s3://, gs://, https://, memory://, …) are all handled the same way. Remote
protocols need their fsspec implementation installed (e.g. s3fs, gcsfs) and can be given credentials or
other options via storage_options.
Module Attributes
|
Where a gridded dataset lives, see the module docstring for the options |
Functions
|
Whether |
|
Lazily open |
|
Resolve a file-based location into the (sorted, for |
Classes
|
Every file under |
|
xarray backend engine used to read netCDF files |
|
Files under |
|
A single zarr store |