Skip to content

Latest commit

 

History

History
158 lines (128 loc) · 7.03 KB

cli.md

File metadata and controls

158 lines (128 loc) · 7.03 KB
title CLI
command does
gaia stage <dataset> stage one dataset
gaia stage --config stage several datasets from a stage file or preset
gaia align put staged rasters on one grid and time step, in a new store
gaia catalog rebuild build a STAC catalog of the stores under a prefix
gaia prism fill fill the shared PRISM cache (maintainers)

Every option is listed in the reference and in gaia <command> --help.

(stage)=

gaia stage <dataset>

AOI=https://raw.githubusercontent.com/DSHydro/skagit-met/refs/heads/main/data/GIS/SkagitBoundary.json

gaia stage prism -i $AOI -s 2025-12-01 -e 2025-12-20 -o skagit   # timed: needs -s and -e
gaia stage dem   -i $AOI -o skagit --skip-existing               # static: no window
  • -i is a vector file or URL holding a single Polygon.
  • -s and -e are UTC. A date-only -e includes the whole day. Timed datasets read one extra day beyond each end, so that periods crossing the edges (such as the PRISM day) are complete.
  • -o is an output folder, local or s3://. The store is named after the folder.
  • --skip-existing adds a dataset to an existing store, e.g. to retry one that failed. --overwrite replaces the store. Run one gaia stage at a time per output folder: --skip-existing checks the store's groups when it starts, so a group another run writes in the meantime fails with unexpected encoding parameters for zarr backend: ['coordinates'].
  • --dry-run checks the arguments and the AOI without fetching anything.

(stage-files)=

gaia stage --config

A stage file lists the AOI, the window and the datasets for one event:

name: skagit-2025-12                  # names the store
aoi: https://raw.githubusercontent.com/DSHydro/skagit-met/refs/heads/main/data/GIS/SkagitBoundary.json
window: 2025-12-01/2025-12-20         # whole days, end included
datasets:
  synoptic: {}
  prism: {variables: [ppt, tmax]}
  hrrr: {}
  nlcd: {year: 2021}
  dem/usgs10m: {}                     # the key names the product
gaia stage --config skagit.yaml --dry-run        # validate and print, fetch nothing
gaia stage --config skagit.yaml -o skagit
gaia stage --config skagit.yaml -o skagit --only prism,hrrr
  • Each dataset's options are the same as its CLI flags. A dataset can set its own aoi and window.
  • An AOI can also be a bounding box, {bbox: [west, south, east, north]}, or a circle, {latitude: 48.5, longitude: -121.5, radius_km: 20}.
  • A dataset that fails doesn't stop the others. Rerun with --skip-existing to retry only the failed ones.
  • A missing token (SYNOPTIC_TOKEN for synoptic, ARRAYLAKE_TOKEN for era5) is warned about before anything is staged, and by --dry-run.
  • A dataset larger than 10 GB fails before it is written; use a smaller AOI or window.
  • --config can be an http(s) URL, e.g. a stage file in another repository. Its AOIs must then be URLs or inline, not paths.

A preset is a built-in stage file without an AOI or window. conus-precip stages Synoptic, PRISM and HRRR precipitation:

gaia stage --config conus-precip -i $AOI -s 2025-12-01 -e 2025-12-20 -o skagit

(align)=

gaia align

gaia align -i skagit/skagit.zarr -o skagit-aligned
gaia align -i skagit/skagit.zarr -o skagit-10m --crs EPSG:32610 --res 10

Writes a new store with every raster on one grid and time step. By default it uses the coarsest of each: for PRISM and HRRR, HRRR's 3 km grid and PRISM's days. Values are combined in time according to their cell_methods (precipitation is summed, temperature averaged), each source step weighted by how much of it lies inside each target step: a step that straddles a target edge is split between the two by time, and a longer step (a PRISM day aligned onto hours) is spread evenly over the shorter ones. Missing values within a dataset's time span are skipped, so a total counts the data present; a step that reaches beyond the span (a PRISM day starting before hourly data does) is NaN rather than a partial total. gaia_cli.align.overlap() gives the same weights for analysis code. In space each dataset uses its own default resampling (conservative for PRISM and HRRR, bilinear for DEMs, mode for categories), which --method overrides, for every dataset or for one (-m dem/usgs10m=cubic). Variables without time, such as ERA5's orography, are only regridded. The input store is not changed.

Scene datasets (sentinel1-rtc, opera-rtc, sentinel2) keep their acquisition times: they are put on the grid, but not combined in time, and the default time step is the coarsest of the other datasets. To total weather between passes, make a scene dataset the target. Each step then runs from one pass to the next; hourly ERA5 between passes at 16:29:38 twelve days apart gives the 287 hours wholly between them plus a share of the two hours each pass falls in:

gaia align -i peters-dome/peters-dome.zarr -o peters-dome-aligned \
  --like rasters/sentinel1-rtc --time-like rasters/sentinel1-rtc

--align-scenes combines scene datasets in time too, onto the same steps as the rest.

Variables keep their staged names. To select the same quantity in every group (ds.cf["precipitation"]), see .

--crs utm --res 10 --aoi $AOI builds a grid from the AOI alone: its UTM zone, its bounds snapped outward to multiples of 10 m, and NaN in cells whose center is outside it. This is the analysis grid of the landlab workflow:

gaia align -i pioneer/pioneer.zarr -o pioneer-10m --aoi $AOI --crs utm --res 10 \
  -m dem/usgs10m=cubic -m rasters/burn-severity=nearest -m rasters/nlcd=nearest

To write GeoTIFF or ESRI ASCII files from the result, use GDAL ().

(catalog)=

gaia catalog rebuild

gaia catalog rebuild -p s3://gaia-scratch/gaia-cli

Collects the STAC Items of every store under a prefix into a catalog.json. The public stores are browsable in STAC Browser and on a map in stac-map. The GitHub stage workflows rebuild it after copying their stores to S3.

gaia-scratch deletes objects 30 days after they are written. Each Item's expires property gives the date, and rerunning the command with --overwrite starts the 30 days again. A store appended to with --skip-existing loses its first groups first, and their missing chunks would read as NaN, so the rebuild leaves out Items past their expires.

(prism-cache)=

gaia prism fill

gaia prism fill -s 2025-12-01 -e 2025-12-31 -v ppt tmean

PRISM limits downloads, so gaia reads PRISM from a shared cache. gaia stage prism fills missing days automatically when you have write access to the cache. Otherwise only cached days can be staged. gaia prism fill pre-fills a range.