Wei Wang and Bill Skamarock NCAR/MMM Ethan Alpert (NCAR/SCD)

Slides:



Advertisements
Similar presentations
B2PDF b2pdf is the new and innovative release of our powerful command line tool for PDF customization b2pdf is a robust stand alone PDF file generation.
Advertisements

WRF Modeling System V2.0 Overview
® Page 1 Intel Compiler Lab – Intel Array Visualizer HDF Workshop VI December 5, 2002 John Readey
The NCAR Command Language (NCL) and the NetCDF Data Format Research Tools Presentation Matthew Janiga 10/30/2012.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Guide To UNIX Using Linux Third Edition
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Guide To UNIX Using Linux Third Edition
Chapter 3 Software Two major types of software
Current Visualization Software NCL, Amira, and OpenDX By Drew Brumm.
Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Programming In C++ Spring Semester 2013 Programming In C++, Lecture 1.
Lesson 4 Computer Software
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
The NCAR Command Language (NCL) Ethan Alpert Visualization and Enabling Technologies Section, SCD, NCAR.
A First Program Using C#
Linux Operations and Administration
Chapter Lead Black Slide Powered by DeSiaMore Powered by DeSiaMore.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
WRF Post-Processing Wei Wang and Bill Skamarock NCAR/MMM Ethan Alpert (NCAR/SCD)
NCL Website Tour NCL Website Tour  NCL Website Tour Overview, downloading, what’s new FAQ Examples.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
Introduction to the WRF Modeling System Wei Wang NCAR/MMM.
Chapter To familiarize you with  Why COBOL is a popular business-oriented language.  Programming practices and techniques  History of COBOL.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Development of ORBIT Data Generation and Exploration Routines G. Shelburne K. Indireshkumar E. Feibush.
1.8History of Java Java –Based on C and C++ –Originally developed in early 1991 for intelligent consumer electronic devices Market did not develop, project.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
An IDL-BasedValidation Toolkit: Extensions to use the HDF-EOS Swath Format Ken Stone, Center for Lower Atmospheric Studies - University of Colorado, Boulder.
Scientific Computing Division A tutorial Introduction to Fortran Siddhartha Ghosh Consulting Services Group.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
PowerBuilder Online Courses - by Prasad Bodepudi
RAMS Evaluation and Visualization Utilities (REVU) Post Processing.
Lead Black Slide. © 2001 Business & Information Systems 2/e2 Chapter 5 Information System Software.
1 Graphics CSCI 343, Fall 2015 Lecture 2 Introduction to HTML, JavaScript and WebGL.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
_______________________________________________________________CMAQ Libraries and Utilities ___________________________________________________Community.
Installing and Running the WPS Michael Duda 2006 WRF-ARW Summer Tutorial.
Geog Basic Skills in Scientific Programming Syllabus, Introduction, Fundamentals of IDL Syntax.
The CCSM2.0 Quick Start Guide Lawrence Buja CCSM Software Engineering Group June
C OMPUTING E SSENTIALS Timothy J. O’Leary Linda I. O’Leary Presentations by: Fred Bounds.
Post Processing Tools Sylvia Murphy National Center for Atmospheric Research.
SCD User Briefing NCL and PyNGL Visualization for the Geosciences Don Middleton with presentation material developed by Luca Cinquini, Mary Haley, Fred.
Postgraduate Computing Lectures PAW 1 PAW: Physicist Analysis Workstation What is PAW? –A tool to display and manipulate data. Learning PAW –See ref. in.
Installing and Running the WPS Michael Duda 2006 WRF-ARW Summer Tutorial.
Chapter – 8 Software Tools.
Systems and User Interface Software. Types of Operating System  Single User  Multi User  Multi-tasking  Batch Processing  Interactive  Real Time.
Hernán García CeCalcULA Universidad de los Andes.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Computer Programming - Key Concepts and Terms Computer Program – A computer program is a set of instructions for computer, arranged in logical order, using.
Invitation to Computer Science 6th Edition
Development Environment
Andrew White, Brian Freitag, Udaysankar Nair, and Arastoo Pour Biazar
CSCI-235 Micro-Computer Applications
Chapter 2 First Java Programs
National Scientific Library at Tbilisi State University
Use of Mathematics using Technology (Maltlab)
An Introduction to Structured Program Design in COBOL
COMPUTER SOFT WARE Software is a set of electronic instructions that tells the computer how to do certain tasks. A set of instructions is often called.
NetCDF and Scientific Data Standard
Introduction to MATLAB
Introduction to Computer Programming
Tour of NCL Website Modified by R. Grotjahn
NCL variable based on a netCDF variable model
Programming Logic and Design Eighth Edition
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Wei Wang and Bill Skamarock NCAR/MMM Ethan Alpert (NCAR/SCD) WRF Post-Processing Wei Wang and Bill Skamarock NCAR/MMM Ethan Alpert (NCAR/SCD)

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

netCDF Data

netCDF Data netCDF is one of the data formats chosen for WRF I/O, and is currently supported. What is netCDF? “A library for storing and retrieving scientific data in self-describing, platform-independent files; enhanced by various utilities,…” (http://www.unidata.ucar.edu/) Documentation available at above site.

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.

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 reads a textual representation of a netCDF dataset and generates the corresponding binary netCDF file or a C or FORTRAN program to create the netCDF dataset

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

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

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)

NCL in WRF

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

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) It is free!

Downloading NCL Go to: Read and agree to GPL license 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

Installing NCL Uncompress tar file in installation directory: Untar: 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)

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

Reference Documentation Main reference documentation http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/Overview.html 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/NclFuncsAndProcs.html

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

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

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 < wrapper_input >! wrapper_W.c

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

NCL for WRF Model Output 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 rotate model wind to earth coordinate.

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/

WRF_NCL/em/ directory make_ncl_fortran make_ncl_fortran.alpha make_ncl_fortran.rhlinux 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 Scripts to build fortran shared library Created by fortran build NCL functions and routines used by the plotting scripts Plotting scripts

How to generate shared object file? Two makefiles exist to create shared object file from Fortran code: 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

How to run NCL? Type the following to run ncl < wrf_em_real.ncl Depending on output option, one can run NCL interactively or in ‘batch’ mode. There are corresponding NCL scripts for height model. cd WRF_NCL/eh/

Example WRF NCL Plotting Script ; ; script to produce standard plots for a wrf real-data run load "wrf_plot.ncl" load "wrf_user.ncl" load "gsn_code.ncl" load "skewt_func.ncl" a = addfile("wrfout_01_000000.nc","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 Files containing NCL functions and routines open netcdf file output options

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 = it*6. ; 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.8*tc+32. 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 = u*1.94386 v = v*1.94386 tc_plane = tc(0,:,:) u_plane = u(0,:,:) v_plane = v(0,:,:) Loop through all times in the output file Function (wrf_user_getvar) that reads data from the WRF output file and computes appropriate diagnostic fields (if necessary)

Example WRF NCL Plotting Script (cont.) opts_tc = True opts_tc@MainTitle = "Surface T (F, color) SLP (mb) and winds (kts)" ; and many more options... opts_psl = True opts_vct = True opts_vct@NumVectors = 47 opts_vct@WindBarbsOn = True opts_vct@NoTitles = True opts_vct@vcWindBarbColor = "black" opts_vct@vcRefAnnoOn = False opts_mp = True map = wrf_new_map(wks,a,opts_mp) opts_map = True opts_map@LabelFont = "HELVETICA-BOLD" opts_map@LabelFontHeight = .01 wrf_maplabel(wks,map,opts_map) Options for plots. Logical variable is “True” if options are present, options are attributes of the logical variable Create map background, label map wrf_mapoverlay(map,contour_psl) wrf_mapoverlay(map,vector)

Example WRF NCL Plotting Script (cont.) Create plots (contour fill/line and vector) Combine individual plots into single picture (overlay or merge) Send picture to output device Clear for the next picture contour_tc = wrf__fill_contour(wks,tc_plane,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)

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",pressure,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

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,angle) tc_plane = wrf_user_intrp3d(tc,z,ter,"v",plane,angle) ; lots of plotting... end do Point in model ‘gridpoint’ space Angle of plane passing through ‘gridpoint’ Interpolation to vertical cross section

Example WRF NCL Plotting Script (cont.) 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 = u*1.94386 v = v*1.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 Skew-T plots First get necessary variables Find nearest gridpoint Options needed (skewOpts) not shown here

Sample plots http://rain.mmm.ucar.edu/mm5/pages/wrf.html

WRF-to-VIS5D Wei Wang NCAR/MMM

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

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/

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

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

File wrf_v5d_input Space at the beginning: Not processed -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

File wrf_v5d_input (cont.) wrfout_01_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.

The end