home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1525513525

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/7790#issuecomment-1525513525 https://api.github.com/repos/pydata/xarray/issues/7790 1525513525 IC_kwDOAMm_X85a7X01 5821660 2023-04-27T11:19:24Z 2023-04-27T11:19:24Z MEMBER

@christine-e-smit

So, I'm no expert for zarr, but it turns out that your NaT was converted to -9.223372036854776e+18 in the encoding step. I'm assuming that zarr is converting NaT as the format doesn't allow to use NaT directly, so it chooses a (default) value.

The _FillValue is not lost, but it will be preserved in the .encoding-dict of the underlying Variable:

python xr_read = xr.open_zarr(location) print("******************") print("No fill value") print(xr_read["time"]) print(xr_read["time"].encoding) ```python


No fill value <xarray.DataArray 'time' (time: 2)> array([ 'NaT', '2023-01-02T00:00:00.000000000'], dtype='datetime64[ns]') Coordinates: * time (time) datetime64[ns] NaT 2023-01-02 {'chunks': (2,), 'preferred_chunks': {'time': 2}, 'compressor': Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0), 'filters': None, '_FillValue': -9.223372036854776e+18, 'units': 'days since 2023-01-02 00:00:00', 'calendar': 'proleptic_gregorian', 'dtype': dtype('float64')} ```

You might also check this without decoding (decode_cd=False):

python with xr.open_zarr(location, decode_cf=False) as xr_read: print("******************") print("No fill value") print(xr_read["time"]) print(xr_read["time"].encoding) ```python


No fill value <xarray.DataArray 'time' (time: 2)> array([-9.223372e+18, 0.000000e+00]) Coordinates: * time (time) float64 -9.223e+18 0.0 Attributes: calendar: proleptic_gregorian units: days since 2023-01-02 00:00:00 _FillValue: -9.223372036854776e+18 {'chunks': (2,), 'preferred_chunks': {'time': 2}, 'compressor': Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0), 'filters': None, 'dtype': dtype('float64')} ```

Maybe a zarr-expert can chime in here, what's the best practice for time-fill_values.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1685803922
Powered by Datasette · Queries took 0.786ms · About: xarray-datasette