Operation on files

This example use comodo-calculator command is order to realized some operations on files. Keep in mind that this method realized the the described operation on the entire field uniformaly, optimized with parallel computation.

Basic operations

Add, Substract, Multiply, Divide

The most simple operators can be used to raised the topography:

rep=/ecola/share/tmp/training/bathymetry/
comodo-calculator -i $rep/etopo-37_IBI.nc =lon =lat z=topography \
                  -f "z_raised=z+50" \
                  -o etopo-37_IBI-raised.nc

or invert it:

rep=/ecola/share/tmp/training/bathymetry/
comodo-calculator -i $rep/etopo-37_IBI.nc =lon =lat z=topography \
                  -f "z_inv=-z" \
                  -o etopo-37_IBI-inverted.nc

Functions

Some functions are already coded and can be directly used, as some exemple are presented below (list of available functions).

Norm and phase for complex variables

HRET is a internal tides atlas that provide the complex coefficient for several tidal waves. As the coefficient are given in Real and Imaginary part, you can convert to Amplitude and Phase lag:

rep=/ecola/share/tmp/training/HRET/
comodo-calculator -i $rep/HRET_v8.1.nc =longitude =latitude =M2re =M2im \
                  -f "M2a=abs(M2re+1j*M2im); M2g=-r2d*arg(M2re+1j*M2im); M2g?atted({units},{degrees})" \
                  -o M2-ag.nc
ncatted -a "units,ITg,o,c,deg" tmp/M2-ag.nc

The use of “?atted” can force the value of the attributes in the saved files. Here, the attribute “units” is set to “degrees” for the phase lag variable “M2g”.

Norm for velocity vector

rep=/ecola/share/tmp/training/FES2014/
comodo-calculator -i $rep/M2.FES2014.nc =longitude =latitude =Ua =Va -f "velocity_norm=ellipseM(Ua,Va)" -o M2-velocity.nc