Skip to content

Commit

Permalink
use pydap version dependent kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
observingClouds committed Jun 3, 2022
1 parent 1280538 commit 9aa6800
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions xarray/backends/pydap_.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,38 +100,26 @@ def open(
user_charset=None,
):

if output_grid is None:
output_grid = True

if verify is None:
verify = True

if timeout is None:
from pydap.lib import DEFAULT_TIMEOUT

timeout = DEFAULT_TIMEOUT

if user_charset is None:
user_charset = "ascii"

kwargs = {
"url": url,
"application": application,
"session": session,
"output_grid": output_grid or True,
"timeout": timeout,
}
if Version(pydap_version) >= Version("3.3.0"):
ds = pydap.client.open_url(
url=url,
application=application,
session=session,
output_grid=output_grid,
timeout=timeout,
verify=verify,
user_charset=user_charset,
)
else:
ds = pydap.client.open_url(
url=url,
application=application,
session=session,
output_grid=output_grid,
timeout=timeout,
kwargs.update(
{
"verify": verify if verify is not None else True,
"user_charset": user_charset or "ascii",
}
)
ds = pydap.client.open_url(**kwargs)
return cls(ds)

def open_store_variable(self, var):
Expand Down

0 comments on commit 9aa6800

Please sign in to comment.