Skip to content

JRGDTRH/erddap-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ERDDAP-CLI: A Command-Line Interface for ERDDAP Servers

Version 1.0

  • Version note - Planning to incorporate better server error handling for nan returns or bad queries. Testing spatial bounds in searches with the goal to point towards a csv or shapefile for BBOX. General testing for bugs/errors all around. Began initially as an MCP project, turned into a CLI project due to erddap2mcp already existing. ERDDAP has always been accessible through different formats, but I just wanted to take my own jab at making some tools.

Introduction

ERDDAP-CLI is a command-line interface tool designed to empower users to effortlessly query and download datasets directly from ERDDAP (Environmental Research Division's Data Access Program) servers. This tool simplifies the process of accessing environmental data, providing a convenient way to interact with ERDDAP's extensive data catalog using familiar command-line commands.

Installation

To install the erddap-cli tool, download the repo to your desired location. The dependencies are listed in the requirements.txt file.

First, navigate to the erddap-cli folder in your terminal. Then, run the following commands:

pip install -r requirements.txt
pip install -e .

This will install the required libraries (erddapy, pandas, requests) and install erddap-cli as an editable package, allowing you to run it directly from the command line using the erddap-cli command.

ERDDAP-CLI Help

  • Example command - "erddap-cli -h/--help", "erddap-cli fetch -h/--help"

Managing ERDDAP Servers

The erddap-cli provides commands for managing ERDDAP servers you want to interact with. These commands are located in the erddap_cli/commands/servers.py file.

Searching and Describing ERDDAP Datasets

The tool includes functionalities for finding and understanding datasets on ERDDAP servers. These commands are found in erddap_cli/commands/search.py and erddap_cli/commands/describe.py.

  • Searching Datasets: Search for datasets on a specified ERDDAP server. You can use various filters, such as spatial and temporal bounds, to narrow down your search results. Limits return window, but provides pagination options. *Combine any keywords with a "+", e.g. text1+text2

  • **Example Command - "erddap-cli search --server https://www.neracoos.org/erddap --query temperature+grid"

  • Describing Datasets: Retrieve and display detailed metadata for a specific dataset. This includes information about its dimensions, variables, and other relevant attributes. You can choose from different output formats (text, JSON, YAML) and sections (all metadata, variables only, or dimensions only).

  • **Example Command - "erddap-cli describe --server https://www.neracoos.org/erddap" --dataset-id WW3_EastCoast_latest --section all"

Fetching Data from ERDDAP Datasets

erddap-cli offers an interactive workflow for downloading csv data from ERDDAP datasets, implemented in erddap_cli/commands/fetch.py.

The fetch command guides you through the following steps:

  1. Select Server: Choose the ERDDAP server you want to fetch data from.
  2. Select Dataset: Select the specific dataset on the chosen server.
  3. Select Protocol: Choose the data access protocol (TableDAP or GridDAP) supported by the dataset.
  4. Select Variables: Choose the variables you want to download.
  5. Specify Constraints or Slices: For TableDAP, specify constraints to filter the data. For GridDAP, define slices to select specific ranges of dimensions.
  6. Generate Download URL: The tool generates the appropriate download URL based on your selections.
  7. Fetch and Preview Data (Optional): The tool fetches the data and provides a preview.
  8. Save Data (Optional): You have the option to save the fetched data to a CSV file.
    • Example Command: erddap-cli fetch --output ./csvoutput.csv

Usage Examples

  • Help Results:
erddap-cli-h
  • Server Example:
erddap-cli-servers
  • Search Example:
eddap-cli-search
  • Describe Example:
erddap-cli-describe1 erddap-cli-describe2
  • Fetch Example:
erddap-cli-fetch1 erddap-cli-fetch2

License

This project is open source and available under the MIT License.