{"id":13733980,"url":"https://github.com/SatelliteApplicationsCatapult/sedas_pyapi","last_synced_at":"2025-05-08T10:30:48.439Z","repository":{"id":48661609,"uuid":"194834658","full_name":"SatelliteApplicationsCatapult/sedas_pyapi","owner":"SatelliteApplicationsCatapult","description":"Python client library for the SeDAS API","archived":false,"fork":false,"pushed_at":"2021-07-15T09:34:22.000Z","size":89,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-15T02:34:31.587Z","etag":null,"topics":["api-client","satellites","sedas-pyapi","sedas-search"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SatelliteApplicationsCatapult.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-02T09:40:15.000Z","updated_at":"2021-07-15T09:34:00.000Z","dependencies_parsed_at":"2022-09-13T16:01:02.971Z","dependency_job_id":null,"html_url":"https://github.com/SatelliteApplicationsCatapult/sedas_pyapi","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SatelliteApplicationsCatapult%2Fsedas_pyapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SatelliteApplicationsCatapult%2Fsedas_pyapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SatelliteApplicationsCatapult%2Fsedas_pyapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SatelliteApplicationsCatapult%2Fsedas_pyapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SatelliteApplicationsCatapult","download_url":"https://codeload.github.com/SatelliteApplicationsCatapult/sedas_pyapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253045568,"owners_count":21845727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","satellites","sedas-pyapi","sedas-search"],"created_at":"2024-08-03T03:00:51.444Z","updated_at":"2025-05-08T10:30:48.177Z","avatar_url":"https://github.com/SatelliteApplicationsCatapult.png","language":"Python","funding_links":[],"categories":["`Python` processing of optical imagery (non deep learning)"],"sub_categories":["Download"],"readme":"# sedas_pyapi\r\n\r\nA small collection of useful functions to get data from SeDAS. Works with the API documented [here](https://geobrowser.satapps.org/docs/index.html)\r\n\r\nRequires python 3+ has been tested with 3.7\r\n\r\n## Installing\r\n\r\nThe project is available in PyPI. Just a pip install away.\r\n\r\n```bash\r\npip install sedas_pyapi\r\n```\r\n\r\nIf you want to build manually we will be providing a contributing guide soon which will include information about \r\nbuilding and testing the project.\r\n\r\n## Usage\r\n\r\nCreate an instance of `sedas_pyapi.sedas_api.SeDASAPI` passing in your username and password.\r\n\r\nThen call `search_optical`, `search_sar` or `search_product` to find the details of a product.\r\n\r\nOnce you have a list of things you want to download you can use the `sedas_pyapi.bulk_download.SeDASBulkDownload` to \r\ndownload all of them. There are also download methods on the `SeDASAPI` if you need to do something a bit different.\r\n\r\nDue to the way the SeDAS system works sometimes when you do a search you will not get a download url in the result \r\nobject. If this happens it means that the data is available but in the long term archive (lta) and must be requested \r\nfirst. Use the `request` and `is_request_ready` methods to make a request and then wait for it to be fulfilled. If you \r\nuse the `SeDASBulkDownload` this will take care of LTA requests for you.\r\n\r\nFor more details see the examples below\r\n\r\n## Examples\r\n\r\n### Creating a client\r\n\r\n```python\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\n\r\n# This is a suggestion for how to get your username and password\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\n```\r\n\r\nThe SeDASAPI object can then be used to access the rest of the api.\r\n\r\n### Search for an optical AOI with cloud cover filters\r\n\r\n```python\r\nimport json\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\n\r\nwkt = \"POLYGON ((-1.3295 51.5881,\" \\\r\n          \"-1.3013 51.5872,\" \\\r\n          \"-1.3020 51.5621,\" \\\r\n          \"-1.3300 51.5622,\" \\\r\n          \"-1.3295 51.5881))\"\r\nstartDate = \"2019-04-30T00:00:00Z\"\r\nendDate = \"2019-05-12T23:59:59Z\"\r\n\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\nresult_optical = sedas.search_optical(wkt, startDate, endDate, maxCloudPercent=50)\r\nprint(json.dumps(result_optical, sort_keys=True, indent=4, separators=(',', ': ')))\r\n```\r\n\r\nReturns a SeDAS search result object. [See more](https://geobrowser.satapps.org/docs/json_SearchResponse.html)\r\n\r\n### Search for a SAR AOI\r\n\r\n```python\r\nimport json\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\n\r\nwkt = \"POLYGON ((-1.3295 51.5881,\" \\\r\n          \"-1.3013 51.5872,\" \\\r\n          \"-1.3020 51.5621,\" \\\r\n          \"-1.3300 51.5622,\" \\\r\n          \"-1.3295 51.5881))\"\r\nstartDate = \"2019-04-30T00:00:00Z\"\r\nendDate = \"2019-05-12T23:59:59Z\"\r\n\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\nresult_sar = sedas.search_sar(wkt, startDate, endDate)\r\nprint(json.dumps(result_sar, sort_keys=True, indent=4, separators=(',', ': ')))\r\n```\r\n\r\nReturns a SeDAS search result object. [See more](https://geobrowser.satapps.org/docs/json_SearchResponse.html)\r\n\r\n### List the source groups available to the user\r\n\r\n```python\r\nimport json\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\n\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\nresult_groups = sedas.list_sensor_groups()\r\nprint(json.dumps(result_groups, sort_keys=True, indent=4, separators=(',', ': ')))\r\n\r\ngroups = []\r\nfor i in range(0, len(result_groups)):\r\n    groups.append(result_groups[i]['name'])\r\n\r\nprint(f\"Available groups are: {', '.join(groups)}\")\r\n```\r\n\r\nReturns a list of SeDAS source group objects. [See more](https://geobrowser.satapps.org/docs/json_SourceGroup.html)\r\n\r\n### List the satellites available to the user\r\n\r\n```python\r\nimport json\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\n\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\nresult_sats = sedas.list_satellites()\r\nprint(json.dumps(result_sats, sort_keys=True, indent=4, separators=(',', ': ')))\r\n\r\nsatellites = []\r\nfor i in range(0, len(result_sats)):\r\n    satellites.append(result_sats[i]['name'])\r\n\r\nprint(f\"Available satellites are: {', '.join(satellites)}\")\r\n```\r\n\r\nReturns a list of SeDAS satellite objects. [See more](https://geobrowser.satapps.org/docs/json_Satellite.html)\r\n\r\n### Filtering on a group of sources\r\nUse sedas.list_sensor_groups to get the list of source groups available for a user ([see above](#List-the-source-groups-available-to-the-user)).\r\n\r\n```python\r\nimport json\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\n\r\nwkt = \"POLYGON ((-1.3295 51.5881,\" \\\r\n          \"-1.3013 51.5872,\" \\\r\n          \"-1.3020 51.5621,\" \\\r\n          \"-1.3300 51.5622,\" \\\r\n          \"-1.3295 51.5881))\"\r\nstartDate = \"2019-04-30T00:00:00Z\"\r\nendDate = \"2019-05-12T23:59:59Z\"\r\n\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\nresult_optical = sedas.search_optical(wkt, startDate, endDate, source_group=\"S2\")\r\nprint(json.dumps(result_optical, sort_keys=True, indent=4, separators=(',', ': ')))\r\n```\r\n\r\n### Filtering on a specific satellite\r\nUse sedas.list_satellites to get the list of satellites available for a user ([see above](#List-the-satellites-available-to-the-user)).\r\n\r\n```python\r\nimport json\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\n\r\nwkt = \"POLYGON ((-1.3295 51.5881,\" \\\r\n          \"-1.3013 51.5872,\" \\\r\n          \"-1.3020 51.5621,\" \\\r\n          \"-1.3300 51.5622,\" \\\r\n          \"-1.3295 51.5881))\"\r\nstartDate = \"2019-04-30T00:00:00Z\"\r\nendDate = \"2019-05-12T23:59:59Z\"\r\n\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\nresult_sar = sedas.search_sar(wkt, startDate, endDate, satellite_name=\"Sentinel-1A\")\r\nprint(json.dumps(result_sar, sort_keys=True, indent=4, separators=(',', ': ')))\r\n```\r\n\r\n### Search for a single product\r\n\r\n```python\r\nimport json\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\n\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\nsingleProduct = sedas.search_product(\"S1B_IW_GRDH_1SDV_20190528T105030_20190528T105055_016443_01EF3E_5E4F\")\r\nprint(json.dumps(singleProduct, sort_keys=True, indent=4, separators=(',', ': ')))\r\n```\r\n\r\nThis returns an array containing SeDAS products. [See more](https://geobrowser.satapps.org/docs/json_Product.html)\r\n\r\n### Download a single product\r\n\r\n```python\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\n\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\nsingleProduct = sedas.search_product(\"S1B_IW_GRDH_1SDV_20190528T105030_20190528T105055_016443_01EF3E_5E4F\")\r\n\r\nsedas.download(singleProduct[0], \"/output/path/S1B_IW_GRDH_1SDV_20190528T105030_20190528T105055_016443_01EF3E_5E4F.zip\")\r\n```\r\n\r\n### Bulk download many products\r\nNote with historical request this can take a while to recover the images from the archive.\r\n```python\r\nfrom sedas_pyapi.bulk_download import SeDASBulkDownload\r\nfrom sedas_pyapi.sedas_api import SeDASAPI\r\nfrom getpass import getpass\r\nimport time\r\n\r\nwkt = \"POLYGON ((-1.3295 51.5881,\" \\\r\n          \"-1.3013 51.5872,\" \\\r\n          \"-1.3020 51.5621,\" \\\r\n          \"-1.3300 51.5622,\" \\\r\n          \"-1.3295 51.5881))\"\r\nstartDate = \"2019-04-30T00:00:00Z\"\r\nendDate = \"2019-05-12T23:59:59Z\"\r\n\r\nusername = input(\"Please enter your username:\")\r\npassword = getpass(\"Please enter your password:\")\r\n\r\nsedas = SeDASAPI(username, password)\r\nsedas.login()\r\n\r\n# Search for some images.\r\nresult_sar = sedas.search_sar(wkt, startDate, endDate, sarProductType=\"SLC\")\r\n# Create a downloader. This will spawn a number of background threads to actually do the downloading and waiting for \r\n# the long term archive requests.\r\ndownloader = SeDASBulkDownload(sedas, \"/output/path/\", parallel=3)\r\n\r\n# Add the things we want to download to the queue\r\ndownloader.add(result_sar['products'])\r\n\r\n# Wait for the downloader to be finished.\r\nwhile not downloader.is_done():\r\n    time.sleep(5)\r\n    \r\n# clean up the background threads.\r\ndownloader.shutdown()\r\n\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSatelliteApplicationsCatapult%2Fsedas_pyapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSatelliteApplicationsCatapult%2Fsedas_pyapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSatelliteApplicationsCatapult%2Fsedas_pyapi/lists"}