Hi,
I have two big netCDF files on which I’d like to perform a calculation to return a third one.
The operation is : 1.25 * 1e-3 * sqrt(u^2 + v^2) * u ;
I tried the following syntax and only computed the 1st day (or so it seems).
gmt grdmath 1.25 0.0013 MUL $u $u MUL $v $v MUL ADD SQRT MUL $u MUL = w.nc
(u and v are 3D data with longitude[1440], latitude[721] and time[14610]).
Thanks,
Guillaume
Well the operation would be
gmr grdmath $u $u MUL $v $v MUL ADD SQRT $u MUL 0.00125 MUL = w.nc
but GMT won’t be able to compute over 3D grids, only 2D layers and then it has no way to reconstruct back 3D stack.
Hi Guillaume,
If you’re using Linux or UNIX, one get of jail as painlessly as possible way would be to install the NetCDF Operators (https://github.com/nco/nco) and then use the ncap2 operator to do your calculation.
Cheers,
Tim
Hi,
Thanks for the both of you. I’ll give a shot to ncap2…
edit : I ended up using Matlab and saving A LOT of memory with this command :
var_ID = netcdf.defVar(ncid,paramID,'NC_SHORT',[dimlon dimlat dimtime]);
Best,
Guillaume