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

UnicodeDecodeError in open_url() #2

Open
marco-thal opened this issue Feb 2, 2023 · 0 comments
Open

UnicodeDecodeError in open_url() #2

marco-thal opened this issue Feb 2, 2023 · 0 comments

Comments

@marco-thal
Copy link

marco-thal commented Feb 2, 2023

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!

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

No branches or pull requests

1 participant