Unidata / siphon

Siphon - A collection of Python utilities for retrieving atmospheric and oceanic data from remote sources, focusing on being able to retrieve data from Unidata data technologies, such as the THREDDS data server.
https://unidata.github.io/siphon
BSD 3-Clause "New" or "Revised" License
215 stars 75 forks source link

TypeError: Failed to decode variable 'time1_bounds': Vectorized indexing with vectorized or outer indexers is not supported. Please use .vindex and .oindex properties to index the array. #787

Open edrewitz opened 2 weeks ago

edrewitz commented 2 weeks ago

Hi all!

I noticed an issue that began over the past couple days with the TDSCatalog as I've used this exact same code for a long time and it worked with no issues but over the past day or so I started getting all these errors out of nowhere. I am trying to access TDS for the RTMA data and I get this error: TypeError: Failed to decode variable 'time1_bounds': Vectorized indexing with vectorized or outer indexers is not supported. Please use .vindex and .oindex properties to index the array.

My guess is this has something to do with TDSCatalog (though I could be wrong) because like I said, I've used this code for a while with no issues:

                try:
                    rtma_cat = TDSCatalog('https://thredds.ucar.edu/thredds/catalog/grib/NCEP/RTMA/CONUS_2p5km/RTMA_CONUS_2p5km_'+times[0].strftime('%Y%m%d_%H00')+'.grib2/catalog.xml')
                    rtma_data = rtma_cat.datasets['RTMA_CONUS_2p5km_'+times[0].strftime('%Y%m%d_%H00')+'.grib2'].remote_access(use_xarray=True)
                    rtma_data = rtma_data.metpy.parse_cf().metpy.assign_latitude_longitude()
                    rtma_temp = rtma_data['Temperature_Analysis_height_above_ground'].squeeze()
                    rtma_dwpt = rtma_data['Dewpoint_temperature_Analysis_height_above_ground'].squeeze()

                    rtma_rh = mpcalc.relative_humidity_from_dewpoint(rtma_temp, rtma_dwpt)
                    print("Data retrieval for " + times[0].strftime('%m/%d/%Y %H00 UTC') + " is successful")

                    time = times[0]

                    return rtma_rh *100, time

                except Exception as e:

                    print("Relative Humidity Data is unavailiable for "+times[0].strftime('%m/%d/%Y %H00 UTC')+ "\nWill try to download the most recent dataset from "+times[1].strftime('%m/%d/%Y %H00 UTC'))

                    #try:
                    rtma_cat = TDSCatalog('https://thredds.ucar.edu/thredds/catalog/grib/NCEP/RTMA/CONUS_2p5km/RTMA_CONUS_2p5km_'+times[1].strftime('%Y%m%d_%H00')+'.grib2/catalog.xml')
                    rtma_data = rtma_cat.datasets['RTMA_CONUS_2p5km_'+times[1].strftime('%Y%m%d_%H00')+'.grib2'].remote_access(use_xarray=True)
                    rtma_data = rtma_data.metpy.parse_cf().metpy.assign_latitude_longitude()
                    rtma_temp = rtma_data['Temperature_Analysis_height_above_ground'].squeeze()
                    rtma_dwpt = rtma_data['Dewpoint_temperature_Analysis_height_above_ground'].squeeze()

                    rtma_rh = mpcalc.relative_humidity_from_dewpoint(rtma_temp, rtma_dwpt)
                    print("Data retrieval for " + times[1].strftime('%m/%d/%Y %H00 UTC') + " is successful")

                    time = times[1]

                    return rtma_rh *100, time

Thanks for looking into this matter.

dopplershift commented 2 weeks ago

I'm guessing this is an incompatibility with newer versions of xarray. Did you update your environment recently?

edrewitz commented 2 weeks ago

Yes, I have been playing around with my environments as of late. It seems like there may be a compatibility issue with the latest form of xarray. I did some testing (I am using Python 3.12.5). It seems like the latest version of xarray where I have no issues is xarray=2024.02.0. All later versions of xarray (2024.03.0, 2024.05.0, 2024.07.0, 2024.09.0) I get that error shown above. When testing, I noticed there is a new version of protobuf that just got released yesterday (protobuf=5.28.2). This version of protobuf doesn't work with the current version of TDSCatalog, when I downgraded to protobuf=3.20.3 TDSCatalog worked fine as usual. I hope you find this helpful. I appreciate your response and help!