from netCDF4 import Dataset import numpy as np import Ngl import xarray as xr import os from wrf import getvar, get_pyngl, latlon_coords, to_np # Open up the workstation so we can make a plot wks = Ngl.open_wks ("X11","t2_plot") # Open up the T2 max/min file that we just made a = xr.open_dataset("t2_maxmin_daily_jja_1990_rtty_1990.nc") b = Dataset("data/met_em.d01.2004-12-16_12:00:00.nc") # Read in t2max, lat and lon t2max = a.T2MAX lat, lon = latlon_coords(t2max) lat = to_np(lat) lon = to_np(lon) # Options for our data contour res = get_pyngl(wrfin=b) res.cnFillOn = True res.cnLineLabelsOn = False res.cnLinesOn = False res.sfXArray = lon res.sfYArray = lat # Map options res.mpDataBaseVersion = "MediumRes" # better map outlines res.mpOutlineBoundarySets = "GeophysicalAndUSStates" # more outlines res.mpGridAndLimbOn = False res.lbOrientation = "horizontal" res.tiMainString = "%s (%s)" % (t2max.description,t2max.units) res.tiMainFontHeightF = 0.015 plot = Ngl.contour_map(wks,t2,res) # End of program