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

Function ensure_fixed_length_bytes

xarray/coding/strings.py:114–122  ·  view source on GitHub ↗

Ensure that a variable with vlen bytes is converted to fixed width.

(var: Variable)

Source from the content-addressed store, hash-verified

112
113
114def ensure_fixed_length_bytes(var: Variable) -> Variable:
115 """Ensure that a variable with vlen bytes is converted to fixed width."""
116 if check_vlen_dtype(var.dtype) is bytes:
117 dims, data, attrs, encoding = unpack_for_encoding(var)
118 # TODO: figure out how to handle this with dask
119 data = np.asarray(data, dtype=np.bytes_)
120 return Variable(dims, data, attrs, encoding)
121 else:
122 return var
123
124
125def validate_char_dim_name(strlen, encoding, name) -> str:

Callers 1

encodeMethod · 0.85

Calls 3

VariableClass · 0.90
check_vlen_dtypeFunction · 0.85
unpack_for_encodingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…