PostWRF’s Documentation¶
PostWRF is a bunch of interactive tools for the visualizaion and post-processing of the Weather Research and Forecasting (WRF) model outputs. PostWRF as an integrated system based on the NCAR Command Language (NCL) and Linux shell scripts, acts as a bridge between atmospheric modeling and environmental science, and makes it possible for many environmental scientists to directly visualize the WRF model outputs, without any advanced knowledge in NCL scripting and WRF modeling system.
PostWRF can provide the input data for the RTTOV (radiation transfer) model, out of WRF output files. Moreover, it can visualize the RTTOV output files from ASCII format to a desired format of NetCDF, PNG, GeoTIFF, or even RGB image.
- PostWRF codes are publically available at:
- https://github.com/anikfal/PostWRF
Note
PostWRF is a Linux-based software, developed on Fedora/CentOS. However, it can be tested on the Mac OS.
Overview¶
For each post-processing task, there are one or more corresponding NCL scripts which are automatically modified by the Linux shell scripts. The end user does not need to make any direct modifications on the NCL scripts, rather, the Linux shell scripts act as proxies between NCL codes and the end user, in modifying the NCL codes with regard to some primary input data, provided by the user.
Software structure¶
The processing steps through PostWRF is depicted below as a flowchart diagram:
Run PostWRF¶
Modify namelist.wrf and enable the section associated with the desired post-processing task:
vi namelist.wrf
Run the tool:
./postwrf.sh
The user can Run postwrf.sh with some special switches. Each switch is described by the command bellow:
./postwrf.sh -h
Installation¶
sudo dnf install ncl
If need more information, please see: NCL download and installation
chmod +x postwrf.sh
chmod +x modules/*.sh
WRF and ERA5 Data extraction¶
The very first step in running PostWRF is modifying namelist.wrf:
vi namelist.wrf
Time-series of the WRF variables¶
The first section in namelist.wrf corresponds to the data extraction:
==================== DATA EXTRACTION ======================= WRF_variable_name = pvo +Vertical_profile_plot_on_off = 0 |
After modifying namelist.wrf, run the software by:
./postwrf.sh
- Nearest point
- Bilinear
- IDW
——————————————————————————————————— WRF output variable: pvo (Potential Vorticity) - unit_scale: PVU ——————————————————————————————————— Time Berlin_(52.52-13.40) London_(51.51-00.10) 2021-11-01_06:00:00 -0.26 -0.33 2021-11-01_07:00:00 -0.27 -0.25 2021-11-01_08:00:00 -0.29 -0.22 2021-11-01_09:00:00 -0.28 -0.24 2021-11-01_10:00:00 -0.25 -0.22 2021-11-01_11:00:00 -0.22 -0.15 2021-11-01_12:00:00 -0.18 0.01 2021-11-01_13:00:00 0.22 1.79 2021-11-01_14:00:00 2.59 3.91 2021-11-01_15:00:00 3.22 5.22 2021-11-01_16:00:00 2.53 6.81 |
Note
ERA5 data can tbe extracted by the same method. Set ERA5_Extract_On-Off to 1, and WRF_Extract_On-Off to 0. For ERA5 data, only one method (bilinear) is applied for interpolation. Moreover, unlike the WRF data, for ERA5 data the start and end of time slots can be specified.
Plotting vertical profiles (for WRF outputs)¶
If +Vertical_profile_plot_on_off is set to 1, the vertical profiles of the locations (Berlin and London) will be plotted:
Conversion to GeoTIFF¶
PostWRF provides conversion of a desired variable (polynomial of variables) of WRF output to GeoTIFF format.
For running this capability of PostWRF,it is necessary to have the gdal tool installed:
sudo dnf install gdal
The section corresponding to the GeoTIFF conversion in namelist.wrf must be enabled:
============== CONVERT TO GEOTIFF ================ ============================================== Geotiff_ON_OFF = 1 Variable_name_to_Geotiff = rh Geotiff_pressure_level = 700 |
After running postwrf.sh, the converted tif files will be saved in a folder with a name similar to the name of the file selected
The generated GeoTIFF files could be processed and visualized by a GIS software:
Contour plots¶
A combination of three variables, as well as wind vectors and location markers, could be plotted by PostWRF.
Note
Line colors, font sizes, etc., can be modified by changing the relevant variables in namelist.wrf
Example 1¶
Two line contours plus the locations of some points (specified in ‘Data extraction’ section of namelist.wrf):
Output image at a specific time-slot in the WRF output is as bellow:
Example 2¶
Shaded contour of a polynomial (tk * (rh/100)^2)
During the processing, several questions, such as the color pattern of the contours, name and unit of the polynomial, and file format will be asked from the usr.
The user can specify a pressure level for each variable names, with exactly the same number as the variable names (2 values, corresponded to tk and rh for this example). If only one value is set for 3rd_Variable_pressure_level, all the variables (tk and rh) will be plotted at the same pressure level.
Output image at a specific time-slot in the WRF output is as bellow:
Example 3¶
Panel plot of a shaded and a line contour
Panel plot is a capability of PostWRF which must be set in the General settings section of namelist.wrf
Output image at a specific time-slot in the WRF output is as bellow:
Cross-section plots¶
- Like the contour plots, PostWRF provides a combination of three variables to be overlaid
- in a cross-section plot, besides the path of cross-section in a separate small plot inside the main plot
Note
Line colors, font sizes, etc., can be modified by changing the relevant variables in namelist.wrf
Example 1¶
A set of line contours with the path of the cross-section:
Output image at a specific time-slot in the WRF output is as bellow:
Example 2¶
A set of line contours of a polynomial and a set of shaded contours, besides the path of the cross-section
Output image at a specific time-slot in the WRF output is as bellow:
Example 3¶
Average (12 hours) plots of Two sets of line contours, shown as a panel plot
Panel plot is a capability of PostWRF which must be set in the General settings section of namelist.wrf
Output image at a specific time-slot in the WRF output is as bellow:
Plotting WRF domains¶
Two methods are available in PostWRF to plot the WRF’s simulation domain:
Method 1¶
Using namelist.wps from the WRF Preprocessing System (WPS)
In this method a schematic map of the simulation domain will be plotted.
Output image at a specific time-slot in the WRF output is as bellow:
Method 2¶
Using the model’s outputs, which could be the outputs of geogrid.exe, metgrid.exe, or wrf.exe
In this method the WRF simulation domain will be plotted as a topography map.
Output image at a specific time-slot in the WRF output is as bellow:
Meteorological diagrams¶
Plotting two meteorological diagrams is provided by PostWRF:
Wind-rose¶
Output image at a specific time-slot in the WRF output is as bellow:
SkewT¶
Output image at a specific time-slot in the WRF output is as bellow:
Statistical Diagrams¶
The extracted variables (by the PostWRF’s EXTRACT section) can be accompanied by observation values, and used in a couple of statistical diagrams. Time-series, scatter plots, and Taylor diagrams can be plotted by PostWRF. Except the time sereis, the other two diagrams (scatter plots and Taylor diagrams), need both simulation (WRF) and observation values. Time series can be plotted by using only simulation values, without incorporating observations.
Example 1¶
Plotting time-series (can be simulations or observations) of the WRF output from some locations:
Plotting time-series needs the WRF output extractions in some points. In other words, running the “DATA EXTRACTION” section of PostWRF is a prerequisite stage for the statistical section. The user can copy the simulation extractions (files started by “values”) and change “values” to “observations” to make a new file with a name started by “observations”. Afterwards, the user is supposed to update the new file and replace its values with observation values.
For example, suppose we have extracted T2 variable in 3 locations of Loc_1, Loc_2, and Loc_3, saved in a directory named outputs_postwrf_wrfout_d01_2017-06-21_18:00:00. The extracted file is named “values-T2-Bilinear”. the observation file (provided by the user) will be a file named “observations-T2-Bilinear”, with the exact structure of the copied file, but different values (observation values).
Minimum and maximum of the Y-axis can be specified while running the program.
Sample output image is as below:
Example 2¶
Scatter plot using the WRF output, and observations in some locations:
Sample output image is as below:
Example 3¶
Taylor Diagram using the WRF output, and observations in some locations:
If several variable outputs are available, Taylor Diagram will be plotted with several models (represented as variables).
Sample output image is as below:
RTTOV model input/output¶
RTTOV (Radiative Transfer for TOVS) is a fast radiative transfer model to simulate imagery from about 100 satellite sensors. It is a FORTRAN 90 code for simulating satellite radiances, designed to be incorporated within user applications.
PostWRF can prepare RTTOV input file from the WRF output variables, and convert the RTTOV outputs from ASCII to other formats, such as NetCDF, PNG, and GeoTIFF.
Input data preparation¶
Generating the RTTOV input data:
PostWRF can generate RTTOV input files from a WRF output, on specified time-slots, for all of the WRF horizontal grid points. In the current PostWRF software (V1.2), aerosol impact on the optical depth is supported only for dust particles. The advanced user can modify the NCL codes to add their desired supplemetary capabilities (e.g. extraction of O3, SO2, and other gaseous profiles).
The first lines of a sample RTTOV input file (from the WRF output), generated by PostWRF is as below:
RTTOV input data from WRF, generated by PostWRF
Output data conversion¶
Converting RTTOV output files to other formats:
PostWRF can convert the RTTOV output files (as ASCII format) to stadard geoscientific data, such as NetCDF. The simulated variables by the RTTOV model are brightness temperature, reflectance, radiance, and surface emissivity. The user must be aware that some of the RTTOV variables might be empty, or with uniform values.
RTTOV output as an ASCII file can be converted to NetCDF, GeoTIFF, PNG, or RGB image. For converting to an RGB image, a python code is run. The required python packages for converting to an RGB image are numpy, pillow, and netCDF4.
Sample output as a PNG image file is as below:
ERA5 Contour plots¶
A combination of three variables, as well as wind vectors and location markers, could be plotted by PostWRF. Moreover, the user can plot the whole domain or a specified sub-domain by turning on ERA5_SubDomain_on_off and setting the relevant variables (Min_lat, Max_lat, Min_lon, and Max_lon)
Note
ERA5 data must be downloaded as NetCDF format
Example 1¶
A group of line contours (temperature) overlaid on a group of filled contours (geopotential thickness between 500 and 1000 hpa)
Output image at a specific time-slot in the ERA5 NetCDF file is as bellow:
Please notice that unlike the WRF outputs, for ERA5 files, pressure levels are not interpolated. Therefor if the input pressure level is not in the file (e.g. 333), the nearest pressure level to this value will be selected.
Example 2¶
Similar to example one, but with overlaid wind vectors, with sub-domain
Same as WRF outputs, location labels, as well as shapefiles can also be overlaid on the plots
Output image at a specific time-slot in the WRF output is as bellow:
Example 3¶
Panel plot of a shaded and a line contour
Panel plot is a capability of PostWRF which must be set in the General settings section of namelist.wrf
Output images of vorticity by 12 hour average, as panel plots: