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

Method encode

xarray/coding/variables.py:565–576  ·  view source on GitHub ↗
(self, variable: Variable, name: T_Name = None)

Source from the content-addressed store, hash-verified

563 """Encode default _FillValue if needed."""
564
565 def encode(self, variable: Variable, name: T_Name = None) -> Variable:
566 dims, data, attrs, encoding = unpack_for_encoding(variable)
567 # make NaN the fill value for float types
568 if (
569 "_FillValue" not in attrs
570 and "_FillValue" not in encoding
571 and np.issubdtype(variable.dtype, np.floating)
572 ):
573 attrs["_FillValue"] = variable.dtype.type(np.nan)
574 return Variable(dims, data, attrs, encoding, fastpath=True)
575 else:
576 return variable
577
578 def decode(self, variable: Variable, name: T_Name = None) -> Variable:
579 raise NotImplementedError()

Callers

nothing calls this directly

Calls 2

unpack_for_encodingFunction · 0.90
VariableClass · 0.90

Tested by

no test coverage detected