Skip to content

Commit 3cf08e5

Browse files
authored
Merge pull request #151 from planetlabs/add_mosaic_examples_to_docs
Add mosaic examples to docs
2 parents 4fc82b3 + 07d74b7 commit 3cf08e5

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

docs/source/cli/examples.rst

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,53 @@ Note: this might take some time and directory must exist::
4545

4646
planet data download --item-type PSScene3Band --limit 3 --dest images-download-directory
4747

48+
Mosaic Examples
49+
---------------
50+
51+
List information for all mosaics you have access to::
52+
53+
planet mosaics list
54+
55+
Note that you may want to parse the JSON that's output into a more human
56+
readable format. The cli does not directly provide options for this, but is
57+
meant to be easily interoperable with other tools, e.g. `jq
58+
<https://stedolan.github.io/jq/>`_. For example, we could output just the name
59+
and date range of each mosaic with::
60+
61+
planet mosaics list | jq -r '.mosaics[] | [.name, .first_acquired, .last_acquired] | @tsv'
62+
63+
Get basic information for a specific mosaic::
64+
65+
planet mosaics info global_monthly_2018_09_mosaic
66+
67+
List the first 10 quads for a mosaic (Omitting the ``--limit`` option will
68+
list all quads. Keep in mind that there may be millions for a global mosaic.)::
69+
70+
planet mosaics search global_monthly_2018_09_mosaic --limit=10
71+
72+
Find all quads inside a particular area of interest::
73+
74+
planet mosaics search global_monthly_2018_09_mosaic --rbox=-95.5,29.6,-95.3,29.8
75+
76+
Note that the format of ``--rbox`` is "xmin,ymin,xmax,ymax", so longitude comes
77+
before latitude.
78+
79+
Get basic information (footprint, etc) for a particular mosaic quad::
80+
81+
planet mosaics quad-info global_monthly_2018_09_mosaic 480-1200
82+
83+
Determine which scenes contributed to a particular mosaic quad::
84+
85+
planet mosaics contribution global_monthly_2018_09_mosaic 480-1200
86+
87+
Download all quads for a mosaic (this is impractical for large mosaics, which
88+
are hundreds of Terabytes in size)::
89+
90+
planet mosaics download <mosaic_name>
91+
92+
Download all quads inside of a rectangular box for a mosaic::
93+
94+
planet mosaics download global_monthly_2018_09_mosaic --rbox=-95.5,29.6,-95.3,29.8
4895

4996
Integration With Other Tools
5097
----------------------------
@@ -67,7 +114,7 @@ Note: the `@-` value for `--geom` specifies reading from stdin
67114
Extracting Metadata Fields
68115
..........................
69116

70-
Using `jq <http://stedolan.github.io/jq/>`_, useful information can be parsed from data returned by the Planet API.
117+
Using jq_, useful information can be parsed from data returned by the Planet API.
71118

72119
.. code-block:: bash
73120

planet/scripts/v1.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,13 @@ def list_mosaics(pretty):
238238
@mosaics.command('search')
239239
@click.argument('name')
240240
@click.option('--rbox', type=BoundingBox(), help=(
241-
'Region to download as a comma-delimited string:'
241+
'Region to query as a comma-delimited string:'
242242
' lon_min,lat_min,lon_max,lat_max'
243243
))
244244
@limit_option(None)
245245
@pretty
246246
def search_mosaics(name, rbox, limit, pretty):
247+
'''Get quad IDs and information for a mosaic'''
247248
cl = clientv1()
248249
mosaic, = cl.get_mosaic_by_name(name).items_iter(1)
249250
response = call_and_wrap(cl.get_quads, mosaic, rbox)
@@ -275,7 +276,7 @@ def quad_info(name, quad, pretty):
275276
@click.argument('quad')
276277
@pretty
277278
def quad_contributions(name, quad, pretty):
278-
'''Get contributing scenes for a specific mosaic quad'''
279+
'''Get contributing scenes for a mosaic quad'''
279280
cl = clientv1()
280281
mosaic, = cl.get_mosaic_by_name(name).items_iter(1)
281282
quad = cl.get_quad_by_id(mosaic, quad).get()

0 commit comments

Comments
 (0)