Ensure that a variable with vlen bytes is converted to fixed width.
(var: Variable)
| 112 | |
| 113 | |
| 114 | def 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 | |
| 125 | def validate_char_dim_name(strlen, encoding, name) -> str: |
no test coverage detected
searching dependent graphs…