I'm trying to plot latest HRRR surface temperature with data from the THREDDS data server.
cat = TDSCatalog('https://thredds-test.unidata.ucar.edu/thredds/catalog/'
'grib/NCEP/HRRR/CONUS_2p5km/latest.xml')
dataset = cat.datasets[0]
ncss = dataset.subset()
sfctemp = ncss.query()
sfctemp.variables('Temperature_height_above_ground')
sfctemp.vertical_level(2.0)
sfctemp.add_lonlat().lonlat_box(north=55, south=20, east=281, west=230)
sfctemp.time(now)
sfctemp_data = ncss.get_data(sfctemp)
That works fine, however, when I grab and print the actual data values from:
sfctemp_vars = units.K * sfctemp_data.variables['Temperature_height_above_ground'][:].squeeze()
It returns:
[[nan nan nan ... nan nan nan] [nan nan nan ... nan nan nan] [nan nan nan ... nan nan nan] ... [nan nan nan ... nan nan nan] [nan nan nan ... nan nan nan] [nan nan nan ... nan nan nan]] kelvin
Not entirely sure what I'm doing wrong here. Help would be greatly appreciated!
I don't think there's actually a problem going on. If I run your code, I do see what you see:
[[nan nan nan ... nan nan nan] [nan nan nan ... nan nan nan] [nan nan nan ... nan nan nan] ... [nan nan nan ... nan nan nan] [nan nan nan ... nan nan nan] [nan nan nan ... nan nan nan]] kelvin
These are just missing values where the grid has undefined/missing values along the edges of the domain. If I run:
import numpy as np
np.nanmax(sfctemp_vars)
I get:
308.1873
A quick plot with:
import matplotlib.pyplot as plt
plt.imshow(sfctemp_vars)
gives me something that seems reasonable:
Note the patches of white missing data at the top and bottom.