MCPcopy
hub / github.com/pydata/xarray / open

Method open

xarray/backends/pydap_.py:104–152  ·  view source on GitHub ↗
(
        cls,
        url,
        group=None,
        application=None,
        session=None,
        output_grid=None,
        timeout=None,
        verify=None,
        user_charset=None,
        checksums=True,
    )

Source from the content-addressed store, hash-verified

102
103 @classmethod
104 def open(
105 cls,
106 url,
107 group=None,
108 application=None,
109 session=None,
110 output_grid=None,
111 timeout=None,
112 verify=None,
113 user_charset=None,
114 checksums=True,
115 ):
116 from pydap.client import open_url
117 from pydap.net import DEFAULT_TIMEOUT
118
119 if output_grid is not None:
120 # output_grid is no longer passed to pydap.client.open_url
121 from xarray.core.utils import emit_user_level_warning
122
123 emit_user_level_warning(
124 "`output_grid` is deprecated and will be removed in a future version"
125 " of xarray. Will be set to `None`, the new default. ",
126 FutureWarning,
127 )
128 output_grid = False # new default behavior
129
130 kwargs = {
131 "url": url,
132 "application": application,
133 "session": session,
134 "output_grid": output_grid or False,
135 "timeout": timeout or DEFAULT_TIMEOUT,
136 "verify": verify or True,
137 "user_charset": user_charset,
138 }
139 if isinstance(url, str):
140 # check uit begins with an acceptable scheme
141 dataset = open_url(**kwargs)
142 elif hasattr(url, "ds"):
143 # pydap dataset
144 dataset = url.ds
145 args = {"dataset": dataset, "checksums": checksums}
146 if group:
147 args["group"] = group
148 if url.startswith(("http", "dap2")):
149 args["protocol"] = "dap2"
150 elif url.startswith("dap4"):
151 args["protocol"] = "dap4"
152 return cls(**args)
153
154 def open_store_variable(self, var):
155 if hasattr(var, "dims"):

Callers 6

open_datasetMethod · 0.45
open_groups_as_dictMethod · 0.45
_open_remote_fileFunction · 0.45
_open_existing_arrayMethod · 0.45
_open_scipy_netcdfFunction · 0.45
guess_can_openMethod · 0.45

Calls 2

emit_user_level_warningFunction · 0.90
startswithMethod · 0.80

Tested by

no test coverage detected