MCPcopy Index your code
hub / github.com/pydata/xarray / open_store_variable

Method open_store_variable

xarray/backends/pydap_.py:154–176  ·  view source on GitHub ↗
(self, var)

Source from the content-addressed store, hash-verified

152 return cls(**args)
153
154 def open_store_variable(self, var):
155 if hasattr(var, "dims"):
156 dimensions = [
157 dim.split("/")[-1] if dim.startswith("/") else dim for dim in var.dims
158 ]
159 else:
160 # GridType does not have a dims attribute - instead get `dimensions`
161 # see https://github.com/pydap/pydap/issues/485
162 dimensions = var.dimensions
163 if (
164 self._protocol == "dap4"
165 and var.name in dimensions
166 and hasattr(var, "dataset") # only True for pydap>3.5.5
167 ):
168 var.dataset.enable_batch_mode()
169 data_array = self._get_data_array(var)
170 data = indexing.LazilyIndexedArray(data_array)
171 var.dataset.disable_batch_mode()
172 else:
173 # all non-dimension variables
174 data = indexing.LazilyIndexedArray(PydapArrayWrapper(var))
175
176 return Variable(dimensions, data, var.attributes)
177
178 def get_variables(self):
179 # get first all variables arrays, excluding any container type like,

Callers 1

get_variablesMethod · 0.95

Calls 5

_get_data_arrayMethod · 0.95
VariableClass · 0.90
PydapArrayWrapperClass · 0.85
splitMethod · 0.80
startswithMethod · 0.80

Tested by

no test coverage detected