0

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?

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
Nat
  • 325
  • 2
  • 13

1 Answers1

0

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.

Charlie Zender
  • 5,929
  • 14
  • 19