(fill_value, times, units, encoded_values)
| 1588 | ids=_TEST_ROUNDTRIP_FLOAT_TIMES_TESTS.keys(), |
| 1589 | ) |
| 1590 | def test_roundtrip_float_times(fill_value, times, units, encoded_values) -> None: |
| 1591 | # Regression test for GitHub issues #8271 and #9488 |
| 1592 | var = Variable( |
| 1593 | ["time"], |
| 1594 | times, |
| 1595 | encoding=dict(dtype=np.float64, _FillValue=fill_value, units=units), |
| 1596 | ) |
| 1597 | |
| 1598 | encoded_var = conventions.encode_cf_variable(var) |
| 1599 | np.testing.assert_array_equal(encoded_var, encoded_values) |
| 1600 | assert encoded_var.attrs["units"] == units |
| 1601 | assert encoded_var.attrs["_FillValue"] == fill_value |
| 1602 | |
| 1603 | decoded_var = conventions.decode_cf_variable( |
| 1604 | "foo", encoded_var, decode_timedelta=CFTimedeltaCoder(time_unit="ns") |
| 1605 | ) |
| 1606 | assert_identical(var, decoded_var) |
| 1607 | assert decoded_var.encoding["units"] == units |
| 1608 | assert decoded_var.encoding["_FillValue"] == fill_value |
| 1609 | |
| 1610 | |
| 1611 | _ENCODE_DATETIME64_VIA_DASK_TESTS = { |
nothing calls this directly
no test coverage detected
searching dependent graphs…