CLI Reference

SatelliteGridding.jl includes a command-line interface via bin/grid.jl.

Usage

julia --project=. bin/grid.jl <command> [options]

Commands

l2 — Grid Level-2 Data

Grid satellite Level-2 data with footprint oversampling.

julia --project=. bin/grid.jl l2 [options]

Options

FlagTypeDefaultDescription
--config, -cStringrequiredTOML/JSON configuration file
--outFile, -oStringgridded_output.ncOutput NetCDF filename
--latMinFloat32-90Lower latitude bound
--latMaxFloat3290Upper latitude bound
--lonMinFloat32-180Lower longitude bound
--lonMaxFloat32180Upper longitude bound
--dLatFloat321.0Latitude resolution (degrees, regular grid)
--dLonFloat321.0Longitude resolution (degrees, regular grid)
--gridTypeStringrectOutput grid: rect (lat/lon) or cs (cubed sphere)
--NcInt0Cubed-sphere cells per panel edge (e.g. 360 for C360); required with --gridType cs
--csConventionStringgmaoCubed-sphere convention: gmao (GEOS/GCHP) or equiangular
--startDateString2018-03-07Start date (YYYY-MM-DD)
--stopDateString2018-10-31Stop date (YYYY-MM-DD)
--dDaysInt8Time step in days (or months with --monthly)
--monthlyFlagfalseUse months instead of days for time step
--oversample_temporalFloat321.0Temporal oversampling factor
--sample_stepInt0Rolling mean: snapshot spacing in days (>0 enables rolling mode)
--window_daysInt0Rolling mean: averaging half-width N in days (window = center ± N)
--nOversampleInt0 (auto)Sub-pixel factor (0 = auto-compute)
--footprintStringquadFootprint geometry: quad or circle
--compSTDFlagfalseCompute standard deviation
--backendStringsequentialCompute backend: sequential, cpu, cuda, or metal
--keepGoingFlagfalseContinue after per-file processing errors

Examples

Global TROPOMI SIF at 0.5° / 8-day composites:

julia --project=. bin/grid.jl l2 \
    --config examples/tropomi_sif.toml \
    --dLat 0.5 --dLon 0.5 \
    --startDate 2019-01-01 --stopDate 2019-12-31 \
    --dDays 8 \
    -o tropomi_sif_2019_8day_05deg.nc

Regional OCO-2 XCO₂ with KA CPU backend:

julia --project=. bin/grid.jl l2 \
    --config examples/oco2_xco2.toml \
    --latMin -60 --latMax 80 \
    --dLat 2.0 --dLon 2.0 \
    --startDate 2019-01-01 --stopDate 2019-12-31 \
    --dDays 30 \
    --backend cpu \
    -o oco2_xco2_2019.nc

Monthly composites with standard deviation:

julia --project=. bin/grid.jl l2 \
    --config examples/tropomi_no2.toml \
    --dLat 0.25 --dLon 0.25 \
    --startDate 2019-01-01 --stopDate 2019-12-31 \
    --monthly --dDays 1 \
    --compSTD \
    -o tropomi_no2_2019_monthly.nc

GOSAT SIF with circular footprints:

julia --project=. bin/grid.jl l2 \
    --config examples/gosat_sif_center_radius.toml \
    --footprint circle --nOversample 80 \
    --backend cpu \
    --dLat 1.0 --dLon 1.0 \
    --startDate 2010-01-01 --stopDate 2010-12-31 \
    -o gosat_sif_2010_radius.nc

--footprint circle works with --backend sequential, cpu, cuda, and metal. CUDA and Metal require the corresponding optional Julia GPU package and hardware support.

Daily-sampled rolling mean over a centered ±7-day window (smooth time series):

julia --project=. bin/grid.jl l2 \
    --config examples/tropomi_sif.toml \
    --dLat 0.5 --dLon 0.5 \
    --startDate 2019-01-01 --stopDate 2019-12-31 \
    --sample_step 1 --window_days 7 \
    -o tropomi_sif_2019_rolling15d.nc

With --sample_step > 0 the run switches to rolling mode: it emits one snapshot every --sample_step days, each averaging the centered window [center − window_days, center + window_days] (here a 15-day window stepped daily). Consecutive windows overlap, so the time series is smooth; --dDays and --oversample_temporal are ignored. Each calendar day is gridded only once and reused across overlapping windows (in-memory day cache), so finer sampling does not re-grid the same data. The time coordinate holds the window center, and every output also carries window_start/window_end recording the exact averaging interval (these clip naturally at the data edges). Rolling mode runs on --backend sequential, on --gridType cs, and on --backend cpu/cuda/metal for the mean; --compSTD requires the sequential CPU path.

TROPOMI SIF onto a GEOS/GCHP C360 cubed sphere (sequential CPU only):

julia --project=. bin/grid.jl l2 \
    --config examples/tropomi_sif.toml \
    --gridType cs --Nc 360 \
    --startDate 2020-07-01 --stopDate 2020-07-16 --dDays 16 \
    -o tropomi_sif_c360.nc

See Cubed-Sphere Grids for the convention, output layout, and the bin/run_tropomi_c360.sh fan-out runner.

center — Grid Center-Coordinate Data

Grid data using center coordinates only (no footprint bounds). Suitable for MODIS-style data where each pixel maps to exactly one grid cell.

julia --project=. bin/grid.jl center [options]

Options

FlagTypeDefaultDescription
--config, -cStringrequiredTOML/JSON configuration file
--outFile, -oStringgridded_output.ncOutput NetCDF filename
--latMinFloat32-90Lower latitude bound
--latMaxFloat3290Upper latitude bound
--lonMinFloat32-180Lower longitude bound
--lonMaxFloat32180Upper longitude bound
--dLatFloat320.5Latitude resolution (degrees)
--dLonFloat320.5Longitude resolution (degrees)
--startDateString2018-01-01Start date (YYYY-MM-DD)
--stopDateString2018-12-31Stop date (YYYY-MM-DD)
--dDaysInt1Time step in days (or months with --monthly)
--monthlyFlagfalseUse months instead of days for time step
--geoProviderStringautoCenter geolocation provider: auto, variables, lut, or modis
--geoTableString(none)Path to legacy monolithic geolocation lookup table (NetCDF)
--geoCacheStringuser cacheDirectory for generated per-tile MODIS sinusoidal geolocation
--vegIndicesFlagfalseCompute vegetation indices (EVI, NDVI, NIRv, NDWI)
--keepGoingFlagfalseContinue after per-file processing errors

Example

julia --project=. bin/grid.jl center \
    --config examples/modis_reflectance.toml \
    --dLat 0.05 --dLon 0.05 \
    --startDate 2019-01-01 --stopDate 2019-12-31 \
    --geoProvider modis \
    --vegIndices \
    -o modis_2019.nc

MODIS geolocation tiles are generated on demand into the user cache. They can also be generated ahead of time:

julia --project=. bin/generate_modis_geolocation.jl \
    --tiles h08v04,h09v04 \
    --cacheDir ~/.cache/SatelliteGridding/modis/sinusoidal_2400px_v1

Backends

BackendFlagDescription
Sequential--backend sequentialDefault. Uses Welford's online algorithm for mean/std. Single-threaded. Supports --compSTD.
KA CPU--backend cpuKernelAbstractions CPU backend. Parallel sort + subpixel computation. Sum-based accumulation.
KA CUDA--backend cudaKernelAbstractions CUDA backend. Requires CUDA.jl. All computation on GPU with atomic scatter.
KA Metal--backend metalKernelAbstractions Metal backend. Requires Metal.jl on macOS/Apple GPU.

The KernelAbstractions backends use sum-based accumulation (mean = sum/weight) instead of Welford's incremental mean. This is fully parallelizable but does not support --compSTD in a single pass. Standard deviation with KA backends requires a two-pass approach.