Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

how to use the wrfout file in get_pyngl and glob?


New member
dear friends,
I encountered two issues when processing wrf output data.
first one: when I use the get_pyngl, it told me that RuntimeError: 'pyngl' is not installed or is disabled. but I have install the Nio &Ngl in conda, how to call this program?
here is my code.
#6.5PyNGL example using a variable
from wrf import getvar, get_pyngl, geo_bounds, latlon_coords
from __future__ import print_function
from netCDF4 import Dataset

ncfile = Dataset("/mnt/hgfs/H/1-dataprocess/6-wrfoutput/w-test4/")

#get the sea level pressure
slp = getvar(ncfile, "slp")

#import Nio, Ngl
#get tge pyngl resources from the variable
pyngl_resources = get_pyngl(slp)

#get the latitude and longitude coordinate.
lats,lons = latlon_coords(slp)
print(lats, lons)

#get the geobounds from the SLP variable
bounds = geo_bounds(slp)

#get the geographic boundaries for a subset of the domain
slp_subset = slp[100:150,2:50]
slp_subset_bounds = geo_bounds(slp_subset)

second one: when I want to add all wrf files to analysis, it showed a AttributeError: NetCDF: Can't open HDF5 attribute. I am sure the file path of wrf outfiles is right and can you tell me how to solve this problem?
here is my code.
#7* geographic boundaries with moving nest example
from wrf import ALL_TIMES, getvar, geo_bounds
from glob import glob
from netCDF4 import Dataset as nc
#get all the domain 01 files
wrf_filenames = glob("/mnt/hgfs/H/dataprocess/6-wrfoutput/wrfout_d01_*")
ncfile = [nc(x) for x in wrf_filenames]

#slp is the example variable and includes all times
slp = getvar(ncfile, "slp", timeidx=ALL_TIMES)
#get the geographic boundaries
bounds = geo_bounds(slp)

here attaches my wrf outfile. can you help me?