Skip to content

UnicodeDecodeError in open_url() #2

@marco-thal

Description

@marco-thal

When trying to run the script, at Step 3.1.b, I run into an error in the following code line:
thredds_ds = open_url(granule_dap)

The full error message is as follows:
`UnicodeDecodeError Traceback (most recent call last)
Cell In[38], line 18
15 print(granule_dap)
17 # Using pydap's open_url
---> 18 thredds_ds = open_url(granule_dap)
20 # Xarray DataSet - opening dataset via remote OPeNDAP
21 ds = xr.open_dataset(xr.backends.PydapDataStore(thredds_ds), decode_coords="all")

File ~\anaconda3\myenv\lib\site-packages\pydap\client.py:66, in open_url(url, application, session, output_grid, timeout)
58 def open_url(url, application=None, session=None, output_grid=True,
59 timeout=DEFAULT_TIMEOUT):
60 """
61 Open a remote URL, returning a dataset.
62
63 set output_grid to False to retrieve only main arrays and
64 never retrieve coordinate axes.
65 """
---> 66 dataset = DAPHandler(url, application, session, output_grid,
67 timeout).dataset
69 # attach server-side functions
70 dataset.functions = Functions(url, application, session)

File ~\anaconda3\myenv\lib\site-packages\pydap\handlers\dap.py:57, in DAPHandler.init(self, url, application, session, output_grid, timeout)
55 if not r.charset:
56 r.charset = 'ascii'
---> 57 dds = r.text
59 dasurl = urlunsplit((scheme, netloc, path + '.das', query, fragment))
60 r = GET(dasurl, application, session, timeout=timeout)

File ~\anaconda3\myenv\lib\site-packages\webob\response.py:622, in Response._text__get(self)
620 decoding = self.charset or self.default_body_encoding
621 body = self.body
--> 622 return body.decode(decoding, self.unicode_errors)

UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 1: ordinal not in range(128)`

I have updated everything in the script to 'Daymet V4R1' (including the ID, changed from ID=1840 to ID=2129).

Any idea where this problem is coming from and how to resolve it is highly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions