# 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 nasa-csda
```
## Using the CLI
See the command's help dialog for detailed usage information for all commands.
```bash
nasa-csda-cli --help
```
All of the commands require login information (the same username and password
used to log into the web page). You can also set environment variables to provide
these credentials.
```bash
export CSDA_USERNAME=<username>
export CSDA_PASSWORD=<password>
```
### Bulk downloading files
The catalog's [web page](https://nasa-csda.wx.spire.com/) provides the
ability to download a query configuration file that can be provided to
the CLI to download all files matching the query created in the UI. To
download all files using this configuration file,
```bash
nasa-csda-cli --username <username> --password <password> bulk-download download-config.json
```
### Querying the catalog
You can also construct queries to perform custom tasks using the `query`
command.
```bash
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
```
By default, this will download all matching files in the same way that the bulk
download does. There are two additional modes of operation this command supports.
#### Listing download links
In `list` mode, a link to all files will be printed to STDOUT.
```bash
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
```
```
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
https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-55-05_FM105_R14_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-55-05_FM105_R14.nc
https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-54-35_FM105_G07_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-54-35_FM105_G07.nc
https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-54-12_FM104_G32_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-54-12_FM104_G32.nc
https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-53-50_FM105_G30_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-53-50_FM105_G30.nc
https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-52-32_FM085_G31_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-52-32_FM085_G31.nc
https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-52-07_FM105_G12_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-52-07_FM105_G12.nc
https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-51-38_FM106_G03_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-51-38_FM106_G03.nc
https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-51-35_FM105_E03_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-51-35_FM105_E03.nc
https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-51-32_FM104_G25_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-51-32_FM104_G25.nc
```
#### Getting raw GeoJSON objects
In `raw` mode, the command will stream out GeoJSON objects conforming to the STAC spec.
```bash
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
```
### Using the CLI to authenticate requests
Advanced users can use the `token` command to generate authentication headers that allow
downloading files using other tools.
```bash
TOKEN="$(nasa-csda-cli token)"
curl -O -L -H "Authorization: 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
The library can be directly for custom behavior. See the [examples](examples) for information
on how to use it.
Raw data
{
"_id": null,
"home_page": null,
"name": "nasa-csda",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "Development Status :: 5 - Stable, License :: OSI Approved :: MIT License, Programming Language :: Python :: 3.9, Programming Language :: Python :: 3.10, Programming Language :: Python :: 3.11, Programming Language :: Python :: 3.12",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/08/03/7d066465359b8a4698910d6dc8a410f49cece0a0c8f505fd19a378780d4a/nasa_csda-1.2.0.tar.gz",
"platform": null,
"description": "# nasa-csda-cli\n\nThis is a CLI and SDK for querying and downloading files from Spire's\n[CSDA catalog](https://nasa-csda.wx.spire.com/).\n\n## Install it from PyPI\n\n```bash\npip install nasa-csda\n```\n\n## Using the CLI\n\nSee the command's help dialog for detailed usage information for all commands.\n\n```bash\nnasa-csda-cli --help\n```\n\nAll of the commands require login information (the same username and password\nused to log into the web page). You can also set environment variables to provide\nthese credentials.\n\n```bash\nexport CSDA_USERNAME=<username>\nexport CSDA_PASSWORD=<password>\n```\n\n### Bulk downloading files\n\nThe catalog's [web page](https://nasa-csda.wx.spire.com/) provides the \nability to download a query configuration file that can be provided to\nthe CLI to download all files matching the query created in the UI. To\ndownload all files using this configuration file,\n\n```bash\nnasa-csda-cli --username <username> --password <password> bulk-download download-config.json\n```\n\n### Querying the catalog\n\nYou can also construct queries to perform custom tasks using the `query`\ncommand.\n\n```bash\nnasa-csda-cli query --start-date 2020-01-01 --end-date 2020-01-02 \\\n --products opnGns,atmPhs \\\n --min-latitude -50 --max-latitude 50 --min-longitude -50 --max-longitude 50\n```\n\nBy default, this will download all matching files in the same way that the bulk\ndownload does. There are two additional modes of operation this command supports.\n\n#### Listing download links\n\nIn `list` mode, a link to all files will be printed to STDOUT.\n\n```bash\nnasa-csda-cli query --start-date 2020-01-01 --end-date 2020-01-02 \\\n --products opnGns,atmPhs \\\n --min-latitude -50 --max-latitude 50 --min-longitude -100 --max-longitude 100 \\\n --mode list --no-progress --limit 10\n```\n```\nhttps://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\nhttps://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-55-05_FM105_R14_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-55-05_FM105_R14.nc\nhttps://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-54-35_FM105_G07_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-54-35_FM105_G07.nc\nhttps://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-54-12_FM104_G32_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-54-12_FM104_G32.nc\nhttps://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-53-50_FM105_G30_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-53-50_FM105_G30.nc\nhttps://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-52-32_FM085_G31_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-52-32_FM085_G31.nc\nhttps://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-52-07_FM105_G12_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-52-07_FM105_G12.nc\nhttps://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-51-38_FM106_G03_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-51-38_FM106_G03.nc\nhttps://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-51-35_FM105_E03_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-51-35_FM105_E03.nc\nhttps://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-51-32_FM104_G25_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-51-32_FM104_G25.nc\n```\n\n#### Getting raw GeoJSON objects\n\nIn `raw` mode, the command will stream out GeoJSON objects conforming to the STAC spec.\n\n```bash\nnasa-csda-cli query --start-date 2020-01-01 --end-date 2020-01-02 \\\n --products opnGns,atmPhs \\\n --min-latitude -50 --max-latitude 50 --min-longitude -100 --max-longitude 100 \\\n --mode raw --no-progress --limit 1\n```\n\n### Using the CLI to authenticate requests\n\nAdvanced users can use the `token` command to generate authentication headers that allow\ndownloading files using other tools.\n\n```bash\nTOKEN=\"$(nasa-csda-cli token)\"\ncurl -O -L -H \"Authorization: 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\n```\n\n## Using the SDK\n\nThe library can be directly for custom behavior. See the [examples](examples) for information\non how to use it.\n\n",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "1.2.0",
"project_urls": null,
"split_keywords": [
"development status :: 5 - stable",
" license :: osi approved :: mit license",
" programming language :: python :: 3.9",
" programming language :: python :: 3.10",
" programming language :: python :: 3.11",
" programming language :: python :: 3.12"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "63b0ae772fced7db8ed1fd602eb74e2bc2eece53f94f9df9c66bdf5fda7d8a2a",
"md5": "e6bfe446e11175812e225f5e01f661d7",
"sha256": "423109d1c71df8f0881a48c9d13b448c356b95c09ddbdf0202cde52f30fafbc9"
},
"downloads": -1,
"filename": "nasa_csda-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e6bfe446e11175812e225f5e01f661d7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 15377,
"upload_time": "2024-08-20T15:30:59",
"upload_time_iso_8601": "2024-08-20T15:30:59.530420Z",
"url": "https://files.pythonhosted.org/packages/63/b0/ae772fced7db8ed1fd602eb74e2bc2eece53f94f9df9c66bdf5fda7d8a2a/nasa_csda-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "08037d066465359b8a4698910d6dc8a410f49cece0a0c8f505fd19a378780d4a",
"md5": "ea649f419e17deda82bf9c233d451c1e",
"sha256": "c3cc40d6d05cb7abdf4148e983c07dc55904fab63cfd148f46e5e9cfadf40837"
},
"downloads": -1,
"filename": "nasa_csda-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "ea649f419e17deda82bf9c233d451c1e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 13087,
"upload_time": "2024-08-20T15:31:00",
"upload_time_iso_8601": "2024-08-20T15:31:00.837039Z",
"url": "https://files.pythonhosted.org/packages/08/03/7d066465359b8a4698910d6dc8a410f49cece0a0c8f505fd19a378780d4a/nasa_csda-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-20 15:31:00",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "nasa-csda"
}