Comodo Calculator¶
Version: 3.2.3 (Mercurial revision 5770:c90c3015e72d, 2026-05-22)
Description¶
comodo-calculator is a calculator, variable extractor, and compiler for scientific data. It supports input files in NetCDF, GRIB, GeoTIFF, and ASCII formats. The output format defaults to NetCDF but can be GeoTIFF if the last input file is in GeoTIFF format.
For ASCII inputs, specify column indices as variable names (e.g., time=col0).
Usage¶
comodo-calculator -i file1.nc [var1]=ncVarName1 [ncPhaseVarName1] [[AXES:n0,...]] [ [var2]=ncVarName2 ...] [-i file2.nc ...] [OPTIONS]
Options¶
Option |
Description |
|---|---|
|
Display help and exit. |
|
Path to an input file (NetCDF, GRIB, GeoTIFF, or ASCII). |
|
Path to the output file. |
|
Formula to apply. If it starts with |
|
Compression level for NetCDF output. Default is |
|
Preserve the input file if it is identical to the output file. |
|
Enforce fixed data types. |
Examples¶
Extract Variables from a File¶
comodo-calculator -i grid.nc =longitude =latitude =depth -o bathymetry.nc
Add Variables to an Existing File¶
comodo-calculator -i tugo.state-2018.01.nc =time =bathymetry =lon =lat =triangles =edges =elevation =ubar =vbar -o tugo.state-2018.01-reduced.nc
Extract Variables from Multiple Files into One¶
comodo-calculator -i grid.nc =longitude =latitude =depth -i modelOutput.nc =elevation -o extract.nc
Extract and Rename Variables from Multiple Files¶
comodo-calculator -i grid.nc =longitude =latitude depth1=depth -i modelOutput.nc depth2=depth -o compilation.nc
Compute a Water Index¶
comodo-calculator -i T30TXR_20181021T110101_B03_ROI.tiff c=1 -i T30TXR_20181021T110101_B11_ROI.tiff b=1 -f "a=c-b; d=b+c; c=a/d" -o MNDWI.tif
Produce NetCDF from ASCII¶
comodo-calculator -i test.dat time=col0 lat=col14 lon=col15 -f "time?atted({units},{days since 1950-01-01})" -o test.nc
Notes¶
If the output file path ends with
.nc, it is treated as a NetCDF file.If the last input file is a GeoTIFF, the output can also be saved as GeoTIFF.
Use
--create=noto avoid overwriting existing files if the input and output are identical.
Valid operators, variables and function for formula¶
Operators¶
Name |
Description |
|---|---|
|
Addition, difference, product, ratio, power, scalar product |
Variables¶
Name |
Description |
|---|---|
|
Degree to radian (π/180) |
|
Radian to degree (180/π) |
|
π |
|
Exponential |
|
Not a number |
Functions¶
Name |
Description |
|---|---|
|
Norm (real or complex) |
|
Phase lag (complex) |
|
Exponential |
|
Zonal point to point difference |
|
Meridian point to point difference |
|
Cosine |
|
Sine |
|
Hyperbolic sine |
|
Zonal difference to the neighbor pixel |
|
Meridian difference to the neighbor pixel |
|
Flip along x-axis |
|
Flip along y-axis |
|
Interpolate the masked value with the nearest one |
|
Norm of vector or maximum current of ellipse |
See Also¶
GDAL Documentation (for GeoTIFF support)