Command line tool

Installing climetlab also make available the climetlab utility command line interface.

Usage

$ climetlab <command> [options]
$ climetlab
(climetlab) <command> [options]

Interactive prompt

climetlab

Running the climetlab command with no argument starts the interactive prompt. Autocompletion is enabled on the interactive prompt. To exit the interactive prompt use Control+D.

$ climetlab
(climetlab) <command> [options]
(climetlab)

availability

Usage

climetlab availability [-h] [--stdout] [--yaml] [--keys KEYS [KEYS ...]] source

Create json availability file.

Positional arguments

source                  File or directory for describing a dataset or source of data
                        with GRIB data.
options:
-h, --help

show this help message and exit

--stdout

Output to stdout (no file).

--yaml

Output yaml format.

–keys KEYS [KEYS …] Keys to use in availability default is

(param,time,date,step,levelist).


benchmark (experimental)

Usage

climetlab benchmark [-h] [--indexedurl] [--dataloading] [--nargs [NARGS ...]] [--all]

Run predefined benchmarks, for CliMetLab development purposes.

options:
-h, --help

show this help message and exit

--indexedurl

Benchmark on using indexed URL (byte-range) and various servers.

--dataloading

Test loading some data.

–nargs [NARGS …] –all Run all benchmarks.


cache

Usage

climetlab cache [-h] [--json] [--all] [--path] [--sort KEY] [--reverse] [--match STRING]
           [--newer DATE] [--older DATE] [--accessed] [--larger SIZE] [--smaller SIZE]

Cache command to inspect the CliMetLab cache. The selection arguments are the same as for the climetlab decache deletion command.

Examples

climetlab cache --all
options:
-h, --help

show this help message and exit

--json

produce a JSON output

–all –path print the path of cache directory and exit –sort KEY sort output according to increasing values of KEY. –reverse reverse the order of the sort, from larger to smaller –match STRING TODO –newer DATE TODO –older DATE TODO –accessed use the date of last access instead of the creation date –larger SIZE consider only cache entries that are larger than SIZE bytes –smaller SIZE consider only cache entries that are smaller than SIZE bytes

SIZE can be expressed using suffixes such a K, M, G, etc. For example --larger 1G will match all cache entries larger than 1 GiB.

DATE can be expressed as absolute time like 2021-10-10T22:59:00` or relative such as 1h (one hour ago) or 2d (two days ago).

The --older and --newer consider the creation date of cache entries, unless --accessed is specified. In this case the time of last access is used.

Example, to remove large files not accessed for one week:

decache --accessed --older 1w --larger 1G


check (experimental)

Usage

climetlab check [-h]

Experimental script to help debugging.

options:
-h, --help

show this help message and exit


completion

Usage

climetlab completion [-h] [SHELL]

Enable autocompletion for the “climetlab” shell command.

Supported shells are : zsh bash.

Usage:

climetlab completion

Positional arguments

SHELL       Shell to use for autocompletion. Must be zsh or bash.
options:
-h, --help

show this help message and exit


decache

Usage

climetlab decache [-h] [--all] [--match STRING] [--newer DATE] [--older DATE] [--accessed]
             [--larger SIZE] [--smaller SIZE]

Cache deletion command (decache) to clean the cache from selected files. The selection arguments are the same as for the climetlab cache query command.

options:
-h, --help

show this help message and exit

–all –match STRING TODO –newer DATE TODO –older DATE TODO –accessed use the date of last access instead of the creation date –larger SIZE consider only cache entries that are larger than SIZE bytes –smaller SIZE consider only cache entries that are smaller than SIZE bytes

SIZE can be expressed using suffixes such a K, M, G, etc. For example --larger 1G will match all cache entries larger than 1 GiB.

DATE can be expressed as absolute time like 2021-10-10T22:59:00` or relative such as 1h (one hour ago) or 2d (two days ago).

The --older and --newer consider the creation date of cache entries, unless --accessed is specified. In this case the time of last access is used.

Example, to remove large files not accessed for one week:

decache --accessed --older 1w --larger 1G


dump_index

Usage

climetlab dump_index [-h] filename

Positional arguments

filename    Database filename.
options:
-h, --help

show this help message and exit


export_cache

Usage

climetlab export_cache [-h] [--match STRING] [--newer DATE] [--older DATE] [--accessed]
                  [--larger SIZE] [--smaller SIZE] [--permissions [PERMISSIONS ...]]
                  DIRECTORY

Copy part of the cache content to a directory.

Positional arguments

DIRECTORY                        Output directory where to copy the cache content.
options:
-h, --help

show this help message and exit

--match STRING

TODO

--newer DATE

TODO

--older DATE

TODO

--accessed

use the date of last access instead of the creation date

--larger SIZE

consider only cache entries that are larger than SIZE bytes

--smaller SIZE

consider only cache entries that are smaller than SIZE bytes

–permissions [PERMISSIONS …] By default, the exported data is public and writable by

its owner. –permissions read-only : Make the data public and read only. –permissions disabled : Do not tweak the files or directories permissions.

SIZE can be expressed using suffixes such a K, M, G, etc. For example --larger 1G will match all cache entries larger than 1 GiB.

DATE can be expressed as absolute time like 2021-10-10T22:59:00` or relative such as 1h (one hour ago) or 2d (two days ago).

The --older and --newer consider the creation date of cache entries, unless --accessed is specified. In this case the time of last access is used.

Example, to remove large files not accessed for one week:

decache --accessed --older 1w --larger 1G


grib_info

Usage

climetlab grib_info [-h] [--param PARAM] [--json] [--stdin]

Display information about grib parameters.

options:
-h, --help

show this help message and exit

--param PARAM

Comma separated list of parameters.

--json

Long json output format.

--stdin

Using stdin as input (for bash piping).


index_directory

Usage

climetlab index_directory [-h] [--no-follow-links] [--relative-paths] [--output OUTPUT]
                     directory

Index a directory containing GRIB files.

Positional arguments

directory          Directory containing the GRIB files to index.
options:
-h, --help

show this help message and exit

--no-follow-links

Do not follow symlinks.

--relative-paths

Use relative paths. Default is to use relative paths, except when a custom location is provided for the index location. (when the argument –output is used, default for –relative-path is False)

--output OUTPUT

Custom location of the database file, will write absolute filenames in the database.


index_url

Usage

climetlab index_url [-h] URL

Create json index files for remote Grib url.

Positional arguments

URL         url to index
options:
-h, --help

show this help message and exit


index_urls

Usage

climetlab index_urls [-h] [--baseurl BASEURL] URLS [URLS ...]
Create json index files for remote Grib urls.

If the option –baseurl is provided, the given url are relative to the BASEURL. This allows creating an index for multiple gribs.

Positional arguments

URLS               List of urls to index.
options:
-h, --help

show this help message and exit

--baseurl BASEURL

Base url to use as a prefix to happen on each URLS to build actual urls.


libraries

Usage

climetlab libraries [-h] [--json]
options:
-h, --help

show this help message and exit

--json

produce a JSON output


plugins

Usage

climetlab plugins [-h] [--json]

List the available plugins

options:
-h, --help

show this help message and exit

--json

produce a JSON output


settings

Usage

climetlab settings [-h] [--json] [SETTING ...]

Display or change CliMetLab settings. See https://climetlab.readthedocs.io/guide/settings.html for more details.

Examples

climetlab settings cache-directory /big-disk/climetlab-cache

Positional arguments

SETTING
options:
-h, --help

show this help message and exit

--json

produce a JSON output


settings_reset

Usage

climetlab settings_reset [-h] [--all] [SETTING ...]

Display or change CliMetLab settings. See https://climetlab.readthedocs.io/guide/settings.html for more details.

Examples

climetlab settings cache-directory /big-disk/climetlab-cache

Positional arguments

SETTING
options:
-h, --help

show this help message and exit

--all

All settings


test_data

Usage

climetlab test_data [-h] [DIRECTORY]

Create a directory with data used to test climetlab.

Positional arguments

DIRECTORY   Shell to use for autocompletion. Must be zsh or bash.
options:
-h, --help

show this help message and exit


versions

Usage

climetlab versions [-h] [--json] [--all] [PACKAGE ...]

List the versions of important Python packages.

Positional arguments

PACKAGE     optional list of Python packages
options:
-h, --help

show this help message and exit

--json

produce a JSON output

–all