resampling windspeed with bilinear method
Added by nazanin tavakoli almost 4 years ago
Hello, I want to resample wind speed data from 0.04 degrees to 0.5 degrees in cdo in windows.So, my code is this:
cdo remapbil,gridfile1.txt,w2001.nc bilinear.nc
and the gridfile1 is:
gridtype = lonlat
gridsize = 259200
xname = lon
xlongname = longitude
xunits = degrees_east
yname = lat
ylongname = latitude
yunits = degrees_north
xsize = 720
ysize = 360
xfirst = -179.75
xinc = 0.5
yfirst = -89.75
yinc = 0.5
but I have this error:
cdo (Abort): Too few streams specified! Operator remapbil,gridfile1.txt,w2001.nc needs 1 input and 1 output streams
could you please help me? I have sent my NetCDF file below.
Replies (9)
RE: resampling windspeed with bilinear method - Added by Ralf Mueller almost 4 years ago
hi!
your syntax is not correct for this operator, please use:
cdo -remapbil,<targetGrid> <inputData> <outputData>
hth
ralf
RE: resampling windspeed with bilinear method - Added by nazanin tavakoli almost 4 years ago
Thank you for your reply. I have another one. When I use the code below I have this error(cdo remapbil (Abort): Unsupported generic coordinates (Variable: src_grid_center_lat)!
cdo genbil,gridfile.txt w2001.nc w2001bil.nc
cdo remapbil,gridfile.txt w2001bil.nc w2001bilinear.nc
I have interpolated my wind speed data with the bilinear method in CDO and gdal but the output NetCDF of these 2 was totally different. I want to know that in CDO, the meaning of the bilinear method, when we use this code (cdo -remapbil,<targetGrid> <inputData> <outputData> is "The four-cell centers from the input raster are closest to the cell center for the output processing cell will be weighted and based on distance and then averaged" am I right?
I would appreciate it if you answer my question.
RE: resampling windspeed with bilinear method - Added by Ralf Mueller almost 4 years ago
You seem to want to interpolate the interpolation weights. the correct workflow is
- (A) use remapbil directly
cdo remapbil,gridfile.txt w2001.nc w2001_on_targetGrid.nc
OR - (B) generate interpolation weights and apply that weights with the general
remap
operatorcdo genbil,gridfile.txt w2001.nc w2001_interpolation_weights_bil.nc cdo remap,gridfile.txt,w2001_interpolation_weights_bil.nc w2001.nc w2001_on_targetGrid.nc
This has the advantage that you can use the interpolation weights for later operations on other files.
hth
ralf
RE: resampling windspeed with bilinear method - Added by nazanin tavakoli almost 4 years ago
I do not understand exactly what do you say. Actually, I want to extrapolate 20 NetCDF files that contain wind speed data from 0.04 degrees to 0.5. Which of these 2 codes do you recommend?
RE: resampling windspeed with bilinear method - Added by Ralf Mueller almost 4 years ago
if all input files have the same input grid, you can use procedure B
- create the interpolation weights ONCE
- apply them on all 20 files
RE: resampling windspeed with bilinear method - Added by nazanin tavakoli almost 4 years ago
When I use the code below,I have this error (cdo (Abort): Too few streams specified! Operator remap,gridfile.txt,w2001_winbil.nc needs 1 input and 1 output streams):
cdo genbil,gridfile.txt w2001.nc w2001_winbil.nc
cdo remap,gridfile.txt,w2001_winbil.nc w2001_Fbil.nc
you mean that I should use the following code for my files:
cdo genbil,gridfile.txt w2001.nc w2001_winbil.nc
cdo remap,gridfile.txt,w2001_winbil.nc w2001_Fbil.nc
cdo remap,gridfile.txt,w2001_winbil.nc w2002_Fbil.nc
cdo remap,gridfile.txt,w2001_winbil.nc w2003_Fbil.nc
..
?
RE: resampling windspeed with bilinear method - Added by Ralf Mueller almost 4 years ago
Please use the code I suggested. you missed the output file: This call from you
cdo remap,gridfile.txt,w2001_winbil.nc w2001_Fbil.ncdoes not mention the input data, but only the interpolation weights from one grid to another. It cannot be correct.
It must be like this
cdo remap,gridfile.txt,w2001_winbil.nc w2001.nc w2001_Fbil.nc cdo remap,gridfile.txt,w2002_winbil.nc w2002.nc w2002_Fbil.nc cdo remap,gridfile.txt,w2003_winbil.nc w2003.nc w2003_Fbil.nc . . .
The documentation is also built-in: Use
cdo -h remapfor having it in the terminal.
best wishes
ralf
RE: resampling windspeed with bilinear method - Added by nazanin tavakoli almost 4 years ago
Thank you for helping me. I have asked a question in this link (https://code.mpimet.mpg.de/boards/2/topics/10494?r=10505#message-10505). I want to know that do you have any idea about my last question?
I would appreciate it if you answer my question.
RE: resampling windspeed with bilinear method - Added by Ralf Mueller almost 4 years ago
I think you have to tread through the documentation of ncks
I also found a hint for an upgrade that can help: https://stackoverflow.com/questions/65380045/ncks-error-received-3-filenames-need-no-more-than-two
cheers
ralf