extract data from wrf-ems for weather forecast

All issues/questions about EMS v3.4 package, please ask here.
dominic
Posts: 334
Joined: Thu Jun 14, 2012 7:19 am

Re: extract data from wrf-ems for weather forecast

Post by dominic » Thu Jul 18, 2013 4:29 pm

Hello ZHB, very good :)

How do I run this script? always through grads?

dominic
Posts: 334
Joined: Thu Jun 14, 2012 7:19 am

Re: extract data from wrf-ems for weather forecast

Post by dominic » Thu Jul 18, 2013 4:47 pm

Ben Lankamp wrote:This is the script I made for saving time series for given locations (by lat lon and an arbitrary locationid). It will save the basic meteorological variables in use for general weather forecasting, such as temperature and dewpoint 2 metres, surface wind speed and gust, downdwelling radiation, cloud cover and precipitation, along with some upper level variables.

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
The time series will be saved as wrf_timeseries.txt. You can extend the list of locations by adding calls to savedata.

Hello Ben, I wanted to ask if it is possible to extract other data to other locations, I tried to add other locations in the script with the coordinates, but grads creates files with the same internal data.

how can I do?

ZHB
Posts: 25
Joined: Wed May 30, 2012 10:49 am

Re: extract data from wrf-ems for weather forecast

Post by ZHB » Thu Jul 18, 2013 5:13 pm

As I said in my first message, you can add the path to the configuration file of your run or launch it manualy. That not a grads script !

nemzamp
Posts: 43
Joined: Thu Jul 19, 2012 11:42 am

Re: extract data from wrf-ems for weather forecast

Post by nemzamp » Wed Oct 23, 2013 11:36 am

Hi guys!
I've a problem with grads output

Code: Select all

sourcerundt;locationid;tau;t2m;dpt2m;rh2m;u10m;v10m;mslp;t850;rh850;t700;hgt700;hgt1000;apcp;tcdc;vissfc;gustmx10m
23OCT201300;2;2;;;;;;;;;;;;;;;;
23OCT201300;2;3;;;;;;;;;;;;;;;;
23OCT201300;2;4;;;;;;;;;;;;;;;;
23OCT201300;2;5;;;;;;;;;;;;;;;;
23OCT201300;2;6;;;;;;;;;;;;;;;;
23OCT201300;2;7;;;;;;;;;;;;;;;;
23OCT201300;2;8;;;;;;;;;;;;;;;;
23OCT201300;2;9;;;;;;;;;;;;;;;;
23OCT201300;2;10;;;;;;;;;;;;;;;;
23OCT201300;2;11;;;;;;;;;;;;;;;;
23OCT201300;2;12;;;;;;;;;;;;;;;;
23OCT201300;2;13;;;;;;;;;;;;;;;;
23OCT201300;2;14;;;;;;;;;;;;;;;;
23OCT201300;2;15;;;;;;;;;;;;;;;;
23OCT201300;2;16;;;;;;;;;;;;;;;;
23OCT201300;2;17;;;;;;;;;;;;;;;;
23OCT201300;2;18;;;;;;;;;;;;;;;;
23OCT201300;2;19;;;;;;;;;;;;;;;;
23OCT201300;2;20;;;;;;;;;;;;;;;;
23OCT201300;2;21;;;;;;;;;;;;;;;;
23OCT201300;2;22;;;;;;;;;;;;;;;;
23OCT201300;2;23;;;;;;;;;;;;;;;;
23OCT201300;2;24;;;;;;;;;;;;;;;;
23OCT201300;2;25;;;;;;;;;;;;;;;;
23OCT201300;2;26;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;27;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;28;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;29;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;30;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;31;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;32;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;33;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;34;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;35;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;36;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;37;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;38;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;39;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;40;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;41;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;42;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;43;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;44;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;45;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;46;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;47;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;48;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;49;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;50;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;51;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;52;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;53;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;54;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;55;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;56;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;57;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;58;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;59;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;60;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;61;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;62;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;63;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;64;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;65;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;66;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;67;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;68;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;69;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;70;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;71;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;72;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
23OCT201300;2;73;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999;-999
Why?? Any idea? Thanks! :(

weatherc
Posts: 64
Joined: Tue Sep 25, 2012 2:39 am

Re: extract data from wrf-ems for weather forecast

Post by weatherc » Sun Oct 27, 2013 1:27 pm

You can use wgrib2 directly to drop the GRIB-data to Mysql:
http://www.nco.ncep.noaa.gov/pmb/codes/ ... readme.txt

Some test of EMS => Mysql => pointforecast here:
http://www.europeanweathernetwork.eu/wrfforecast.php

raposu
Posts: 26
Joined: Mon Jul 22, 2013 7:20 pm

Re: extract data from wrf-ems for weather forecast

Post by raposu » Sun Oct 27, 2013 6:53 pm

weatherc wrote: Some test of EMS => Mysql => pointforecast here:
http://www.europeanweathernetwork.eu/wrfforecast.php

Fantastic

meteoadriatic
Posts: 1574
Joined: Wed Aug 19, 2009 10:05 am

Re: extract data from wrf-ems for weather forecast

Post by meteoadriatic » Sun Oct 27, 2013 6:57 pm

raposu wrote:Fantastic
Exactly!

dominic
Posts: 334
Joined: Thu Jun 14, 2012 7:19 am

Re: extract data from wrf-ems for weather forecast

Post by dominic » Tue Oct 29, 2013 7:31 am

The main problem is not so much reading data and saving to mysql. The real problem is to create a mechanism that reads (algorithm), the data and create a map. To programmatically create a map it is easy enough to know asp or php or something else. What is difficult is to create functions that need to create the "weather conditions", ie, (if the coverage is 50% and rainfall is equal to 0 mm) means that the weather is partly cloudy.


weatherc system that you use to read the data and then put on the screen the forecasts?

raposu
Posts: 26
Joined: Mon Jul 22, 2013 7:20 pm

Re: extract data from wrf-ems for weather forecast

Post by raposu » Tue Oct 29, 2013 1:32 pm

dominic wrote:What is difficult is to create functions that need to create the "weather conditions", ie, (if the coverage is 50% and rainfall is equal to 0 mm) means that the weather is partly cloudy.
In my case a problem would be mysql, never use, but 15 days may be sufficient to gain knowledge.

The biggest problem is to generate infinite latitudes, not if they are already preprocessed, if decoded according to the request etc ...

Once we have the data all prove easier, it's about having good taste with graphs, maps, tables, etc. ….

I am the last to come to this forum, but I managed to do this with the help of you and your messages.

http://isocero.com/tablas-asturias/pajares1.php

Is this what you mean?

dominic
Posts: 334
Joined: Thu Jun 14, 2012 7:19 am

Re: extract data from wrf-ems for weather forecast

Post by dominic » Tue Oct 29, 2013 10:55 pm

Theoretically, it is difficult to generate many latitudes, just that you create so many grads script identical to the first. Example, the first place you call Paris, the second Rome, and the third Oslo.

In grads run the script at the end of the first and do:

run paris.gs
run rome.gs


in this way you are extracted the data for the other locations. my problem is to create code in php that reads and generates a prediction type by entering your symbols suitable for a specific weather condition.
Last edited by dominic on Wed Oct 30, 2013 9:42 am, edited 1 time in total.

Post Reply