You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+82-20Lines changed: 82 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,7 @@
1
-
This repository is a copy of [jddeal/python_cmr](https://github.com/jddeal/python-cmr/tree/ef0f9e7d67ce99d342a568bd6a098c3462df16d2) which is no longer maintained. It has been copied here with the permission of the original author for the purpose of continuing to develop a python library that can be used for CMR access.
1
+
This repository is a copy
2
+
of [jddeal/python_cmr](https://github.com/jddeal/python-cmr/tree/ef0f9e7d67ce99d342a568bd6a098c3462df16d2) which is no
3
+
longer maintained. It has been copied here with the permission of the original author for the purpose of continuing to
4
+
develop a python library that can be used for CMR access.
Python CMR is an easy to use wrapper to the NASA EOSDIS [Common Metadata Repository API](https://cmr.earthdata.nasa.gov/search/). This package aims to make querying the API intuitive and less error-prone by providing methods that will preemptively check for invalid input and handle the URL encoding the CMR API expects.
13
+
Python CMR is an easy to use wrapper to the NASA
14
+
EOSDIS [Common Metadata Repository API](https://cmr.earthdata.nasa.gov/search/). This package aims to make querying the
15
+
API intuitive and less error-prone by providing methods that will preemptively check for invalid input and handle the
16
+
URL encoding the CMR API expects.
11
17
12
18
Getting access to NASA's earth science metadata is as simple as this:
13
19
@@ -47,7 +53,9 @@ To install from github, perhaps to try out the dev branch:
47
53
Examples
48
54
========
49
55
50
-
This library is broken into two classes, CollectionQuery and GranuleQuery. Each of these classes provide a large set of methods used to build a query for CMR. Not all parameters provided by the CMR API are covered by this version of python-cmr.
56
+
This library is broken into two classes, CollectionQuery and GranuleQuery. Each of these classes provide a large set of
57
+
methods used to build a query for CMR. Not all parameters provided by the CMR API are covered by this version of
58
+
python-cmr.
51
59
52
60
The following methods are available to both collecton and granule queries:
53
61
@@ -171,7 +179,8 @@ Variable searches support the following methods
171
179
# Search via concept_id
172
180
>>> api.concept_id('V2112019824-POCLOUD')
173
181
174
-
As an alternative to chaining methods together to set the parameters of your query, a method exists to allow you to pass your parameters as keyword arguments:
182
+
As an alternative to chaining methods together to set the parameters of your query, a method exists to allow you to pass
183
+
your parameters as keyword arguments:
175
184
176
185
# search for AST_L1T version 003 granules at latitude 42, longitude -100
177
186
>>> api.parameters(
@@ -180,7 +189,8 @@ As an alternative to chaining methods together to set the parameters of your que
180
189
point=(-100, 42)
181
190
)
182
191
183
-
Note: the kwarg key should match the name of a method from the above examples, and the value should be a tuple if it's a parameter that requires multiple values.
192
+
Note: the kwarg key should match the name of a method from the above examples, and the value should be a tuple if it's a
193
+
parameter that requires multiple values.
184
194
185
195
To inspect and retreive results from the API, the following methods are available:
186
196
@@ -196,26 +206,78 @@ To inspect and retreive results from the API, the following methods are availabl
196
206
# retrieve all the granules possible for the query
197
207
>>> granules = api.get_all() # this is a shortcut for api.get(api.hits())
198
208
199
-
By default the responses will return as json and be accessible as a list of python dictionaries. Other formats can be specified before making the request:
209
+
By default the responses will return as json and be accessible as a list of python dictionaries. Other formats can be
210
+
specified before making the request:
200
211
201
212
>>> granules = api.format("echo10").get(100)
202
213
203
214
The following formats are supported for both granule and collection queries:
204
215
205
-
-json (default)
206
-
-xml
207
-
-echo10
208
-
-iso
209
-
-iso19115
210
-
-csv
211
-
-atom
212
-
-kml
213
-
-native
216
+
- json (default)
217
+
- xml
218
+
- echo10
219
+
- iso
220
+
- iso19115
221
+
- csv
222
+
- atom
223
+
- kml
224
+
- native
214
225
215
226
Collection queries also support the following formats:
216
227
217
-
- dif
218
-
- dif10
219
-
- opendata
220
-
- umm\_json
221
-
- umm\_json\_vX\_Y (ex: umm\_json\_v1\_9)
228
+
- dif
229
+
- dif10
230
+
- opendata
231
+
- umm\_json
232
+
- umm\_json\_vX\_Y (ex: umm\_json\_v1\_9)
233
+
234
+
# Developing
235
+
236
+
python-cmr uses the [poetry](https://python-poetry.org/) build system. Download and install poetry before starting
0 commit comments