pyarts.data
Common functions for the pyarts package.
- pyarts.data.download(data=('xml', 'cat'), download_dir=None, verbose=False, **kwargs)[source]
Download and extract data files.
This function sets the ARTS data search path to the downloaded data directories, so that ARTS can find the required data files.
If the environment variable ARTS_DATA_PATH or ARTS_INCLUDE_PATH is set, it is assumed that the user wants to use their own catalog locations and this function does nothing.
- Parameters:
data (Tuple[str]) – List of data types to download. Possible values are: -
"xml"
: arts-xml-data package -"cat"
: arts-cat-data packagedownload_dir (str, optional) – The directory where the data files will be stored. If not provided, the default is
~/.cache/arts/
.verbose (bool, optional) – Whether to print info messages. Defaults to False.
**kwargs – Additional options passed on to the data specific download functions, e.g.
version
for ARTS catalogs.
- pyarts.data.download_arts_cat_data(download_dir=None, version=None, verbose=False)[source]
Download and extract the ARTS catalog data files from github.
This function sets the ARTS data search path to the downloaded data directories, so that ARTS can find the required data files.
If the environment variable ARTS_DATA_PATH or ARTS_INCLUDE_PATH is set, it is assumed that the user wants to use their own catalog locations and this function does nothing.
- Parameters:
download_dir (str, optional) – The directory where the data files will be stored. ggkIf not provided, the default is ~/.cache/arts.
version (str, optional) – The version of ARTS to download the data files for. The default is the version of the currently installed pyarts package.
verbose (bool, optional) – Whether to print info messages. Defaults to False.
- pyarts.data.download_arts_xml_data(download_dir=None, version=None, verbose=False)[source]
Download and extract the ARTS XML data files from github.
This function sets the ARTS data search path to the downloaded data directories, so that ARTS can find the required data files.
If the environment variable ARTS_DATA_PATH or ARTS_INCLUDE_PATH is set, it is assumed that the user wants to use their own catalog locations and this function does nothing.
- Parameters:
download_dir (str, optional) – The directory where the data files will be stored. ggkIf not provided, the default is ~/.cache/arts.
version (str, optional) – The version of ARTS to download the data files for. The default is the version of the currently installed pyarts package.
verbose (bool, optional) – Whether to print info messages. Defaults to False.
- pyarts.data.to_absorption_species(atm_field: AtmField) ArrayOfArrayOfSpeciesTag [source]
Scans the ARTS data path for species relevant to the given atmospheric field.
The scan is done over files in an arts-cat-data like directory structure.
- Parameters:
atm_field (pyarts.arts.AtmField) – A relevant atmospheric field.
- Returns:
All found species tags. The intent is that this is enough information to use pyarts.workspace.Workspace.ReadCatalogData
- Return type:
- pyarts.data.to_atmospheric_field(data: Dataset, remap: None | dict[str, str] = None, ignore: None | list[str] = None, *, atm: None | AtmField = None) AtmField [source]
Populates a ~pyarts.arts.AtmField from an xarray Dataset-like structure
- Parameters:
data (xarray.Dataset) – A dataset. Coordinates should contain ‘alt’, ‘lat’, and ‘lon’. All other keys() should be assignable to the atm-field by name.
remap (None | dict[str, str], optional) – All names in this optional dict are renamed when accessing the dataset. For example, if the altitude-grid is called ‘Alt’ instead of ‘alt’, the dict should contain {…, ‘alt’: ‘Alt’, …}.
ignore (None | list[str], optional) – Ignore keys listed from assignment into the atmospheric field.
atm (None | pyarts.arts.AtmField) – The default atmospheric field to use. Defaults to None to use default- constructed atmospheric field object.
- Returns:
atm – An atmospheric field
- Return type:
- pyarts.data.xarray_open_dataset(filename_or_obj, *args, **kwargs)[source]
Wraps xarray.open_dataset to search for files in the current and in ARTS’ data path.
All args and kwargs are passed on to xarray.open_dataset directly. Any FileNotFoundError will be caught and just raised if no path works.
- Parameters:
filename_or_obj (_type_) – _description_
- Raises:
FileNotFoundError – _description_
- Returns:
_description_
- Return type:
_type_