项目作者: m9brady

项目描述 :
EODMS API Client for Python
高级语言: Python
项目地址: git://github.com/m9brady/eodms-api-client.git
创建时间: 2020-10-16T14:19:24Z
项目社区:https://github.com/m9brady/eodms-api-client

开源协议:MIT License

下载


EODMS API Client

Conda (channel only)
PyPI
Documentation

A Python3 package for querying, ordering and downloading from the REST API provided by Natural Resources Canada’s Earth Observation Data Management System (EODMS).

Heavily influenced by the utterly fantastic sentinelsat package: https://github.com/sentinelsat/sentinelsat

Usage:

Full documentation and real-world example on GitHub Pages!

Quickstart:

Create a new environment with conda

  1. conda create -n eodms-env eodms-api-client -c conda-forge
  2. conda activate eodms-env

… or install with pip

Warning
Pip is not recommended

  • may clobber your existing Python environment
  • may be problematic with Windows+GDAL
  1. pip install eodms-api-client

Use the CLI

Given a geojson file containing search geometry (Point, Line, Polygon), query - but do not order - the RCM collection for products in the last 24hrs and dump the results to a geojson file for inspection (query_results.geojson)

  1. eodms -c RCM -g query_aoi.geojson --dump-results

Same query as above, but this time submit an order for all products found by the query instead of saving a result file

  1. eodms -c RCM -g query_aoi.geojson --submit-order

After submitting an order, this package will return a list of Order IDs that users should take note of as these will be used to download the imagery once the order is complete:

  1. eodms -c RCM --order-id [integer Order ID]

If your order produced several Order IDs (e.g. more than 50 images ordered at once), you may wish to create a text file of line-separated Order IDs to feed to the package:

  1. eodms -c RCM --order-ids [path to text file containing integer Order IDs]

Use interactively in a Python REPL

Repeating the same query as the CLI example above in a Python REPL allows you to manually inspect the results and do all sorts of interesting things with the query result geodataframe.

For example, one may wish to inspect the image metadata to check approximate download sizes. One may also want to inspect the image footprints to ensure that they are ordering only the images which have most-optimal coverage of their query_aoi.geojson.

  1. >>> from eodms_api_client import EodmsAPI
  2. >>> x = EodmsAPI(collection='RCM')
  3. >>> x.query(geometry='query_aoi.geojson')
  4. >>> type(x.results)
  5. geopandas.geodataframe.GeoDataFrame

List of possible CLI arguments

  1. eodms --help
  2. Usage: eodms [OPTIONS]
  3. Options:
  4. -u, --username TEXT EODMS username (leave blank to use .netrc or
  5. be prompted)
  6. -p, --password TEXT EODMS password (leave blank to use .netrc or
  7. be prompted)
  8. -c, --collection TEXT EODMS collection to search [required]
  9. -s, --start TEXT Beginning of acquisition time window
  10. (default to 1 day prior to now)
  11. -e, --end TEXT End of acquisition time window (default to
  12. now)
  13. -g, --geometry PATH File containing vector feature(s) used to
  14. constrain the query results to a spatial
  15. region
  16. -pt, --product-type TEXT Limit results to a certain image product
  17. type
  18. -pf, --product-format [GeoTIFF|NITF21]
  19. Limit results to a certain image product
  20. format
  21. -sr, --spatial-resolution TEXT Limit results to the desired spatial
  22. resolution
  23. -rel, --relative-orbit TEXT Limit results to the desired relative orbit
  24. Id
  25. -abs, --absolute-orbit TEXT Limit results to the desired absolute orbit
  26. Id
  27. -ia, --incidence-angle TEXT Limit results to the desired incidence angle
  28. -ial, --incidence-angle-low TEXT
  29. Limit results to scenes that have incidence
  30. angles greater than this value (degrees)
  31. -iah, --incidence-angle-high TEXT
  32. Limit results to scenes that have incidence
  33. angles less than this value (degrees)
  34. -rb, --radarsat-beam-mode TEXT Limit SAR collection results to the desired
  35. beam mode
  36. -rm, --radarsat-beam-mnemonic TEXT
  37. Limit SAR collection results to the desired
  38. beam mnemonic
  39. -rp, --radarsat-polarization [CH CV|HH|HH HV|HH HV VH VV|HH VV|HV|VH|VH VV|VV]
  40. Limit SAR collection results to the desired
  41. polarization
  42. -ro, --radarsat-orbit-direction [Ascending|Descending]
  43. Limit SAR collection results to the desired
  44. orbit type
  45. -rl, --radarsat-look-direction [Left|Right]
  46. Limit SAR collection results to the desired
  47. antenna look direction
  48. -rd, --radarsat-downlink-segment-id TEXT
  49. Limit SAR collection results to the desired
  50. downlink segment Id
  51. -rs, --rcm-satellite [RCM1|RCM2|RCM3]
  52. Limit RCM collection results to the desired
  53. satellite
  54. -cc, --cloud-cover TEXT Limit optical results to have less than this
  55. amount of cloud cover [0-100]
  56. -rn, --roll-number TEXT Limit NAPL results to the given roll number
  57. -pn, --photo-number TEXT Limit NAPL results to the given photo number
  58. --priority [Low|Medium|High|Urgent]
  59. What priority to use when submitting orders
  60. [default: Medium]
  61. -o, --output-dir DIRECTORY Directory where query results and downloaded
  62. imagery will be saved [default: .]
  63. -dr, --dump-results Whether or not to create a geojson dump
  64. containing the results of the query
  65. -dfn, --dump-filename TEXT Filename for query results geojson
  66. [default: query_results]
  67. --submit-order Submit an order to EODMS from the results of
  68. the current query parameters
  69. --record-id INTEGER Specific Record Id to order from the desired
  70. collection
  71. --record-ids PATH File of line-separated Record Ids to order
  72. from the desired collection
  73. --order-id INTEGER Specific Order Id to download from EODMS
  74. --order-ids PATH File of line-separated Order Ids to download
  75. from EODMS
  76. --uuid TEXT Specific UUID to order from the desired
  77. collection
  78. --uuid-list PATH File of line-separated UUIDs to order from
  79. the desired collection
  80. --n-dds-workers INTEGER Number of concurrent threads to use when
  81. downloading from DDS api
  82. --verbose Use debug-level logging
  83. --version Show the package version
  84. -h, --help Show this message and exit.

ToDo:

  • query RCM
  • query and order RCM
  • order with provided record Ids (no query necessary)
  • download given item Ids (no query or order submission necessary)
  • blindly order (skip extra metadata fetching, just order whatever is returned by query)
  • add support for other collections:
    • Radarsat2 (WIP)
    • Radarsat1 (WIP)
    • PlanetScope (WIP)
  • add multi-select functionality for supported collection parameters
  • allow for collection-switching for an existing EodmsAPI instance (must re-evaluate params and rebuild search_url)
  • readthedocs documentation