Creating Text Output from WRF

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.
meteoadriatic
Posts: 1601
Joined: Wed Aug 19, 2009 10:05 am

Creating Text Output from WRF

Post by meteoadriatic » Tue Mar 16, 2010 11:03 pm

Hello dear people,

does anybody do textual (numeric) output from your WRF? What will be the easiest way to do so? For example, if I want to extract numeric forecast data for given lat/lon for example temperature, precipitation, wind... what are my options to do the job? Final product will be a nice html table with forecast by numbers for a given location. The first problem is extracting numeric data from model output.

Comments and recommendations are welcome, thanks!

Antonix
Posts: 260
Joined: Fri Oct 16, 2009 8:53 am

Re: Creating Text Output

Post by Antonix » Wed Mar 17, 2010 12:21 am

I thought about using CDO or NCO on NetCDF files
later write on a single file with Java.
I know that python is very advanced in the management of netcdf file.
Matlab is also excellent.
but do not know a specific method.
I am very interested to me

meteosciez
Posts: 55
Joined: Sat Sep 05, 2009 6:36 am

Re: Creating Text Output

Post by meteosciez » Wed Mar 17, 2010 5:43 pm

I am doing that by extracting data from grib files to csv text files using a php script and degrib. You can also consider wgrib2 instead of degrib.

I use then the numerical data to display weather icons, tables and meteograms (see http://www.meteo-sciez.com/wxprev.php)
meteo-sciez.fr

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

Re: Creating Text Output

Post by meteoadriatic » Wed Mar 17, 2010 6:53 pm

Can you, please, share with us the part where you actually use degrib? I never did that and documentation on degrib is very poor.

meteosciez
Posts: 55
Joined: Sat Sep 05, 2009 6:36 am

Re: Creating Text Output

Post by meteosciez » Wed Mar 17, 2010 8:06 pm

meteoadriatic wrote:Can you, please, share with us the part where you actually use degrib? I never did that and documentation on degrib is very poor.
Sure. i will do a summary of my use of degrib... but i will not have the time before this week-end
meteo-sciez.fr

trcostan
Posts: 7
Joined: Fri Mar 19, 2010 11:00 pm

Re: Creating Text Output

Post by trcostan » Fri Mar 19, 2010 11:15 pm

I'm using OpenGRADS and the Python GRADS interface to export data to numpy arrays.

here is the sample i used..

http://cookbooks.opengrads.org/index.ph ... _text_file

meteosciez
Posts: 55
Joined: Sat Sep 05, 2009 6:36 am

Re: Creating Text Output

Post by meteosciez » Sat Mar 20, 2010 10:07 am

meteoadriatic wrote:Can you, please, share with us the part where you actually use degrib? I never did that and documentation on degrib is very poor.
Here is the way I do with degrib:

To extract all the data for one location and for one grib file, in metric units, the command to use is

Code: Select all

degrib /wrfems/runs/XXXXX/emsprd/grib/1003200000_NMM_d01.grb2f040000 -P -pnt 48.45,-4.25 -Unit m > gribdata.txt 
The coordinates of the -pnt option are the latitude and longitude of the desired location.

The format of the created "gribdata.txt" file looks like :

Code: Select all

element, unit, refTime, validTime, (46.330000,6.380000)
PRMSL, [Pa], 201003200000, 201003200400, 102067.700
PRES, [Pa], 201003200000, 201003200400, 96472.450
HGT, [gpm], 201003200000, 201003200400, 467.723
TMP, [C], 201003200000, 201003200400, 7.410
DPT, [C], 201003200000, 201003200400, 5.535
SPFH, [kg/kg], 201003200000, 201003200400, 0.006
UGRD, [m/s], 201003200000, 201003200400, 1.905
VGRD, [m/s], 201003200000, 201003200400, 4.443
PRES, [Pa], 201003200000, 201003200400, 95925.150
HGT, [gpm], 201003200000, 201003200400, 514.708
TMP, [C], 201003200000, 201003200400, 8.683
DPT, [C], 201003200000, 201003200400, 5.143
SPFH, [kg/kg], 201003200000, 201003200400, 0.006
.....
......
where the last element of each line is the value of the parameter.
The problem is that the altitude level of each parameters is not indicated in this file, so you have to generate an index file :

Code: Select all

degrib /wrfems/runs/XXXXX/emsprd/grib/1003200000_NMM_d01.grb2f040000  -I > gribindex.txt
the format of the "gribindex.txt" file is the following :

Code: Select all

1.0, 0, 1, PRMSL="Pressure reduced to MSL [Pa]", 0-MSL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
2.0, 13672, 1, PRES="Pressure [Pa]", 1-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
3.0, 28854, 1, HGT="Geopotential height [gpm]", 1-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
4.0, 47052, 1, TMP="Temperature [K]", 1-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
5.0, 58462, 1, DPT="Dew point temperature [K]", 1-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
6.0, 72134, 1, SPFH="Specific humidity [kg/kg]", 1-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
7.0, 79018, 1, UGRD="u-component of wind [m/s]", 1-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
8.0, 91186, 1, VGRD="v-component of wind [m/s]", 1-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
9.0, 103354, 1, PRES="Pressure [Pa]", 2-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
10.0, 118536, 1, HGT="Geopotential height [gpm]", 2-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
11.0, 136734, 1, TMP="Temperature [K]", 2-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
12.0, 148144, 1, DPT="Dew point temperature [K]", 2-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
13.0, 161816, 1, SPFH="Specific humidity [kg/kg]", 2-HYBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
........
........
In this file, the first number of each line is the index number. For instance if you want to extract the value for TMP at 2-HYBL, the index number for these parameter is 11, and you will find the value at the 11th line of the "gribdata.txt" file.

If you want the value of , for instance, the temperature at 850 hPa, you will do :

Code: Select all

degrib /wrfems/runs/XXXXX/emsprd/grib/1003200000_NMM_d01.grb2f040000 -I | grep "TMP" | grep "850-ISBL" > index.txt
The index.txt file will contain one line :

Code: Select all

288.0, 3396974, 1, TMP="Temperature [K]", 850-ISBL, 03/20/2010 00:00, 03/20/2010 04:00, 4.00
indicating that you will find the TMP 850-ISBL at line 288 of the "gribdata.txt" file.
meteo-sciez.fr

delinend
Posts: 65
Joined: Wed Oct 28, 2009 7:07 pm

Re: Creating Text Output

Post by delinend » Mon Mar 22, 2010 4:33 pm

A very nice home page, you have made meteosciez :)

How do you manage to compute Wx icons? I mean, how do you calculate witch weather icon, from the the GRIB data ?

Do you use a kind of a program, or do you calculate it in PHP?

meteosciez
Posts: 55
Joined: Sat Sep 05, 2009 6:36 am

Re: Creating Text Output

Post by meteosciez » Tue Mar 23, 2010 11:37 am

delinend wrote:Do you use a kind of a program, or do you calculate it in PHP?
I have written a script to calculate the Wx icons based on the extracted GRIB data.
meteo-sciez.fr

delinend
Posts: 65
Joined: Wed Oct 28, 2009 7:07 pm

Re: Creating Text Output

Post by delinend » Tue Mar 23, 2010 1:53 pm

There is a big job. :o

Will you release something from the PHP code or formula ? Or is the Wx-formula available on the web.

Post Reply