Skip to content

Commit

Permalink
remove!: USGS EROS
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Jul 14, 2023
1 parent 5bbf7f2 commit b607e3e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 137 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Removed

- USGS EROS client ([#37](https://github.com/stac-utils/stac-asset/pull/37))

## [0.1.1] - 2023-07-12

### Fixed
Expand Down
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,29 @@ Some clients require some setup before use; they are called out in this table, a
| `S3Client` | Simple S3 client | Use `requester_pays=True` in the client initializer to enable access to requester pays buckets, e.g. USGS landsat's public AWS archive |
| `FilesystemClient` | Moves files from place to place on a local filesystem | Mostly used for testing |
| `PlanetaryComputerClient` | Signs urls with the [Planetary Computer Authentication API](https://planetarycomputer.microsoft.com/docs/reference/sas/) | No additional setup required, works out of the box |
| `UsgsErosClient` | Uses a token-based authentication workflow to download data, e.g. landsat, from USGS EROS | Requires creation of a personal access token, see section below |
| `EarthdataClient` | Uses a token-based authentication to download data, from _some_ Earthdata providers, e.g. DAACs | Requires creation of a personal access token, see section below |

### S3Client
#### USGS EROS

To use the `requester_pays` option, you need to configure your AWS credentials.
See [the AWS documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) for instructions.
We used to have a USGS EROS client, but it turns out it was broken, and accessing landsat data via HTTP requires special authorization from USGS.
To access USGS landsat data, you can use `--s3-requester-pays`, e.g.:

#### USGS EROS
```shell
stac-client search https://landsatlook.usgs.gov/stac-server \
-c landsat-c2l2-sr \
--intersects "$(cat longmont.json)" \
--query "eo:cloud_cover<10" \
--sortby='-properties.datetime' \
--max-items 1 \
| stac-asset download --s3-requester-pays -w > landsat-c2l2-sr.json
```

The USGS EROS system, which hosts landsat data, requires a personal access token to download assets.
Here's how to create and use your personal access token with **stac-asset**:
You'll need to set up requester pays, as detailed [below](#s3client).

1. [Create a new personal access token](https://ers.cr.usgs.gov/password/appgenerate)
2. Set two environment variables:
- `USGS_EROS_USERNAME` to your username (found in the top right of the web UI)
- `USGS_EROS_PAT` to your personal access token
3. Use `UsgsErosClient.default()` to create a new client.
### S3Client

You can also provide your username and password to the `UsgsErosClient.login` method.
To use the `requester_pays` option, you need to configure your AWS credentials.
See [the AWS documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) for instructions.

#### Earthdata

Expand Down
2 changes: 0 additions & 2 deletions src/stac_asset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from .planetary_computer_client import PlanetaryComputerClient
from .s3_client import S3Client
from .strategy import FileNameStrategy
from .usgs_eros_client import UsgsErosClient

__all__ = [
"DownloadWarning",
Expand All @@ -44,7 +43,6 @@
"HttpClient",
"PlanetaryComputerClient",
"S3Client",
"UsgsErosClient",
"download_item",
"download_item_collection",
"guess_client",
Expand Down
3 changes: 0 additions & 3 deletions src/stac_asset/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from .s3_client import S3Client
from .strategy import FileNameStrategy
from .types import PathLikeObject
from .usgs_eros_client import UsgsErosClient


async def download_item(
Expand Down Expand Up @@ -142,8 +141,6 @@ async def guess_client(href: str, s3_requester_pays: bool = False) -> Client:
return S3Client(requester_pays=s3_requester_pays)
elif url.host.endswith("blob.core.windows.net"):
return await PlanetaryComputerClient.default()
elif url.host == "landsatlook.usgs.gov":
return await UsgsErosClient.default()
elif url.scheme == "http" or url.scheme == "https":
return await HttpClient.default()
else:
Expand Down
89 changes: 0 additions & 89 deletions src/stac_asset/usgs_eros_client.py

This file was deleted.

30 changes: 0 additions & 30 deletions tests/test_usgs_eros_client.py

This file was deleted.

0 comments on commit b607e3e

Please sign in to comment.