Skip to content

Commit

Permalink
Rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeezley committed Aug 8, 2024
1 parent 9a46157 commit 92a479d
Show file tree
Hide file tree
Showing 22 changed files with 46 additions and 46 deletions.
File renamed without changes.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# spire-csda
# nasa-csda-cli

This is a CLI and SDK for querying and downloading files from Spire's
[CSDA catalog](https://nasa-csda.wx.spire.com/).

## Install it from PyPI

```bash
pip install spire-csda
pip install nasa-csda
```

## Using the CLI

See the command's help dialog for detailed usage information for all commands.

```bash
spire-csda --help
nasa-csda-cli --help
```

All of the commands require login information (the same username and password
Expand All @@ -34,7 +34,7 @@ the CLI to download all files matching the query created in the UI. To
download all files using this configuration file,

```bash
spire-csda --username <username> --password <password> bulk-download download-config.json
nasa-csda-cli --username <username> --password <password> bulk-download download-config.json
```

### Querying the catalog
Expand All @@ -43,7 +43,7 @@ You can also construct queries to perform custom tasks using the `query`
command.

```bash
spire-csda query --start-date 2020-01-01 --end-date 2020-01-02 \
nasa-csda-cli query --start-date 2020-01-01 --end-date 2020-01-02 \
--products opnGns,atmPhs \
--min-latitude -50 --max-latitude 50 --min-longitude -50 --max-longitude 50
```
Expand All @@ -56,7 +56,7 @@ download does. There are two additional modes of operation this command supports
In `list` mode, a link to all files will be printed to STDOUT.

```bash
spire-csda query --start-date 2020-01-01 --end-date 2020-01-02 \
nasa-csda-cli query --start-date 2020-01-01 --end-date 2020-01-02 \
--products opnGns,atmPhs \
--min-latitude -50 --max-latitude 50 --min-longitude -100 --max-longitude 100 \
--mode list --no-progress --limit 10
Expand All @@ -79,7 +79,7 @@ https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-51-32_FM104_G25_atmP
In `raw` mode, the command will stream out GeoJSON objects conforming to the STAC spec.

```bash
spire-csda query --start-date 2020-01-01 --end-date 2020-01-02 \
nasa-csda-cli query --start-date 2020-01-01 --end-date 2020-01-02 \
--products opnGns,atmPhs \
--min-latitude -50 --max-latitude 50 --min-longitude -100 --max-longitude 100 \
--mode raw --no-progress --limit 1
Expand All @@ -91,8 +91,8 @@ Advanced users can use the `token` command to generate authentication headers th
downloading files using other tools.

```bash
TOKEN="$(spire-csda token)"
curl -O -L -H "Authentication: Bearer ${TOKEN}" https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-56-00_FM104_R15_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-56-00_FM104_R15.nc -o
TOKEN="$(nasa-csda-cli token)"
curl -O -L -H "Authentication: Bearer ${TOKEN}" https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-56-00_FM104_R15_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-56-00_FM104_R15.nc
```

## Using the SDK
Expand Down
12 changes: 6 additions & 6 deletions examples/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

from aiostream import pipe, stream

from spire_csda.buffer import Buffer
from spire_csda.client import Client
from spire_csda.config import Settings
from spire_csda.models.item_collection import CSDAItemCollection
from spire_csda.models.search import CSDASearch
from spire_csda.streaming import download, extract_links, search
from nasa_csda.buffer import Buffer
from nasa_csda.client import Client
from nasa_csda.config import Settings
from nasa_csda.models.item_collection import CSDAItemCollection
from nasa_csda.models.search import CSDASearch
from nasa_csda.streaming import download, extract_links, search

_max_buffer_size = 10
_max_concurrent_downloads = 4
Expand Down
6 changes: 3 additions & 3 deletions examples/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from asyncio import run

from spire_csda.client import Client
from spire_csda.config import Settings
from spire_csda.models.search import CSDASearch
from nasa_csda.client import Client
from nasa_csda.config import Settings
from nasa_csda.models.search import CSDASearch


async def download_first_file(query: CSDASearch):
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions spire_csda/cli.py → nasa_csda/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from tqdm.asyncio import tqdm
from tqdm.contrib.logging import logging_redirect_tqdm

from spire_csda.buffer import Buffer
from spire_csda.client import Client
from spire_csda.config import Settings
from spire_csda.models.bulk_download import BulkDownload
from spire_csda.models.item_collection import CSDAItemCollection
from spire_csda.models.search import CSDASearch
from spire_csda.streaming import download, extract_links, search
from nasa_csda.buffer import Buffer
from nasa_csda.client import Client
from nasa_csda.config import Settings
from nasa_csda.models.bulk_download import BulkDownload
from nasa_csda.models.item_collection import CSDAItemCollection
from nasa_csda.models.search import CSDASearch
from nasa_csda.streaming import download, extract_links, search

T = TypeVar("T")

Expand Down
10 changes: 5 additions & 5 deletions spire_csda/client.py → nasa_csda/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
from httpx import AsyncClient, HTTPStatusError, Request
from tqdm.asyncio import tqdm

from spire_csda.config import Settings
from spire_csda.models.link import DownloadLink
from spire_csda.models.item_collection import CSDAItemCollection
from spire_csda.models.search import CSDASearch
from spire_csda.transport import RetryableTransport
from nasa_csda.config import Settings
from nasa_csda.models.link import DownloadLink
from nasa_csda.models.item_collection import CSDAItemCollection
from nasa_csda.models.search import CSDASearch
from nasa_csda.transport import RetryableTransport

logger = logging.getLogger(__name__)
_session: ContextVar[AsyncClient] = ContextVar("session")
Expand Down
File renamed without changes.
File renamed without changes.
Empty file added nasa_csda/models/__init__.py
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pydantic import BaseModel, ConfigDict, Field

from spire_csda.models.search import CSDASearch
from nasa_csda.models.search import CSDASearch


class BulkDownload(BaseModel):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions spire_csda/streaming.py → nasa_csda/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from aiostream.core import pipable_operator, streamcontext
from aiostream.stream import advanced

from spire_csda.client import Client
from spire_csda.models.link import DownloadLink
from spire_csda.models.item_collection import CSDAItemCollection
from spire_csda.models.search import CSDASearch
from nasa_csda.client import Client
from nasa_csda.models.link import DownloadLink
from nasa_csda.models.item_collection import CSDAItemCollection
from nasa_csda.models.search import CSDASearch

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion spire_csda/transport.py → nasa_csda/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from httpx import AsyncHTTPTransport, Request, Response
from tenacity import AsyncRetrying, stop_after_attempt, wait_exponential_jitter

from spire_csda.config import Settings
from nasa_csda.config import Settings

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "spire-csda"
name = "nasa-csda"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
Expand Down Expand Up @@ -28,7 +28,7 @@ pydantic-settings = "^2.4.0"
platformdirs = "^4.2.2"

[tool.poetry.scripts]
spire-csda = "spire_csda.cli:cli"
nasa-csda-cli = "nasa_csda.cli:cli"

[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
from stac_pydantic.api.search import FieldsExtension
from stac_pydantic.api.item import Item

from spire_csda.client import Client
from spire_csda.config import Settings
from spire_csda.models.item_collection import CSDAItemCollection
from spire_csda.models.search import CSDASearch
from nasa_csda.client import Client
from nasa_csda.config import Settings
from nasa_csda.models.item_collection import CSDAItemCollection
from nasa_csda.models.search import CSDASearch

T = TypeVar("T", bound=BaseModel)
HERE = Path(__file__).parent
Expand Down
2 changes: 1 addition & 1 deletion tests/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from aiostream.pipe import take
import pytest

from spire_csda.buffer import Buffer
from nasa_csda.buffer import Buffer


async def test_buffer_end():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
from tempfile import TemporaryDirectory

from spire_csda.client import Client
from nasa_csda.client import Client


async def test_authenticate(httpx_csda, config):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from aiostream.stream import iterate

from spire_csda.client import Client
from spire_csda.streaming import download, extract_links, search as search_
from nasa_csda.client import Client
from nasa_csda.streaming import download, extract_links, search as search_


async def test_search(httpx_csda_client, config, search):
Expand Down

0 comments on commit 92a479d

Please sign in to comment.