OneStop is a data discovery system being built by CIRES researchers on a grant from the NOAA National Centers for Environmental Information. We welcome contributions from the community!
This project is maintained by cedardevs
The onestop-cli
tool provides a convenient command line interface for the OneStop search API.
For additional information on our OneStop API’s read the Search API Documentation or Registry API Documentation.
Either golang, or docker. Direct downloads of binaries will be available in the future.
Pull the image from Docker Hub (version 2.4.2 and up available).
docker run cedardevs/onestop-cli:2.4.2 <CMD>
For example-
docker run cedardevs/onestop-cli:2.4.2 searchcollection --query="satellite"
For more commands and flags -
docker run cedardevs/onestop-cli:2.4.2 <CMD> --help
Download the cli:
go get github.com/cedardevs/onestop/cli/cmd/onestop
or to get it from a specific branch:
GO111MODULE=on go get github.com/cedardevs/onestop/cli/cmd/onestop@[branchname]
Run the cli:
~/go/bin/onestop --help
or
PATH=$PATH:~/go/bin onestop
or
export PATH=$PATH:~/go/bin
after which you can just call onestop
To use a semantic types (i.e.--type
), the user can use a configuration to map type to UUID. For example-
scdr-types:
ABI-L1b-Rad : 5b58de08-afef-49fb-99a1-9c5d5c003bde
ABI-L2-CMIP : 22222222-2222-2222-2222-222222222222
GLM-L2-LCFA : 33333333-3333-3333-3333-333333333333
ABI-L2-FDC : 44444444-4444-4444-4444-444444444444
The CLI binary will look for a configuration named scdr-files-config.yml in /etc/scdr-files
, $HOME/.scdr-files
, and in the current working directory.
The docker image has a built in config containing the example config above.
Note: the following example commands assume you installed the cli using go get
mentioned above.
Add --verbose
to get more complete output. For example, to see what server is being used by default.
Add the --server
flag:
--server=data.noaa.gov/onestop/api/search/
--server=https://cedardevs.org/onestop/api/search/
--server=localhost/onestop/api/search/
The getcollectionbyid
, getgranulebyid
and getflattenedgranulebyid
work the same way.
Get collection by id:
onestop getcollectionbyid ecb087a6-25cf-4bfa-8165-2d374c701646
The searchcollection
, searchgranule
and searchflattenedgranule
work the same way.
There are two ways to specify queries and filters. A shorthand version and a longhand version. The shorthand uses flags, and the longhand is based on the JSON that would be required to curl the API directly.
Find collection by file identifier:
onestop searchcollection --query="fileIdentifier:/gov.noaa.nodc:NDBC-COOPS/"
which is equivalent to the longhand version:
onestop searchcollection queries[]{type:queryText, value:fileIdentifier:\"gov.noaa.nodc:NDBC-COOPS\"}
Search granule with parent identifier:
onestop searchgranule --query="parentIdentifier:\\"\"gov.noaa.nodc:NDBC-COOPS\\"\""
which is equivalent to:
onestop searchgranule queries[]{type:queryText, value:parentIdentifier:\"gov.noaa.nodc:NDBC-COOPS\"}
Search collections start date:
onestop searchcollection --start-time=2016/03/02
which is equivalent to:
onestop searchcollection filters[]{ type:datetime, after:2016-03-02T00:00:00Z}
Or search by both start and end date:
onestop searchcollection --start-time=2016/03/02 --end-time=2017/02/01
which is equivalent to:
onestop searchcollection filters[]{ type:datetime, after:2017-01-01T00:00:00Z, before:2017-02-01T00:00:00Z}
Shorthand geometries use WKT, as opposed to the longhand which is a polygon (such as would be represented in geoJSON).
Search collections with a geometry filter:
onestop searchcollection --area="POLYGON(( 22.686768 34.051522, 30.606537 34.051522, 30.606537 41.280903, 22.686768 41.280903, 22.686768 34.051522 ))"
which is equivalent to:
onestop searchcollection filters[]{ type : geometry }, filters[0].geometry{type : Polygon}, .geometry.coordinates[][]: 22.686768, 34.051522, []: 30.606537, 34.051522, []: 30.606537, 41.280903, []: 22.686768, 41.280903, []: 22.686768, 34.051522
Collections search with a query and filters:
onestop searchcollection --area="POLYGON(( 22.686768 34.051522, 30.606537 34.051522, 30.606537 41.280903, 22.686768 41.280903, 22.686768 34.051522 ))" --query="satellite"
Longhand query, including the --verbose
flag to provide more logging:
onestop searchcollection filters[]{ type : geometry }, filters[0].geometry{type : Polygon}, .geometry.coordinates[][]: 22.686768, 34.051522, []: 30.606537, 34.051522, []: 30.606537, 41.280903, []: 22.686768, 41.280903, []: 22.686768, 34.051522, queries[]{type:queryText, value:satellite} --verbose
For complex query and filter structure, refer to the short hand documentation.
Note: As it is now, you cannot combine the flags with json shorthand. e.g. This will not work - onestop searchcollection --area="POLYGON(( 22.686768 34.051522, 30.606537 34.051522, 30.606537 41.280903, 22.686768 41.280903, 22.686768 34.051522 ))" --query="satellite" filters[]{ type:datetime, after:2017-01-01T00:00:00Z, before:2017-02-01T00:00:00Z}