NCL example scripts for plotting WRF-ARW and MPAS data

These are sample NCL scripts for plotting WRF-ARW and MPAS data, for the NCL Tutorial at the Joint WRF and MPAS Users' Workshop, June 15, 2018.

You should be able to substitute your own WRF-ARW and/or MPAS data files in these scripts.

For more advanced WRF-ARW and MPAS plotting scripts, visit:

query_file_dims.ncl: Queries dimension names and sizes on a NetCDF file.

This example does not produce any graphics.

query_file_dims_cla.ncl: Queries dimension names and sizes of a NetCDF file entered on the command line.

This example does not produce any graphics.

query_file_vars.ncl: Queries variable names on a NetCDF file

This example does not produce any graphics.

query_file_vars_more_info.ncl: Queries variable names and their types, dimension names, and sizes on a NetCDF file.

This example does not produce any graphics.

query_var.ncl: Reads a variable and prints some information about it.

This example does not produce any graphics.

wrf_native_1.ncl: Creates a filled contour plot of the "HGT" variable in a WRF-ARW file, using the map projection defined in the file.

wrf_native_2.ncl: Changes the color map used for the filled contours.

wrf_native_3.ncl: Increases the number of contour levels and makes the labelbar vertical.

wrf_native_4.ncl: Explicitly sets the contour levels.

wrf_native_5.ncl: Sets some map resources to make the map outlines more visible.

wrf_gsn_1.ncl: Creates a filled contour plot of the "HGT" variable in a WRF-ARW file, using a different map projection than what's defined in the file. The key for this to work is that you need to read the XLAT / XLONG arrays off the file and attach them as special attributes called "lat2d" and "lon2d".

wrf_gsn_2.ncl: Changes the color map used for the filled contours.

wrf_gsn_3.ncl: Increases the number of contour levels and makes the labelbar vertical.

wrf_gsn_4.ncl: Explicitly sets the contour levels, adds a little margin around the domain being plotted, adds nicer map tickmarks, and county outlines.

wrf_tc_native.ncl: Creates a filled contour plot of temperature (degC) over a map using the map projection defined in the file.

wrf_tc_native_with_grid.ncl: Same as wrf_tc_native.ncl, except the WRF-ARW lat/lon grid is drawn using gsn_coordinates.

wrf_tc_ortho.ncl: Similar to wrf_tc_plot_native, except the plot is drawn over an orthographic map projection, with resources set to turn on land and ocean fill and lat/lon grid lines.

wrf_tc_native_panel.ncl: Draws six different levels of "tc" in a panel plot with a common labelbar.

wrf_tc_native_panel_custom.ncl: Similar to wrf_tc_native_panel.ncl, except with more customization of the paneled plots. When you have lot of plots in a panel, it helps to turn off some of the tickmarks on the interior plots for a cleaner look.

wrf_tc_native_shapefiles.ncl: Similar to wrf_tc_native.ncl, except NCL's map outlines are turned off and shapefile outlines are drawn used instead. Country shapefiles can be downloaded from https://gadm.org/download_country_v3.html.

wrf_tc_native_shapefiles_mask.ncl: Uses a shapefile with USA state outlines (downloaded from https://gadm.org/download_country_v3.html) to mask the data over three states. This script uses the "shapefile_mask_data" function, which is in shapefile_utils.ncl.

wrf_tc_native_shapefiles_mask_points.ncl: Same as wrf_tc_native_shapefiles_mask.ncl, except the WRF-ARW lat/lon grid is drawn as a set of points gsn_coordinates. This script uses the "shapefile_mask_data" function, which is in shapefile_utils.ncl.

wrf_tc_native_shapefiles_mask_zoom.ncl: Similar to wrf_tc_native_shapefiles_mask.ncl, except it zooms in on the map so you can see more detail. Note that the native WRF-ARW map projection is not being used in this example.

wrf_vector.ncl: Creates a simple wind vector plot.

wrf_vector_color.ncl: Creates a wind vector plot colored by magnitude. Other resources are set for further customization.

wrf_overlays.ncl: Creates an overlay plot with slp line contours, wind barbs, and temperture filled contours.

mpas_generic.ncl: Creates a raster-filled contour plot of the "ter" variable on a 40,962 cell MPAS file. The file, which is 121+ megabytes, can be downloaded from https://mpas-dev.github.io/atmosphere/real_data.html.

mpas_ter_uni.ncl: Creates a raster-filled contour plot of the "ter" variable on a 2.6 million cell MPAS "init.nc" file. This script takes about 7 seconds.

mpas_ter_hwt.ncl: Creates a raster-filled contour plot of the "ter" variable on a 6.5 million cell MPAS "init.nc" file. This script takes about 18 seconds.

mpas_ter_uni_cell.ncl: Creates a cell-filled contour plot of the "ter" variable on a 2.6 million cell MPAS "init.nc" file. This script takes about 64 seconds, but produces a nicer plot than mpa_ter_uni. About half the time is taken up constructing the lat/lon boundaries for each cell. If you use mpas_ter_uni_cell_faster.ncl, which reads the lat/lon cell boundaries off a NetCDF file, then the script takes 30 seconds.

mpas_ter_hwt_cell.ncl: Creates a cell-filled contour plot of the "ter" variable on a 6.5 million cell MPAS "init.nc" file. This script takes about 153 seconds, but produces a nicer plot than mpa_ter_hwt. About half the time is taken up constructing the lat/lon boundaries for each cell. If you use mpas_ter_hwt_cell_faster.ncl, which reads the lat/lon cell boundaries off a NetCDF file, then the script takes 72 seconds.

mpas_ter_hwt_custom.ncl: Similar to mpas_ter_hwt, except the contour levels and color map are customized.

mpas_ter_hwt_zoom.ncl: Similar to mpas_ter_hwt.ncl, except map resources are set to zoom in on the Tibet region. You can see the structure of the MPAS mesh if you look closely.

mpas_contour_plot_uni.ncl: Creates a filled contour plot of the desired variable on a 2.6 million cell MPAS file. The default variable plotted is relhum_200hPa, which can be changed by setting "varname" on the command line (see comments in script).

mpas_contour_plot_hwt.ncl: Creates a filled contour plot of the desired variable on a 6.5 million cell MPAS file. The default variable plotted is relhum_200hPa, which can be changed by setting "varname" on the command line (see comments in script).

mpas_contour_plot_panel.ncl: Creates contour plots of the same variable read off the "uni" (low-res) and "hwt" (high-res) MPAS files and compares them in a panel.

mpas_contour_plot_panel_cell.ncl: Similar to mpas_contour_plot_panel.ncl, except it uses CellFill to create the contour plots. CellFill is slower, but can produce nicer plots. This script takes about 215 seconds. About half the time is taken up constructing the lat/lon boundaries for each cell. If you use mpas_contour_plot_panel_cell_faster.ncl, which reads the lat/lon cell boundaries off a NetCDF file, then the script takes 102 seconds.

mpas_contour_plot_zoom_panel.ncl: Similar to mpas_contour_plot_panel.ncl, except it zooms in on the United States for a more detailed look at the data.

mpas_contour_plot_zoom_panel_cell.ncl: Similar to mpas_contour_plot_zoom_panel.ncl, except it uses CellFill to create the contour plots. CellFill is slower, but can produce nicer plots.

mpas_zoom_colorado_uni_cell.ncl: Creates a cell-filled contour plot of a selected MPAS variable over Colorado. Using NCL's CellFill method allows us to also turn on the cell edges, so we can see the structure of the grid. This is a 2.6 million cell MPAS file.

mpas_zoom_colorado_hwt_cell.ncl: Creates a cell-filled contour plot of a selected MPAS variable over Colorado. Using NCL's CellFill method allows us to also turn on the cell edges, so we can see the structure of the grid. This is a 6.5 million cell MPAS file.

mpas_zoom_boulder_uni_cell.ncl: This is similar to mpas_zoom_colorado_uni_cell.ncl, except the map is further zoomed in over Boulder, Colorado so you can see the mesh even better. Note that this mesh is less dense than the "uni" one.

mpas_zoom_boulder_hwt_cell.ncl: This is similar to mpas_zoom_colorado_hwt_cell.ncl, except the map is further zoomed in over Boulder, Colorado so you can see the mesh even better. Note that this mesh is more dense than the "uni" one.

mpas_zoom_tibet_uni_cell.ncl: Creates a cell-filled contour plot of a selected MPAS variable over Tibet. Using NCL's CellFill method allows us to also turn on the cell edges, so we can see the structure of the grid. This is a 2.6 million cell MPAS file.

mpas_zoom_tibet_hwt_cell.ncl: Creates a cell-filled contour plot of a selected MPAS variable over Tibet. Using NCL's CellFill method allows us to also turn on the cell edges, so we can see the structure of the grid. This is a 6.5 million cell MPAS file.

mpas_draw_elements.ncl: Draws various elements of an MPAS grid (primal mesh, dual mesh, edge points). This script is meant to be used on a zoomed in area, and NOT across the whole mesh.