-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
760 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" | ||
Convenience functions for downloading STAC items via stac-asset | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
import os | ||
from pathlib import Path | ||
|
||
import stac_asset | ||
from pystac import Item | ||
|
||
|
||
async def download_item( | ||
item: Item, | ||
path: str = "/tmp", | ||
config: str | None = None, | ||
) -> Item: | ||
""" | ||
Downloads a STAC item to a specified local path. | ||
Parameters | ||
---------- | ||
item : pystac.Item | ||
The STAC item to be downloaded. | ||
path : str, optional | ||
The local directory path where the item will be downloaded. Default is "/tmp". | ||
config : str, optional | ||
If config=='maxar', a MAXAR-API-KEY HTTP Header is used for authentication. | ||
Returns | ||
------- | ||
pystac.Item | ||
The downloaded STAC item. | ||
Examples | ||
-------- | ||
>>> localitem = asyncio.run(download_item(item, config=MAXAR_CONFIG)) | ||
""" | ||
posixpath = Path(path) | ||
|
||
if config == "maxar": | ||
config = stac_asset.Config( | ||
http_headers={"MAXAR-API-KEY": os.environ.get("MAXAR_API_KEY")} | ||
) | ||
# NOTE: prevent in-place modification of remote hrefs with item.clone() | ||
await stac_asset.download_item(item.clone(), posixpath, config=config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
""" | ||
selection of useful plots with matplotlib | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from coincident.plot.matplotlib import plot_esa_worldcover, plot_maxar_browse | ||
|
||
__all__ = ["plot_esa_worldcover", "plot_maxar_browse"] |
Oops, something went wrong.