strange values ​​extracted with grads

All other topics about postprocessing model data (GrADS and other software), about other numerical weather prediction software (including WRF-NMM and WRF-ARW discussion unrelated to UEMS/WRF EMS), and general meteorology talk go in this forum.
dominic
Posts: 336
Joined: Thu Jun 14, 2012 7:19 am

Re: strange values ​​extracted with grads

Post by dominic » Tue Mar 18, 2014 7:35 pm

wrf_model wrote:
dominic wrote:hello ivan


I extract the data for grads use scripts created by users of this forum.

This: viewtopic.php?f=11&t=611

Code: Select all

    * open WRF output, change according to your set-up
    'open /WRFV3/wrfems/lastrun/wrf.ctl'

    * initialize variables, this creates a new time series file
    * with the first line containing a header
    outfile = 'wrf_timeseries.txt'
    code=write(''outfile,'sourcerundt;locationid;tau;t2m;dpt2m;rh2m;u10m;v10m;mslp;t850;rh850;t700;hgt700;hgt1000;dswrf;apcp;tcdc;vissfc;gustsfc')

    * append a time series to a file, one line for each location
    rc=savedata(52.15,4.42,1)

    'quit'

    * Savedata: function to save data for a specific location (lat lon)
    * locationid is a custom integer number for identifying the location, which you can use with a database
    function savedata(locationlat,locationlon,locationid)
    'set t 1'
    'q time'
    _inittime = subwrd(result, 3)
    day = substr(_inittime, 4, 9)
    tm = substr(_inittime, 1, 2)

    * Set time
    'set lat ' locationlat
    'set lon ' locationlon

    outfile = 'wrf_timeseries.txt'

    'q dims'

    * start tau
    * we start at t=2 (t+1) because of the precipitation fields
    p = 2

    'set gxout stat'

    'set z 1'

    * loop through taus to t+72 (t=73)
    while ( p <= 73)
       'set t 'p''
     
       'd tmp2m-273.15'
       regel = sublin(result,9)
       res_t2m=subwrd(regel,4)

       'd dpt2m-273.15'
       regel = sublin(result,9)
       res_dpt2m=subwrd(regel,4)

       'd rh2m'
       regel = sublin(result,9)
       res_rh2m=subwrd(regel,4)

       'd ugrd10m'
       regel = sublin(result,9)
       res_windu=subwrd(regel,4)

       'd vgrd10m'
       regel = sublin(result,9)
       res_windv=subwrd(regel,4)

       'd prmslmsl/100'
       regel = sublin(result,9)
       res_slp=subwrd(regel,4)

       'd tmpprs(lev=850)-273.15'
       regel = sublin(result,9)
       res_t850=subwrd(regel,4)

       'd rhprs(lev=850)'
       regel = sublin(result,9)
       res_rh850=subwrd(regel,4)

       'd tmpprs(lev=750)-273.15'
       regel = sublin(result,9)
       res_t700=subwrd(regel,4)

       'd hgtprs(lev=700)'
       regel = sublin(result,9)
       res_hgt700=subwrd(regel,4)

       'd hgtprs(lev=1000)'
       regel = sublin(result,9)
       res_hgt1000=subwrd(regel,4)

       'd DSWRFsfc'
       regel = sublin(result,9)
       res_dswrf=subwrd(regel,4)

       'd apcpsfc'
       regel = sublin(result,9)
       res_apcp=subwrd(regel,4)

       'd VISsfc'
       regel = sublin(result,9)
       res_vissfc=subwrd(regel,4)

       'd GUST10m'
       regel = sublin(result,9)
       res_gustsfc=subwrd(regel,4)

       'd TCDCclm'
       regel = sublin(result,9)
       res_tcdc=subwrd(regel,4)
       code=write(''outfile,day''tm';'locationid';'p';'res_t2m';'res_dpt2m';'res_rh2m';'res_windu';'res_windv';'res_slp';'res_t850';'res_rh850';'res_t700';'res_hgt700';'res_hgt1000';'res_dswrf';'res_apcp';'res_tcdc';'res_vissfc';'res_gustsfc'',append)
       
       p = p + 1
    endwhile

    return rc

Practically the same values ​​are extracted by using this other script you created Cory

viewtopic.php?f=6&t=299

Code: Select all

    #!/bin/tcsh
    cd /usr1/wrfems/runs/[domain name]/emsprd/grads
    wgrib2 *.grb2 -match ":TMP:2 m above ground" -rpn "273.15:-:9:*:5:/:32:+" -colon , -vt -print 2MTEMP -lon -98.470468 29.533113 > out.txt
    sed -i 's/[^,]*,//' out.txt
    sed -i 's/lon=261.506072,//' out.txt
    sed -i 's/lat=29.546945,//' out.txt
    sed -i 's/val=//g' out.txt
    sed -i 's/vt=//g' out.txt

They always come out strange data, and in many cases such as yesterday ARW is that NMM (extracted data) gave 0 millimeters of rain per hour, in fact I noticed that snow was reported in the plains, when they were 15 degrees. The plot chart with grads instead is correct

It will be a bug in the WRF EMS 3.4?
Dears,

I use the script for output in text. Can i have values without demical digits? I use "dignum" from grads but it does not work.

For example in temperature i have value 23.23456 and i want 23 without demical digits.

Thank you for your time.

hello, it depends on how you want to use the extracted data, if you must use them to generate forecasts assume that you are using a programming language (php / asp)

?

Post Reply