1 / 49

WRF Post-Processing

WRF Post-Processing. Wei Wang NCAR/MMM. Outline. NetCDF data NCL General information How is it used in WRF post-processing? How to run it? WRF-to-Vis5D RIP. netCDF Data. netCDF Data. netCDF is one of the data formats chosen for WRF I/O, and is currently supported.

clarke
Download Presentation

WRF Post-Processing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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.edu/) • 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 ) > get dimensions of field T in an array dims call get_gl_att_real_cdf( file_for_time(1), & 'CEN_LON', cen_lon, debug ) > get attributes from a netCDF file call get_var_2d_real_cdf( file_for_time(1), & 'XLAT', xlat, dims(1), dims(2), 1, debug) > 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. Important resources forusing and learning NCL • NCL home page: • http://ngwww.ucar.edu/ncl • Contains links to documentation, examples, FAQ, ncl-talk email list, and update information

  15. 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 NCL’s object oriented Graphics interface • The “Beyond the Basics” section covers incorporating FORTRAN into NCL

  16. 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

  17. 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

  18. 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

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

  20. WRF_NCL/em/ directory make_ncl_fortran make_ncl_fortran.alpha make_ncl_fortran.rhlinux make_ncl_fortran.ibm make_ncl_fortran.sun wrf_user_fortran_util_0.f wrf_user_fortran_util_0.o wrf_user_fortran_util_0.so wrf_user_fortran_util_0_W.c wrf_user_fortran_util_0_W.o wrf_plot.ncl wrf_user_mass.ncl skewt_func.ncl gsn_code.ncl wrf_em_b_wave.ncl wrf_em_hill2d.ncl wrf_em_qss.ncl wrf_em_squall_2d_x.ncl wrf_em_squall_2d_y.ncl 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

  21. 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”

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

  23. 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

  24. 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

  25. 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 -> creates wrf_user_fortran_util_0.so • For other machines, edit one of the make files

  26. How to run NCL? • Type the following to run (batch example) ncl < 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

  27. WRF-to-VIS5D Wei Wang NCAR/MMM

  28. 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

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

  30. 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

  31. 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

  32. File wrf_v5d_input -1 ! number of times to put in vis5d file, negative means ignore the times 2000-01-24_18:00:00 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

  33. File wrf_v5d_input (cont.) wrfout_d01_000000 ! WRF output file name end_of_file_list -1 ! specify v5d vertical grid 0=cartesian, -1=interp to z from lowest h, >1 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.

  34. RIP4Read/Interpolate/Plot (Version 4) Slides contribution from Dave Gill

  35. 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

  36. 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 (> 100) • Allow users to tailor the graphics • Currently works for real-data simulation data only • Detailed documentation

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

  38. 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 <machine type> (it’ll make suggestions) e.g. make linux compile RIP on a Linux computer

  39. 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

  40. 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] <model_data_name> [basic/all] \ <input_file1 input_file2> namelist-file optional • Make a directory for the files, use that as part of the model_data_name. e.g. ./storm_case/test1

  41. 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

  42. 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)

  43. 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

  44. RIP UIF &userin .... / &trajcalc .... / =============================================== --------- Plot Specification Table ------------ =============================================== Plot specification line (PSL) PSL: plot spec settings (PSS) PSL: PSSs =============================================== namelist frame specification group(FSG)

  45. 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

  46. RIP PSS • Each PSL contains several PSSs (Plot Specification Settings) (see example next) • keyword=value[,value,value] • keyword is a 4-char identifier • All PSSs within a PSL are separated by “;” • Last PSS on a PSL has no “;” • “>” at the end of the line means the PSL continues • Comments require a “#”

  47. An example of PST ======================================================== feld=tmc; ptyp=hc; vcor=s; levs=b1; cint=2; cmth=fill;> cosq=-32,light.violet,-24,violet,-16,blue,8,green, > 0,yellow,8,red,16,orange,24,brown,32,light.gray feld=slp; ptyp=hc; cint=2; linw=2 feld=uuu,vvv; ptyp=hv; vcmx=-1; colr=white; intv=5 feld=map; ptyp=hb feld=tic; ptyp=hb ======================================================== * Bold letters indicate ‘keywords’

  48. 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

  49. 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

More Related