Skip to content

Commit 3371df0

Browse files
authored
Merge pull request #4 from nasa/release/0.5.0
Release/0.5.0
2 parents ef0f9e7 + 3bf709a commit 3371df0

File tree

11 files changed

+600
-182
lines changed

11 files changed

+600
-182
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main, develop, feature/* ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main, develop ]
20+
schedule:
21+
- cron: '42 19 * * 5'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'python' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37+
# Learn more:
38+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v2
43+
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
53+
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v1
58+
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
61+
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
65+
66+
#- run: |
67+
# make bootstrap
68+
# make release
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v1

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
venv/
22
.idea
33
*.pyc
4-
tags
4+
tags
5+
.venv
6+
*.egg-info
7+
dist

.travis.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
## [0.5.0]
10+
### Added
11+
- New support for querying tools (UMM-T) and services (UMM-S)
12+
- CodeQL Analysis on pushes and pull requests
13+
### Changed
14+
- Moved to github.com/nasa/python_cmr
15+
16+
## [Older]
17+
- Prior releases of this software originated from https://github.com/jddeal/python-cmr/releases
18+
19+
[Unreleased]: https://github.com/nasa/python_cmr/compare/v0.5.0...HEAD
20+
[0.5.0]: https://github.com/nasa/python_cmr/compare/ef0f9e7d67ce99d342a568bd6a098c3462df16d2...v0.5.0
21+
[Older]: https://github.com/jddeal/python-cmr/releases

README.rst renamed to README.md

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
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.
2+
3+
----
4+
15
Python CMR
26
==========
37

4-
.. image:: https://travis-ci.org/jddeal/python-cmr.svg?branch=master
5-
:target: https://travis-ci.org/jddeal/python-cmr
8+
[![CodeQL](https://github.com/nasa/python_cmr/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/nasa/python_cmr/actions/workflows/codeql-analysis.yml)
69

7-
Python CMR is an easy to use wrapper to the NASA EOSDIS
8-
`Common Metadata Repository API <https://cmr.earthdata.nasa.gov/search/>`_. This package aims to make
9-
querying the API intuitive and less error-prone by providing methods that will preemptively check
10-
for invalid input and handle the URL encoding the CMR API expects.
10+
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.
1111

1212
Getting access to NASA's earth science metadata is as simple as this:
1313

14-
::
15-
1614
>>> from cmr import CollectionQuery, GranuleQuery
17-
15+
1816
>>> api = CollectionQuery()
1917
>>> collections = api.archive_center("LP DAAC").keyword("AST_L1*").get(5)
2018

@@ -33,37 +31,26 @@ Getting access to NASA's earth science metadata is as simple as this:
3331
SC:AST_L1T.003:2149105820
3432
SC:AST_L1T.003:2149155037
3533

36-
3734
Installation
3835
============
3936

4037
To install from pypi:
4138

42-
::
43-
4439
$ pip install python-cmr
4540

46-
4741
To install from github, perhaps to try out the dev branch:
4842

49-
::
50-
5143
$ git clone https://github.com/jddeal/python-cmr
5244
$ cd python-cmr
5345
$ pip install .
5446

55-
5647
Examples
5748
========
5849

59-
This library is broken into two classes, `CollectionQuery` and `GranuleQuery`. Each of these
60-
classes provide a large set of methods used to build a query for CMR. Not all parameters provided
61-
by the CMR API are covered by this version of python-cmr.
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.
6251

6352
The following methods are available to both collecton and granule queries:
6453

65-
::
66-
6754
# search for granules matching a specific product/short_name
6855
>>> api.short_name("AST_L1T")
6956

@@ -102,11 +89,11 @@ The following methods are available to both collecton and granule queries:
10289
>>> api.concept_id("C1299783579-LPDAAC_ECS")
10390
>>> api.concept_id(["G1327299284-LPDAAC_ECS", "G1326330014-LPDAAC_ECS"])
10491

92+
# search by provider
93+
>>> api.provider('POCLOUD')
10594

10695
Granule searches support these methods (in addition to the shared methods above):
10796

108-
::
109-
11097
# search for a granule by its unique ID
11198
>>> api.granule_ur("SC:AST_L1T.003:2150315169")
11299
# search for granules from a specific orbit
@@ -121,23 +108,49 @@ Granule searches support these methods (in addition to the shared methods above)
121108
# filter by specific instrument or platform
122109
>>> api.instrument("MODIS")
123110
>>> api.platform("Terra")
124-
125111

126112
Collection searches support these methods (in addition to the shared methods above):
127113

128-
::
129-
130114
# search for collections from a specific archive center
131115
>>> api.archive_center("LP DAAC")
132116

133117
# case insensitive, wildcard enabled text search through most collection fields
134118
>>> api.keyword("M*D09")
135119

120+
# search by native_id
121+
>>> api.native_id('native_id')
136122

137-
As an alternative to chaining methods together to set the parameters of your query, a
138-
method exists to allow you to pass your parameters as keyword arguments:
123+
# filter by tool concept id
124+
>>> api.tool_concept_id('TL2092786348-POCLOUD')
139125

140-
::
126+
# filter by service concept id
127+
>>> api.service_concept_id('S1962070864-POCLOUD')
128+
129+
Service searches support the following methods
130+
131+
# Search via provider
132+
>>> api = ServiceQuery()
133+
>>> api.provider('POCLOUD')
134+
135+
# Search via native_id
136+
>>> api.native_id('POCLOUD_podaac_l2_cloud_subsetter')
137+
138+
# Search via name
139+
>>> api.name('PODAAC L2 Cloud Subsetter')
140+
141+
Tool searches support the following methods
142+
143+
# Search via provider
144+
>>> api = ToolQuery()
145+
>>> api.provider('POCLOUD')
146+
147+
# Search via native_id
148+
>>> api.native_id('POCLOUD_hitide')
149+
150+
# Search via name
151+
>>> api.name('hitide')
152+
153+
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:
141154

142155
# search for AST_L1T version 003 granules at latitude 42, longitude -100
143156
>>> api.parameters(
@@ -146,14 +159,10 @@ method exists to allow you to pass your parameters as keyword arguments:
146159
point=(-100, 42)
147160
)
148161

149-
Note: the kwarg key should match the name of a method from the above examples, and the value
150-
should be a tuple if it's a parameter that requires multiple values.
151-
162+
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.
152163

153164
To inspect and retreive results from the API, the following methods are available:
154165

155-
::
156-
157166
# inspect the number of results the query will return without downloading the results
158167
>>> print(api.hits())
159168

@@ -166,30 +175,26 @@ To inspect and retreive results from the API, the following methods are availabl
166175
# retrieve all the granules possible for the query
167176
>>> granules = api.get_all() # this is a shortcut for api.get(api.hits())
168177

169-
170-
By default the responses will return as json and be accessible as a list of python dictionaries.
171-
Other formats can be specified before making the request:
172-
173-
::
178+
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:
174179

175180
>>> granules = api.format("echo10").get(100)
176181

177182
The following formats are supported for both granule and collection queries:
178183

179-
* json (default)
180-
* xml
181-
* echo10
182-
* iso
183-
* iso19115
184-
* csv
185-
* atom
186-
* kml
187-
* native
184+
- json (default)
185+
- xml
186+
- echo10
187+
- iso
188+
- iso19115
189+
- csv
190+
- atom
191+
- kml
192+
- native
188193

189194
Collection queries also support the following formats:
190195

191-
* dif
192-
* dif10
193-
* opendata
194-
* umm_json
195-
* umm_json_vX_Y (ex: umm_json_v1_9)
196+
- dif
197+
- dif10
198+
- opendata
199+
- umm\_json
200+
- umm\_json\_vX\_Y (ex: umm\_json\_v1\_9)

0 commit comments

Comments
 (0)