I have gridded 4D (lonlatplevtime) data, where lon and lat represent longitude and latitude, and plev designates the vertical pressure level. I want to extract the data only along a straight line of multiple longitude-latitude pair points so that I can finally obtain 3D (xplev*time) data, where x represents the dimension of lon-lat pair points. Now, the straight line has 781 longitude-latitude pair points. However, the sizes of the longitude and latitude in the gridded data are 501x1 and 901x1, respectively.
Earlier, I successfully extracted the value from the same 4D data only for a station location (i.e., only a latitude-longitude point) using the following CDO command line:
cdo -remapnn,"lon=77.222_lat=28.588" data.nc data_NewDelhi.nc
But this time I want to extract data from the same gridded data but only along the straight line of 781 latitude-longitude pair points, and then store the data in the new netcdf file. Thus, the final netcdf file should have a size of 781 * plev * time
.
So, my question is: Is there a command line in CDO to perform this operation?
To do this using CDO you first need to create an unstructured grid file. The example below will work for 2 data points. Replace it with the 70 grid points you need. Just call a file grid and put the following in it.
gridtype = unstructured
gridsize = 2
xvals = 0 10
yvals = 0 10
Once you have defined that file, you can regrid in CDO in a similar way to what you have shown:
cdo remapnn,grid in.nc out.nc