Project

General

Profile

Extract values for station coordinates

Added by Jonas Müller over 4 years ago

Hello,

I am currently working with model data of the German weather service, which are available in .grb format.
I have already converted these into .nc files with the CDO package in Ubuntu.
Now I wanted to know if there is a possibility to extract the values for certain station coordinates from this model data with the CDO package?

Thanks in advance


Replies (3)

RE: Extract values for station coordinates - Added by Ralf Mueller over 4 years ago

hi Jonas!

Since the grid is not part of the data, you have to download it separately from https://opendata.dwd.de/weather/lib/cdo/.
check which grid is needed with

cdo sinfo
like this:
% cdo sinfov icon_global_icosahedral_single-level_2019100612_018_U_10M.grib2                                                                                                                                                                                                                         
   File format : GRIB2
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter name
     1 : DWD      unknown  v instant       1   1   2949120   1  P16  : 10u           
   Grid coordinates :
     1 : unstructured             : points=2949120
                             grid : number=26  position=1
                             uuid : a27b8de6-18c4-11e4-820a-b5b098c6a5c0
   Vertical coordinates :
     1 : height                   : levels=1
                           height : 10 m
   Time coordinate :  1 step
     RefTime =  2019-10-06 12:00:00  Units = minutes  Calendar = proleptic_gregorian
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  2019-10-07 06:00:00
cdo    sinfon: Processed 1 variable over 1 timestep [0.09s 66MB].

CDO prints a grid number (26) and a UUID. Download the correct one and attach it to the data within your CDO call:

% cdo sinfov -sellonlatbox,0,10,-10,10 -setgrid,icon_grid_0026_R03B07_G.nc icon_global_icosahedral_single-level_2019100612_018_U_10M.grib2
cdo(1) sellonlatbox: Process started
cdo(2) setgrid: Process started
   File format : GRIB2
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter name
     1 : DWD      unknown  v instant       1   1     13899   1  P16  : 10u           
   Grid coordinates :
     1 : unstructured             : points=13899  nvertex=3
                             clon : 8.511765e-17 to 0.1745291 radian
                             clat : -0.1745276 to 0.1745085 radian
                        available : cellbounds
   Vertical coordinates :
     1 : height                   : levels=1
                           height : 10 m
   Time coordinate :  1 step
     RefTime =  2019-10-06 12:00:00  Units = minutes  Calendar = proleptic_gregorian
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  2019-10-07 06:00:00
cdo(2) setgrid: Processed 1 variable over 1 timestep.
cdo(1) sellonlatbox: Processed 2949120 values from 1 variable.
cdo    sinfon: Processed 1 variable [0.74s 950MB].

for the selection of a special location I recommend using remapnn or what ever interpolation you like:

cdo infov -remapnn,lon=-22.2_lat=54.9 -setgrid,icon_grid_0026_R03B07_G.nc icon_global_icosahedral_single-level_2019100612_018_U_10M.grib2

hth
ralf

RE: Extract values for station coordinates - Added by Jonas Müller over 4 years ago

Hi Ralf!

I cant upload my data cause its to big but i can give u the download link (https://opendata.dwd.de/climate_environment/REA/COSMO_REA6/hourly/2D/CLCT/) - CLCT.2D.200901.grb
When I get the command "cdo sinfo CLCT.2D.200901.grb" I get the following output:

root@DESKTOP-PPMRK6S:/home/jonas/CDO/CLCT# cdo sinfo CLCT.2D.200901.grb
   File format : GRIB
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter ID
     1 : DWD      unknown  v instant       1   1    698752   1  P16  : 71.2
   Grid coordinates :
     1 : projection               : points=698752 (848x824)
                          mapping : rotated_latitude_longitude
                             rlon : -28.403 to 18.182 by 0.055 degrees
                             rlat : -23.403 to 21.863 by 0.05500122 degrees
   Vertical coordinates :
     1 : surface                  : levels=1
   Time coordinate :  unlimited steps
     RefTime =  2009-01-01 01:00:00  Units = hours  Calendar = proleptic_gregorian
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  2009-01-01 01:00:00  2009-01-01 02:00:00  2009-01-01 03:00:00  2009-01-01 04:00:00
  2009-01-01 05:00:00  2009-01-01 06:00:00  2009-01-01 07:00:00  2009-01-01 08:00:00
  2009-01-01 09:00:00  2009-01-01 10:00:00  2009-01-01 11:00:00  2009-01-01 12:00:00
  2009-01-01 13:00:00  2009-01-01 14:00:00  2009-01-01 15:00:00  2009-01-01 16:00:00
  2009-01-01 17:00:00  2009-01-01 18:00:00  2009-01-01 19:00:00  2009-01-01 20:00:00
  2009-01-01 21:00:00  2009-01-01 22:00:00  2009-01-01 23:00:00  2009-01-02 00:00:00
  2009-01-02 01:00:00  2009-01-02 02:00:00  2009-01-02 03:00:00  2009-01-02 04:00:00
  2009-01-02 05:00:00  2009-01-02 06:00:00  2009-01-02 07:00:00  2009-01-02 08:00:00
  2009-01-02 09:00:00  2009-01-02 10:00:00  2009-01-02 11:00:00  2009-01-02 12:00:00
  2009-01-02 13:00:00  2009-01-02 14:00:00  2009-01-02 15:00:00  2009-01-02 16:00:00
  2009-01-02 17:00:00  2009-01-02 18:00:00  2009-01-02 19:00:00  2009-01-02 20:00:00
  2009-01-02 21:00:00  2009-01-02 22:00:00  2009-01-02 23:00:00  2009-01-03 00:00:00
  2009-01-03 01:00:00  2009-01-03 02:00:00  2009-01-03 03:00:00  2009-01-03 04:00:00
  2009-01-03 05:00:00  2009-01-03 06:00:00  2009-01-03 07:00:00  2009-01-03 08:00:00
  2009-01-03 09:00:00  2009-01-03 10:00:00  2009-01-03 11:00:00  2009-01-03 12:00:00
   ................................................................................
   .......................................................
  2009-01-29 13:00:00  2009-01-29 14:00:00  2009-01-29 15:00:00  2009-01-29 16:00:00
  2009-01-29 17:00:00  2009-01-29 18:00:00  2009-01-29 19:00:00  2009-01-29 20:00:00
  2009-01-29 21:00:00  2009-01-29 22:00:00  2009-01-29 23:00:00  2009-01-30 00:00:00
  2009-01-30 01:00:00  2009-01-30 02:00:00  2009-01-30 03:00:00  2009-01-30 04:00:00
  2009-01-30 05:00:00  2009-01-30 06:00:00  2009-01-30 07:00:00  2009-01-30 08:00:00
  2009-01-30 09:00:00  2009-01-30 10:00:00  2009-01-30 11:00:00  2009-01-30 12:00:00
  2009-01-30 13:00:00  2009-01-30 14:00:00  2009-01-30 15:00:00  2009-01-30 16:00:00
  2009-01-30 17:00:00  2009-01-30 18:00:00  2009-01-30 19:00:00  2009-01-30 20:00:00
  2009-01-30 21:00:00  2009-01-30 22:00:00  2009-01-30 23:00:00  2009-01-31 00:00:00
  2009-01-31 01:00:00  2009-01-31 02:00:00  2009-01-31 03:00:00  2009-01-31 04:00:00
  2009-01-31 05:00:00  2009-01-31 06:00:00  2009-01-31 07:00:00  2009-01-31 08:00:00
  2009-01-31 09:00:00  2009-01-31 10:00:00  2009-01-31 11:00:00  2009-01-31 12:00:00
  2009-01-31 13:00:00  2009-01-31 14:00:00  2009-01-31 15:00:00  2009-01-31 16:00:00
  2009-01-31 17:00:00  2009-01-31 18:00:00  2009-01-31 19:00:00  2009-01-31 20:00:00
  2009-01-31 21:00:00  2009-01-31 22:00:00  2009-01-31 23:00:00  2009-02-01 00:00:00
cdo sinfo: Processed 1 variable over 744 timesteps [0.78s 38MB]

If I'm not mistaken, there's already a grid here.
So now i want to select the data for following coordinates:
latitude= 53.0316; longitude= 13.9907
So what do i have to do now?
Sorry, but i am a complete beginner at ubuntu and cdo.
Thanks in advance.
Jonas

RE: Extract values for station coordinates - Added by Ralf Mueller over 4 years ago

hi!

latitude range is from -23.403 to 21.862, so there will be no point with lat=53.0316 I think.

If it was there your would use

cdo remapnn,lon=13.9907_lat=53.0316 <ifile> <ofile>
and get the values at the nearest cell of the grid.

hth
ralf

    (1-3/3)