File: cli_user_guide.rst

package info (click to toggle)
eodag 4.0.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 57,492 kB
  • sloc: python: 38,214; xml: 3,791; makefile: 26; sh: 1
file content (158 lines) | stat: -rw-r--r-- 5,620 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
.. _cli_user_guide:

CLI User Guide
==============

Make sure you correctly followed instructions on :ref:`configure`.

Then you can start playing with it:

* Run ``eodag --help`` to display all the available options and commands:

.. command-output:: eodag --help

* Each command has its own help, see for instance the help of the ``list`` command with ``eodag list --help``.

* By default the command line interface of eodag is set to the minimum **verbosity level**. You can print more
  log messages by adding ``-v`` to eodag master command. The more ``v`` given (up to 3), the more verbose the tool is.
  This feature comes in handy when you want to inspect an error or an unexpected behaviour. 4 different verbosity levels
  are offered to you:

.. code-block:: console

        eodag list
        eodag -v list
        eodag -vv list
        eodag -vvv list

Search
------

.. command-output:: eodag search --help

* To search for products and crunch the results of the search:

.. code-block:: console

        eodag search \
        --conf my_conf.yml \
        --box 1 43 2 44 \
        --start 2018-01-01 --end 2018-01-31 \
        --collection S2_MSI_L1C \
        --all \
        --storage my_search.geojson

The request above searches for `S2_MSI_L1C` collections in a given bounding box, in January 2018. The command fetches
internally all the products that match these criteria. Without ``--all``, it would only fetch the products found on the
first result page. It finally saves the results in a GeoJSON file.

You can pass arguments to a cruncher on the command line by doing this (example with using ``FilterOverlap`` cruncher
which takes ``minimum_overlap`` as argument):

.. code-block:: console

        eodag search -f my_conf.yml -b 1 43 2 44 -s 2018-01-01 -e 2018-01-31 -c S2_MSI_L1C --all \
                     --cruncher FilterOverlap \
                     --cruncher-args FilterOverlap minimum_overlap 10

The request above means : "Give me all the products from `S2_MSI_L1C` collection, use ``FilterOverlap`` to keep only those
products that are contained in the bbox I gave you, or whose spatial extent overlaps at least 10% (``minimum_overlap``)
of the surface of this bbox".

You can use ``eaodag search`` with custom query parameters. Custom query parameters will be used as is in the query
string search sent to the provider. For instance, if you want to add foo=1 and bar=2 to the previous query:

.. code-block:: console

        eodag search -f my_conf.yml -b 1 43 2 44 -s 2018-01-01 -e 2018-01-31 -c S2_MSI_L1C \
                     --cruncher FilterOverlap \
                     --cruncher-args FilterOverlap minimum_overlap 10 \
                     --query "foo=1&bar=2"

* If the collection is not known, it can also be guessed by EODAG during the search based on parameters in the search
  request. The possible parameters are:

  - `instruments` (e.g. MSI)
  - `constellation` (e.g. SENTINEL2)
  - `platform` (e.g. S2A)
  - `processing-level` (e.g. L1)
  - `sensor-type` (e.g. OPTICAL)
  - `keywords` (e.g. SENTINEL2 L1C SAFE), which is case insensitive and ignores `-` or `_` characters

For example, the following search request will first search for a collection for platform SENTINEL2 and
processing:level L1 (there are several collections matching these criteria, e.g., `S2_MSI_L1C`) and then use this
collection to execute the actual search.

.. code-block:: console

        eodag search \
        --constellation SENTINEL2 \
        --processing-level L1 \
        --box 1 43 2 44 \
        --start 2021-03-01 --end 2021-03-31

Download
--------

.. command-output:: eodag download --help

* To download the result of a previous call to ``search``:

.. code-block:: console

        eodag download --conf my_conf.yml --search-results my_search.geojson

* To download STAC items from their URL or path:

.. code-block:: console

        eodag download --stac-item https://foo/collections/bar/items/item-1-id --stac-item /path/to/item2.json

* Using commands chaining, ``download`` can also directly be executed after a ``search`` in a single command:

.. code-block:: console

        eodag search --collection S2_MSI_L1C --bbox 1 43 2 44 --start 2025-03-01 download

Collections
-------------

.. command-output:: eodag list --help

* To list all available collections and supported providers:

.. code-block:: console

        eodag list

* To list available collections on a specified supported provider:

.. code-block:: console

        eodag list -p creodias

* By default, ``list`` command will also fetch for new collections, which may be slow depending on the network status.
  To skip fetching, use the following option:

.. code-block:: console

        eodag list --no-fetch

* EODAG can fetch providers (all or only a given one) to discover available collections, using the following command.
  It will store result in a JSON file (defaults to `ext_collections.json`):

.. command-output:: eodag discover --help

Examples:

.. code-block:: console

        eodag discover
        eodag discover -p planetary_computer
        eodag discover -p planetary_computer --storage my_collections_conf.json

This file can then be used in EODAG using the environment variable ``EODAG_EXT_COLLECTIONS_CFG_FILE``.

Please note that if you did not customize EODAG with new providers settings, this command should not be useful.
For more information on the collections discovery mechanism, please see
`Python API User Guide / Providers and collections / Collections discovery <notebooks/api_user_guide/1_providers_collections_available.html#Collections-discovery>`_.