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

Method load

xarray/backends/common.py:351–373  ·  view source on GitHub ↗

This loads the variables and attributes simultaneously. A centralized loading function makes it easier to create data stores that do automatic encoding/decoding. For example:: class SuffixAppendingDataStore(AbstractDataStore): def load(s

(self)

Source from the content-addressed store, hash-verified

349 return {}
350
351 def load(self):
352 """
353 This loads the variables and attributes simultaneously.
354 A centralized loading function makes it easier to create
355 data stores that do automatic encoding/decoding.
356
357 For example::
358
359 class SuffixAppendingDataStore(AbstractDataStore):
360 def load(self):
361 variables, attributes = AbstractDataStore.load(self)
362 variables = {"%s_suffix" % k: v for k, v in variables.items()}
363 attributes = {"%s_suffix" % k: v for k, v in attributes.items()}
364 return variables, attributes
365
366 This function will be called anytime variables or attributes
367 are requested, so care should be taken to make sure its fast.
368 """
369 variables = FrozenDict(
370 (_decode_variable_name(k), v) for k, v in self.get_variables().items()
371 )
372 attributes = FrozenDict(self.get_attrs())
373 return variables, attributes
374
375 def close(self):
376 pass

Callers 6

load_datasetFunction · 0.45
load_dataarrayFunction · 0.45
load_datatreeFunction · 0.45
to_zarrFunction · 0.45
backends_dict_from_pkgFunction · 0.45
open_datasetMethod · 0.45

Calls 5

get_variablesMethod · 0.95
get_attrsMethod · 0.95
FrozenDictFunction · 0.90
_decode_variable_nameFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected