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.
meteosciez
Posts: 55
Joined: Sat Sep 05, 2009 6:36 am

Re: Creating Text Output

Post by meteosciez » Mon Mar 29, 2010 6:15 pm

delinend wrote:That is a big lake. :o

I've tried to reconstruc your cloud, from your website. From (TCDCprs * 100). Sciez (46.33/6.37) with WRF-EMS NMM (5km res.).

I use GFS 0.5 degrees NCEP data (00Z) without Modis. But have not really succeeded in, getting the same output as you. I think I'm doing something wrong.

May I ask, what data do you use for initializing your simulation (ems_prep --dset) ?
I am using the following settings :

dset : gfsptile
Physics :
CU_PHYSICS = 2
MP_PHYSICS = 6
BL_PBL_PHYSICS = 2
SF_SURFACE_PHYSICS = 2
meteo-sciez.fr

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

Re: Creating Text Output

Post by delinend » Tue Mar 30, 2010 7:40 pm

Many thanks for your help meteosciez.

I will try to make a compare run.

May I ask, what is the LAT/LON for your run over Sciez ?

Best regards

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

Re: Creating Text Output

Post by meteosciez » Tue Mar 30, 2010 8:10 pm

delinend wrote:Many thanks for your help meteosciez.

I will try to make a compare run.

May I ask, what is the LAT/LON for your run over Sciez ?
The lat/lon is 46.33 6.38
meteo-sciez.fr

jaimito_85
Posts: 2
Joined: Wed Mar 31, 2010 11:35 am

Re: Creating Text Output

Post by jaimito_85 » Wed Mar 31, 2010 11:47 am

hello everybody

I am a little late here, but anyway I'm gonna answer to the first question. If I got it you are trying to get numerical outputs of different meteorological fields.

well, I am doing so by using a ncl script, it allows me to get the needed fields in .txt files, then I manage those files with matlab because I have more experience with it and it is easier for me to get the plots that I want in matlab, anyway you could do it directly in the ncl script (It is able to create plots, tables or whatever you want to output and it is fast)
I'll copy a part of my ncl script, so that you can see what I am doing.

by the way, did I get the question? I mean, the question is weird to me because I though that everybody was using ncl scripts... otherwise, how do you get the outputs? I guess you can use Grads and also output text files

; load functions and procedures
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin

; input file
a = addfile("wrfout_d01_2008-02-16_00:00:00.nc","r")


;00:00
time = 241
rh1 = wrf_user_getvar(a,"rh2",time) ; calculate RH at 2m height
P1 = a->PSFC ; pressure at surface level
;;Pb1 = a->PSFCB ; base state pressure
;;P1 = ;P1 + ;Pb1 ; total pressure
tc1 = a->T2 ; calculate TC
uvm = wrf_user_getvar(a,"uvmet10",time) ;these are the wnid components at 10m height rotated to earth coordinates
u1 = uvm(0,:,:)
v1 = uvm(1,:,:)
relh1 = wrf_user_getvar(a,"rh",time) ; calculate RH at all levels, we will use it later to estimate whether there are clouds or not
asciiwrite("../../output/26_02_2008/u1.txt" , u1)
asciiwrite("../../output/26_02_2008/v1.txt" , v1)
lon = a->XLONG
lat = a->XLAT
asciiwrite("../../output/26_02_2008/relh1.txt" , relh1)
asciiwrite("../../output/26_02_2008/rh1.txt" , rh1)
asciiwrite("../../output/26_02_2008/tc1.txt" , tc1(time-1,:,:))
asciiwrite("../../output/26_02_2008/P1.txt" , P1(time-1,:,:))
asciiwrite("../../output/26_02_2008/lon.txt" , lon(time-1,:,:))
asciiwrite("../../output/26_02_2008/lat.txt" , lat(time-1,:,:))

;01:00
time = time+1
rh2 = wrf_user_getvar(a,"rh2",time) ; calculate RH
P2 = a->PSFC ; perturbation
;;;Pb2 = a->;Pb ; base state pressure
;;P2 = ;P2 + ;Pb2 ; total pressure
tc2 = a->T2 ; calculate TC
uvm = wrf_user_getvar(a,"uvmet10",time)
u2 = uvm(0,:,:)
v2 = uvm(1,:,:)
relh2 = wrf_user_getvar(a,"rh",time)
asciiwrite("../../output/26_02_2008/relh2.txt" , relh2)
asciiwrite("../../output/26_02_2008/rh2.txt" , rh1)
asciiwrite("../../output/26_02_2008/tc2.txt" , tc2(time-1,:,:))
asciiwrite("../../output/26_02_2008/u2.txt" , u2)
asciiwrite("../../output/26_02_2008/v2.txt" , v2)
asciiwrite("../../output/26_02_2008/P2.txt" , P2(time-1,:,:))

;02:00
time = time+1
rh3 = wrf_user_getvar(a,"rh2",time) ; calculate RH
P3 = a->PSFC ; perturbation
;;;Pb3 = a->;Pb ; base state pressure
;;P3 = ;P3 + ;Pb3 ; total pressure
tc3 = a->T2 ; calculate TC
uvm = wrf_user_getvar(a,"uvmet10",time)
u3 = uvm(0,:,:)
v3 = uvm(1,:,:)
relh3 = wrf_user_getvar(a,"rh",time)
asciiwrite("../../output/26_02_2008/relh3.txt" , relh3)
asciiwrite("../../output/26_02_2008/rh3.txt" , rh3)
asciiwrite("../../output/26_02_2008/tc3.txt" , tc3(time-1,:,:))
asciiwrite("../../output/26_02_2008/u3.txt" , u3)
asciiwrite("../../output/26_02_2008/v3.txt" , v3)
asciiwrite("../../output/26_02_2008/P3.txt" , P3(time-1,:,:))

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

Re: Creating Text Output

Post by Antonix » Wed Mar 31, 2010 4:58 pm

I have problems installing the program.
during compilation (make) me says:

../jpeg2000/src/libjasper/base/.libs//libbase.a(jas_stream.o): In function `jas_stream_tmpfile':
jas_stream.c:(.text+0xe43): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
../libxml/.libs//libxml2.a(xmlIO.o): In function `xmlGzfileOpen_real':
xmlIO.c:(.text+0xc56): undefined reference to `gzopen64'
../libxml/.libs//libxml2.a(xmlIO.o): In function `__xmlOutputBufferCreateFilename':
xmlIO.c:(.text+0x2b87): undefined reference to `gzopen64'
xmlIO.c:(.text+0x2c0f): undefined reference to `gzopen64'
collect2: ld returned 1 exit status
make[1]: *** [degrib] Errore 1
make[1]: uscita dalla directory «/home/xxxx/de/degrib/src/degrib»
make: *** [degrib/degrib] Errore 2



there is some. deb or some similar file for ubuntu??

jaimito_85
Posts: 2
Joined: Wed Mar 31, 2010 11:35 am

Re: Creating Text Output

Post by jaimito_85 » Mon Apr 05, 2010 9:35 am

this is not the place for the question dude, open a new topic...
it seems that you don't have the required libraries linked, check whether you have the jpeg and jasp libraries, anyway you should post more info

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

Re: Creating Text Output

Post by Antonix » Mon Apr 12, 2010 2:24 pm

Hello everyone
Which Linux distribution used for the program DEGRIB???
I have many problems using ubuntu 9.04!!!

thanks!


Best regards

magbal
Posts: 1
Joined: Tue May 04, 2010 8:04 am

Re: Creating Text Output

Post by magbal » Tue May 04, 2010 8:17 am

meteoadriatic wrote: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!

Hello,

You can also get a text output timeseries for specified Lat/Lon 's directly from the WRF. Just use the tslist. The quote below comes from readme.tslist in [wrfemslocation]/data/tables/wrf:
To activate time series output in WRF, a file named "tslist" must be present
in the WRF run directory. The tslist file contains a list of locations, given
by their latitude and longitude, along with a short description and an
abbreviation for each location. The first three lines in the file are
regarded as header information, and are ignored. The contents of an example
tslist file are shown below.


#-----------------------------------------------#
# 24 characters for name | pfx | LAT | LON |
#-----------------------------------------------#
Cape Hallett hallt -72.330 170.250
McMurdo Station mcm -77.851 166.713
Bogus point A pt_a 29.718 -75.772
Bogus point B pt_b 37.614 -74.650


Given a tslist file, for each location inside a model domain (either coarse
or nested) a file containing time series variables at each time step will be
created with the name pfx.dNN.TS, where pfx is the specified prefix for the
location in the tslist file, and NN is the domain ID, as given in
namelist.input. If locations not in any model domain are specified in the
tslist file, they will be simply ignored by the time series capability.

The maximum number of time series locations is controlled by the namelist
variable max_ts_locs, which may be specified in the &domains namelist. Also,
the number of entries in the buffers for time series output can be set with
the ts_buf_size variable, also found in &domains. Decreasing the size of the
buffers will reduce the amount of memory that is allocated for time series;
however, smaller buffers will need to be flushed to disk more often than
larger buffers. Thus, it is recommended that the size of the buffer be set
to the maximum number of time steps for any domain in a model run.
The output variables are:

id: grid ID
ts_hour: forecast time in hours
id_tsloc: time series ID
ix,iy: grid location (nearest grid to the station)
t: 2 m Temperature (K)
q: 2 m vapor mixing ratio (kg/kg)
u: 10 m U wind (earth-relative)
v: 10 m V wind (earth-relative)
psfc: surface pressure (Pa)
glw: downward longwave radiation flux at the ground (W/m^2, downward is positive)
gsw: net shortwave radiation flux at the ground (W/m^2, downward is positive)
hfx: surface sensible heat flux (W/m^2, upward is positive)
lh: surface latent heat flux (W/m^2, upward is positive)
tsk: skin temperature (K)
tslb(1): top soil layer temperature (K)
rainc: rainfall from a cumulus scheme (mm)
rainnc: rainfall from an explicit scheme (mm)
clw: total column-integrated water vapor and cloud variables

Though you will need to the edit some of the perl scripts of wrfems so that the ouput textfiles doesn't get cleaned away when the model run is finished (wrf outputs them in the run directory).

Hope this might help!

magbal

wrfbrasil
Posts: 7
Joined: Tue Sep 29, 2009 6:16 pm

Re: Creating Text Output

Post by wrfbrasil » Wed May 05, 2010 10:31 pm

Look at the output tetx WRF directly in grads:
http://tempo.web44.net/
click Modelo WRF -> Meteogramas 15 km -> Numérico
If you like, put the necessary part of the script
tempo.web44.net - WRF Model 15 Km - South of Brazil and WRF 40 Km - South America

wrfbrasil
Posts: 7
Joined: Tue Sep 29, 2009 6:16 pm

Re: Creating Text Output

Post by wrfbrasil » Sat May 08, 2010 9:44 pm

Following example of creating a header, find the value of the variable and save it in txt in a script grads

Creating txt file:
arquivo = i'.txt'

Creating header variables describing in line:
write (arquivo, 'HORA CAPE K LIFT SHOW SRH3 SWEAT TOTAL THOMP VVEL LLS NebA NebM NebB', append)

Calculating variable:
******
*VVEL
******
'd vvelprs(lev=700)'
linha = sublin(result,2)
vvel1 = subwrd(linha,4)
vvel2 = substr(vvel1,1,4)
if ( vvel2 = 0 ) ; vvel2 = 0.00 ; endif

Writing outcome variables in line
write (arquivo, '+'%kt%' '%cape2%' '%indk2%' '%lift2%' '%show2%' '%srh32%' '%swet2%' '%tot2%' '%thomp2%' '%vvel2%' '%lls2%' '%nuvema2%' '%nuvemm2%' '%nuvemb2 , append)
tempo.web44.net - WRF Model 15 Km - South of Brazil and WRF 40 Km - South America

Post Reply