The databrowser command line interface#

This section introduces the usage of the freva-client databrowser sub command. Please see the Installation and configuration section on how to install and configure the command line interface.

After successful installation you can use the freva-client databrowser sub command

freva-client databrowser --help

Searching for data locations#

Getting the locations of the data is probably the most common use case of the databrowser application. You can search for data locations by applying the data-search sub-command:

freva-client databrowser data-search --help

Results

                                                                                
 Usage: freva-client databrowser data-search [OPTIONS] [SEARCH_KEYS]...         
                                                                                
 Search the databrowser for datasets.                                           
                                                                                
โ•ญโ”€ Arguments โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚   search_keys      [SEARCH_KEYS]...  Refine your data search with this       โ”‚
โ”‚                                      `key=value` pair search parameters. The โ”‚
โ”‚                                      parameters could be, depending on the   โ”‚
โ”‚                                      DRS standard, flavour product, project  โ”‚
โ”‚                                      model etc.                              โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --facet                   TEXT                      If you are not sure      โ”‚
โ”‚                                                     about the correct search โ”‚
โ”‚                                                     key's you can use the    โ”‚
โ”‚                                                     ``--facet`` flag to      โ”‚
โ”‚                                                     search of any matching   โ”‚
โ”‚                                                     entries. For example     โ”‚
โ”‚                                                     --facet 'era5' would     โ”‚
โ”‚                                                     allow you to search for  โ”‚
โ”‚                                                     any entries containing   โ”‚
โ”‚                                                     era5, regardless of      โ”‚
โ”‚                                                     project, product etc.    โ”‚
โ”‚ --uniq-key       -u       [file|uri]                The type of search       โ”‚
โ”‚                                                     result, which can be     โ”‚
โ”‚                                                     either โ€œfileโ€ or โ€œuriโ€.  โ”‚
โ”‚                                                     This parameter           โ”‚
โ”‚                                                     determines whether the   โ”‚
โ”‚                                                     search will be based on  โ”‚
โ”‚                                                     file paths or Uniform    โ”‚
โ”‚                                                     Resource Identifiers     โ”‚
โ”‚                                                     [default: file]          โ”‚
โ”‚ --flavour                 TEXT                      The Data Reference       โ”‚
โ”‚                                                     Syntax (DRS) standard    โ”‚
โ”‚                                                     specifying the type of   โ”‚
โ”‚                                                     climate datasets to      โ”‚
โ”‚                                                     query.                   โ”‚
โ”‚ --time-select    -ts      [strict|flexible|file]    Operator that specifies  โ”‚
โ”‚                                                     how the time period is   โ”‚
โ”‚                                                     selected. Choose from    โ”‚
โ”‚                                                     flexible (default),      โ”‚
โ”‚                                                     strict or file.          โ”‚
โ”‚                                                     ``strict`` returns only  โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     the *entire* time period โ”‚
โ”‚                                                     covered. The time search โ”‚
โ”‚                                                     ``2000 to 2012`` will    โ”‚
โ”‚                                                     not select files         โ”‚
โ”‚                                                     containing data from     โ”‚
โ”‚                                                     2010 to 2020 with the    โ”‚
โ”‚                                                     ``strict`` method.       โ”‚
โ”‚                                                     ``flexible`` will select โ”‚
โ”‚                                                     those files as           โ”‚
โ”‚                                                     ``flexible`` returns     โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     start or end period      โ”‚
โ”‚                                                     covered. ``file`` will   โ”‚
โ”‚                                                     only return files where  โ”‚
โ”‚                                                     the entire time period   โ”‚
โ”‚                                                     is contained within *one โ”‚
โ”‚                                                     single* file.            โ”‚
โ”‚                                                     [default: flexible]      โ”‚
โ”‚ --zarr                                              Create zarr stream       โ”‚
โ”‚                                                     files.                   โ”‚
โ”‚ --public                                            Make any zarr url public โ”‚
โ”‚ --ttl-seconds             INTEGER                   Set the expiry time of   โ”‚
โ”‚                                                     any public zarr urls     โ”‚
โ”‚                                                     [default: 86400]         โ”‚
โ”‚ --token-file     -tf      PATH                      Instead of               โ”‚
โ”‚                                                     authenticating via code  โ”‚
โ”‚                                                     based authentication     โ”‚
โ”‚                                                     flow you can set the     โ”‚
โ”‚                                                     path to the json file    โ”‚
โ”‚                                                     that contains a `refresh โ”‚
โ”‚                                                     token` containing a      โ”‚
โ”‚                                                     refresh_token key.       โ”‚
โ”‚ --time           -t       TEXT                      Special search facet to  โ”‚
โ”‚                                                     refine/subset search     โ”‚
โ”‚                                                     results by time. This    โ”‚
โ”‚                                                     can be a string          โ”‚
โ”‚                                                     representation of a time โ”‚
โ”‚                                                     range or a single time   โ”‚
โ”‚                                                     step. The time steps     โ”‚
โ”‚                                                     have to follow ISO-8601. โ”‚
โ”‚                                                     Valid strings are        โ”‚
โ”‚                                                     ``%Y-%m-%dT%H:%M`` to    โ”‚
โ”‚                                                     ``%Y-%m-%dT%H:%M`` for   โ”‚
โ”‚                                                     time ranges and          โ”‚
โ”‚                                                     ``%Y-%m-%dT%H:%M``.      โ”‚
โ”‚                                                     **Note**: You don't have โ”‚
โ”‚                                                     to give the full string  โ”‚
โ”‚                                                     format to subset time    โ”‚
โ”‚                                                     steps ``%Y``, ``%Y-%m``  โ”‚
โ”‚                                                     etc are also valid.      โ”‚
โ”‚ --bbox           -b       <FLOAT FLOAT FLOAT        Special search facet to  โ”‚
โ”‚                           FLOAT>...                 refine/subset search     โ”‚
โ”‚                                                     results by spatial       โ”‚
โ”‚                                                     extent. This can be a    โ”‚
โ”‚                                                     string representation of โ”‚
โ”‚                                                     a bounding box. The      โ”‚
โ”‚                                                     bounding box has to      โ”‚
โ”‚                                                     follow the format        โ”‚
โ”‚                                                     ``min_lon max_lon        โ”‚
โ”‚                                                     min_lat max_lat``. Valid โ”‚
โ”‚                                                     strings are ``-10 10 -10 โ”‚
โ”‚                                                     10`` to ``0 5 0 5``.     โ”‚
โ”‚ --bbox-select    -bs      [strict|flexible|file]    Operator that specifies  โ”‚
โ”‚                                                     how the spatial extent   โ”‚
โ”‚                                                     is selected. Choose from โ”‚
โ”‚                                                     flexible (default),      โ”‚
โ”‚                                                     strict or file.          โ”‚
โ”‚                                                     ``strict`` returns only  โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     the *entire* spatial     โ”‚
โ”‚                                                     extent covered. The bbox โ”‚
โ”‚                                                     search ``-10 10 -10 10`` โ”‚
โ”‚                                                     will not select files    โ”‚
โ”‚                                                     containing data from 0 5 โ”‚
โ”‚                                                     0 5 with the ``strict``  โ”‚
โ”‚                                                     method. ``flexible``     โ”‚
โ”‚                                                     will select those files  โ”‚
โ”‚                                                     as ``flexible`` returns  โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     any part of the extent   โ”‚
โ”‚                                                     covered. ``file`` will   โ”‚
โ”‚                                                     only return files where  โ”‚
โ”‚                                                     the entire spatial       โ”‚
โ”‚                                                     extent is contained      โ”‚
โ”‚                                                     within *one single*      โ”‚
โ”‚                                                     file.                    โ”‚
โ”‚                                                     [default: flexible]      โ”‚
โ”‚ --json           -j                                 Parse output in json     โ”‚
โ”‚                                                     format.                  โ”‚
โ”‚ --host                    TEXT                      Set the hostname of the  โ”‚
โ”‚                                                     databrowser, if not set  โ”‚
โ”‚                                                     (default) the hostname   โ”‚
โ”‚                                                     is read from a config    โ”‚
โ”‚                                                     file                     โ”‚
โ”‚                  -v       INTEGER                   Increase verbosity       โ”‚
โ”‚                                                     [default: 0]             โ”‚
โ”‚ --multi-version                                     Select all versions and  โ”‚
โ”‚                                                     not just the latest      โ”‚
โ”‚                                                     version (default).       โ”‚
โ”‚ --version        -V                                 Show version an exit     โ”‚
โ”‚ --help                                              Show this message and    โ”‚
โ”‚                                                     exit.                    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ


The command expects a list of key=value pairs. The order of the pairs doesnโ€™t really matter. Most important is that you donโ€™t need to split the search according to the type of data you are searching for. You can search for files within observations, reanalysis and model data at the same time. Also important is that all queries are case insensitive. You can also search for attributes themselves instead of file paths. For example you can search for the list of variables available that satisfies a certain constraint (e.g.ย sampled 6hr, from a certain model, etc).

freva-client databrowser data-search project=observations variable=pr model=cp*

There are many more options for defining a value for a given key:

Attribute syntax

Meaning

attribute=value

Search for files containing exactly that attribute

attribute='val\*'

Search for files containing a value for attribute that starts with the prefix val

attribute='*lue'

Search for files containing a value for attribute that ends with the suffix lue

attribute='*alu\*'

Search for files containing a value for attribute that has alu somewhere

attribute='/.*alu.*/'

Search for files containing a value for attribute that matches the given regular expression (yes! you might use any regular expression to find what you want.)

attribute=value1 attribute=value2

OR:

attribute={value1,value2}

Search for files containing either value1 OR value2 for the given attribute (note thatโ€™s the same attribute twice!)

attribute1=value1 attribute2=value2

Search for files containing value1 for attribute1 AND value2 for attribute2

attribute_not_=value

Search for files NOT containing value

attribute_not_=value1 attribute_not_=value2

Search for files containing neither value1 nor value2

Note

When using * remember that your shell might give it a different meaning (normally it will try to match files with that name) to turn that off you can use backslash (key=*) or use quotes (key=โ€™*โ€™).

Searching multi-versioned datasets#

In datasets with multiple versions only the latest version (i.e. highest version number) is returned by default. Querying a specific version from a multi versioned datasets requires the multi-version flag in combination with the version special attribute:

freva-client databrowser data-search dataset=cmip6-fs model=access-cm2 --multi-version version=v20191108

If no particular version is requested, all versions will be returned.

Streaming files via zarr#

Instead of getting the file locations on disk or tape, you can instruct the system to register zarr streams. Which means that instead of opening the data directly you can open it via zarr from anywhere. To do so simply add the --zarr flag.

Note

Before you can use the --zarr flag you will have to create an access token and use that token to log on to the system see also the Authentication & Authorization chapter for more details on token creation.

freva-client auth > .token.json
chmod 600 .token.json
freva-client databrowser data-search dataset=cmip6-fs --zarr --token-file .token.json

Special cases: Searching for times#

For example you want to know how many files we have between a certain time range To do so you can use the time search key to subset time steps and whole time ranges:

freva-client databrowser data-search project=observations -t '2016-09-02T22:15 to 2016-10'

The default method for selecting time periods is flexible, which means all files are selected that cover at least start or end date. The strict method implies that the entire search time period has to be covered by the files. Using the strict method in the example above would only yield on file because the first file contains time steps prior to the start of the time period:

freva-client databrowser data-search project=observations -t '2016-09-02T22:15 to 2016-10' -ts strict

Giving single time steps is also possible:

freva-client databrowser data-search project=observations -t 2016-09-02T22:10

Note

The time format has to follow the ISO-8601 standard. Time ranges are indicated by the to keyword such as 2000 to 2100 or 2000-01 to 2100-12 and alike. Single time steps are given without the to keyword.

Creating intake-esm catalouges#

The intake-catalogue sub command allows you to create an intake-esm catalogue <https://intake-esm.readthedocs.io/en/stable/>_ from the current search. This can be useful to share the catalogue with others or merge datasets.

freva-client databrowser intake-catalogue --help

Results

                                                                                
 Usage: freva-client databrowser intake-catalogue [OPTIONS] [SEARCH_KEYS]...    
                                                                                
 Create an intake catalogue from the search.                                    
                                                                                
โ•ญโ”€ Arguments โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚   search_keys      [SEARCH_KEYS]...  Refine your data search with this       โ”‚
โ”‚                                      `key=value` pair search parameters. The โ”‚
โ”‚                                      parameters could be, depending on the   โ”‚
โ”‚                                      DRS standard, flavour product, project  โ”‚
โ”‚                                      model etc.                              โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --facet                   TEXT                      If you are not sure      โ”‚
โ”‚                                                     about the correct search โ”‚
โ”‚                                                     key's you can use the    โ”‚
โ”‚                                                     ``--facet`` flag to      โ”‚
โ”‚                                                     search of any matching   โ”‚
โ”‚                                                     entries. For example     โ”‚
โ”‚                                                     --facet 'era5' would     โ”‚
โ”‚                                                     allow you to search for  โ”‚
โ”‚                                                     any entries containing   โ”‚
โ”‚                                                     era5, regardless of      โ”‚
โ”‚                                                     project, product etc.    โ”‚
โ”‚ --uniq-key       -u       [file|uri]                The type of search       โ”‚
โ”‚                                                     result, which can be     โ”‚
โ”‚                                                     either โ€œfileโ€ or โ€œuriโ€.  โ”‚
โ”‚                                                     This parameter           โ”‚
โ”‚                                                     determines whether the   โ”‚
โ”‚                                                     search will be based on  โ”‚
โ”‚                                                     file paths or Uniform    โ”‚
โ”‚                                                     Resource Identifiers     โ”‚
โ”‚                                                     [default: file]          โ”‚
โ”‚ --flavour                 TEXT                      The Data Reference       โ”‚
โ”‚                                                     Syntax (DRS) standard    โ”‚
โ”‚                                                     specifying the type of   โ”‚
โ”‚                                                     climate datasets to      โ”‚
โ”‚                                                     query.                   โ”‚
โ”‚ --time-select    -ts      [strict|flexible|file]    Operator that specifies  โ”‚
โ”‚                                                     how the time period is   โ”‚
โ”‚                                                     selected. Choose from    โ”‚
โ”‚                                                     flexible (default),      โ”‚
โ”‚                                                     strict or file.          โ”‚
โ”‚                                                     ``strict`` returns only  โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     the *entire* time period โ”‚
โ”‚                                                     covered. The time search โ”‚
โ”‚                                                     ``2000 to 2012`` will    โ”‚
โ”‚                                                     not select files         โ”‚
โ”‚                                                     containing data from     โ”‚
โ”‚                                                     2010 to 2020 with the    โ”‚
โ”‚                                                     ``strict`` method.       โ”‚
โ”‚                                                     ``flexible`` will select โ”‚
โ”‚                                                     those files as           โ”‚
โ”‚                                                     ``flexible`` returns     โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     start or end period      โ”‚
โ”‚                                                     covered. ``file`` will   โ”‚
โ”‚                                                     only return files where  โ”‚
โ”‚                                                     the entire time period   โ”‚
โ”‚                                                     is contained within *one โ”‚
โ”‚                                                     single* file.            โ”‚
โ”‚                                                     [default: flexible]      โ”‚
โ”‚ --time           -t       TEXT                      Special search facet to  โ”‚
โ”‚                                                     refine/subset search     โ”‚
โ”‚                                                     results by time. This    โ”‚
โ”‚                                                     can be a string          โ”‚
โ”‚                                                     representation of a time โ”‚
โ”‚                                                     range or a single time   โ”‚
โ”‚                                                     step. The time steps     โ”‚
โ”‚                                                     have to follow ISO-8601. โ”‚
โ”‚                                                     Valid strings are        โ”‚
โ”‚                                                     ``%Y-%m-%dT%H:%M`` to    โ”‚
โ”‚                                                     ``%Y-%m-%dT%H:%M`` for   โ”‚
โ”‚                                                     time ranges and          โ”‚
โ”‚                                                     ``%Y-%m-%dT%H:%M``.      โ”‚
โ”‚                                                     **Note**: You don't have โ”‚
โ”‚                                                     to give the full string  โ”‚
โ”‚                                                     format to subset time    โ”‚
โ”‚                                                     steps ``%Y``, ``%Y-%m``  โ”‚
โ”‚                                                     etc are also valid.      โ”‚
โ”‚ --bbox           -b       <FLOAT FLOAT FLOAT        Special search facet to  โ”‚
โ”‚                           FLOAT>...                 refine/subset search     โ”‚
โ”‚                                                     results by spatial       โ”‚
โ”‚                                                     extent. This can be a    โ”‚
โ”‚                                                     string representation of โ”‚
โ”‚                                                     a bounding box. The      โ”‚
โ”‚                                                     bounding box has to      โ”‚
โ”‚                                                     follow the format        โ”‚
โ”‚                                                     ``min_lon max_lon        โ”‚
โ”‚                                                     min_lat max_lat``. Valid โ”‚
โ”‚                                                     strings are ``-10 10 -10 โ”‚
โ”‚                                                     10`` to ``0 5 0 5``.     โ”‚
โ”‚ --bbox-select    -bs      [strict|flexible|file]    Operator that specifies  โ”‚
โ”‚                                                     how the spatial extent   โ”‚
โ”‚                                                     is selected. Choose from โ”‚
โ”‚                                                     flexible (default),      โ”‚
โ”‚                                                     strict or file.          โ”‚
โ”‚                                                     ``strict`` returns only  โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     the *entire* spatial     โ”‚
โ”‚                                                     extent covered. The bbox โ”‚
โ”‚                                                     search ``-10 10 -10 10`` โ”‚
โ”‚                                                     will not select files    โ”‚
โ”‚                                                     containing data from 0 5 โ”‚
โ”‚                                                     0 5 with the ``strict``  โ”‚
โ”‚                                                     method. ``flexible``     โ”‚
โ”‚                                                     will select those files  โ”‚
โ”‚                                                     as ``flexible`` returns  โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     any part of the extent   โ”‚
โ”‚                                                     covered. ``file`` will   โ”‚
โ”‚                                                     only return files where  โ”‚
โ”‚                                                     the entire spatial       โ”‚
โ”‚                                                     extent is contained      โ”‚
โ”‚                                                     within *one single*      โ”‚
โ”‚                                                     file.                    โ”‚
โ”‚                                                     [default: flexible]      โ”‚
โ”‚ --zarr                                              Create zarr stream       โ”‚
โ”‚                                                     files, as catalogue      โ”‚
โ”‚                                                     targets.                 โ”‚
โ”‚ --public                                            Make any zarr url public โ”‚
โ”‚ --ttl-seconds             INTEGER                   Set the expiry time of   โ”‚
โ”‚                                                     any public zarr urls     โ”‚
โ”‚                                                     [default: 86400]         โ”‚
โ”‚ --token-file     -tf      PATH                      Instead of               โ”‚
โ”‚                                                     authenticating via code  โ”‚
โ”‚                                                     based authentication     โ”‚
โ”‚                                                     flow you can set the     โ”‚
โ”‚                                                     path to the json file    โ”‚
โ”‚                                                     that contains a `refresh โ”‚
โ”‚                                                     token` containing a      โ”‚
โ”‚                                                     refresh_token key.       โ”‚
โ”‚ --filename       -f       PATH                      Path to the file where   โ”‚
โ”‚                                                     the catalogue, should be โ”‚
โ”‚                                                     written to. if None      โ”‚
โ”‚                                                     given (default) the      โ”‚
โ”‚                                                     catalogue is parsed to   โ”‚
โ”‚                                                     stdout.                  โ”‚
โ”‚ --host                    TEXT                      Set the hostname of the  โ”‚
โ”‚                                                     databrowser, if not set  โ”‚
โ”‚                                                     (default) the hostname   โ”‚
โ”‚                                                     is read from a config    โ”‚
โ”‚                                                     file                     โ”‚
โ”‚                  -v       INTEGER                   Increase verbosity       โ”‚
โ”‚                                                     [default: 0]             โ”‚
โ”‚ --multi-version                                     Select all versions and  โ”‚
โ”‚                                                     not just the latest      โ”‚
โ”‚                                                     version (default).       โ”‚
โ”‚ --version        -V                                 Show version an exit     โ”‚
โ”‚ --help                                              Show this message and    โ”‚
โ”‚                                                     exit.                    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ


You can either set the --filename flag to save the catalogue to a .json file or pipe the catalogue to stdout (default). Just like for the data-search sub command you can instruct the system to create zarr file streams to access the data via zarr.

Creating STAC Catalogue#

The stac-catalogue sub command allows you to create a static SpatioTemporal Asset Catalog (STAC) <https://stacspec.org/en/about/stac-spec/>_ from the current search. This can be useful for creating, sharing and using standardized geospatial data catalogs and enabling interoperability between different data systems.

freva-client databrowser stac-catalogue --help

Results

                                                                                
 Usage: freva-client databrowser stac-catalogue [OPTIONS] [SEARCH_KEYS]...      
                                                                                
 Create a static STAC catalogue from the search.                                
                                                                                
โ•ญโ”€ Arguments โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚   search_keys      [SEARCH_KEYS]...  Refine your data search with this       โ”‚
โ”‚                                      `key=value` pair search parameters. The โ”‚
โ”‚                                      parameters could be, depending on the   โ”‚
โ”‚                                      DRS standard, flavour product, project  โ”‚
โ”‚                                      model etc.                              โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --facet                   TEXT                      If you are not sure      โ”‚
โ”‚                                                     about the correct search โ”‚
โ”‚                                                     key's you can use the    โ”‚
โ”‚                                                     ``--facet`` flag to      โ”‚
โ”‚                                                     search of any matching   โ”‚
โ”‚                                                     entries. For example     โ”‚
โ”‚                                                     --facet 'era5' would     โ”‚
โ”‚                                                     allow you to search for  โ”‚
โ”‚                                                     any entries containing   โ”‚
โ”‚                                                     era5, regardless of      โ”‚
โ”‚                                                     project, product etc.    โ”‚
โ”‚ --uniq-key       -u       [file|uri]                The type of search       โ”‚
โ”‚                                                     result, which can be     โ”‚
โ”‚                                                     either โ€œfileโ€ or โ€œuriโ€.  โ”‚
โ”‚                                                     This parameter           โ”‚
โ”‚                                                     determines whether the   โ”‚
โ”‚                                                     search will be based on  โ”‚
โ”‚                                                     file paths or Uniform    โ”‚
โ”‚                                                     Resource Identifiers     โ”‚
โ”‚                                                     [default: file]          โ”‚
โ”‚ --flavour                 TEXT                      The Data Reference       โ”‚
โ”‚                                                     Syntax (DRS) standard    โ”‚
โ”‚                                                     specifying the type of   โ”‚
โ”‚                                                     climate datasets to      โ”‚
โ”‚                                                     query.                   โ”‚
โ”‚ --time-select    -ts      [strict|flexible|file]    Operator that specifies  โ”‚
โ”‚                                                     how the time period is   โ”‚
โ”‚                                                     selected. Choose from    โ”‚
โ”‚                                                     flexible (default),      โ”‚
โ”‚                                                     strict or file.          โ”‚
โ”‚                                                     ``strict`` returns only  โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     the *entire* time period โ”‚
โ”‚                                                     covered. The time search โ”‚
โ”‚                                                     ``2000 to 2012`` will    โ”‚
โ”‚                                                     not select files         โ”‚
โ”‚                                                     containing data from     โ”‚
โ”‚                                                     2010 to 2020 with the    โ”‚
โ”‚                                                     ``strict`` method.       โ”‚
โ”‚                                                     ``flexible`` will select โ”‚
โ”‚                                                     those files as           โ”‚
โ”‚                                                     ``flexible`` returns     โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     start or end period      โ”‚
โ”‚                                                     covered. ``file`` will   โ”‚
โ”‚                                                     only return files where  โ”‚
โ”‚                                                     the entire time period   โ”‚
โ”‚                                                     is contained within *one โ”‚
โ”‚                                                     single* file.            โ”‚
โ”‚                                                     [default: flexible]      โ”‚
โ”‚ --time           -t       TEXT                      Special search facet to  โ”‚
โ”‚                                                     refine/subset search     โ”‚
โ”‚                                                     results by time. This    โ”‚
โ”‚                                                     can be a string          โ”‚
โ”‚                                                     representation of a time โ”‚
โ”‚                                                     range or a single time   โ”‚
โ”‚                                                     step. The time steps     โ”‚
โ”‚                                                     have to follow ISO-8601. โ”‚
โ”‚                                                     Valid strings are        โ”‚
โ”‚                                                     ``%Y-%m-%dT%H:%M`` to    โ”‚
โ”‚                                                     ``%Y-%m-%dT%H:%M`` for   โ”‚
โ”‚                                                     time ranges and          โ”‚
โ”‚                                                     ``%Y-%m-%dT%H:%M``.      โ”‚
โ”‚                                                     **Note**: You don't have โ”‚
โ”‚                                                     to give the full string  โ”‚
โ”‚                                                     format to subset time    โ”‚
โ”‚                                                     steps ``%Y``, ``%Y-%m``  โ”‚
โ”‚                                                     etc are also valid.      โ”‚
โ”‚ --bbox           -b       <FLOAT FLOAT FLOAT        Special search facet to  โ”‚
โ”‚                           FLOAT>...                 refine/subset search     โ”‚
โ”‚                                                     results by spatial       โ”‚
โ”‚                                                     extent. This can be a    โ”‚
โ”‚                                                     string representation of โ”‚
โ”‚                                                     a bounding box. The      โ”‚
โ”‚                                                     bounding box has to      โ”‚
โ”‚                                                     follow the format        โ”‚
โ”‚                                                     ``min_lon max_lon        โ”‚
โ”‚                                                     min_lat max_lat``. Valid โ”‚
โ”‚                                                     strings are ``-10 10 -10 โ”‚
โ”‚                                                     10`` to ``0 5 0 5``.     โ”‚
โ”‚ --bbox-select    -bs      [strict|flexible|file]    Operator that specifies  โ”‚
โ”‚                                                     how the spatial extent   โ”‚
โ”‚                                                     is selected. Choose from โ”‚
โ”‚                                                     flexible (default),      โ”‚
โ”‚                                                     strict or file.          โ”‚
โ”‚                                                     ``strict`` returns only  โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     the *entire* spatial     โ”‚
โ”‚                                                     extent covered. The bbox โ”‚
โ”‚                                                     search ``-10 10 -10 10`` โ”‚
โ”‚                                                     will not select files    โ”‚
โ”‚                                                     containing data from 0 5 โ”‚
โ”‚                                                     0 5 with the ``strict``  โ”‚
โ”‚                                                     method. ``flexible``     โ”‚
โ”‚                                                     will select those files  โ”‚
โ”‚                                                     as ``flexible`` returns  โ”‚
โ”‚                                                     those files that have    โ”‚
โ”‚                                                     any part of the extent   โ”‚
โ”‚                                                     covered. ``file`` will   โ”‚
โ”‚                                                     only return files where  โ”‚
โ”‚                                                     the entire spatial       โ”‚
โ”‚                                                     extent is contained      โ”‚
โ”‚                                                     within *one single*      โ”‚
โ”‚                                                     file.                    โ”‚
โ”‚                                                     [default: flexible]      โ”‚
โ”‚ --host                    TEXT                      Set the hostname of the  โ”‚
โ”‚                                                     databrowser, if not set  โ”‚
โ”‚                                                     (default) the hostname   โ”‚
โ”‚                                                     is read from a config    โ”‚
โ”‚                                                     file                     โ”‚
โ”‚ --token-file     -tf      PATH                      Instead of               โ”‚
โ”‚                                                     authenticating via code  โ”‚
โ”‚                                                     based authentication     โ”‚
โ”‚                                                     flow you can set the     โ”‚
โ”‚                                                     path to the json file    โ”‚
โ”‚                                                     that contains a `refresh โ”‚
โ”‚                                                     token` containing a      โ”‚
โ”‚                                                     refresh_token key.       โ”‚
โ”‚                  -v       INTEGER                   Increase verbosity       โ”‚
โ”‚                                                     [default: 0]             โ”‚
โ”‚ --multi-version                                     Select all versions and  โ”‚
โ”‚                                                     not just the latest      โ”‚
โ”‚                                                     version (default).       โ”‚
โ”‚ --version        -V                                 Show version an exit     โ”‚
โ”‚ --filename       -o       PATH                      Path to the file where   โ”‚
โ”‚                                                     the static STAC          โ”‚
โ”‚                                                     catalogue, should be     โ”‚
โ”‚                                                     written to. If you don't โ”‚
โ”‚                                                     specify or the path does โ”‚
โ”‚                                                     not exist, the file will โ”‚
โ”‚                                                     be created in the        โ”‚
โ”‚                                                     current working          โ”‚
โ”‚                                                     directory.               โ”‚
โ”‚ --help                                              Show this message and    โ”‚
โ”‚                                                     exit.                    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ


To get an static STAC catalogue you can use the following command:

freva-client databrowser stac-catalogue --filename /path/to/output

and if the specified filename directory doesnโ€™t specify or not existed or not provided, the STAC catalogue will be saved in the current directory. It can be only a directory or a fully qualified filename.

The STAC Catalogue provides multiple ways to access and interact with the data:

  • Access your climate data through the intake-esm data catalog specification

  • Access search results as Zarr files, available as STAC Assets at both collection and item levels

  • Browse and explore your search results directly through the Freva DataBrowser web interface

Each of these access methods is encoded as STAC Assets, making them easily discoverable and accessible through any STAC-compatible tool.

Query the number of occurrences#

In some cases it might be useful to know how many files are found in the databrowser for certain search constraints. In such cases you can use the data-count sub command to count the number of found files instead of getting the files themselves.

freva-client databrowser data-count --help

By default the data-count sub command will display the total number of items matching your search query. For example:

freva-client databrowser data-count project=observations

If you want to group the number of occurrences by search categories (facets) use the -d or --detail flag:

freva-client databrowser data-count -d project=observations

Retrieving the available metadata#

Sometime it might be useful to know about possible values that search attributes. For this you use the metadata-search sub command:

freva-client databrowser metadata-search --help

Just like with any other databrowser command you can apply different search constraints when acquiring metadata

freva-client databrowser metadata-search project=observations

By default the command will display only the most commonly used metadata keys. To retrieve all metadata you can use the -e or --extended-search flag.

freva-client databrowser metadata-search -e project=observations

Sometimes you donโ€™t exactly know the exact names of the search keys and want retrieve all file objects that match a certain category. For example for getting all ocean reanalysis datasets you can apply the --facet flag:

freva-client databrowser metadata-search -e realm=ocean --facet 'rean*'

Filtering metadata results#

You can filter the metadata results using standard command-line tools:

Using grep to filter pandas output:

freva-client databrowser metadata-search | grep -E '(project|realm)'

Using jq to filter JSON output:

freva-client databrowser metadata-search --json | jq 'with_entries(select(.key | IN("experiment", "realm")))'

These methods allow you to focus on specific metadata categories and make the output more targeted and easier to process.

Expert tip: Getting metadata for certain files#

In some cases it might be useful to retrieve metadata for certain file or object store locations. For example if we wanted to retrieve the metadata of those files on tape:

freva-client databrowser metadata-search -e file="/arch/*"

Parsing the command output#

You might have already noticed that each command has a --json flag. Enabling this flag lets you parse the output of each command to JSON.

Following on from the example above we can parse the output of the reverse search to the command line json processor jq:

freva-client databrowser metadata-search -e file="/arch/*" --json

By using the pipe operator | the JSON output of the freva-client commands can be piped and processed by jq:

freva-client databrowser metadata-search -e file="/arch/*" --json | jq -r .ensemble[0]

The above example will select only the first entry of the ensembles that are associated with files on the tape archive.

Adding and Deleting User Data#

You can manage your personal datasets within the databrowser by adding or deleting user-specific data. This functionality allows you to include your own data files into the databrowser, making them accessible for analysis and retrieval alongside other datasets.

Before using the user-data commands, you need to create an access token and authenticate with the system. Please refer to the Authentication & Authorization chapter for more details on token creation and authentication.

Adding User Data#

To add your data to the databrowser, use the user-data add command. Youโ€™ll need to provide the paths to your data files, and any metadata youโ€™d like to associate with your data.

freva-client databrowser user-data add \
    --path freva-rest/src/freva_rest/databrowser_api/mock/ \
    --facet project=cordex \
    --facet experiment=rcp85 \
    --facet model=mpi-m-mpi-esm-lr-clmcom-cclm4-8-17-v1 \
    --facet variable=tas \
    --token-file ~/.access_token

This command adds the specified data files to the databrowser and tags them with the provided metadata. These search filters help in indexing and searching your data within the system.

Deleting User Data#

If you need to remove your data from the databrowser, use the user-data delete command. Provide your the search keys (facets) that identify the user data you wish to delete.

freva-client databrowser user-data delete \
    --search-key project=cordex \
    --search-key experiment=rcp85 \
    --token-file ~/.access_token

This command deletes all data entries that match the specified search keys from the databrowser.

Managing Custom Flavours#

You can create and manage custom Data Reference Syntax (DRS) flavours that define how search facets are mapped to different data standards. This allows you to create personalized search interfaces that match your specific data organization needs.

Before using the flavour commands for adding or deleting flavours, you need to create an access token and authenticate with the system. Please refer to the Authentication & Authorization chapter for more details on token creation and authentication.

Adding Custom Flavours#

To create a new custom flavour, use the flavour add command. Youโ€™ll need to provide a name for your flavour and specify how search facets should be mapped.

freva-client databrowser flavour add my-custom-flavour \
    --map project=activity_id \
    --map model=source_id \
    --map experiment=experiment_id

This command creates a personal flavour named โ€œmy-custom-flavourโ€ that maps the standard search keys to different attribute names.

To create a global flavour that all users can access (requires admin privileges):

freva-client databrowser flavour add global-flavour \
    --map project=activity_id \
    --map model=source_id \
    --global

Updating Custom Flavours#

To update an existing custom flavour, use the flavour update command. This allows you to modify the facet mappings without recreating the entire flavour. You can update specific keys while keeping others unchanged.

freva-client databrowser flavour update my-custom-flavour \
    --map experiment=new_experiment_id \
    --map variable=var_name

This command updates only the specified mappings in โ€œmy-custom-flavourโ€, leaving other mappings intact.

You can also rename a flavour while updating it:

freva-client databrowser flavour update my-custom-flavour \
    --new-name my-updated-flavour \
    --map project=new_project_id

To update a global flavour (requires admin privileges):

freva-client databrowser flavour update global-flavour \
    --map model=updated_source_id \
    --global

Note

Regular users can only update their own personal flavours. Admin users can update both personal and global flavours. If you only want to rename a flavour, you can use --new-name without providing any --map options.

Listing Available Flavours#

To see all custom flavours available to you, use the flavour list command:

freva-client databrowser flavour list

Note

The flavour list command does not require authentication and will show global flavours available to all users.

This will display both personal flavours youโ€™ve created and global flavours available to all users.

You can also output the results in JSON format:

freva-client databrowser flavour list --json

Deleting Custom Flavours#

To remove a custom flavour you no longer need, use the flavour delete command:

freva-client databrowser flavour delete my-custom-flavour

This command removes the specified flavour from the system. You can only delete flavours that you own, unless you are an admin user who can delete global flavours.