Vertical height interpolation
Added by Rodrigo Sousa over 3 years ago
I have a lot of .grib2 files from ECMWF.
In these files, I have four variables:
10u (u wind in 10 meters)
10v (v wind in 10 meters)
100u (u wind in 100 meters)
100v (v wind in 100 meters)
I want to interpolate the 100 meters variables to 75m. Can anyone help me?
Attached is an example data.
Replies (3)
RE: Vertical height interpolation - Added by Ralf Mueller over 3 years ago
hi Rodrigo!
which interpolation method to you want to use? inverse distance weighted?
RE: Vertical height interpolation - Added by Ralf Mueller over 3 years ago
in case the answer is yes, you might use this call
cdo infov -expr,'w100=0.722222;w10=0.2777778;v75=w100*100v+w10*10v;u75=w100*100u+w10*10u' D1D04150000042200001.grib2
I computed the weights with this small script (using ruby and the numo-narray gem)
require 'numo/narray'
dists = Numo::NArray[25.0, 65.0]
dFull = dists.sum
values = Numo::NArray[100.0,10.0]
# following stack overflow
weights = 1/dists
weights /= weights.sum
p weights
# example usage
newValue = values.dot(weights)
#p newValue
which prints the eights to be
[0.722222, 0.277778]
.RE: Vertical height interpolation - Added by Rodrigo Sousa over 3 years ago
Thanks Ralf.
It works fine.