siphon icon indicating copy to clipboard operation
siphon copied to clipboard

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.

Open edrewitz opened this issue 1 year ago • 2 comments

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.

edrewitz avatar Sep 18 '24 14:09 edrewitz

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

dopplershift avatar Sep 18 '24 17:09 dopplershift

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!

edrewitz avatar Sep 19 '24 20:09 edrewitz

I'm pretty sure this was fixed by #800. We're working on a new release which will include this fix. I'm going to go ahead and close out but feel free to re-open if it's not fixed on main or in the next release.

dopplershift avatar Nov 08 '24 00:11 dopplershift