access_nri_intake.cli#

Command line interfaces for access-nri-intake

Attributes#

Exceptions#

MetadataCheckError

Common base class for all non-exit exceptions.

DirectoryExistsError

Raised when a directory already exists and the user has not specified

Classes#

Functions#

build([argv])

Build an intake-dataframe-catalog from YAML configuration file(s).

concretize([argv])

Concretize a build by moving it to the final location and updating the paths in the catalog.json files.

metadata_validate([argv])

Check provided metadata.yaml file(s) against the experiment schema

metadata_template([argv])

Create an empty template for a metadata.yaml file using the experiment schema.

use_esm_datastore([argv])

Either creates, verifies, or updates the intake-esm datastore

scaffold_catalog_entry([argv])

Module Contents#

access_nri_intake.cli.STORAGE_FLAG_PATTERN = 'gdata/[a-z]{1,2}[0-9]{1,2}'#
access_nri_intake.cli.T_catname#
exception access_nri_intake.cli.MetadataCheckError#

Bases: Exception

Common base class for all non-exit exceptions.

Initialize self. See help(type(self)) for accurate signature.

exception access_nri_intake.cli.DirectoryExistsError#

Bases: Exception

Raised when a directory already exists and the user has not specified the –force flag to overwrite it.

Initialize self. See help(type(self)) for accurate signature.

class access_nri_intake.cli.VersionHandler(yaml_dict, catalog_base_path, build_base_path, version, use_parquet=False)#
CSV_AND_PQ_SOURCES#
yaml_dict#
catalog_base_path#
build_base_path#
version#
use_parquet = False#
property cat_name: T_catname#
property alt_name: T_catname#
property cat_loc: pathlib.Path#
property existing_cat: bool#

Memo-ised property to check for existing catalog file. If we don’t memoize, then we run into mutation issues - because __call__ will write a new catalog partway through its execution, invaliding the checks.

property yaml_old: dict | None#
set_versions_no_existing_cat()#

No existing catalog, so set min = max = current version, unless there are folders with the right names in the write directory

set_versions_no_prev_vmin_vmax()#

Still not really sure what exactly this should be called.

access_nri_intake.cli.build(argv=None)#

Build an intake-dataframe-catalog from YAML configuration file(s).

access_nri_intake.cli.concretize(argv=None)#

Concretize a build by moving it to the final location and updating the paths in the catalog.json files.

access_nri_intake.cli.metadata_validate(argv=None)#

Check provided metadata.yaml file(s) against the experiment schema

access_nri_intake.cli.metadata_template(argv=None)#

Create an empty template for a metadata.yaml file using the experiment schema.

Writes the template to the current working directory by default.

Parameters:#

loc (str, Path, optional): The directory in which to save the template. Defaults to the current working directory.

Returns:#

None

access_nri_intake.cli.use_esm_datastore(argv=None)#

Either creates, verifies, or updates the intake-esm datastore

access_nri_intake.cli.scaffold_catalog_entry(argv=None)#