0

I am trying to download Daymet data via python, using the following jupyter notebook provided by the ORNL: https://github.com/ornldaac/daymet-python-opendap-xarray/blob/master/1_daymetv4_discovery_access_subsetting.ipynb

Everything works fine until section 3.1.b, which looks like the following:

thredds_url = "https://thredds.daac.ornl.gov/thredds/dodsC/ornldaac/2129/" #ORNL DAAC TDS OPeNDAP URLfor Daymet V4R1 Daily Files

before = time.time() 
cnt = 0 
for g_name in granule_names: 
    print(granule_names) 
    print(g_name) 
    print(' GRANULE_NAME ---->', g_name) 
    granule_dap = thredds_url + g_name.replace('Daymet_Daily_V4R1.','') print(granule_dap)

    #Using pydap's open_url 
    thredds_ds = open_url(granule_dap) 

    #Xarray DataSet - opening dataset via remote OPeNDAP 
    ds = xr.open_dataset(xr.backends.PydapDataStore(thredds_ds), decode_coords="all")
    
    temp=ds['tmin'].sel(x=slice(lccbounds.minx[0],lccbounds.maxx[0]),
    y=slice(lccbounds.maxy[0],lccbounds.miny[0]))

    if cnt==0:
        tmin = temp
    else:
        tmin = xr.concat([tmin, temp], dim="time")

    cnt += 1

#save to netcdf
tmin.to_netcdf(var + '_tdssubset.nc') print("Processing Time: ", time.time() - before, 'seconds')

The error message occurs at the following position with this error:

thredds_ds = open_url(granule_dap)
UnicodeDecodeError: 'ascii' code cant decode byte 0x0b in position 1: ordinal not in range(128)

Any ideas how this can be fixed?

I already looked for mistakes in the labelling of the daymet_doi, etc. as with the move from Daymet V4 to V4R1 the ID had changed but this was not the root cause. Can anyone check if the tutorial is working for them?

Marco
  • 11
  • 2

0 Answers0