Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Demonstrate how to smooth contour values from a higher resolution model field.

By: Kevin Goebbert

Date: 13 April 2017

Do the needed imports

Set up netCDF Subset Service link

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Cell In[2], line 19
     15                 'u-component_of_wind_isobaric',
     16                 'v-component_of_wind_isobaric')
     17 
     18 # Obtain the data we've queried for
---> 19 data = ncss.get_data(query)
     20 
     21 # Make into an xarray Dataset object
     22 ds = xr.open_dataset(NetCDF4DataStore(data)).metpy.parse_cf()

File ~/micromamba/envs/metpy-cookbook/lib/python3.14/site-packages/siphon/ncss.py:114, in NCSS.get_data(self, query)
     93 def get_data(self, query):
     94     """Fetch parsed data from a THREDDS server using NCSS.
     95 
     96     Requests data from the NCSS endpoint given the parameters in `query` and
   (...)    112 
    113     """
--> 114     resp = self.get_query(query)
    115     return response_handlers(resp, self.unit_handler)

File ~/micromamba/envs/metpy-cookbook/lib/python3.14/site-packages/siphon/http_util.py:406, in HTTPEndPoint.get_query(self, query)
    386 """Make a GET request, including a query, to the endpoint.
    387 
    388 The path of the request is to the base URL assigned to the endpoint.
   (...)    403 
    404 """
    405 url = self._base[:-1] if self._base[-1] == '/' else self._base
--> 406 return self.get(url, query)

File ~/micromamba/envs/metpy-cookbook/lib/python3.14/site-packages/siphon/http_util.py:488, in HTTPEndPoint.get(self, path, params)
    486     else:
    487         text = resp.text
--> 488     raise requests.HTTPError(f'Error accessing {resp.request.url}\n'
    489                              f'Server Error ({resp.status_code: d}: {text})')
    490 return resp

HTTPError: Error accessing https://thredds.ucar.edu/thredds/ncss/grid/grib/NCEP/NAM/CONUS_12km/NAM_CONUS_12km_20261103_0600.grib2?var=v-component_of_wind_isobaric&var=u-component_of_wind_isobaric&var=Geopotential_height_isobaric&time=2026-11-17T06%3A17%3A28.738574%2B00%3A00&addLatLon=True
Server Error ( 400: Requested time 2026-11-17T06:17:28.738Z does not intersect actual time range 2026-11-03T06:00:00Z - 2026-11-06T18:00:00Z)

Pull apart the data

Set up the projection for LCC

Subset and smooth

Plot the contours