'How to multiply with a constant a selected region of a gridded Netcdf file for all the variables with NCO or CDO?
I have a gridded netcdf file with several variables.
I want to multiply all the variables with a constant value c but ONLY for a selected region of the grid.
with NCO for one variable for example I do the following
ncap2 -s 'where((lat >= 40.55 && lat <= 40.7) && (lon >= 22.8 && lon <= 23)) var1=var1*0.55;' in.nc out.nc
since I have over 20 variables in the netcdf file , how I could define to multiply all the variables?
Solution 1:[1]
Have you tried ncap2's Vpointer functionality? Create a Vpointer list based on the variables you want. Loop through the list and apply the where statement you have above to each variable.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Charlie Zender |
