Project

General

Profile

Interpolation along specific line of longitude

Added by Zachary Remling almost 3 years ago

Hello cdo community,
I am having a slight problem with an interpolation that I am running. I am using the rtofs currents data set which is a curvilinear dataset. I have used remap bilinear to map the curvilinear data to a lat long grid and it, for the most part, works. However it creates a line of null values down part of the 0 degree of longitude that should not be there.

I was wondering if there is a cdo command that I could run to interpolate across the 0 longitude where it is null to fix the nulls.

For a bit more context my grid definition is :
gridtype=lonlat
xsize=4500
ysize=2108
xinc=0.08
yinc=0.08
yfirst=-78.64

cdo commands :
cdo remapbil,$(aboveGridDeff) $(inFile) $(outFile)
cdo sellonlatbox,-180,180,-90,90 $(inFile) $(outFile)

Data Example:
https://nomads.ncep.noaa.gov/pub/data/nccf/com/rtofs/prod/rtofs.20210528/rtofs_glo_2ds_f000_prog.nc

Thanks in advance for any advice you can give!


Replies (4)

RE: Interpolation along specific line of longitude - Added by Uwe Schulzweida almost 3 years ago

Here are the first lines of the sinfon output for your data:

cdo sinfon rtofs_glo_2ds_f000_prog.nc
   File format : NetCDF4 zip
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter name
     1 : NCEP     HYCOM    v instant       1   1  14841000   1  F32z : u_velocity    
     2 : NCEP     HYCOM    v instant       1   1  14841000   1  F32z : v_velocity    
     3 : NCEP     HYCOM    v instant       1   2  14841000   1  F32z : sst           
     4 : NCEP     HYCOM    v instant       1   2  14841000   1  F32z : sss           
     5 : NCEP     HYCOM    v instant       1   1  14841000   1  F32z : layer_density 
   Grid coordinates :
     1 : curvilinear              : points=14841000 (4500x3298)
                        Longitude : 74.12 to 1019.12 degrees_east  circular
                         Latitude : -78.64 to 89.97772 degrees_north
                          mapping : Projection
                                X : 1 to 4500 by 1 m
                                Y : 1 to 3298 by 1 m
The range of the longitudes is 74.12 to 1019.12. Longitudes grather than 720 degress are confusing the search algorithym in CDO. There is only one longitude line at the northpole with values grather than 720, remove it if you don't really need it:
cdo remapbil,<targetgrid> -selindexbox,1,4500,1,3297 rtofs_glo_2ds_f000_prog.nc result

RE: Interpolation along specific line of longitude - Added by Zachary Remling almost 3 years ago

Thanks for the reply I'll give this a try :)

RE: Interpolation along specific line of longitude - Added by Zachary Remling almost 3 years ago

Just wanted to say thank Uwe Schulzweida this seems to have done the trick. I do find it weird though that when I ran the commands separately (cdo remapbil,<targetgrid> <in> <out> then cdo selindexbox,1,4500,1,3297 <in> <out>;) the same longitude problem happened but when running them as one it worked just fine. All in all thanks for the help!!!

RE: Interpolation along specific line of longitude - Added by Zachary Remling almost 3 years ago

Zachary Remling wrote in RE: Interpolation along specific line of longitude :

Just wanted to say thank Uwe Schulzweida this seems to have done the trick. I do find it weird though that when I ran the commands separately (cdo remapbil,<targetgrid> <in> <out> then cdo selindexbox,1,4500,1,3297 <in> <out> ) the same longitude problem happened but when running them as one it worked just fine. All in all thanks for the help!!!

    (1-4/4)