Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Jupyter notebook showing how to use Python to access the NCEI radar archive on Amazon S3 through Unidata's THREDDS server.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tjlang

This comment has been minimized.

Copy link

commented Oct 28, 2015

I get the following error when trying to execute line 2 (the RadarServer declaration):


KeyError Traceback (most recent call last)
in ()
1 from siphon.radarserver import RadarServer
----> 2 rs = RadarServer('http://thredds-aws.unidata.ucar.edu/thredds/radarServer/nexrad/level2/S3/')

/Users/tjlang/anaconda/lib/python2.7/site-packages/siphon/radarserver.pyc in init(self, url)
66 if url.endswith(xmlfile):
67 url = url[:-len(xmlfile)]
---> 68 super(RadarServer, self).init(url)
69
70 def _get_metadata(self):

/Users/tjlang/anaconda/lib/python2.7/site-packages/siphon/http_util.pyc in init(self, url)
345 self._base = url
346 self._session = create_http_session()
--> 347 self._get_metadata()
348
349 def get_query(self, query):

/Users/tjlang/anaconda/lib/python2.7/site-packages/siphon/radarserver.pyc in _get_metadata(self)
69
70 def _get_metadata(self):
---> 71 ds_cat = TDSCatalog(self.url_path('dataset.xml'))
72 self.metadata = ds_cat.metadata
73 self.variables = set(k.split('/')[0] for k in self.metadata['variables'].keys())

/Users/tjlang/anaconda/lib/python2.7/site-packages/siphon/catalog.pyc in init(self, catalog_url)
55
56 # If we were given an HTML link, warn about it and try to fix to xml
---> 57 if 'html' in resp.headers['content-type']:
58 import warnings
59 new_url = self.catalog_url.replace('html', 'xml')

/Users/tjlang/anaconda/lib/python2.7/site-packages/requests/structures.pyc in getitem(self, key)
52
53 def getitem(self, key):
---> 54 return self._store[key.lower()][1]
55
56 def delitem(self, key):

KeyError: 'content-type'

@dopplershift

This comment has been minimized.

Copy link
Owner Author

commented Oct 29, 2015

Are you, by chance, coming from a non-edu domain? Since the TDS is locked down to .edu only, siphon will only work there?

I need to catch the error and be more clear about what's going on (obviously), but the root cause is that you're getting a 403 (Unauthorized) error.

@imaleaper

This comment has been minimized.

Copy link

commented Oct 29, 2015

I am having the same 'content-type' error. I am not on an edu domain. Any way to get around this TDS lock down?

@dopplershift

This comment has been minimized.

Copy link
Owner Author

commented Nov 2, 2015

Sorry, we kinda have to be careful of data charges. One option, if you're looking for data from the last two weeks is to use our server at http://thredds.ucar.edu/thredds/

The other option is that you can browse and downloda the data over http directly from the S3 bucket at https://noaa-nexrad-level2.s3.amazonaws.com/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.