Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue Sep 18, 2024 · 2 comments

Comments

@edrewitz
Copy link

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
Copy link
Member

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

@edrewitz
Copy link
Author

edrewitz commented Sep 19, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants