siphon
siphon copied to clipboard
CDMRemote failing on a structure
This code downloading a NIDS NST product:
from siphon.catalog import TDSCatalog
from siphon.radarserver import RadarServer
from siphon.cdmr import Dataset
from datetime import datetime, timedelta
cat = TDSCatalog("http://thredds.ucar.edu/thredds/radarServer/catalog.xml")
url = cat.catalog_refs['NEXRAD Level III Radar from IDD'].href
rs = RadarServer(url)
query_latest = rs.query()
now = datetime.utcnow()
query_latest.lonlat_box(292.9375, 235.0625, 25.0625, 52.9375).time(now).variables('NST')
query_latest_cat = rs.get_catalog(query_latest)
data_available = list(query_latest_cat.datasets.values())
data_from_thredds = Dataset(data_available[0].access_urls['CdmRemote'])
data_from_thredds.variables['textStruct_code8gg'][:]
results in:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-33-5a7eeac0ffd5> in <module>
13 data_from_thredds = Dataset(data_available[0].access_urls['CdmRemote'])
14
---> 15 data_from_thredds.variables['textStruct_code8gg'][:]
~/repos/siphon/siphon/cdmr/dataset.py in __getitem__(self, ind)
207 pass
208 else:
--> 209 arr.dtype = dt
210
211 # Need to handle removing dimensions that have had an index
~/miniconda3/envs/py38/lib/python3.8/site-packages/numpy/core/_internal.py in _view_is_safe(oldtype, newtype)
457
458 if newtype.hasobject or oldtype.hasobject:
--> 459 raise TypeError("Cannot change data-type for object array.")
460 return
461
TypeError: Cannot change data-type for object array.