WRF PostProcessing - PowerPoint PPT Presentation

Loading...

PPT – WRF PostProcessing PowerPoint presentation | free to download - id: be581-ZmQxO



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

WRF PostProcessing

Description:

... reads a netCDF dataset and prints a textual representation of the information in the dataset ... ncdump v variable-name file -- print values of the var ... – PowerPoint PPT presentation

Number of Views:570
Avg rating:3.0/5.0
Slides: 50
Provided by: weiw3
Learn more at: http://www.wrf-model.org
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: WRF PostProcessing


1
WRF Post-Processing
  • Wei Wang
  • NCAR/MMM

2
Outline
  • NetCDF data
  • NCL
  • General information
  • How is it used in WRF post-processing?
  • How to run it?
  • WRF-to-Vis5D
  • RIP

3
netCDF Data
4
netCDF Data
  • netCDF is one of the data formats chosen for WRF
    I/O, and is currently supported.
  • What is netCDF?
  • netCDF stands for Network Common Data Form
  • netCDF is an interface to a library of data
    access functions for storing and retrieving data
    in the form of arrays. (http//www.unidata.ucar.e
    du/)
  • Documentation available at above site.

5
netCDF Data (cont)
  • What are the advantages of using netCDF?
  • Platform-independent (no big_endian,
    little_endian) though it may be with some
    caveat..
  • Many software may already exist which can be used
    to process netCDF data.

6
netCDF Data (cont)
  • netCDF utilities available
  • ncdump reads a netCDF dataset and prints a
    textual representation of the information in the
    dataset
  • e.g. ncdump h file -- print header (inc.
    variables in the file)
  • ncdump v variable-name file -- print
    values of the var
  • ncgen generates a netCDF file or a C or FORTRAN
    program that creates a netCDF dataset

7
netCDF Data (cont)
  • Other netCDF operators are available from
    http//nco.sourceforge.net/, which can be used to
    manipulate data, such as performing grid point
    averaging, file differencing, and file
    appending.

8
netCDF Data (cont)
  • In WRF system, simple utilities are also
    available. See for example,
  • module_wrf_to_v5d_util.F
  • in wrf2vis5d.tar file.

9
netCDF Data (cont)
  • Simple calls to access the data. For example,
  • call get_dims_cdf( file_for_time(1), 'T',
  • dims, ndims, debug )
  • gt get dimensions of field T in an array dims
  • call get_gl_att_real_cdf( file_for_time(1),
  • 'CEN_LON', cen_lon, debug )
  • gt get attributes from a netCDF file
  • call get_var_2d_real_cdf( file_for_time(1),
  • 'XLAT', xlat, dims(1), dims(2), 1,
    debug)
  • gt get the 2D field XLAT (similar call for a
    3D field)

10
NCL in WRF
  • Slides contributions from Bill Skamarock and
    Ethan Alpert (NCAR/SCD)

11
What is NCL?
  • NCL stands for NCAR Command Language
  • NCL is an interpreted programming language
  • Array based algebraic operators
  • Support netCDF data
  • Wide variety of graphics capabilities
  • Maps, Contours, XY, Vectors, Streamlines,
    labelbars, text, tickmarks as well as line,
    marker and polygon primatives
  • Output to X, NCGM, PostScript

12
What is NCL?
  • NCL is available on most UNIX platforms
  • NCL can run in batch or interactive mode
  • Interactive mode has command history and command
    line editing
  • Many useful functions and procedures
  • Code integration tool (ability to import FORTRAN)
  • Pre-compiled binaries are free.

13
Downloading NCL
  • Go to
  • http//ngwww.ucar.edu/ncl/download
  • Read and agree to GPL license
  • Fill out short registration form
  • Download binaries
  • Precompiled versions exist for
  • IBM RS6000, DEC Alpha, Sun Solaris, RedHat Linux,
    SGI IRIX, Alpha running RedHat Linux, and Mac
    running OSX

14
Installing NCL
  • Uncompress tar file in installation directory
  • cd /usr/local
  • gunzip ncl-4.2.0.a024_OSF5.1_alpha.tar.gz
  • Untar
  • tar xvf ncl-4.2.0.a024_OSF5.1_alpha.tar
  • Set NCARG_ROOT environment variable
  • setenv NCARG_ROOT /usr/local/
  • set path ( /usr/local/bin PATH)

15
Important resources for using and learning NCL
  • NCL home page
  • http//ngwww.ucar.edu/ncl
  • Contains links to documentation, examples, FAQ,
    ncl-talk email list, and update information

16
Reference Documentation
  • Main reference documentation
  • http//ngwww.ucar.edu/ngdoc/ng/ref/ncl/Overview.ht
    ml
  • All syntax and statements defined
  • Links to all procedures and functions
  • Basic overview of graphics
  • Usage tips
  • Information on importing FORTRAN
  • Information on supported data formats
  • Function and Procedure Reference
  • http//ngwww.ucar.edu/ngdoc/ng/ref/ncl/NclFuncsAnd
    Procs.html

17
Getting Started Using NCL (GSUN)
  • Getting Started Using NCL (GSUN)
  • http//ngwww.ucar.edu/ngdoc/ng/ug/ncl/gsun/
  • Intended for users with little or no NCL
    experience
  • Some programming language knowledge is assumed
  • Learning by example concept
  • Starts with basics and builds from there
  • Provides a set of simple functions written in NCL
    to be used by new users instead of NCLs object
    oriented Graphics interface
  • The Beyond the Basics section covers
    incorporating FORTRAN into NCL

18
Additional resources for using and learning NCL
  • NCL users email list
  • http//ngwww.ucar.edu/ncl-talk/
  • Email list devoted to NCL discussion
  • Read by NCL developers and support staff
  • Examples page
  • http//ngwww.ucar.edu/ncl/examples.html
  • CCSM NCL page for additional examples
  • http//www.cgd.ucar.edu/csm/support

19
Incorporating FORTRAN codes
  • Create FORTRAN stub text file or add comments to
    existing FORTRAN codes
  • C NCLFORTSTART
  • FUNCTION ARCLN(NUMPNT, POINTX, POINTY)
  • DIMENSION POINTX(NUMPNT), POINTY(NUMPNT)
  • C NCLEND
  • Call wrapit77
  • wrapit77 lt wrapper_input gt! wrapper_W.c

20
Incorporating FORTRAN codes
  • Compile FORTRAN and C wrapper to create .o files
  • Link object files to create shared object
  • Example
  • nhlcc -c fcode_W.c
  • nhlf77 -c fcode.f
  • ld -shared -o fcode.so fcode_W.o fcode.o

21
NCL for WRF Model Data
  • The NCL scripts for plotting WRF model output are
    our first attempt at producing plots for use in
    our development efforts.
  • They can do vertical interpolation (so one can
    plot data on pressure levels), skew-T, and
    vertical cross-sections.
  • They currently plot model output variables plus a
    few diagnostic variables, such as SLP, dew point
    temperature, and RH.
  • Can work with multiple input files and subdomains

22
NCL for WRF Model Data
  • Advantage
  • NCL reads WRF data directly
  • Can make simple plots quickly
  • Easy to make difference plots
  • Disadvantage
  • Initial learning may be slow
  • Array computation may be slow unless using Fortran

23
Downloading
  • From wrf-model.org web site
  • http//www.mmm.ucar.edu/wrf/users/download.ht
    ml
  • tar file wrf_ncl.tar
  • After untar, one finds directory
  • WRF_NCL/README_FIRST
  • README_NCL
  • eh/
  • em/

24
WRF_NCL/em/ directory
make_ncl_fortran make_ncl_fortran.alpha make_ncl_
fortran.rhlinux make_ncl_fortran.ibm make_ncl_fort
ran.sun wrf_user_fortran_util_0.f wrf_user_fortra
n_util_0.o wrf_user_fortran_util_0.so wrf_user_for
tran_util_0_W.c wrf_user_fortran_util_0_W.o wrf_p
lot.ncl wrf_user_mass.ncl skewt_func.ncl gsn_code.
ncl wrf_em_b_wave.ncl wrf_em_hill2d.ncl wrf_em_qs
s.ncl wrf_em_squall_2d_x.ncl wrf_em_squall_2d_y.nc
l wrf_em_sfc.ncl wrf_em_slp.ncl wrf_em_qv.ncl wrf_
em_the.ncl wrf_em_real.ncl wrf_em_real_input.ncl
Scripts to build fortran shared library
Created by fortran build
NCL functions and procedures used by the plotting
scripts
Plotting scripts
25
wrf_plot.ncl
  • Contains functions and procedures that are used
    by all ncl plotting scripts
  • maps
  • contour and color-filled plots
  • vectors
  • To include it in a ncl script
  • load wrf_plot.ncl

26
skewt_func.ncl
  • Functions for making skew-T plots
  • Load near the top of the ncl plotting script

27
wrf_user_mass.ncl
  • This is where a user may choose to add new
    variables for plotting
  • Can be used to obtain native model output
    variables, or diagnose new variables
  • Make Fortran calls to routines in
    wrf_fortran_user_util_0.f
  • Use existing examples inside the file as
    templates for adding new variables

28
wrf_fortran_user_util_0.f
  • Contains Fortran routines for diagnostic
    calculations
  • Fortran routines are stubbed with NCLFORTSTART
    and NCLEND.
  • e.g.
  • C NCLFORTSTART
  • subroutine compute_rh(qv,p,t,rh,nx,ny,nz)
  • implicit none
  • integer nx, ny, nz
  • real qv(nx,ny,nz),p(nx,ny,nz),
  • t(nx,ny,nz),rh(nx,ny,nz)
  • C NCLEND

29
How to generate shared object file?
  • makefiles exist to create shared object file from
    Fortran code for Alpha, Linux, IBM and Sun e.g.
  • make_ncl_fortran.alpha
  • make_ncl_fortran.linux
  • Type
  • make_ncl_fortran.alpha wrf_user_fortran_util_0
  • -gt creates wrf_user_fortran_util_0.so
  • For other machines, edit one of the make files

30
How to run NCL?
  • Type the following to run (batch example)
  • ncl lt wrf_em_real.ncl
  • To run NCL interactively, type
  • ncl
  • then enter appropriate ncl commands
  • Output from ncl can be in metacode, postscript,
    or on the screen

31
Example WRF NCL Plotting Script
script to produce standard plots for a wrf
real-data run load "wrf_plot.ncl" load
"wrf_user_mass.ncl" load "gsn_code.ncl" load
"skewt_func.ncl" a addfile("wrfout_01_000000.n
c","r") wks wrf_open_X11()
output to screen wks wrf_open_ncgm("wrf_plots")
output to ncgm wks wrf_open_PS("wrf_plots"
) output to postscript times
wrf_user_list_times(a) get times in the
file pressure_levels (/ 850., 700., 500.,
300./) pressure levels to plot ntimes
dimsizes(times) number of times in the
file nlevels dimsizes(pressure_levels)
number of pressure levels
32
Example WRF NCL Plotting Script (cont.)
do it 0, ntimes-1 time it
print(times(it)) if (it.eq.0) then
time_save times(it) end if hours it6.
start with surface pressure plot slvl
wrf_user_getvar(a,"slvl",time) psl
wrf_user_filter2d(slvl, 3) filter the fields
tc wrf_user_getvar(a,"tc",time) tc
1.8tc32. u wrf_user_getvar(a,"ua",time)
ua is u averaged to mass points v
wrf_user_getvar(a,"va",time) va is v averaged
to mass points u u1.94386 v v1.94386
tc_plane tc(0,,) u_plane u(0,,)
v_plane v(0,,)
Function (wrf_user_getvar) that reads data from
the WRF output file and computes appropriate
diagnostic fields (if necessary)
33
Example WRF NCL Plotting Script (cont.)
opts_tc True opts_tc_at_MainTitle
"Surface T (F, color) SLP (mb) and winds (kts)"
and many more options... opts_psl
True and many more options...
opts_vct True opts_vct_at_NumVectors 47
opts_vct_at_WindBarbsOn True opts_vct_at_NoTitles
True opts_vct_at_vcWindBarbColor "black"
opts_vct_at_vcRefAnnoOn False opts_mp True
and many more options... map
wrf_new_map(wks,a,opts_mp) opts_map True
opts_map_at_LabelFont "HELVETICA-BOLD"
opts_map_at_LabelFontHeight .01
wrf_maplabel(wks,map,opts_map)
34
Example WRF NCL Plotting Script (cont.)
contour_tc wrf__fill_contour(wks,tc_plan
e,opts_tc) contour_psl
wrf_new_line_contour(wks,slvl(,),opts_psl)
vector wrf_new_vector(wks,u_plane,
v_plane,opts_vct) wrf_mapoverlay(map,contour_
tc) wrf_mapoverlay(map,contour_psl)
wrf_mapoverlay(map,vector) draw(map)
frame(wks)
35
Example WRF NCL Plotting Script (cont.)
preparing for 3-D plots p
wrf_user_getvar(a, "p",time) pressure is our
vertical coordinate z wrf_user_getvar(a,
"Z",time) grid point height rh
wrf_user_getvar(a,"rh",time) w
wrf_user_getvar(a,"wa",time) w 100.w tc
(tc-32.).55555 do level 0,nlevels-1
pressure pressure_levels(level) z_plane
wrf_user_intrp3d( z,p,ter,"h",pressure,0.)
tc_plane wrf_user_intrp3d(tc,p,ter,"h",pressure,
0.) u_plane wrf_user_intrp3d(
u,p,ter,"h",pressure,0.) v_plane
wrf_user_intrp3d( v,p,ter,"h",pressure,0.)
rh_plane wrf_user_intrp3d( rh,p,ter,"h",pressur
e,0.) w_plane wrf_user_intrp3d(
w,p,ter,"h",pressure,0.) lots of
plotting... end do
Loop over desired pressure surface for plots
Vertical interp to desired surface
36
Example WRF NCL Plotting Script (cont.)
do ip 1, 2 dimsrh dimsizes(rh)
plane new(2,float) plane (/ dimsrh(2)/2,
dimsrh(1)/2 /) if(ip .eq. 1) angle
90. else angle 0. end if
rh_plane wrf_user_intrp3d(rh,z,ter,"v",plane,ang
le) tc_plane wrf_user_intrp3d(tc,z,ter,"v",p
lane,angle) lots of plotting... end do
Point in model gridpoint space
Angle of plane passing through gridpoint
Interpolation to vertical cross section
37
Example WRF NCL Plotting Script (cont.)
Skew-T plots First get necessary variables
qv wrf_user_getvar(a,"QVAPOR",time) td
wrf_user_getvar(a,"td",time) u
wrf_user_getvar(a,"umet",time) v
wrf_user_getvar(a,"vmet",time) u u1.94386
v v1.94386 locr wrf_user_find_ij_lat_long(
a, 39.77, 104.87 ) loc floattointeger(locr)
loc_str "Skew-T at Denver valid at "
times(it) skewt_bkgd skewT_BackGround
(wks, skewtOpts) draw (skewt_bkgd)
skewT_data skewT_PlotData(wks, skewt_bkgd,
p(,loc(0), loc(1)), \
tc(,loc(0), loc(1)), \

td(,loc(0), loc(1)), \
z(,loc(0), loc(1)), \

-u(,loc(0), loc(1)), \
-v(,loc(0), loc(1)), \
dataOpts
) frame(wks) end do end do
Find nearest gridpoint
Options needed (skewOpts) not shown here
38
WRF-to-VIS5D
  • Wei Wang
  • NCAR/MMM

39
What does it do?
  • Convert WRF model output data in netCDF to Vis5D
    format.
  • Vis5D is a three-dimensional visualization
    software
  • Vis5D is free and can be downloaded from
  • http//www.ssec.wisc.edu/billh/vis5d.html

40
Downloading
  • From wrf-model.org web site
  • http//www.mmm.ucar.edu/wrf/users/download.htm
    l
  • tar file wrf2vis5d.tar
  • After untar, one finds directory
  • WRF2VIS5D/README
  • eh/
  • em/

41
WRF2VIS5D/em directory
  • The following files exist in the directory
  • Makefile
  • README
  • module_wrf_to_v5d_util.F
  • module_wrf_to_v5d_netcdf.F
  • v5df.h
  • wrf_to_v5d.F
  • wrf_v5d_input

42
How to compile and run?
  • Type the following to compile
  • make wrf_to_v5d
  • Edit command line input file
  • wrf_v5d_input
  • Type the following to run
  • wrf_to_v5d wrf_v5f_input vis5d-filename
  • Type the following to view Vis5D data
  • vis5d vis5d-filename

43
File wrf_v5d_input
  • -1 ! number of times to put in vis5d file,
    negative means ignore the times
  • 2000-01-24_180000
  • U ! variable list for vis5d file, indent
    one space to skip
  • V ! first five in list are special
    variables (diagnosed)
  • W
  • THETA
  • TK
  • TC
  • QVAPOR
  • QCLOUD
  • QRAIN
  • RAINC
  • TSK
  • end_of_variable_list

Space at the beginning Not processed
44
File wrf_v5d_input (cont.)
  • wrfout_d01_000000 ! WRF output file name
  • end_of_file_list
  • -1 ! specify v5d vertical grid 0cartesian,
    -1interp to z from lowest h, gt1 list
    levels (z) desired in vis5d file
  • 1 1.
  • 2 2.
  • 3 3.
  • 4 4.
  • 5 5.
  • 6 6.
  • 7 7.
  • 8 8.
  • 9 9.
  • 10 10.

45
RIP4 Read/Interpolate/Plot (Version 4)
  • Slides contribution from Dave Gill

46
General Information
  • Written by Mark Stoelinga of UW
  • Requires NCAR Graphics low-level routines
    freely available from http//ngwww.ucar.edu
  • Originally written for MM5 input and output, and
    recently rewritten and generalized to include WRF
  • Horizontal plots on native model coordinate,
    pressure, height, q, qe, or PV surfaces
  • Vertical cross sections on native model
    coordinate, pressure or log pressure, p, height,
    q, qe, or PV as coordinate surface

47
General Information (cont)
  • Skew-T/log p soundings specified at grid points
    or lat/lon, optional hodographs and sounding
    quantities
  • Forward and backward trajectories
  • Generate input data for Vis5D
  • Large number of diagnostic fields (gt 100)
  • Allow users to tailor the graphics
  • Currently works for real-data simulation data
    only
  • Detailed documentation

48
Downloading Program tar File
  • RIP program tar file can be downloaded from
  • http//www.mmm.ucar.edu/wrf/users/download.html
  • html documentation included

49
Compiling RIP on Your Machine
  • Uncompress and untar the file RIP4.TAR.gz
  • Edit src/Makefile to define paths to netCDF
    library and include file on your computer
  • NETCDFLIB and NETCDFINC
  • make ltmachine typegt (itll make suggestions)
  • e.g.
  • make linux
  • compile RIP on a Linux computer

50
RIPDP_WRF
  • ripdp_wrf where dp stands for Data processing
  • ripdp_wrf converts WRF netCDF data into RIP input
    format (format described in the document)
  • ripdp_wrf puts each variable at each time into a
    separate file expect to see LOTS of files

51
Running ripdp_wrf
  • Set environment variable RIP_ROOT to where RIP is
    installed and where RIP utility files reside.
  • e.g. setenv RIP_ROOT /users/wrfhelp/RIP4
  • Run ripdp_wrf
  • ripdp_wrf n namelist-file
    ltmodel_data_namegt basic/all \
  • ltinput_file1 input_file2gt
  • namelist-file optional
  • Make a directory for the files, use that as part
    of the model_data_name. e.g.
  • ./storm_case/test1

52
RIPDP namelist
  • Use namelist-file (example in ripdp_sample.in) to
    add control
  • select processing times
  • discard fields if all is selected on the
    command line

53
RIP UIF
  • UIF User Input File (example in rip_sample.in)
  • First section is a list of general parameters
    (namelist format)
  • Second section is a Plot Specification Table (or
    PST)

54
RIP namelist
  • Use namelist to control
  • processing times, intervals
  • title information
  • text quality on a plot
  • whether to do time series, trajectory, or to
    write output for Vis5D
  • Full explanation for namelist variables is
    available in the user document

55
RIP UIF
  • userin
  • ....
  • /
  • trajcalc
  • ....
  • /
  • --------- Plot Specification Table ------------
  • Plot specification line (PSL)
  • PSL plot spec settings (PSS)
  • PSL PSSs

namelist
frame specification group (FSG)
56
RIP PST FSG PSL
  • PST Plot Specification Table
  • First line is , next 2 lines ignored
  • Each group separated by subsequent is a FSG
    (Frame Specification Group)
  • Each line within an FSG is a PSL (Plot
    Specification Line)
  • An FSG with 3 PSLs will have 3 plots on one frame

57
RIP PSS
  • Each PSL contains several PSSs (Plot
    Specification Settings) (see example next)
  • keywordvalue,value,value
  • keyword is a 4-char identifier
  • All PSSs within a PSL are separated by
  • Last PSS on a PSL has no
  • gt at the end of the line means the PSL
    continues
  • Comments require a

58
An example of PST

  • feldtmc ptyphc vcors levsb1 cint2
    cmthfillgt
  • cosq-32,light.violet,-24,violet,-16,blue,8,gree
    n, gt 0,yellow,8,red,16,orange,24,brown,32,light.g
    ray
  • feldslp ptyphc cint2 linw2
  • felduuu,vvv ptyphv vcmx-1 colrwhite
    intv5
  • feldmap ptyphb
  • feldtic ptyphb


Bold letters indicate keywords
59
Running RIP
  • Edit the UIF (rip-execution-name.in)
  • Type the following to run
  • rip -f model-data-set-name
    rip-execution-name
  • model-data-set-name is from RIPDP_WRF
  • rip-execution-name is unique name, for output,
    metacode and UIF
  • e.g. rip-execution-name.cgm
  • View the .cgm file using NCAR Graphics utility
  • idt rip-execution-name.cgm

60
Other Notes
  • Appendix A contains a list of keywords for PSS
  • Appendix B has a long list of fields that can be
    plotted by RIP
  • New fields may be added
  • Currently works with wrfout files only, and with
    real-data
About PowerShow.com