(self, variable: Variable, name: T_Name = None)
| 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() |
nothing calls this directly
no test coverage detected