Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Subsetting Data with the GDEX API

Authors
Affiliations
NSF NCAR
NSF NCAR
NSF NCAR

Overview

GDEX supports server-side subsetting by time range, spatial region, and variable. This notebook shows how to build and submit a subset request using the API.

  1. Retrieve subsettable parameters via the control file template

  2. Build a JSON control file

  3. Submit a subset request

  4. Check status and retrieve output files

Prerequisites

ConceptsImportanceNotes
api_introNecessaryGDEX API conventions
api_metadataHelpfulKnow your dataset’s variables and coverage
GDEX account and tokenNecessaryRegister at https://gdex.ucar.edu
  • Time to learn: 25 minutes


Imports

Retrieving Subsettable Parameters

GET /control_file_template/{dsid}/ returns the JSON control file structure. GET /paramsummary/{dsid}/ summarises available parameters and date ranges.

{
  "status": "ok",
  "http_response": 200,
  "error_messages": [],
  "data": {
    "template": "dataset=ds084.1\ndate=201609200000/to/201609200000\ndatetype=init\nparam=TMP/R H/ABS V\nlevel=ISBL:850/700/500\n#oformat=netCDF\nnlat=30\nslat=-25\nwlon=-150\nelon=-30\nproduct=Analysis/12-hour Forecast/6-hour Forecast/18-hour Forecast\ntargetdir=/glade/scratch\n"
  },
  "contact": "datahelp@ucar.edu"
}

Building the Control File

Populate the control file fields: dataset ID, date range, spatial bounds, and selected variables/parameters.

Submitting and Monitoring

POST /submit_json/?token={token} submits the request and returns an rindex. Poll GET /status/{rindex}/?token={token} until the status is Completed.

Remember to set your TOKEN!

Retrieving Output Files

GET /get_req_files/{rindex}/?token={token} lists the resulting files. Download them or transfer via Globus.

Remember to set your TOKEN!

Summary

GDEX subset requests are asynchronous: submit a JSON control file, poll for completion, then retrieve the resulting files. Use DELETE /api/purge/{rindex}/ to clean up old requests.