From 0c0a0a3681d5218e8802011134b6ec6ba5da819d Mon Sep 17 00:00:00 2001 From: Florian <12199342+fwfichtner@users.noreply.github.com> Date: Thu, 4 May 2023 10:17:26 +0200 Subject: [PATCH] Remove data part & cleanup (#171) * fast cleanup * linting * update date --- CHANGELOG.rst | 6 + README.md | 36 +-- docs/index.rst | 61 +---- docs/installation.rst | 4 +- requirements.txt | 12 - setup.py | 12 - tests/test_data.py | 255 ------------------ tests/testfiles/aoi_3857.geojson | 8 - tests/testfiles/aoi_4326.geojson | 8 - tests/testfiles/catalog.json | 17 -- ukis_pysat/__init__.py | 2 +- ukis_pysat/_landsat.py | 143 ---------- ukis_pysat/data.py | 439 ------------------------------- ukis_pysat/members.py | 62 ----- ukis_pysat/raster.py | 1 - ukis_pysat/utils.py | 40 --- 16 files changed, 12 insertions(+), 1094 deletions(-) delete mode 100644 tests/test_data.py delete mode 100644 tests/testfiles/aoi_3857.geojson delete mode 100644 tests/testfiles/aoi_4326.geojson delete mode 100644 tests/testfiles/catalog.json delete mode 100644 ukis_pysat/_landsat.py delete mode 100644 ukis_pysat/data.py delete mode 100644 ukis_pysat/utils.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e8a1899..794feb2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Changelog ========= +[1.5.0] (2023-05-04) +--------------------- +Deleted +^^^^^^^ +- Removed data part #170 + [1.4.3] (2022-09-19) --------------------- Fixed diff --git a/README.md b/README.md index 02c0d0a..76eff38 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,7 @@ [![DOI](https://zenodo.org/badge/259635994.svg)](https://zenodo.org/badge/latestdoi/259635994) -The UKIS-pysat package provides generic classes and functions to query, access and process multi-spectral and SAR satellite images. - -### data -Download satellites data from different sources (currently Earth Explorer, SciHub, STAC), deal with and structure metadata. +The UKIS-pysat package provides generic classes and functions to access and process multi-spectral and SAR satellite images. ### file @@ -33,28 +30,9 @@ Here's an example about some basic features, it might also help to read through ```python # import all the required libraries -from ukis_pysat.data import Source from ukis_pysat.file import get_sentinel_scene_from_dir -from ukis_pysat.members import Datahub, Platform from ukis_pysat.raster import Image -# connect to Copernicus Open Access Hub and query metadata -src = Source(Datahub.Scihub) -meta = src.query_metadata( - platform=Platform.Sentinel2, - date=("20200101", "NOW"), - aoi=(11.90, 51.46, 11.94, 51.50), - cloud_cover=(0, 50), -) -for item in meta: # item is now a PySTAC item - print(item.id) - uuid = item.properties["srcuuid"] - - # download geocoded quicklook and image - src.download_quicklook(product_uuid=uuid, target_dir="/users/username/tmp") - src.download_image(product_uuid=uuid, target_dir="/users/username/tmp") - - break # get sentinel scene from directory with get_sentinel_scene_from_dir("/users/username/tmp") as (full_path, ident): @@ -65,19 +43,9 @@ with get_sentinel_scene_from_dir("/users/username/tmp") as (full_path, ident): For working with the Landsat we need an item id for downloading the product Check [Pystac](https://pystac.readthedocs.io/en/1.0/) documentation for more functionality on [STAC](https://stacspec.org/). -### Environment variables to configure Datahub credentials -To use ``ukis_pysat.data`` and to download from the respective Datahub you need to set the credentials as environment variables. - -For EarthExplorer that's: \ -``EARTHEXPLORER_USER=your_username`` \ -``EARTHEXPLORER_PW=your_password`` - -For SciHub that's: \ -``SCIHUB_USER=your_username`` \ -``SCIHUB_PW=your_password`` ## Installation -The easiest way to install `pysat` is through pip. Be aware, that Rasterio requires GDAL >= 1.11, < 3.1. +The easiest way to install `ukis-pysat` is through pip. Be aware, that Rasterio requires GDAL >= 1.11, < 3.1. Most users will want to do this: ```shell diff --git a/docs/index.rst b/docs/index.rst index 5d4f7ee..858fbf3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,11 +6,7 @@ Welcome to UKIS-pysat's documentation! ====================================== -The UKIS-pysat package provides generic classes and functions to query, access and process multi-spectral and SAR satellite images. - -data -____ -Download satellites data from different sources (currently Earth Explorer, SciHub, STAC), deal with and structure metadata. +The UKIS-pysat package provides generic classes and functions to access and process multi-spectral and SAR satellite images. file ____ @@ -18,7 +14,7 @@ Work with you local satellite data files and read information out of file names raster ______ -Reading satellite data and performing simple, but cumbersome tasks. This is just a layer on top of `rasterio `__ for stuff we often need. It can very well be that using *rasterio* directly is often the better choice. +Reading satellite data and performing simple, but cumbersome tasks. This is just a layer on top of `rasterio `__ for stuff we often need. It can very well be that using *rasterio* directly is often the better choice. Example _______ @@ -26,28 +22,9 @@ Here's an example about some basic features: .. code-block:: python - from ukis_pysat.data import Source from ukis_pysat.file import get_sentinel_scene_from_dir - from ukis_pysat.members import Datahub, Platform from ukis_pysat.raster import Image - # connect to Copernicus Open Access Hub and query metadata - src = Source(Datahub.Scihub) - meta = src.query_metadata( - platform=Platform.Sentinel2, - date=("20200101", "NOW"), - aoi=(11.90, 51.46, 11.94, 51.50), - cloud_cover=(0, 50), - ) - for item in meta: # item is now a PySTAC item - print(item.id) - uuid = item.properties["srcuuid"] - - # download geocoded quicklook and image - src.download_quicklook(product_uuid=uuid, target_dir="/users/username/tmp") - src.download_image(product_uuid=uuid, target_dir="/users/username/tmp") - - break # get sentinel scene from directory with get_sentinel_scene_from_dir("/users/username/tmp") as (full_path, ident): @@ -63,40 +40,6 @@ If the image was initialized with dimension order *last*, the result will be res Altering the array replaces all bands. If it is intended to alter a particular band, the remaining bands should be copied. -STAC API Item IO Concept -________________________ -To enable reading from different types of file systems (similar to `PySTAC `__), it is recommended that in the ``__init__.py`` of the client module, or at the beginning of the script using ``ukis_pysat.data``, you overwrite the ``STACAPI_IO.read_item_method`` with function that read and write however you need. The following is an example for a on premise S3 environment: - -.. code-block:: python - - from pystac import Item - from ukis_pysat.stacapi_io import STACAPI_IO - - def on_premise_s3_url_method(feature, root_bucket="dem"): - """the href is build like /collections/*collection_prefix*/items/*item_prefix* - - At some environments we will need to give back the href according to this method. - """ - item = Item.from_dict(feature) - href = item.get_self_href() - stripped_href = href.replace(r"collections/", "").replace(r"items/", "") - - return Item.from_file(f"s3://{root_bucket}{stripped_href}/{item.id}.json") - - STACAPI_IO.read_item_method = on_premise_s3_url_method - -Environment variables ---------------------- -To use ``ukis_pysat.data`` and to download from the respective Datahub you need to set the credentials as environment variables. - -For EarthExplorer that's: - | ``EARTHEXPLORER_USER=your_username`` - | ``EARTHEXPLORER_PW=your_password`` - -For SciHub that's: - | ``SCIHUB_USER=your_username`` - | ``SCIHUB_PW=your_password`` - .. toctree:: :caption: Contents: diff --git a/docs/installation.rst b/docs/installation.rst index 0b825a0..5af13d7 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -16,8 +16,6 @@ There's also some lighter versions with less dependencies: pip install ukis-pysat # only install core dependencies (ukis_pysat.file can be used) - pip install ukis-pysat[data] # also install dependencies for ukis_pysat.data - pip install ukis-pysat[raster] # also install dependencies for ukis_pysat.raster Some helper functions might need additional dependencies like `pandas`, `dask[array]` or `utm`. If this is the case you will receive an `ImportError`. @@ -29,7 +27,7 @@ If you're having troubles installing GDAL and Rasterio use conda and/or follow t Tests ----- -To run the tests set the Environment variables and then: +To run the tests: .. code-block:: console diff --git a/requirements.txt b/requirements.txt index ce6250d..1a8b8c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,3 @@ -## data -numpy -pillow -pystac[validation]>=1.0.0 -python-dateutil -requests -sentinelsat>=1.0.1 -shapely -pydantic - ## raster # numpy rasterio>=1.1.8 @@ -18,10 +8,8 @@ xmltodict ## dev dask[array] fiona -landsatxplore>=0.13.0 pandas pyproj -requests_mock utm>=0.7.0 geojson setuptools diff --git a/setup.py b/setup.py index 7e4f81e..7f5333d 100644 --- a/setup.py +++ b/setup.py @@ -25,16 +25,6 @@ def get_version(rel_path): # please also update requirements.txt for testing. Make sure package versions are the same in each subset. extras_require = { - "data": [ - "numpy", - "pillow", - "pystac>=1.0.0", - "python-dateutil", - "requests", - "sentinelsat>=1.0.1", - "shapely", - "pydantic", - ], "raster": [ "numpy", "rasterio>=1.1.8", @@ -50,10 +40,8 @@ def get_version(rel_path): + [ "dask[array]", "fiona", - "landsatxplore>=0.13.0", "pandas", "pyproj>=3.0.0", - "requests_mock", "utm>=0.7.0", "sphinx>=1.3", "sphinx_rtd_theme", diff --git a/tests/test_data.py b/tests/test_data.py deleted file mode 100644 index 962f464..0000000 --- a/tests/test_data.py +++ /dev/null @@ -1,255 +0,0 @@ -import unittest -from datetime import datetime -from pathlib import Path -from tempfile import gettempdir - -import pystac -import requests_mock -from pkg_resources import resource_filename -from shapely.geometry import Polygon - -from ukis_pysat._landsat import Product, meta_from_pid, compute_md5 -from ukis_pysat.data import Source -from ukis_pysat.members import Datahub, Platform, Bands - -# os.environ["EARTHEXPLORER_USER"] = "Tim" -# os.environ["EARTHEXPLORER_PW"] = "TheEnchanter" -# os.environ["SCIHUB_USER"] = "Tim" -# os.environ["SCIHUB_PW"] = "TheEnchanter" - -catalog_path = Path(__file__).parents[0] / "testfiles" / "catalog.json" -target_dir = Path(__file__).parents[0] / "testfiles" -aoi_4326 = target_dir / "aoi_4326.geojson" -aoi_3857 = target_dir / "aoi_3857.geojson" -aoi_bbox = (11.90, 51.46, 11.94, 51.50) -bands = Bands() - - -class DataTest(unittest.TestCase): - def test_init_stac_catalog(self): - with Source(datahub=Datahub.STAC_local, catalog=catalog_path) as src: - self.assertTrue(isinstance(src.api, pystac.catalog.Catalog)) - - def test_init_exception_other_hub(self): - with self.assertRaises( - NotImplementedError, msg=f"Hub is not supported [STAC_local, EarthExplorer, " f"Scihub]." - ): - Source(datahub="Hub") - - def test_init_exception_other_enum(self): - with self.assertRaises(AttributeError): - Source(datahub=Datahub.Hub) - - def test_exception_false_aoi(self): - with Source(datahub=Datahub.STAC_local, catalog=catalog_path) as src: - with self.assertRaises(TypeError, msg=f"aoi must be of type string or tuple"): - src._prep_aoi(1) - - def test_aoi_geointerface(self): - geom = Source._prep_aoi( - { - "type": "Polygon", - "coordinates": ( - ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (2.0, -1.0), (0.0, 0.0)), - ((0.1, 0.1), (0.1, 0.2), (0.2, 0.2), (0.2, 0.1), (0.1, 0.1)), - ), - } - ) - self.assertIsInstance(geom, Polygon) - self.assertEqual(tuple(geom.exterior.coords), ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (2.0, -1.0), (0.0, 0.0))) - self.assertEqual(len(geom.interiors), 1) - - # @unittest.skip("Skip until we find a better test or this also runs with Github Actions") - def test_query_metadata_stac_local(self): - with Source(datahub=Datahub.STAC_local, catalog=catalog_path) as src: - meta = src.query_metadata( - platform=Platform.Sentinel2, - date=("20200220", "20200222"), - aoi=aoi_3857, - cloud_cover=(90, 100), - ) - cat = src._init_catalog() - for item in meta: - cat.add_item(item) - item = cat.get_item("S2A_MSIL1C_20200221T102041_N0209_R065_T32UPC_20200221T110731") - self.assertEqual(item.properties.get("srcuuid"), "ae674e64-013d-4898-a6d7-096d7b02bdde") - cat.normalize_hrefs(Path(gettempdir()).as_posix()) - cat.validate_all() - - @unittest.skip("Does not work on Actions anymore") - @requests_mock.Mocker(real_http=True) - def test_query_metadata_scihub(self, m): - m.get( - "https://apihub.copernicus.eu/apihub/search?format=json&rows=100&start=0&q=beginPosition%3A%5B%222020-02-24T00%3A00%3A00Z%22+TO+%222020-02-25T00%3A00%3A00Z%22%5D+platformname%3A%22Sentinel-1%22+footprint%3A%22Intersects%28POLYGON+%28%2811.90274575621129+51.46641523383226%2C+11.90274575621129+51.50095226908388%2C+11.94774352810161+51.50095226908388%2C+11.94774352810161+51.46641523383226%2C+11.90274575621129+51.46641523383226%29%29%29%22", - content=b'{"feed":{"xmlns:opensearch":"http://a9.com/-/spec/opensearch/1.1/","xmlns":"http://www.w3.org/2005/Atom","title":"Sentinels Scientific Data Hub search results for: beginPosition:[\\"2020-02-24T00:00:00Z\\" TO \\"2020-02-25T00:00:00Z\\"] platformname:\\"Sentinel-1\\" footprint:\\"Intersects(POLYGON ((11.90274575621129 51.46641523383226, 11.90274575621129 51.50095226908388, 11.94774352810161 51.50095226908388, 11.94774352810161 51.46641523383226, 11.90274575621129 51.46641523383226)))\\"","subtitle":"Displaying 3 results. Request done in 0.003 seconds.","updated":"2021-06-23T14:20:50.811Z","author":{"name":"Sentinels Scientific Data Hub"},"id":"https://apihub.copernicus.eu/apihub/search?q=beginPosition:[\\"2020-02-24T00:00:00Z\\" TO \\"2020-02-25T00:00:00Z\\"] platformname:\\"Sentinel-1\\" footprint:\\"Intersects(POLYGON ((11.90274575621129 51.46641523383226, 11.90274575621129 51.50095226908388, 11.94774352810161 51.50095226908388, 11.94774352810161 51.46641523383226, 11.90274575621129 51.46641523383226)))\\"","opensearch:totalResults":"3","opensearch:startIndex":"0","opensearch:itemsPerPage":"100","opensearch:Query":{"role":"request","searchTerms":"beginPosition:[\\"2020-02-24T00:00:00Z\\" TO \\"2020-02-25T00:00:00Z\\"] platformname:\\"Sentinel-1\\" footprint:\\"Intersects(POLYGON ((11.90274575621129 51.46641523383226, 11.90274575621129 51.50095226908388, 11.94774352810161 51.50095226908388, 11.94774352810161 51.46641523383226, 11.90274575621129 51.46641523383226)))\\"","startPage":"1"},"link":[{"rel":"self","type":"application/json","href":"https://apihub.copernicus.eu/apihub/search?q=beginPosition:[\\"2020-02-24T00:00:00Z\\" TO \\"2020-02-25T00:00:00Z\\"] platformname:\\"Sentinel-1\\" footprint:\\"Intersects(POLYGON ((11.90274575621129 51.46641523383226, 11.90274575621129 51.50095226908388, 11.94774352810161 51.50095226908388, 11.94774352810161 51.46641523383226, 11.90274575621129 51.46641523383226)))\\"&start=0&rows=100&format=json"},{"rel":"first","type":"application/json","href":"https://apihub.copernicus.eu/apihub/search?q=beginPosition:[\\"2020-02-24T00:00:00Z\\" TO \\"2020-02-25T00:00:00Z\\"] platformname:\\"Sentinel-1\\" footprint:\\"Intersects(POLYGON ((11.90274575621129 51.46641523383226, 11.90274575621129 51.50095226908388, 11.94774352810161 51.50095226908388, 11.94774352810161 51.46641523383226, 11.90274575621129 51.46641523383226)))\\"&start=0&rows=100&format=json"},{"rel":"last","type":"application/json","href":"https://apihub.copernicus.eu/apihub/search?q=beginPosition:[\\"2020-02-24T00:00:00Z\\" TO \\"2020-02-25T00:00:00Z\\"] platformname:\\"Sentinel-1\\" footprint:\\"Intersects(POLYGON ((11.90274575621129 51.46641523383226, 11.90274575621129 51.50095226908388, 11.94774352810161 51.50095226908388, 11.94774352810161 51.46641523383226, 11.90274575621129 51.46641523383226)))\\"&start=2&rows=100&format=json"},{"rel":"search","type":"application/opensearchdescription+xml","href":"opensearch_description.xml"}],"entry":[{"title":"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6","link":[{"href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'8a611d5b-f9d9-437e-9f55-eca18cf79fd4\')/$value"},{"rel":"alternative","href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'8a611d5b-f9d9-437e-9f55-eca18cf79fd4\')/"},{"rel":"icon","href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'8a611d5b-f9d9-437e-9f55-eca18cf79fd4\')/Products(\'Quicklook\')/$value"}],"id":"8a611d5b-f9d9-437e-9f55-eca18cf79fd4","summary":"Date: 2020-02-24T05:25:28.861Z, Instrument: SAR-C SAR, Mode: VV VH, Satellite: Sentinel-1, Size: 7.65 GB","ondemand":"false","date":[{"name":"beginposition","content":"2020-02-24T05:25:28.861Z"},{"name":"endposition","content":"2020-02-24T05:25:55.96Z"},{"name":"ingestiondate","content":"2020-02-24T09:44:57.338Z"}],"int":[{"name":"missiondatatakeid","content":"236786"},{"name":"slicenumber","content":"16"},{"name":"orbitnumber","content":"31390"},{"name":"lastorbitnumber","content":"31390"},{"name":"relativeorbitnumber","content":"168"},{"name":"lastrelativeorbitnumber","content":"168"}],"str":[{"name":"sensoroperationalmode","content":"IW"},{"name":"swathidentifier","content":"IW1 IW2 IW3"},{"name":"orbitdirection","content":"DESCENDING"},{"name":"producttype","content":"SLC"},{"name":"timeliness","content":"Fast-24h"},{"name":"platformname","content":"Sentinel-1"},{"name":"platformidentifier","content":"2014-016A"},{"name":"instrumentname","content":"Synthetic Aperture Radar (C-band)"},{"name":"instrumentshortname","content":"SAR-C SAR"},{"name":"filename","content":"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6.SAFE"},{"name":"format","content":"SAFE"},{"name":"productclass","content":"S"},{"name":"polarisationmode","content":"VV VH"},{"name":"acquisitiontype","content":"NOMINAL"},{"name":"status","content":"ARCHIVED"},{"name":"size","content":"7.65 GB"},{"name":"gmlfootprint","content":"\\n \\n \\n 50.907326,13.664250 51.312340,10.003944 52.933346,10.404160 52.525398,14.201497 50.907326,13.664250\\n \\n \\n"},{"name":"footprint","content":"MULTIPOLYGON (((13.66425 50.907326, 14.201497 52.525398, 10.40416 52.933346, 10.003944 51.31234, 13.66425 50.907326)))"},{"name":"identifier","content":"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6"},{"name":"uuid","content":"8a611d5b-f9d9-437e-9f55-eca18cf79fd4"}]},{"title":"S1A_IW_GRDH_1SDV_20200224T052530_20200224T052555_031390_039CF2_EBED","link":[{"href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'8b78a444-e6a4-48bc-9aa8-6b6a00cfcd80\')/$value"},{"rel":"alternative","href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'8b78a444-e6a4-48bc-9aa8-6b6a00cfcd80\')/"},{"rel":"icon","href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'8b78a444-e6a4-48bc-9aa8-6b6a00cfcd80\')/Products(\'Quicklook\')/$value"}],"id":"8b78a444-e6a4-48bc-9aa8-6b6a00cfcd80","summary":"Date: 2020-02-24T05:25:30.023Z, Instrument: SAR-C SAR, Mode: VV VH, Satellite: Sentinel-1, Size: 1.64 GB","ondemand":"false","date":[{"name":"beginposition","content":"2020-02-24T05:25:30.023Z"},{"name":"endposition","content":"2020-02-24T05:25:55.021Z"},{"name":"ingestiondate","content":"2020-02-24T09:29:17.891Z"}],"int":[{"name":"missiondatatakeid","content":"236786"},{"name":"slicenumber","content":"16"},{"name":"orbitnumber","content":"31390"},{"name":"lastorbitnumber","content":"31390"},{"name":"relativeorbitnumber","content":"168"},{"name":"lastrelativeorbitnumber","content":"168"}],"str":[{"name":"sensoroperationalmode","content":"IW"},{"name":"swathidentifier","content":"IW"},{"name":"orbitdirection","content":"DESCENDING"},{"name":"producttype","content":"GRD"},{"name":"timeliness","content":"Fast-24h"},{"name":"platformname","content":"Sentinel-1"},{"name":"platformidentifier","content":"2014-016A"},{"name":"instrumentname","content":"Synthetic Aperture Radar (C-band)"},{"name":"instrumentshortname","content":"SAR-C SAR"},{"name":"filename","content":"S1A_IW_GRDH_1SDV_20200224T052530_20200224T052555_031390_039CF2_EBED.SAFE"},{"name":"format","content":"SAFE"},{"name":"productclass","content":"S"},{"name":"polarisationmode","content":"VV VH"},{"name":"acquisitiontype","content":"NOMINAL"},{"name":"status","content":"ARCHIVED"},{"name":"size","content":"1.64 GB"},{"name":"gmlfootprint","content":"\\n \\n \\n 50.963913,13.678375 51.374710,9.951296 52.869320,10.326388 52.455978,14.178555 50.963913,13.678375\\n \\n \\n"},{"name":"footprint","content":"MULTIPOLYGON (((13.678375 50.963913, 14.178555 52.455978, 10.326388 52.86932, 9.951296 51.37471, 13.678375 50.963913)))"},{"name":"identifier","content":"S1A_IW_GRDH_1SDV_20200224T052530_20200224T052555_031390_039CF2_EBED"},{"name":"uuid","content":"8b78a444-e6a4-48bc-9aa8-6b6a00cfcd80"}]},{"title":"S1A_IW_RAW__0SDV_20200224T052526_20200224T052558_031390_039CF2_16A0","link":[{"href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'82cde615-bd22-44bb-98ca-b3e5d2811d32\')/$value"},{"rel":"alternative","href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'82cde615-bd22-44bb-98ca-b3e5d2811d32\')/"},{"rel":"icon","href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'82cde615-bd22-44bb-98ca-b3e5d2811d32\')/Products(\'Quicklook\')/$value"}],"id":"82cde615-bd22-44bb-98ca-b3e5d2811d32","summary":"Date: 2020-02-24T05:25:26.325Z, Instrument: SAR-C SAR, Mode: VH VV, Satellite: Sentinel-1, Size: 1.52 GB","ondemand":"false","date":[{"name":"beginposition","content":"2020-02-24T05:25:26.325Z"},{"name":"endposition","content":"2020-02-24T05:25:58.724Z"},{"name":"ingestiondate","content":"2020-02-24T07:34:15.963Z"}],"int":[{"name":"missiondatatakeid","content":"236786"},{"name":"slicenumber","content":"16"},{"name":"orbitnumber","content":"31390"},{"name":"lastorbitnumber","content":"31390"},{"name":"relativeorbitnumber","content":"168"},{"name":"lastrelativeorbitnumber","content":"168"}],"str":[{"name":"sensoroperationalmode","content":"IW"},{"name":"orbitdirection","content":"DESCENDING"},{"name":"producttype","content":"RAW"},{"name":"platformname","content":"Sentinel-1"},{"name":"platformidentifier","content":"2014-016A"},{"name":"instrumentname","content":"Synthetic Aperture Radar (C-band)"},{"name":"instrumentshortname","content":"SAR-C SAR"},{"name":"filename","content":"S1A_IW_RAW__0SDV_20200224T052526_20200224T052558_031390_039CF2_16A0.SAFE"},{"name":"format","content":"SAFE"},{"name":"productclass","content":"S"},{"name":"polarisationmode","content":"VH VV"},{"name":"acquisitiontype","content":"NOMINAL"},{"name":"status","content":"ARCHIVED"},{"name":"size","content":"1.52 GB"},{"name":"gmlfootprint","content":"\\n \\n \\n 52.8520,10.6192 50.9032,10.1431 50.6090,13.6194 52.5508,14.2489 52.8520,10.6192 52.8520,10.6192\\n \\n \\n"},{"name":"footprint","content":"MULTIPOLYGON (((13.6194 50.609, 14.2489 52.5508, 10.6192 52.852, 10.1431 50.9032, 13.6194 50.609)))"},{"name":"identifier","content":"S1A_IW_RAW__0SDV_20200224T052526_20200224T052558_031390_039CF2_16A0"},{"name":"productconsolidation","content":"SLICE"},{"name":"uuid","content":"82cde615-bd22-44bb-98ca-b3e5d2811d32"}]}]}}', - ) - - with Source(datahub=Datahub.Scihub) as src: - meta = src.query_metadata( - platform=Platform.Sentinel1, - date=("20200224", "20200225"), - aoi=aoi_4326, - ) - cat = src._init_catalog() - for item in meta: - cat.add_item(item) - item = cat.get_item("S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6") - self.assertEqual(item.properties.get("srcuuid"), "8a611d5b-f9d9-437e-9f55-eca18cf79fd4") - cat.normalize_hrefs(Path(gettempdir()).as_posix()) - cat.validate_all() - - @requests_mock.Mocker(real_http=True) - def test_query_metadata_earth_explorer(self, m): - m.post( - "https://m2m.cr.usgs.gov/api/api/json/stable/login", - content=b'{"requestId": 241064318, "version": "stable", "data": "token", "errorCode": null, "errorMessage": null, "sessionId": 51372983}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/scene-search", - content=b'{"requestId": 241178020, "version": "stable", "sessionId": 51396676, "data": {"results": [{"browse":[{"id":"5e83d0b86f2c3061","browseRotationEnabled":null,"browseName":"LandsatLook Natural Color Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg"},{"id":"5e83d0b85da62c02","browseRotationEnabled":null,"browseName":"LandsatLook Thermal Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_tir","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg"},{"id":"5e83d0b8b814a0e6","browseRotationEnabled":null,"browseName":"LandsatLook Quality Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_qb","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg"}],"cloudCover":"12.47","entityId":"LC81930242020082LGN00","displayId":"LC08_L1TP_193024_20200322_20200326_01_T1","orderingId":null,"metadata":[{"id":"5e83d0b82af07b21","fieldName":"Landsat Product Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_product_id","value":"LC08_L1TP_193024_20200322_20200326_01_T1"},{"id":"5e83d0b88275745","fieldName":"Landsat Scene Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_scene_id","value":"LC81930242020082LGN00"},{"id":"5e83d0b92ff6b5e8","fieldName":"Acquisition Date","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"2020\\/03\\/22"},{"id":"5e83d0b9332fd122","fieldName":"Collection Category","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"T1"},{"id":"5e83d0b9948e2596","fieldName":"Collection Number","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":1},{"id":"5e83d0b922c5f981","fieldName":"WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b94328e34e","fieldName":"WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9a34ebe01","fieldName":"Target WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b8852f2e23","fieldName":"Target WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9173b715a","fieldName":"Nadir\\/Off Nadir","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"NADIR"},{"id":"5e83d0b820eaa311","fieldName":"Roll Angle","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#roll_angle","value":"-0.001"},{"id":"5e83d0b8379c9dae","fieldName":"Date L-1 Generated","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#date_l1_generated","value":"2020\\/03\\/26"},{"id":"5e83d0b9a78d1dbe","fieldName":"Start Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#start_time","value":"2020:082:10:02:29.1296010"},{"id":"5e83d0b887e40f8e","fieldName":"Stop Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#stop_time","value":"2020:082:10:03:00.8996000"},{"id":"5e83d0b926d7d304","fieldName":"Station Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#distribution_site","value":"LGN"},{"id":"5e83d0b91ad332e3","fieldName":"Day\\/Night Indicator","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#day_or_night","value":"DAY"},{"id":"5e83d0b864f5722e","fieldName":"Land Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover_land","value":"12.47"},{"id":"5e83d0b92e9d1b11","fieldName":"Scene Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover","value":"12.47"},{"id":"5e83d0b991213d01","fieldName":"Ground Control Points Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_model","value":253},{"id":"5e83d0b9e4a26b2a","fieldName":"Ground Control Points Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_version","value":4},{"id":"5e83d0b9bb19d4cc","fieldName":"Geometric RMSE Model (meters)","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model","value":"8.296"},{"id":"5e83d0b8f922f1d3","fieldName":"Geometric RMSE Model X","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_x","value":"5.809"},{"id":"5e83d0b93b83213d","fieldName":"Geometric RMSE Model Y","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_y","value":"5.924"},{"id":"5e83d0b9c9fa1556","fieldName":"Image Quality","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#image_quality_landsat_8","value":9},{"id":"5e83d0b8a926bb3e","fieldName":"Processing Software Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#processing_software_version","value":"LPGS_13.1.0"},{"id":"5e83d0b84092b361","fieldName":"Sun Elevation L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_elevation","value":"36.94009856"},{"id":"5e83d0b8bf763033","fieldName":"Sun Azimuth L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_azimuth","value":"156.99969272"},{"id":"5e83d0b97cb734c3","fieldName":"TIRS SSM Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#tirs_ssm_model","value":"FINAL"},{"id":"5e83d0b861614fa4","fieldName":"Data Type Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#data_type_l1","value":"OLI_TIRS_L1TP"},{"id":"5e83d0b993a4fa4a","fieldName":"Sensor Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sensor_id ","value":"OLI_TIRS"},{"id":"5e83d0b9de23d772","fieldName":"Panchromatic Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_lines","value":16301},{"id":"5e83d0b8100f0577","fieldName":"Panchromatic Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_samples","value":16101},{"id":"5e83d0b92bc96899","fieldName":"Reflective Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_lines","value":8151},{"id":"5e83d0b8bbb70baf","fieldName":"Reflective Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_samples","value":8051},{"id":"5e83d0b955642ca4","fieldName":"Thermal Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_lines","value":8151},{"id":"5e83d0b96b1a0d35","fieldName":"Thermal Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_samples","value":8051},{"id":"5e83d0b9104800de","fieldName":"Map Projection Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#map_projection_l1","value":"UTM"},{"id":"5e83d0b9fb0dce2d","fieldName":"UTM Zone","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#utm_zone","value":33},{"id":"5e83d0b8fd64f557","fieldName":"Datum","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#datum","value":"WGS84"},{"id":"5e83d0b84cc2632e","fieldName":"Ellipsoid","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ellipsoid","value":"WGS84"},{"id":"5e83d0b98f651440","fieldName":"Grid Cell Size Panchromatic","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_panchromatic","value":"15.00"},{"id":"5e83d0b9c6eaa87d","fieldName":"Grid Cell Size Reflective","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_reflective","value":"30.00"},{"id":"5e83d0b8c810ced","fieldName":"Grid Cell Size Thermal","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_thermal","value":"30.00"},{"id":"5e83d0b8a40bafa4","fieldName":"Bias Parameter File Name OLI","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_oli","value":"LO8BPF20200322095233_20200322113039.01"},{"id":"5e83d0b964a91d93","fieldName":"Bias Parameter File Name TIRS","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_tirs","value":"LT8BPF20200310060739_20200324104153.01"},{"id":"5e83d0b9b5d81214","fieldName":"Calibration Parameter File","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cpf_name","value":"LC08CPF_20200101_20200331_01.04"},{"id":"5e83d0b9c67b22a3","fieldName":"RLUT File Name","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#rlut_file_name","value":"LC08RLUT_20150303_20431231_01_12.h5"},{"id":"5e83d0b9a610a996","fieldName":"Center Latitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°41\'35.34\\"N"},{"id":"5e83d0b94fad23df","fieldName":"Center Longitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"12°48\'15.73\\"E"},{"id":"5e83d0b9c1d54551","fieldName":"UL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°45\'50.58\\"N"},{"id":"5e83d0b8d91068e","fieldName":"UL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°49\'23.52\\"E"},{"id":"5e83d0b94ff6f17e","fieldName":"UR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°17\'44.92\\"N"},{"id":"5e83d0b9a76119fe","fieldName":"UR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"14°32\'32.78\\"E"},{"id":"5e83d0b9f29120e3","fieldName":"LL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°03\'53.57\\"N"},{"id":"5e83d0b988d2162b","fieldName":"LL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°06\'35.75\\"E"},{"id":"5e83d0b96162233","fieldName":"LR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"50°36\'17.24\\"N"},{"id":"5e83d0b894a09772","fieldName":"LR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"13°43\'57.40\\"E"},{"id":"5e83d0b87f203a10","fieldName":"Center Latitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.69315"},{"id":"5e83d0b9b2a9a299","fieldName":"Center Longitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"12.80437"},{"id":"5e83d0b8bc51bf5b","fieldName":"UL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.76405"},{"id":"5e83d0b95071b3bf","fieldName":"UL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.82320"},{"id":"5e83d0b9842b0429","fieldName":"UR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.29581"},{"id":"5e83d0b931a16a9","fieldName":"UR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"14.54244"},{"id":"5e83d0b8abad8ec9","fieldName":"LL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.06488"},{"id":"5e83d0b92a9532e0","fieldName":"LL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.10993"},{"id":"5e83d0b834fea374","fieldName":"LR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"50.60479"},{"id":"5e83d0b9f619dbbe","fieldName":"LR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"13.73261"}],"hasCustomizedMetadata":null,"options":{"bulk":true,"download":true,"order":true,"secondary":false},"selected":{"bulk":false,"compare":false,"order":false},"spatialBounds":{"type":"Polygon","coordinates":[[[11.10993,50.60479],[11.10993,52.76405],[14.54244,52.76405],[14.54244,50.60479],[11.10993,50.60479]]]},"spatialCoverage":{"type":"Polygon","coordinates":[[[11.10993,51.06488],[13.73261,50.60479],[14.54244,52.29581],[11.8232,52.76405],[11.10993,51.06488]]]},"temporalCoverage":{"endDate":"2020-03-22 00:00:00","startDate":"2020-03-22 00:00:00"},"publishDate":"2020-03-22 09:56:49"}],"recordsReturned": 1,"totalHits": 1,"isCustomized": false,"numExcluded": 0,"startingNumber": 1,"nextRecord": 1}, "errorCode": null, "errorMessage": null}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/logout", - content=b'{"errorCode":null,"error":"","data":true,"api_version":"1.4.1","access_level":"user","catalog_id":"EE","executionTime":0.4}', - ) - - with Source(datahub=Datahub.EarthExplorer) as src: - meta = src.query_metadata( - platform=Platform.Landsat8, - date=("20200310", "20200325"), - aoi=aoi_bbox, - cloud_cover=(0, 20), - ) - cat = src._init_catalog() - for item in meta: - cat.add_item(item) - item = cat.get_item("LC08_L1TP_193024_20200322_20200326_01_T1") - self.assertEqual(item.properties.get("srcuuid"), "LC81930242020082LGN00") - cat.normalize_hrefs(Path(gettempdir()).as_posix()) - cat.validate_all() - - @unittest.skip("Does not work on Actions anymore") - @requests_mock.Mocker(real_http=True) - def test_query_metadata_srcid_scihub(self, m): - m.get( - "https://apihub.copernicus.eu/apihub/search?format=json&rows=100&start=0&q=identifier%3A%22S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6%22", - content=b'{"feed":{"xmlns:opensearch":"http://a9.com/-/spec/opensearch/1.1/","xmlns":"http://www.w3.org/2005/Atom","title":"Sentinels Scientific Data Hub search results for: identifier:\\"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6\\"","subtitle":"Displaying 1 results. Request done in 0.038 seconds.","updated":"2021-06-23T14:14:46.076Z","author":{"name":"Sentinels Scientific Data Hub"},"id":"https://apihub.copernicus.eu/apihub/search?q=identifier:\\"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6\\"","opensearch:totalResults":"1","opensearch:startIndex":"0","opensearch:itemsPerPage":"100","opensearch:Query":{"role":"request","searchTerms":"identifier:\\"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6\\"","startPage":"1"},"link":[{"rel":"self","type":"application/json","href":"https://apihub.copernicus.eu/apihub/search?q=identifier:\\"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6\\"&start=0&rows=100&format=json"},{"rel":"first","type":"application/json","href":"https://apihub.copernicus.eu/apihub/search?q=identifier:\\"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6\\"&start=0&rows=100&format=json"},{"rel":"last","type":"application/json","href":"https://apihub.copernicus.eu/apihub/search?q=identifier:\\"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6\\"&start=0&rows=100&format=json"},{"rel":"search","type":"application/opensearchdescription+xml","href":"opensearch_description.xml"}],"entry":{"title":"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6","link":[{"href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'8a611d5b-f9d9-437e-9f55-eca18cf79fd4\')/$value"},{"rel":"alternative","href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'8a611d5b-f9d9-437e-9f55-eca18cf79fd4\')/"},{"rel":"icon","href":"https://apihub.copernicus.eu/apihub/odata/v1/Products(\'8a611d5b-f9d9-437e-9f55-eca18cf79fd4\')/Products(\'Quicklook\')/$value"}],"id":"8a611d5b-f9d9-437e-9f55-eca18cf79fd4","summary":"Date: 2020-02-24T05:25:28.861Z, Instrument: SAR-C SAR, Mode: VV VH, Satellite: Sentinel-1, Size: 7.65 GB","ondemand":"false","date":[{"name":"beginposition","content":"2020-02-24T05:25:28.861Z"},{"name":"endposition","content":"2020-02-24T05:25:55.96Z"},{"name":"ingestiondate","content":"2020-02-24T09:44:57.338Z"}],"int":[{"name":"missiondatatakeid","content":"236786"},{"name":"slicenumber","content":"16"},{"name":"orbitnumber","content":"31390"},{"name":"lastorbitnumber","content":"31390"},{"name":"relativeorbitnumber","content":"168"},{"name":"lastrelativeorbitnumber","content":"168"}],"str":[{"name":"sensoroperationalmode","content":"IW"},{"name":"swathidentifier","content":"IW1 IW2 IW3"},{"name":"orbitdirection","content":"DESCENDING"},{"name":"producttype","content":"SLC"},{"name":"timeliness","content":"Fast-24h"},{"name":"platformname","content":"Sentinel-1"},{"name":"platformidentifier","content":"2014-016A"},{"name":"instrumentname","content":"Synthetic Aperture Radar (C-band)"},{"name":"instrumentshortname","content":"SAR-C SAR"},{"name":"filename","content":"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6.SAFE"},{"name":"format","content":"SAFE"},{"name":"productclass","content":"S"},{"name":"polarisationmode","content":"VV VH"},{"name":"acquisitiontype","content":"NOMINAL"},{"name":"status","content":"ARCHIVED"},{"name":"size","content":"7.65 GB"},{"name":"gmlfootprint","content":"\\n \\n \\n 50.907326,13.664250 51.312340,10.003944 52.933346,10.404160 52.525398,14.201497 50.907326,13.664250\\n \\n \\n"},{"name":"footprint","content":"MULTIPOLYGON (((13.66425 50.907326, 14.201497 52.525398, 10.40416 52.933346, 10.003944 51.31234, 13.66425 50.907326)))"},{"name":"identifier","content":"S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6"},{"name":"uuid","content":"8a611d5b-f9d9-437e-9f55-eca18cf79fd4"}]}}}', - ) - with Source(datahub=Datahub.Scihub) as src: - meta = src.query_metadata_srcid( - platform=Platform.Sentinel1, - srcid="S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6", - ) - cat = src._init_catalog() - for item in meta: - cat.add_item(item) - item = cat.get_item("S1A_IW_SLC__1SDV_20200224T052528_20200224T052555_031390_039CF2_BEA6") - self.assertEqual(item.properties.get("srcuuid"), "8a611d5b-f9d9-437e-9f55-eca18cf79fd4") - cat.normalize_hrefs(Path(gettempdir()).as_posix()) - item.validate() - - @requests_mock.Mocker(real_http=True) - def test_query_metadata_srcid_earth_explorer(self, m): - m.post( - "https://m2m.cr.usgs.gov/api/api/json/stable/login", - content=b'{"requestId": 241064318, "version": "stable", "data": "token", "errorCode": null, "errorMessage": null, "sessionId": 51372983}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/scene-list-add", - content=b'{"requestId": 241159456, "version": "stable", "sessionId": 51393323, "data": {"browse":[{"id":"5e83d0b86f2c3061","browseRotationEnabled":false,"browseName":"LandsatLook Natural Color Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg"},{"id":"5e83d0b85da62c02","browseRotationEnabled":false,"browseName":"LandsatLook Thermal Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_tir","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg"},{"id":"5e83d0b8b814a0e6","browseRotationEnabled":false,"browseName":"LandsatLook Quality Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_qb","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg"}],"cloudCover":"12.47","entityId":"LC81930242020082LGN00","displayId":"LC08_L1TP_193024_20200322_20200326_01_T1","orderingId":"LC81930242020082LGN00","metadata":[{"id":"5e83d0b82af07b21","fieldName":"Landsat Product Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_product_id","value":"LC08_L1TP_193024_20200322_20200326_01_T1"},{"id":"5e83d0b88275745","fieldName":"Landsat Scene Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_scene_id","value":"LC81930242020082LGN00"},{"id":"5e83d0b92ff6b5e8","fieldName":"Acquisition Date","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"2020\\/03\\/22"},{"id":"5e83d0b9332fd122","fieldName":"Collection Category","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"T1"},{"id":"5e83d0b9948e2596","fieldName":"Collection Number","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":1},{"id":"5e83d0b922c5f981","fieldName":"WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b94328e34e","fieldName":"WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9a34ebe01","fieldName":"Target WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b8852f2e23","fieldName":"Target WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9173b715a","fieldName":"Nadir\\/Off Nadir","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"NADIR"},{"id":"5e83d0b820eaa311","fieldName":"Roll Angle","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#roll_angle","value":"-0.001"},{"id":"5e83d0b8379c9dae","fieldName":"Date L-1 Generated","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#date_l1_generated","value":"2020\\/03\\/26"},{"id":"5e83d0b9a78d1dbe","fieldName":"Start Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#start_time","value":"2020:082:10:02:29.1296010"},{"id":"5e83d0b887e40f8e","fieldName":"Stop Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#stop_time","value":"2020:082:10:03:00.8996000"},{"id":"5e83d0b926d7d304","fieldName":"Station Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#distribution_site","value":"LGN"},{"id":"5e83d0b91ad332e3","fieldName":"Day\\/Night Indicator","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#day_or_night","value":"DAY"},{"id":"5e83d0b864f5722e","fieldName":"Land Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover_land","value":"12.47"},{"id":"5e83d0b92e9d1b11","fieldName":"Scene Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover","value":"12.47"},{"id":"5e83d0b991213d01","fieldName":"Ground Control Points Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_model","value":253},{"id":"5e83d0b9e4a26b2a","fieldName":"Ground Control Points Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_version","value":4},{"id":"5e83d0b9bb19d4cc","fieldName":"Geometric RMSE Model (meters)","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model","value":"8.296"},{"id":"5e83d0b8f922f1d3","fieldName":"Geometric RMSE Model X","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_x","value":"5.809"},{"id":"5e83d0b93b83213d","fieldName":"Geometric RMSE Model Y","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_y","value":"5.924"},{"id":"5e83d0b9c9fa1556","fieldName":"Image Quality","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#image_quality_landsat_8","value":9},{"id":"5e83d0b8a926bb3e","fieldName":"Processing Software Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#processing_software_version","value":"LPGS_13.1.0"},{"id":"5e83d0b84092b361","fieldName":"Sun Elevation L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_elevation","value":"36.94009856"},{"id":"5e83d0b8bf763033","fieldName":"Sun Azimuth L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_azimuth","value":"156.99969272"},{"id":"5e83d0b97cb734c3","fieldName":"TIRS SSM Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#tirs_ssm_model","value":"FINAL"},{"id":"5e83d0b861614fa4","fieldName":"Data Type Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#data_type_l1","value":"OLI_TIRS_L1TP"},{"id":"5e83d0b993a4fa4a","fieldName":"Sensor Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sensor_id ","value":"OLI_TIRS"},{"id":"5e83d0b9de23d772","fieldName":"Panchromatic Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_lines","value":16301},{"id":"5e83d0b8100f0577","fieldName":"Panchromatic Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_samples","value":16101},{"id":"5e83d0b92bc96899","fieldName":"Reflective Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_lines","value":8151},{"id":"5e83d0b8bbb70baf","fieldName":"Reflective Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_samples","value":8051},{"id":"5e83d0b955642ca4","fieldName":"Thermal Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_lines","value":8151},{"id":"5e83d0b96b1a0d35","fieldName":"Thermal Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_samples","value":8051},{"id":"5e83d0b9104800de","fieldName":"Map Projection Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#map_projection_l1","value":"UTM"},{"id":"5e83d0b9fb0dce2d","fieldName":"UTM Zone","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#utm_zone","value":33},{"id":"5e83d0b8fd64f557","fieldName":"Datum","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#datum","value":"WGS84"},{"id":"5e83d0b84cc2632e","fieldName":"Ellipsoid","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ellipsoid","value":"WGS84"},{"id":"5e83d0b98f651440","fieldName":"Grid Cell Size Panchromatic","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_panchromatic","value":"15.00"},{"id":"5e83d0b9c6eaa87d","fieldName":"Grid Cell Size Reflective","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_reflective","value":"30.00"},{"id":"5e83d0b8c810ced","fieldName":"Grid Cell Size Thermal","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_thermal","value":"30.00"},{"id":"5e83d0b8a40bafa4","fieldName":"Bias Parameter File Name OLI","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_oli","value":"LO8BPF20200322095233_20200322113039.01"},{"id":"5e83d0b964a91d93","fieldName":"Bias Parameter File Name TIRS","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_tirs","value":"LT8BPF20200310060739_20200324104153.01"},{"id":"5e83d0b9b5d81214","fieldName":"Calibration Parameter File","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cpf_name","value":"LC08CPF_20200101_20200331_01.04"},{"id":"5e83d0b9c67b22a3","fieldName":"RLUT File Name","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#rlut_file_name","value":"LC08RLUT_20150303_20431231_01_12.h5"},{"id":"5e83d0b9a610a996","fieldName":"Center Latitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°41\'35.34\\"N"},{"id":"5e83d0b94fad23df","fieldName":"Center Longitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"12°48\'15.73\\"E"},{"id":"5e83d0b9c1d54551","fieldName":"UL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°45\'50.58\\"N"},{"id":"5e83d0b8d91068e","fieldName":"UL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°49\'23.52\\"E"},{"id":"5e83d0b94ff6f17e","fieldName":"UR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°17\'44.92\\"N"},{"id":"5e83d0b9a76119fe","fieldName":"UR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"14°32\'32.78\\"E"},{"id":"5e83d0b9f29120e3","fieldName":"LL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°03\'53.57\\"N"},{"id":"5e83d0b988d2162b","fieldName":"LL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°06\'35.75\\"E"},{"id":"5e83d0b96162233","fieldName":"LR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"50°36\'17.24\\"N"},{"id":"5e83d0b894a09772","fieldName":"LR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"13°43\'57.40\\"E"},{"id":"5e83d0b87f203a10","fieldName":"Center Latitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.69315"},{"id":"5e83d0b9b2a9a299","fieldName":"Center Longitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"12.80437"},{"id":"5e83d0b8bc51bf5b","fieldName":"UL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.76405"},{"id":"5e83d0b95071b3bf","fieldName":"UL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.82320"},{"id":"5e83d0b9842b0429","fieldName":"UR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.29581"},{"id":"5e83d0b931a16a9","fieldName":"UR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"14.54244"},{"id":"5e83d0b8abad8ec9","fieldName":"LL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.06488"},{"id":"5e83d0b92a9532e0","fieldName":"LL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.10993"},{"id":"5e83d0b834fea374","fieldName":"LR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"50.60479"},{"id":"5e83d0b9f619dbbe","fieldName":"LR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"13.73261"}],"hasCustomizedMetadata":false,"options":{"bulk":true,"download":true,"order":true,"secondary":false},"selected":null,"spatialBounds":{"type":"Polygon","coordinates":[[[11.10993,50.60479],[11.10993,52.76405],[14.54244,52.76405],[14.54244,50.60479],[11.10993,50.60479]]]},"spatialCoverage":{"type":"Polygon","coordinates":[[[11.10993,51.06488],[13.73261,50.60479],[14.54244,52.29581],[11.8232,52.76405],[11.10993,51.06488]]]},"temporalCoverage":{"endDate":"2020-03-22 00:00:00","startDate":"2020-03-22 00:00:00"},"publishDate":"2020-03-22T09:56:49"}, "errorCode": null, "errorMessage": null}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/scene-list-get", - content=b'{"requestId": 241160510, "version": "stable", "sessionId": 51393558, "data": [{"entityId":"LC81930242020082LGN00","datasetName":"landsat_8_c1"}], "errorCode": null, "errorMessage": null}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/scene-list-remove", - content=b'{"requestId": 241161482, "version": "stable", "sessionId": 51393761, "data": null, "errorCode": null, "errorMessage": null}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/scene-metadata", - content=b'{"requestId": 241162488, "version": "stable", "sessionId": 51393950, "data": {"browse":[{"id":"5e83d0b86f2c3061","browseRotationEnabled":false,"browseName":"LandsatLook Natural Color Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg"},{"id":"5e83d0b85da62c02","browseRotationEnabled":false,"browseName":"LandsatLook Thermal Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_tir","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg"},{"id":"5e83d0b8b814a0e6","browseRotationEnabled":false,"browseName":"LandsatLook Quality Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_qb","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg"}],"cloudCover":"12.47","entityId":"LC81930242020082LGN00","displayId":"LC08_L1TP_193024_20200322_20200326_01_T1","orderingId":"LC81930242020082LGN00","metadata":[{"id":"5e83d0b82af07b21","fieldName":"Landsat Product Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_product_id","value":"LC08_L1TP_193024_20200322_20200326_01_T1"},{"id":"5e83d0b88275745","fieldName":"Landsat Scene Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_scene_id","value":"LC81930242020082LGN00"},{"id":"5e83d0b92ff6b5e8","fieldName":"Acquisition Date","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"2020\\/03\\/22"},{"id":"5e83d0b9332fd122","fieldName":"Collection Category","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"T1"},{"id":"5e83d0b9948e2596","fieldName":"Collection Number","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":1},{"id":"5e83d0b922c5f981","fieldName":"WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b94328e34e","fieldName":"WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9a34ebe01","fieldName":"Target WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b8852f2e23","fieldName":"Target WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9173b715a","fieldName":"Nadir\\/Off Nadir","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"NADIR"},{"id":"5e83d0b820eaa311","fieldName":"Roll Angle","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#roll_angle","value":"-0.001"},{"id":"5e83d0b8379c9dae","fieldName":"Date L-1 Generated","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#date_l1_generated","value":"2020\\/03\\/26"},{"id":"5e83d0b9a78d1dbe","fieldName":"Start Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#start_time","value":"2020:082:10:02:29.1296010"},{"id":"5e83d0b887e40f8e","fieldName":"Stop Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#stop_time","value":"2020:082:10:03:00.8996000"},{"id":"5e83d0b926d7d304","fieldName":"Station Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#distribution_site","value":"LGN"},{"id":"5e83d0b91ad332e3","fieldName":"Day\\/Night Indicator","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#day_or_night","value":"DAY"},{"id":"5e83d0b864f5722e","fieldName":"Land Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover_land","value":"12.47"},{"id":"5e83d0b92e9d1b11","fieldName":"Scene Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover","value":"12.47"},{"id":"5e83d0b991213d01","fieldName":"Ground Control Points Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_model","value":253},{"id":"5e83d0b9e4a26b2a","fieldName":"Ground Control Points Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_version","value":4},{"id":"5e83d0b9bb19d4cc","fieldName":"Geometric RMSE Model (meters)","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model","value":"8.296"},{"id":"5e83d0b8f922f1d3","fieldName":"Geometric RMSE Model X","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_x","value":"5.809"},{"id":"5e83d0b93b83213d","fieldName":"Geometric RMSE Model Y","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_y","value":"5.924"},{"id":"5e83d0b9c9fa1556","fieldName":"Image Quality","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#image_quality_landsat_8","value":9},{"id":"5e83d0b8a926bb3e","fieldName":"Processing Software Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#processing_software_version","value":"LPGS_13.1.0"},{"id":"5e83d0b84092b361","fieldName":"Sun Elevation L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_elevation","value":"36.94009856"},{"id":"5e83d0b8bf763033","fieldName":"Sun Azimuth L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_azimuth","value":"156.99969272"},{"id":"5e83d0b97cb734c3","fieldName":"TIRS SSM Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#tirs_ssm_model","value":"FINAL"},{"id":"5e83d0b861614fa4","fieldName":"Data Type Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#data_type_l1","value":"OLI_TIRS_L1TP"},{"id":"5e83d0b993a4fa4a","fieldName":"Sensor Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sensor_id ","value":"OLI_TIRS"},{"id":"5e83d0b9de23d772","fieldName":"Panchromatic Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_lines","value":16301},{"id":"5e83d0b8100f0577","fieldName":"Panchromatic Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_samples","value":16101},{"id":"5e83d0b92bc96899","fieldName":"Reflective Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_lines","value":8151},{"id":"5e83d0b8bbb70baf","fieldName":"Reflective Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_samples","value":8051},{"id":"5e83d0b955642ca4","fieldName":"Thermal Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_lines","value":8151},{"id":"5e83d0b96b1a0d35","fieldName":"Thermal Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_samples","value":8051},{"id":"5e83d0b9104800de","fieldName":"Map Projection Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#map_projection_l1","value":"UTM"},{"id":"5e83d0b9fb0dce2d","fieldName":"UTM Zone","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#utm_zone","value":33},{"id":"5e83d0b8fd64f557","fieldName":"Datum","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#datum","value":"WGS84"},{"id":"5e83d0b84cc2632e","fieldName":"Ellipsoid","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ellipsoid","value":"WGS84"},{"id":"5e83d0b98f651440","fieldName":"Grid Cell Size Panchromatic","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_panchromatic","value":"15.00"},{"id":"5e83d0b9c6eaa87d","fieldName":"Grid Cell Size Reflective","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_reflective","value":"30.00"},{"id":"5e83d0b8c810ced","fieldName":"Grid Cell Size Thermal","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_thermal","value":"30.00"},{"id":"5e83d0b8a40bafa4","fieldName":"Bias Parameter File Name OLI","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_oli","value":"LO8BPF20200322095233_20200322113039.01"},{"id":"5e83d0b964a91d93","fieldName":"Bias Parameter File Name TIRS","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_tirs","value":"LT8BPF20200310060739_20200324104153.01"},{"id":"5e83d0b9b5d81214","fieldName":"Calibration Parameter File","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cpf_name","value":"LC08CPF_20200101_20200331_01.04"},{"id":"5e83d0b9c67b22a3","fieldName":"RLUT File Name","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#rlut_file_name","value":"LC08RLUT_20150303_20431231_01_12.h5"},{"id":"5e83d0b9a610a996","fieldName":"Center Latitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°41\'35.34\\"N"},{"id":"5e83d0b94fad23df","fieldName":"Center Longitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"12°48\'15.73\\"E"},{"id":"5e83d0b9c1d54551","fieldName":"UL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°45\'50.58\\"N"},{"id":"5e83d0b8d91068e","fieldName":"UL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°49\'23.52\\"E"},{"id":"5e83d0b94ff6f17e","fieldName":"UR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°17\'44.92\\"N"},{"id":"5e83d0b9a76119fe","fieldName":"UR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"14°32\'32.78\\"E"},{"id":"5e83d0b9f29120e3","fieldName":"LL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°03\'53.57\\"N"},{"id":"5e83d0b988d2162b","fieldName":"LL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°06\'35.75\\"E"},{"id":"5e83d0b96162233","fieldName":"LR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"50°36\'17.24\\"N"},{"id":"5e83d0b894a09772","fieldName":"LR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"13°43\'57.40\\"E"},{"id":"5e83d0b87f203a10","fieldName":"Center Latitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.69315"},{"id":"5e83d0b9b2a9a299","fieldName":"Center Longitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"12.80437"},{"id":"5e83d0b8bc51bf5b","fieldName":"UL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.76405"},{"id":"5e83d0b95071b3bf","fieldName":"UL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.82320"},{"id":"5e83d0b9842b0429","fieldName":"UR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.29581"},{"id":"5e83d0b931a16a9","fieldName":"UR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"14.54244"},{"id":"5e83d0b8abad8ec9","fieldName":"LL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.06488"},{"id":"5e83d0b92a9532e0","fieldName":"LL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.10993"},{"id":"5e83d0b834fea374","fieldName":"LR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"50.60479"},{"id":"5e83d0b9f619dbbe","fieldName":"LR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"13.73261"}],"hasCustomizedMetadata":false,"options":{"bulk":true,"download":true,"order":true,"secondary":false},"selected":null,"spatialBounds":{"type":"Polygon","coordinates":[[[11.10993,50.60479],[11.10993,52.76405],[14.54244,52.76405],[14.54244,50.60479],[11.10993,50.60479]]]},"spatialCoverage":{"type":"Polygon","coordinates":[[[11.10993,51.06488],[13.73261,50.60479],[14.54244,52.29581],[11.8232,52.76405],[11.10993,51.06488]]]},"temporalCoverage":{"endDate":"2020-03-22 00:00:00","startDate":"2020-03-22 00:00:00"},"publishDate":"2020-03-22T09:56:49"}, "errorCode": null, "errorMessage": null}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/logout", - content=b'{"errorCode":null,"error":"","data":true,"api_version":"1.4.1","access_level":"user","catalog_id":"EE","executionTime":0.4}', - ) - - with Source(datahub=Datahub.EarthExplorer) as src: - meta = src.query_metadata_srcid( - platform=Platform.Landsat8, - srcid="LC08_L1TP_193024_20200322_20200326_01_T1", - ) - cat = src._init_catalog() - for item in meta: - cat.add_item(item) - - item = cat.get_item("LC08_L1TP_193024_20200322_20200326_01_T1") - self.assertEqual(item.properties.get("srcuuid"), "LC81930242020082LGN00") - cat.normalize_hrefs(Path(gettempdir()).as_posix()) - item.validate() - - def test_meta_from_pid(self): - meta = meta_from_pid("LC08_L1TP_193024_20200322_20200326_01_T1") - self.assertEqual(meta.get("product_id"), "LC08_L1TP_193024_20200322_20200326_01_T1") - self.assertEqual(meta.get("sensor"), "LC08") - self.assertEqual(meta.get("correction"), "L1TP") - self.assertEqual(meta.get("path"), 193) - self.assertEqual(meta.get("row"), 24) - self.assertEqual(meta.get("acquisition_date"), datetime(2020, 3, 22)) - self.assertEqual(meta.get("processing_date"), datetime(2020, 3, 26)) - self.assertEqual(meta.get("collection"), 1) - self.assertEqual(meta.get("tier"), "T1") - - def test_compute_md5(self): - sample = resource_filename(__name__, "test.txt") - self.assertEqual(compute_md5(sample), "4f3b92c1a86ad81d6f7e49a5e2e13ffa") - - def test_product_available(self): - product = Product("LC08_L1GT_001002_20160817_20170322_01_T2") - available_bands = product.available - required_bands = bands.LC08 - self.assertListEqual(available_bands, required_bands, "All bands required are available") - - def test_url(self): - product = Product("LC08_L1GT_001002_20160817_20170322_01_T2") - self.assertEqual( - "https://storage.googleapis.com/gcp-public-data-landsat/LC08/01/001/002/LC08_L1GT_001002_20160817_20170322_01_T2/LC08_L1GT_001002_20160817_20170322_01_T2_B1.tif", - product._url("B1.tif"), - ) - - @requests_mock.Mocker(real_http=True) - def test_get_srcid_from_product_uuid_ee(self, m): - m.post( - "https://m2m.cr.usgs.gov/api/api/json/stable/login", - content=b'{"requestId": 241064318, "version": "stable", "data": "token", "errorCode": null, "errorMessage": null, "sessionId": 51372983}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/scene-list-add", - content=b'{"requestId": 241159456, "version": "stable", "sessionId": 51393323, "data": {"browse":[{"id":"5e83d0b86f2c3061","browseRotationEnabled":false,"browseName":"LandsatLook Natural Color Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg"},{"id":"5e83d0b85da62c02","browseRotationEnabled":false,"browseName":"LandsatLook Thermal Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_tir","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg"},{"id":"5e83d0b8b814a0e6","browseRotationEnabled":false,"browseName":"LandsatLook Quality Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_qb","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg"}],"cloudCover":"12.47","entityId":"LC81930242020082LGN00","displayId":"LC08_L1TP_193024_20200322_20200326_01_T1","orderingId":"LC81930242020082LGN00","metadata":[{"id":"5e83d0b82af07b21","fieldName":"Landsat Product Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_product_id","value":"LC08_L1TP_193024_20200322_20200326_01_T1"},{"id":"5e83d0b88275745","fieldName":"Landsat Scene Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_scene_id","value":"LC81930242020082LGN00"},{"id":"5e83d0b92ff6b5e8","fieldName":"Acquisition Date","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"2020\\/03\\/22"},{"id":"5e83d0b9332fd122","fieldName":"Collection Category","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"T1"},{"id":"5e83d0b9948e2596","fieldName":"Collection Number","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":1},{"id":"5e83d0b922c5f981","fieldName":"WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b94328e34e","fieldName":"WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9a34ebe01","fieldName":"Target WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b8852f2e23","fieldName":"Target WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9173b715a","fieldName":"Nadir\\/Off Nadir","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"NADIR"},{"id":"5e83d0b820eaa311","fieldName":"Roll Angle","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#roll_angle","value":"-0.001"},{"id":"5e83d0b8379c9dae","fieldName":"Date L-1 Generated","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#date_l1_generated","value":"2020\\/03\\/26"},{"id":"5e83d0b9a78d1dbe","fieldName":"Start Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#start_time","value":"2020:082:10:02:29.1296010"},{"id":"5e83d0b887e40f8e","fieldName":"Stop Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#stop_time","value":"2020:082:10:03:00.8996000"},{"id":"5e83d0b926d7d304","fieldName":"Station Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#distribution_site","value":"LGN"},{"id":"5e83d0b91ad332e3","fieldName":"Day\\/Night Indicator","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#day_or_night","value":"DAY"},{"id":"5e83d0b864f5722e","fieldName":"Land Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover_land","value":"12.47"},{"id":"5e83d0b92e9d1b11","fieldName":"Scene Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover","value":"12.47"},{"id":"5e83d0b991213d01","fieldName":"Ground Control Points Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_model","value":253},{"id":"5e83d0b9e4a26b2a","fieldName":"Ground Control Points Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_version","value":4},{"id":"5e83d0b9bb19d4cc","fieldName":"Geometric RMSE Model (meters)","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model","value":"8.296"},{"id":"5e83d0b8f922f1d3","fieldName":"Geometric RMSE Model X","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_x","value":"5.809"},{"id":"5e83d0b93b83213d","fieldName":"Geometric RMSE Model Y","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_y","value":"5.924"},{"id":"5e83d0b9c9fa1556","fieldName":"Image Quality","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#image_quality_landsat_8","value":9},{"id":"5e83d0b8a926bb3e","fieldName":"Processing Software Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#processing_software_version","value":"LPGS_13.1.0"},{"id":"5e83d0b84092b361","fieldName":"Sun Elevation L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_elevation","value":"36.94009856"},{"id":"5e83d0b8bf763033","fieldName":"Sun Azimuth L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_azimuth","value":"156.99969272"},{"id":"5e83d0b97cb734c3","fieldName":"TIRS SSM Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#tirs_ssm_model","value":"FINAL"},{"id":"5e83d0b861614fa4","fieldName":"Data Type Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#data_type_l1","value":"OLI_TIRS_L1TP"},{"id":"5e83d0b993a4fa4a","fieldName":"Sensor Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sensor_id ","value":"OLI_TIRS"},{"id":"5e83d0b9de23d772","fieldName":"Panchromatic Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_lines","value":16301},{"id":"5e83d0b8100f0577","fieldName":"Panchromatic Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_samples","value":16101},{"id":"5e83d0b92bc96899","fieldName":"Reflective Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_lines","value":8151},{"id":"5e83d0b8bbb70baf","fieldName":"Reflective Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_samples","value":8051},{"id":"5e83d0b955642ca4","fieldName":"Thermal Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_lines","value":8151},{"id":"5e83d0b96b1a0d35","fieldName":"Thermal Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_samples","value":8051},{"id":"5e83d0b9104800de","fieldName":"Map Projection Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#map_projection_l1","value":"UTM"},{"id":"5e83d0b9fb0dce2d","fieldName":"UTM Zone","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#utm_zone","value":33},{"id":"5e83d0b8fd64f557","fieldName":"Datum","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#datum","value":"WGS84"},{"id":"5e83d0b84cc2632e","fieldName":"Ellipsoid","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ellipsoid","value":"WGS84"},{"id":"5e83d0b98f651440","fieldName":"Grid Cell Size Panchromatic","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_panchromatic","value":"15.00"},{"id":"5e83d0b9c6eaa87d","fieldName":"Grid Cell Size Reflective","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_reflective","value":"30.00"},{"id":"5e83d0b8c810ced","fieldName":"Grid Cell Size Thermal","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_thermal","value":"30.00"},{"id":"5e83d0b8a40bafa4","fieldName":"Bias Parameter File Name OLI","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_oli","value":"LO8BPF20200322095233_20200322113039.01"},{"id":"5e83d0b964a91d93","fieldName":"Bias Parameter File Name TIRS","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_tirs","value":"LT8BPF20200310060739_20200324104153.01"},{"id":"5e83d0b9b5d81214","fieldName":"Calibration Parameter File","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cpf_name","value":"LC08CPF_20200101_20200331_01.04"},{"id":"5e83d0b9c67b22a3","fieldName":"RLUT File Name","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#rlut_file_name","value":"LC08RLUT_20150303_20431231_01_12.h5"},{"id":"5e83d0b9a610a996","fieldName":"Center Latitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°41\'35.34\\"N"},{"id":"5e83d0b94fad23df","fieldName":"Center Longitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"12°48\'15.73\\"E"},{"id":"5e83d0b9c1d54551","fieldName":"UL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°45\'50.58\\"N"},{"id":"5e83d0b8d91068e","fieldName":"UL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°49\'23.52\\"E"},{"id":"5e83d0b94ff6f17e","fieldName":"UR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°17\'44.92\\"N"},{"id":"5e83d0b9a76119fe","fieldName":"UR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"14°32\'32.78\\"E"},{"id":"5e83d0b9f29120e3","fieldName":"LL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°03\'53.57\\"N"},{"id":"5e83d0b988d2162b","fieldName":"LL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°06\'35.75\\"E"},{"id":"5e83d0b96162233","fieldName":"LR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"50°36\'17.24\\"N"},{"id":"5e83d0b894a09772","fieldName":"LR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"13°43\'57.40\\"E"},{"id":"5e83d0b87f203a10","fieldName":"Center Latitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.69315"},{"id":"5e83d0b9b2a9a299","fieldName":"Center Longitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"12.80437"},{"id":"5e83d0b8bc51bf5b","fieldName":"UL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.76405"},{"id":"5e83d0b95071b3bf","fieldName":"UL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.82320"},{"id":"5e83d0b9842b0429","fieldName":"UR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.29581"},{"id":"5e83d0b931a16a9","fieldName":"UR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"14.54244"},{"id":"5e83d0b8abad8ec9","fieldName":"LL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.06488"},{"id":"5e83d0b92a9532e0","fieldName":"LL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.10993"},{"id":"5e83d0b834fea374","fieldName":"LR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"50.60479"},{"id":"5e83d0b9f619dbbe","fieldName":"LR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"13.73261"}],"hasCustomizedMetadata":false,"options":{"bulk":true,"download":true,"order":true,"secondary":false},"selected":null,"spatialBounds":{"type":"Polygon","coordinates":[[[11.10993,50.60479],[11.10993,52.76405],[14.54244,52.76405],[14.54244,50.60479],[11.10993,50.60479]]]},"spatialCoverage":{"type":"Polygon","coordinates":[[[11.10993,51.06488],[13.73261,50.60479],[14.54244,52.29581],[11.8232,52.76405],[11.10993,51.06488]]]},"temporalCoverage":{"endDate":"2020-03-22 00:00:00","startDate":"2020-03-22 00:00:00"},"publishDate":"2020-03-22T09:56:49"}, "errorCode": null, "errorMessage": null}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/scene-list-get", - content=b'{"requestId": 241160510, "version": "stable", "sessionId": 51393558, "data": [{"entityId":"LC81930242020082LGN00","datasetName":"landsat_8_c1"}], "errorCode": null, "errorMessage": null}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/scene-list-remove", - content=b'{"requestId": 241161482, "version": "stable", "sessionId": 51393761, "data": null, "errorCode": null, "errorMessage": null}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/scene-metadata", - content=b'{"requestId": 241162488, "version": "stable", "sessionId": 51393950, "data": {"browse":[{"id":"5e83d0b86f2c3061","browseRotationEnabled":false,"browseName":"LandsatLook Natural Color Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1.jpg"},{"id":"5e83d0b85da62c02","browseRotationEnabled":false,"browseName":"LandsatLook Thermal Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_tir","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_TIR.jpg"},{"id":"5e83d0b8b814a0e6","browseRotationEnabled":false,"browseName":"LandsatLook Quality Preview Image","browsePath":"https:\\/\\/ims.cr.usgs.gov\\/browse\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg","overlayPath":"https:\\/\\/ims.cr.usgs.gov\\/wms\\/landsat_8_c1?sceneId=lc81930242020082lgn00_qb","overlayType":"dmid_wms","thumbnailPath":"https:\\/\\/ims.cr.usgs.gov\\/thumbnail\\/landsat_8_c1\\/2020\\/193\\/024\\/LC08_L1TP_193024_20200322_20200326_01_T1_QB.jpg"}],"cloudCover":"12.47","entityId":"LC81930242020082LGN00","displayId":"LC08_L1TP_193024_20200322_20200326_01_T1","orderingId":"LC81930242020082LGN00","metadata":[{"id":"5e83d0b82af07b21","fieldName":"Landsat Product Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_product_id","value":"LC08_L1TP_193024_20200322_20200326_01_T1"},{"id":"5e83d0b88275745","fieldName":"Landsat Scene Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#landsat_scene_id","value":"LC81930242020082LGN00"},{"id":"5e83d0b92ff6b5e8","fieldName":"Acquisition Date","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"2020\\/03\\/22"},{"id":"5e83d0b9332fd122","fieldName":"Collection Category","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"T1"},{"id":"5e83d0b9948e2596","fieldName":"Collection Number","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":1},{"id":"5e83d0b922c5f981","fieldName":"WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b94328e34e","fieldName":"WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9a34ebe01","fieldName":"Target WRS Path","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 193"},{"id":"5e83d0b8852f2e23","fieldName":"Target WRS Row","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":" 024"},{"id":"5e83d0b9173b715a","fieldName":"Nadir\\/Off Nadir","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_c2_dictionary.html#acquisition_date","value":"NADIR"},{"id":"5e83d0b820eaa311","fieldName":"Roll Angle","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#roll_angle","value":"-0.001"},{"id":"5e83d0b8379c9dae","fieldName":"Date L-1 Generated","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#date_l1_generated","value":"2020\\/03\\/26"},{"id":"5e83d0b9a78d1dbe","fieldName":"Start Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#start_time","value":"2020:082:10:02:29.1296010"},{"id":"5e83d0b887e40f8e","fieldName":"Stop Time","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#stop_time","value":"2020:082:10:03:00.8996000"},{"id":"5e83d0b926d7d304","fieldName":"Station Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#distribution_site","value":"LGN"},{"id":"5e83d0b91ad332e3","fieldName":"Day\\/Night Indicator","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#day_or_night","value":"DAY"},{"id":"5e83d0b864f5722e","fieldName":"Land Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover_land","value":"12.47"},{"id":"5e83d0b92e9d1b11","fieldName":"Scene Cloud Cover","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cloud_cover","value":"12.47"},{"id":"5e83d0b991213d01","fieldName":"Ground Control Points Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_model","value":253},{"id":"5e83d0b9e4a26b2a","fieldName":"Ground Control Points Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ground_control_points_version","value":4},{"id":"5e83d0b9bb19d4cc","fieldName":"Geometric RMSE Model (meters)","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model","value":"8.296"},{"id":"5e83d0b8f922f1d3","fieldName":"Geometric RMSE Model X","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_x","value":"5.809"},{"id":"5e83d0b93b83213d","fieldName":"Geometric RMSE Model Y","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#geometric_rmse_model_y","value":"5.924"},{"id":"5e83d0b9c9fa1556","fieldName":"Image Quality","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#image_quality_landsat_8","value":9},{"id":"5e83d0b8a926bb3e","fieldName":"Processing Software Version","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#processing_software_version","value":"LPGS_13.1.0"},{"id":"5e83d0b84092b361","fieldName":"Sun Elevation L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_elevation","value":"36.94009856"},{"id":"5e83d0b8bf763033","fieldName":"Sun Azimuth L1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sun_azimuth","value":"156.99969272"},{"id":"5e83d0b97cb734c3","fieldName":"TIRS SSM Model","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#tirs_ssm_model","value":"FINAL"},{"id":"5e83d0b861614fa4","fieldName":"Data Type Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#data_type_l1","value":"OLI_TIRS_L1TP"},{"id":"5e83d0b993a4fa4a","fieldName":"Sensor Identifier","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#sensor_id ","value":"OLI_TIRS"},{"id":"5e83d0b9de23d772","fieldName":"Panchromatic Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_lines","value":16301},{"id":"5e83d0b8100f0577","fieldName":"Panchromatic Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#panchromatic_samples","value":16101},{"id":"5e83d0b92bc96899","fieldName":"Reflective Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_lines","value":8151},{"id":"5e83d0b8bbb70baf","fieldName":"Reflective Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#reflective_samples","value":8051},{"id":"5e83d0b955642ca4","fieldName":"Thermal Lines","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_lines","value":8151},{"id":"5e83d0b96b1a0d35","fieldName":"Thermal Samples","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#thermal_samples","value":8051},{"id":"5e83d0b9104800de","fieldName":"Map Projection Level-1","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#map_projection_l1","value":"UTM"},{"id":"5e83d0b9fb0dce2d","fieldName":"UTM Zone","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#utm_zone","value":33},{"id":"5e83d0b8fd64f557","fieldName":"Datum","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#datum","value":"WGS84"},{"id":"5e83d0b84cc2632e","fieldName":"Ellipsoid","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#ellipsoid","value":"WGS84"},{"id":"5e83d0b98f651440","fieldName":"Grid Cell Size Panchromatic","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_panchromatic","value":"15.00"},{"id":"5e83d0b9c6eaa87d","fieldName":"Grid Cell Size Reflective","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_reflective","value":"30.00"},{"id":"5e83d0b8c810ced","fieldName":"Grid Cell Size Thermal","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#grid_cell_size_thermal","value":"30.00"},{"id":"5e83d0b8a40bafa4","fieldName":"Bias Parameter File Name OLI","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_oli","value":"LO8BPF20200322095233_20200322113039.01"},{"id":"5e83d0b964a91d93","fieldName":"Bias Parameter File Name TIRS","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#bpf_name_tirs","value":"LT8BPF20200310060739_20200324104153.01"},{"id":"5e83d0b9b5d81214","fieldName":"Calibration Parameter File","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#cpf_name","value":"LC08CPF_20200101_20200331_01.04"},{"id":"5e83d0b9c67b22a3","fieldName":"RLUT File Name","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#rlut_file_name","value":"LC08RLUT_20150303_20431231_01_12.h5"},{"id":"5e83d0b9a610a996","fieldName":"Center Latitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°41\'35.34\\"N"},{"id":"5e83d0b94fad23df","fieldName":"Center Longitude","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"12°48\'15.73\\"E"},{"id":"5e83d0b9c1d54551","fieldName":"UL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°45\'50.58\\"N"},{"id":"5e83d0b8d91068e","fieldName":"UL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°49\'23.52\\"E"},{"id":"5e83d0b94ff6f17e","fieldName":"UR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"52°17\'44.92\\"N"},{"id":"5e83d0b9a76119fe","fieldName":"UR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"14°32\'32.78\\"E"},{"id":"5e83d0b9f29120e3","fieldName":"LL Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"51°03\'53.57\\"N"},{"id":"5e83d0b988d2162b","fieldName":"LL Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"11°06\'35.75\\"E"},{"id":"5e83d0b96162233","fieldName":"LR Corner Lat","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"50°36\'17.24\\"N"},{"id":"5e83d0b894a09772","fieldName":"LR Corner Long","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_degrees","value":"13°43\'57.40\\"E"},{"id":"5e83d0b87f203a10","fieldName":"Center Latitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.69315"},{"id":"5e83d0b9b2a9a299","fieldName":"Center Longitude dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"12.80437"},{"id":"5e83d0b8bc51bf5b","fieldName":"UL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.76405"},{"id":"5e83d0b95071b3bf","fieldName":"UL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.82320"},{"id":"5e83d0b9842b0429","fieldName":"UR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"52.29581"},{"id":"5e83d0b931a16a9","fieldName":"UR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"14.54244"},{"id":"5e83d0b8abad8ec9","fieldName":"LL Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"51.06488"},{"id":"5e83d0b92a9532e0","fieldName":"LL Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"11.10993"},{"id":"5e83d0b834fea374","fieldName":"LR Corner Lat dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"50.60479"},{"id":"5e83d0b9f619dbbe","fieldName":"LR Corner Long dec","dictionaryLink":"https:\\/\\/lta.cr.usgs.gov\\/DD\\/landsat_dictionary.html#coordinates_decimal","value":"13.73261"}],"hasCustomizedMetadata":false,"options":{"bulk":true,"download":true,"order":true,"secondary":false},"selected":null,"spatialBounds":{"type":"Polygon","coordinates":[[[11.10993,50.60479],[11.10993,52.76405],[14.54244,52.76405],[14.54244,50.60479],[11.10993,50.60479]]]},"spatialCoverage":{"type":"Polygon","coordinates":[[[11.10993,51.06488],[13.73261,50.60479],[14.54244,52.29581],[11.8232,52.76405],[11.10993,51.06488]]]},"temporalCoverage":{"endDate":"2020-03-22 00:00:00","startDate":"2020-03-22 00:00:00"},"publishDate":"2020-03-22T09:56:49"}, "errorCode": null, "errorMessage": null}', - ) - m.get( - "https://m2m.cr.usgs.gov/api/api/json/stable/logout", - content=b'{"errorCode":null,"error":"","data":true,"api_version":"1.4.1","access_level":"user","catalog_id":"EE","executionTime":0.4}', - ) - with Source(datahub=Datahub.EarthExplorer) as src: - product_srcid, _ = src._get_srcid_from_product_uuid_ee( - product_uuid="LC81930242020082LGN00", - ) - self.assertEqual(product_srcid, "LC08_L1TP_193024_20200322_20200326_01_T1") - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/testfiles/aoi_3857.geojson b/tests/testfiles/aoi_3857.geojson deleted file mode 100644 index 804a029..0000000 --- a/tests/testfiles/aoi_3857.geojson +++ /dev/null @@ -1,8 +0,0 @@ -{ -"type": "FeatureCollection", -"name": "aoi_3857", -"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3857" } }, -"features": [ -{ "type": "Feature", "properties": { "MINX": null, "MINY": null, "MAXX": null, "MAXY": null, "CNTX": null, "CNTY": null, "AREA": null, "PERIM": null, "HEIGHT": null, "WIDTH": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1325007.596623238641769, 6704215.58994026388973 ], [ 1325007.596623238641769, 6710389.37193488329649 ], [ 1330016.725676901638508, 6710389.37193488329649 ], [ 1330016.725676901638508, 6704215.58994026388973 ], [ 1325007.596623238641769, 6704215.58994026388973 ] ] ] } } -] -} diff --git a/tests/testfiles/aoi_4326.geojson b/tests/testfiles/aoi_4326.geojson deleted file mode 100644 index 84b5767..0000000 --- a/tests/testfiles/aoi_4326.geojson +++ /dev/null @@ -1,8 +0,0 @@ -{ -"type": "FeatureCollection", -"name": "aoi", -"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, -"features": [ -{ "type": "Feature", "properties": { "MINX": null, "MINY": null, "MAXX": null, "MAXY": null, "CNTX": null, "CNTY": null, "AREA": null, "PERIM": null, "HEIGHT": null, "WIDTH": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 11.902745756211294, 51.466415233832258 ], [ 11.902745756211294, 51.500952269083875 ], [ 11.947743528101613, 51.500952269083875 ], [ 11.947743528101613, 51.466415233832258 ], [ 11.902745756211294, 51.466415233832258 ] ] ] } } -] -} diff --git a/tests/testfiles/catalog.json b/tests/testfiles/catalog.json deleted file mode 100644 index 55f7da7..0000000 --- a/tests/testfiles/catalog.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "id": "72539b1f-76c1-48ba-a060-a99c9e6738a2", - "stac_version": "1.0.0-beta.2", - "description": "Creation Date: 2021-03-19 12:01:06.817919, Datahub: Scihub", - "links": [ - { - "rel": "root", - "href": "./catalog.json", - "type": "application/json" - }, - { - "rel": "item", - "href": "./S2A_MSIL1C_20200221T102041_N0209_R065_T32UPC_20200221T110731.json", - "type": "application/json" - } - ] -} \ No newline at end of file diff --git a/ukis_pysat/__init__.py b/ukis_pysat/__init__.py index 5bf71d1..99b41f0 100644 --- a/ukis_pysat/__init__.py +++ b/ukis_pysat/__init__.py @@ -1 +1 @@ -__version__ = "1.4.3" +__version__ = "1.5.0" diff --git a/ukis_pysat/_landsat.py b/ukis_pysat/_landsat.py deleted file mode 100644 index f340f64..0000000 --- a/ukis_pysat/_landsat.py +++ /dev/null @@ -1,143 +0,0 @@ -import hashlib -import os -from datetime import datetime - -import requests -from tqdm import tqdm - -from ukis_pysat.members import Bands - -"""Extracted from the pylandsat""" -"""https://github.com/yannforget/pylandsat""" - - -def meta_from_pid(product_id): - """Extract metadata contained in a Landsat Product Identifier.""" - meta = {} - parts = product_id.split("_") - meta["product_id"] = product_id - meta["sensor"], meta["correction"] = parts[0], parts[1] - meta["path"], meta["row"] = int(parts[2][:3]), int(parts[2][3:]) - meta["acquisition_date"] = datetime.strptime(parts[3], "%Y%m%d") - meta["processing_date"] = datetime.strptime(parts[4], "%Y%m%d") - meta["collection"], meta["tier"] = int(parts[5]), parts[6] - return meta - - -def compute_md5(fpath): - """Get hexadecimal MD5 hash of a file.""" - with open(fpath, "rb") as f: - h = hashlib.md5(f.read()) - return h.hexdigest() - - -def download_files(url, out_dir, progressbar=False, verify=False): - """Download a file from an URL into a given directory. - - - :param url : str - File to download. - :param out_dir : str - Path to output directory. - :param progressbar : bool, optional - Display a progress bar. - :param verify : bool, optional - Check that remote and local MD5 hashes are equal. - - :returns fpath : str - Path to downloaded file. - """ - - fname = url.split("/")[-1] - fpath = os.path.join(out_dir, fname) - r = requests.get(url, stream=True) - remotesize = int(r.headers.get("Content-Length", 0)) - etag = r.headers.get("ETag", "").replace('"', "") - - if r.status_code != 200: - raise requests.exceptions.HTTPError(str(r.status_code)) - - if os.path.isfile(fpath) and os.path.getsize(fpath) == remotesize: - return fpath - if progressbar: - progress = tqdm(total=remotesize, unit="B", unit_scale=True) - progress.set_description(fname) - with open(fpath, "wb") as f: - for chunk in r.iter_content(chunk_size=1024 * 1024): - if chunk: - f.write(chunk) - if progressbar: - progress.update(1024 * 1024) - - r.close() - if progressbar: - progress.close() - - if verify: - if not compute_md5(fpath) == etag: - raise requests.exceptions.HTTPError("Download corrupted.") - - return fpath - - -class Product: - """It provides methods for checking the list of the available Geotiff Landsat bands and download them by - using the product_id and base_url""" - - def __init__(self, product_id): - """Initialize a product download. - - :param product_id : str - Landsat product identifier. - """ - - base_url = ( - "https://storage.googleapis.com/gcp-public-data-landsat/" - "{sensor}/{collection:02}/{path:03}/{row:03}/{product_id}/" - ) - - self.product_id = product_id - self.meta = meta_from_pid(product_id) - self.baseurl = base_url.format(**self.meta) - - @property - def available(self): - """List all available files.""" - bands = Bands() - labels = bands.dict() - return labels[self.meta["sensor"]] - - def _url(self, label): - """Get download URL of a given file according to its label.""" - if "README" in label: - basename = label - else: - basename = self.product_id + "_" + label - return self.baseurl + basename - - def download(self, out_dir, progressbar=True, files=None, verify=True): - """Download a Landsat product. - - :param out_dir : str - Path to output directory. A subdirectory named after the - product ID will automatically be created. - :param progressbar : bool, optional - Show a progress bar. - :param files :: list of str, optional - Specify the files to download manually. By default, all available - files will be downloaded. - :param verify : bool, optional - Check downloaded files for corruption (True by default). - """ - dst_dir = os.path.join(out_dir, self.product_id) - os.makedirs(dst_dir, exist_ok=True) - if not files: - files = self.available - else: - files = [f for f in files if f in self.available] - - for label in files: - if ".tif" in label: - label = label.replace(".tif", ".TIF") - url = self._url(label) - download_files(url, dst_dir, progressbar=progressbar, verify=verify) diff --git a/ukis_pysat/data.py b/ukis_pysat/data.py deleted file mode 100644 index 6dc7203..0000000 --- a/ukis_pysat/data.py +++ /dev/null @@ -1,439 +0,0 @@ -#!/usr/bin/env python3 -import datetime -import shutil -import uuid -from io import BytesIO -from pathlib import Path - -from dateutil.parser import parse - -from ukis_pysat._landsat import Product -from ukis_pysat.utils import SENTINEL_PROVIDER, LANDSAT_PROVIDER - -try: - import numpy as np - import pystac - import requests - import sentinelsat - from PIL import Image - from pystac.extensions import sat - from pystac.extensions.eo import EOExtension - from pystac.extensions.sat import SatExtension, OrbitState - from shapely import geometry, wkt, ops - from shapely.geometry import shape, mapping -except ImportError as e: - msg = ( - "ukis_pysat.data dependencies are not installed.\n\n" - "Please pip install as follows:\n\n" - " python -m pip install ukis-pysat[data] --upgrade" - ) - raise ImportError(str(e) + "\n\n" + msg) - -from ukis_pysat.file import env_get -from ukis_pysat.members import Datahub - - -class Source: - """ - Provides methods to query data sources for metadata and download images and quicklooks (APIs only). - Remote APIs and local data directories that hold metadata files are supported. - """ - - def __init__(self, datahub, catalog=None): - """ - :param datahub: Data source (). - :param catalog: Only applicable if datahub is 'STAC_local'. Can be one of the following types: - Path to STAC Catalog file catalog.json (String, Path). - Pystac Catalog or Collection object (pystac.catalog.Catalog, pystac.collection.Collection). - None initializes an empty catalog. - (default: None) - """ - self.src = datahub - - if self.src == Datahub.STAC_local: - # connect to STAC Catalog - if isinstance(catalog, (pystac.catalog.Catalog, pystac.collection.Collection)): - self.api = catalog - elif isinstance(catalog, (str, Path)): - href = Path(catalog).resolve().as_uri() - self.api = pystac.catalog.Catalog.from_file(href) - elif catalog is None: - self.api = self._init_catalog() - else: - raise AttributeError( - f"{catalog} is not a valid STAC Catalog [catalog.json, pystac.catalog.Catalog, " - f"pystac.collection.Collection, None] " - ) - - elif self.src == Datahub.EarthExplorer: - import landsatxplore.api - - # connect to Earthexplorer - self.user = env_get("EARTHEXPLORER_USER") - self.pw = env_get("EARTHEXPLORER_PW") - self.api = landsatxplore.api.API(self.user, self.pw) - - elif self.src == Datahub.Scihub: - # connect to Scihub - self.user = env_get("SCIHUB_USER") - self.pw = env_get("SCIHUB_PW") - self.api = sentinelsat.SentinelAPI( - self.user, - self.pw, - "https://apihub.copernicus.eu/apihub", - show_progressbars=False, - ) - - else: - raise NotImplementedError(f"{datahub} is not supported [STAC_local, EarthExplorer, Scihub]") - - def __enter__(self): - return self - - def _init_catalog(self): - """Initializes an empty STAC Catalog.""" - return pystac.catalog.Catalog( - id=str(uuid.uuid4()), - description=f"Creation Date: {datetime.datetime.now()}, Datahub: {self.src.value}", - catalog_type=pystac.catalog.CatalogType.SELF_CONTAINED, - ) - - def add_items_from_directory(self, item_dir, item_glob="*.json"): - """Adds STAC items from a directory to a STAC Catalog. - - :param item_dir: Path to directory that holds the STAC items (String). - :param item_glob: Optional glob pattern to identify STAC items in directory (String), (default: '*.json'). - """ - if self.src == Datahub.STAC_local: - # get all json files in item_dir that match item_substr - item_files = sorted(Path(item_dir).rglob(item_glob)) - - # load items from file and add to STAC Catalog - for item_file in item_files: - item = pystac.read_file(str(item_file)) - self.api.add_item(item) - - else: - raise TypeError(f"add_items_from_directory only works for Datahub.STAC_local and not with {self.src}.") - - def query_metadata(self, platform, date, aoi, cloud_cover=None, kwargs=None): - """Queries metadata from data source. - - :param platform: Image platform (). - :param date: Date from - to in format yyyyMMdd (String or Datetime tuple). - :param aoi: Area of interest as GeoJson file or bounding box tuple with lat lon coordinates (String, Tuple). - :param cloud_cover: Percent cloud cover scene from - to (Integer tuple) (default: None). - :param kwargs: Dictionary of the additional requirements for the hub used (default: None). - :generates: Metadata item of products that match query criteria (PySTAC item). - """ - if kwargs is None: - kwargs = {} - if self.src == Datahub.STAC_local: - # query STAC Catalog for metadata - geom = self._prep_aoi(aoi) - for item in self.api.get_all_items(): - eo_ext = EOExtension.ext(item) - if eo_ext.cloud_cover and cloud_cover: - if not cloud_cover[0] <= eo_ext.cloud_cover < cloud_cover[1]: - continue - if ( - platform.value == item.common_metadata.platform - and sentinelsat.format_query_date(date[0]) - <= sentinelsat.format_query_date(parse(item.properties["acquisitiondate"]).strftime("%Y%m%d")) - < sentinelsat.format_query_date(date[1]) - and geometry.shape(item.geometry).intersects(geom) - ): - yield item - - elif self.src == Datahub.EarthExplorer: - # query EarthExplorer for metadata - bbox = self._prep_aoi(aoi).bounds - if cloud_cover: - kwargs["max_cloud_cover"] = cloud_cover[1] - products = self.api.search( - dataset=platform.value, - bbox=bbox, - start_date=sentinelsat.format_query_date(date[0]), - end_date=sentinelsat.format_query_date(date[1]), - max_results=10000, - **kwargs, - ) - for meta in products: - yield self.construct_metadata(meta=meta, platform=platform) - - else: - # query Scihub for metadata - if cloud_cover and platform != platform.Sentinel1: - kwargs["cloudcoverpercentage"] = cloud_cover - products = self.api.query( - area=self._prep_aoi(aoi).wkt, - date=date, - platformname=platform.value, - **kwargs, - ) - products = self.api.to_geojson(products)["features"] - - for meta in products: - yield self.construct_metadata(meta=meta, platform=platform) - - def query_metadata_srcid(self, platform, srcid): - """Queries metadata from data source by srcid. - - :param platform: Image platform (). - :param srcid: Srcid of a specific product (String). - :generates: Metadata of product that matches srcid (PySTAC item). - """ - if self.src == Datahub.STAC_local: - # query Spatio Temporal Asset Catalog for metadata by srcid - for item in self.api.get_all_items(): - if item.id == srcid: - yield item - - elif self.src == Datahub.EarthExplorer: - from landsatxplore.util import guess_dataset - - dataset = guess_dataset(srcid) - metadata = self.api.metadata(self.api.get_entity_id(srcid, dataset), dataset) - yield self.construct_metadata(meta=metadata, platform=platform) - - else: # query Scihub for metadata by srcid - for meta in self.api.to_geojson(self.api.query(identifier=srcid))["features"]: - yield self.construct_metadata(meta=meta, platform=platform) - - def construct_metadata(self, meta, platform): - """Constructs a STAC item that is harmonized across the different satellite image sources. - - :param meta: Source metadata (GeoJSON-like mapping) - :param platform: Image platform (). - :returns: PySTAC item - """ - if self.src == Datahub.STAC_local: - raise NotImplementedError(f"construct_metadata not supported for {self.src}.") - - elif self.src == Datahub.EarthExplorer: - item = pystac.Item( - id=meta["display_id"], - datetime=meta["start_time"], - geometry=meta["spatial_coverage"].__geo_interface__, - bbox=meta["spatial_bounds"], - properties={ - "producttype": "L1TP", - "srcuuid": meta["entity_id"], - "start_datetime": meta["start_time"].astimezone(tz=datetime.timezone.utc).isoformat(), - "end_datetime": meta["stop_time"].astimezone(tz=datetime.timezone.utc).isoformat(), - }, - ) - # extensions - sat_ext = SatExtension.ext(item, add_if_missing=True) - relative_orbit = int(f"{meta['wrs_path']}{meta['wrs_row']}") - sat_ext.apply(orbit_state=sat.OrbitState.DESCENDING, relative_orbit=relative_orbit) - - eo_ext = EOExtension.ext(item, add_if_missing=True) - if "cloudCover" in meta: - eo_ext.cloud_cover = round(float(meta["cloud_cover"]), 2) - - # common - item.common_metadata.providers = [LANDSAT_PROVIDER] - - else: # Scihub - item = pystac.Item( - id=meta["properties"]["identifier"], - datetime=parse(meta["properties"]["beginposition"]), - geometry=meta["geometry"], - bbox=_get_bbox_from_geometry_string(meta["geometry"]), - properties={ - "producttype": meta["properties"]["producttype"], - "size": meta["properties"]["size"], - "srcurl": meta["properties"]["link"], - "srcuuid": meta["properties"]["uuid"], - "start_datetime": parse(meta["properties"]["beginposition"]) - .astimezone(tz=datetime.timezone.utc) - .isoformat(), - "end_datetime": parse(meta["properties"]["endposition"]) - .astimezone(tz=datetime.timezone.utc) - .isoformat(), - }, - stac_extensions=[], - ) - - # extensions - sat_ext = SatExtension.ext(item, add_if_missing=True) - sat_ext.apply( - orbit_state=OrbitState[meta["properties"]["orbitdirection"].upper()], # for enum key to work - relative_orbit=int(meta["properties"]["orbitnumber"]), - ) - - eo_ext = EOExtension.ext(item, add_if_missing=True) - if "cloudcoverpercentage" in meta["properties"]: - eo_ext.cloud_cover = round(float(meta["properties"]["cloudcoverpercentage"]), 2) - - # common - item.common_metadata.providers = [SENTINEL_PROVIDER] - - item.common_metadata.platform = platform.value - - return item - - def stream_image(self, product_uuid): - """ - :param product_uuid: UUID of the satellite image product (String). - - :returns: response - """ - - if self.src == Datahub.Scihub: - return self.api.get_stream(product_uuid) - - else: - raise NotImplementedError( - f"stream_image not supported for {self.src}. " - f"It is much easier to stream the asset yourself now using `requests.get(url, stream=True)`" - ) - - def _get_srcid_from_product_uuid_ee(self, product_uuid): - """ - query EarthExplorer for srcid and meta (e.g. for url and bounds of product) - :param product_uuid: UUID of the satellite image product (String). - - :return: product_uuid, meta_src of product - """ - from landsatxplore.util import parse_scene_id, landsat_dataset - - meta = parse_scene_id(product_uuid) - metadata = self.api.metadata(product_uuid, landsat_dataset(int(meta["satellite"]))) - - return metadata["display_id"], metadata - - def download_image(self, product_uuid, target_dir): - """Downloads satellite image data to a target directory for a specific product_id. - Incomplete downloads are continued and complete files are skipped. - - :param product_uuid: UUID of the satellite image product (String). - :param target_dir: Target directory that holds the downloaded images (String, Path) - """ - if isinstance(target_dir, str): - target_dir = Path(target_dir) - - if self.src == Datahub.STAC_local: - raise NotImplementedError( - f"download_image not supported for {self.src}. It is much easier to get the asset yourself now." - ) - - elif self.src == Datahub.EarthExplorer: - product_srcid, _ = self._get_srcid_from_product_uuid_ee(product_uuid) - if not Path(target_dir.joinpath(product_srcid + ".zip")).is_file(): - # download data from GCS if file does not already exist - product = Product(product_srcid) - product.download(out_dir=target_dir, progressbar=False) - - # compress download directory and remove original files - shutil.make_archive( - target_dir.joinpath(product_srcid), - "zip", - root_dir=target_dir.joinpath(product_srcid), - ) - shutil.rmtree(target_dir.joinpath(product_srcid)) - - else: - self.api.download(product_uuid, target_dir, checksum=True) - - def download_quicklook(self, product_uuid, target_dir): - """Downloads a quicklook of the satellite image to a target directory for a specific product_id. - It performs a very rough geocoding of the quicklooks by shifting the image to the location of the footprint. - - :param product_uuid: UUID of the satellite image product (String). - :param target_dir: Target directory that holds the downloaded images (String, Path) - """ - if isinstance(target_dir, str): - target_dir = Path(target_dir) - - if self.src == Datahub.EarthExplorer: - product_srcid, meta_src = self._get_srcid_from_product_uuid_ee(product_uuid) - url = meta_src[0]["browseUrl"] - bounds = geometry.shape(meta_src[0]["spatialFootprint"]).bounds - - else: - # query Scihub for url, srcid and bounds of product - meta_src = self.api.get_product_odata(product_uuid) - url = "https://scihub.copernicus.eu/apihub/odata/v1/Products('{}')/Products('Quicklook')/$value".format( - product_uuid - ) - bounds = wkt.loads(meta_src["footprint"]).bounds - product_srcid = meta_src["title"] - - # download quicklook and crop no-data borders - response = requests.get(url, auth=(self.user, self.pw)) - quicklook = np.asarray(Image.open(BytesIO(response.content))) - # use threshold of 50 to overcome noise in JPEG compression - xs, ys, zs = np.where(quicklook >= 50) - quicklook = quicklook[min(xs) : max(xs) + 1, min(ys) : max(ys) + 1, min(zs) : max(zs) + 1] - Image.fromarray(quicklook).save(target_dir.joinpath(product_srcid + ".jpg")) - - # geocode quicklook - quicklook_size = (quicklook.shape[1], quicklook.shape[0]) - dist_x = geometry.Point(bounds[0], bounds[1]).distance(geometry.Point(bounds[2], bounds[1])) / quicklook_size[0] - dist_y = geometry.Point(bounds[0], bounds[1]).distance(geometry.Point(bounds[0], bounds[3])) / quicklook_size[1] - ul_x, ul_y = bounds[0], bounds[3] - with open(target_dir.joinpath(product_srcid + ".jpgw"), "w") as out_file: - out_file.write(str(dist_x) + "\n") - out_file.write(str(0.0) + "\n") - out_file.write(str(0.0) + "\n") - out_file.write(str(-dist_y) + "\n") - out_file.write(str(ul_x) + "\n") - out_file.write(str(ul_y) + "\n") - - @staticmethod - def _prep_aoi(aoi): - """Converts aoi to Shapely Polygon and reprojects to WGS84. - - :param aoi: Area of interest as Geojson file, WKT string or bounding box in lat lon coordinates (String, - Tuple, __geo_interface__) - :return: Shapely Polygon - """ - # check if handed object is a string - # this could include both file paths and WKT strings - if isinstance(aoi, (str, Path)): - # check if handed object is a file - if Path(aoi).is_file(): - try: - import fiona - import pyproj - except ImportError: - raise ImportError("if your AOI is a file optional dependencies [fiona, pyproj] are required.") - with fiona.open(aoi, "r") as aoi: - # make sure crs is in epsg:4326 - project = pyproj.Transformer.from_proj( - proj_from=pyproj.Proj(aoi.crs["init"]), - proj_to=pyproj.Proj("epsg:4326"), - always_xy=True, - ) - aoi = ops.transform(project.transform, geometry.shape(aoi[0]["geometry"])) - else: - aoi = wkt.loads(aoi) - - elif isinstance(aoi, dict): - aoi = shape(aoi) - - elif isinstance(aoi, tuple): - aoi = geometry.box(aoi[0], aoi[1], aoi[2], aoi[3]) - - else: - raise TypeError(f"aoi must be of type string, Path, tuple or __geo_interface__") - - return aoi - - def close(self): - """Closes connection to or logs out of Datahub.""" - if self.src == Datahub.EarthExplorer: - self.api.logout() - elif self.src == Datahub.Scihub: - self.api.session.close() - else: - pass - - def __exit__(self, exc_type, exc_value, traceback): - self.close() - - -def _get_bbox_from_geometry_string(geom): - return list(geometry.shape(geom).bounds) diff --git a/ukis_pysat/members.py b/ukis_pysat/members.py index 4cebbd4..03751b7 100644 --- a/ukis_pysat/members.py +++ b/ukis_pysat/members.py @@ -1,7 +1,5 @@ from enum import Enum -from pydantic import BaseModel - class Platform(Enum): Sentinel1 = "Sentinel-1" @@ -10,63 +8,3 @@ class Platform(Enum): Landsat5 = "LANDSAT_TM_C1" Landsat7 = "LANDSAT_ETM_C1" Landsat8 = "LANDSAT_8_C1" - - -class Datahub(Enum): - STAC_local = "STAC Catalog/Collection" - EarthExplorer = "EarthExplorer" - Scihub = "Scihub" - - -class Bands(BaseModel): - LC08: list = [ - "B1.TIF", - "B2.TIF", - "B3.TIF", - "B4.TIF", - "B5.TIF", - "B6.TIF", - "B7.TIF", - "B8.TIF", - "B9.TIF", - "B10.TIF", - "B11.TIF", - "BQA.TIF", - "MTL.txt", - "ANG.txt", - ] - LE07: list = [ - "B1.TIF", - "B2.TIF", - "B3.TIF", - "B4.TIF", - "B5.TIF", - "B6_VCID_1.TIF", - "B6_VCID_2.TIF", - "B7.TIF", - "B8.TIF", - "BQA.TIF", - "GCP.txt", - "MTL.txt", - "ANG.txt", - "README.GTF", - ] - LT05: list = [ - "B1.TIF", - "B2.TIF", - "B3.TIF", - "B4.TIF", - "B5.TIF", - "B6.TIF", - "B7.TIF", - "BQA.TIF", - "GCP.txt", - "MTL.txt", - "VER.txt", - "README.GTF", - "ANG.txt", - ] - LM04: list = ["B1.TIF", "B2.TIF", "B3.TIF", "B4.TIF", "BQA.TIF", "GCP.txt", "MTL.txt", "VER.txt", "README.GTF"] - LM03: list = ["B4.TIF", "B5.TIF", "B6.TIF", "B7.TIF", "BQA.TIF", "MTL.txt", "README.GTF"] - LM02: list = ["B4.TIF", "B5.TIF", "B6.TIF", "B7.TIF", "BQA.TIF", "MTL.txt", "README.GTF"] - LM01: list = ["B4.TIF", "B5.TIF", "B6.TIF", "B7.TIF", "BQA.TIF", "MTL.txt", "README.GTF"] diff --git a/ukis_pysat/raster.py b/ukis_pysat/raster.py index fa139bd..434ec3e 100644 --- a/ukis_pysat/raster.py +++ b/ukis_pysat/raster.py @@ -28,7 +28,6 @@ class Image: - da_arr = None def __init__(self, data, dimorder="first", crs=None, transform=None, nodata=None): diff --git a/ukis_pysat/utils.py b/ukis_pysat/utils.py deleted file mode 100644 index a0317ed..0000000 --- a/ukis_pysat/utils.py +++ /dev/null @@ -1,40 +0,0 @@ -import pystac -from geojson import Feature -from pystac import ProviderRole -from pystac.extensions.sar import FrequencyBand, SarExtension, Polarization - - -def fill_sar_ext(sar_ext: SarExtension, meta: Feature): - # Fixed properties - sar_ext.frequency_band = FrequencyBand("C") - sar_ext.center_frequency = 5.405 - # rest (like e.g. sar:pixel_spacing_range) cannot be known from API response AFAIK - - # Read properties - sar_ext.instrument_mode = meta["properties"]["sensoroperationalmode"] - sar_ext.product_type = meta["properties"]["producttype"] - - # TODO maybe this is not good, because we often only use one later on - sar_ext.polarizations = [Polarization(p) for p in meta["properties"]["polarisationmode"].split(" ")] - - -# constants -SENTINEL_PROVIDER = pystac.Provider( - name="ESA", - roles=[ - ProviderRole.PRODUCER, - ProviderRole.PROCESSOR, - ProviderRole.LICENSOR, - ], - url="https://earth.esa.int/web/guest/home", -) - -LANDSAT_PROVIDER = pystac.Provider( - name="USGS", - roles=[ - ProviderRole.PRODUCER, - ProviderRole.PROCESSOR, - ProviderRole.LICENSOR, - ], - url="https://earthexplorer.usgs.gov/", -)