home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1319964729

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1319964729 I_kwDOAMm_X85OrRA5 6840 better warning message for xarray/core/dataset.py:2060: SerializationWarning 17162724 open 0     0 2022-07-27T18:26:55Z 2024-01-25T18:02:57Z   CONTRIBUTOR      

Is your feature request related to a problem?

I was trying to store a zarr fstore and I got:

/opt/userenvs/ray.bell/autofront/lib/python3.9/site-packages/xarray/core/dataset.py:2060: SerializationWarning: saving variable None with floating point data as an integer dtype without any _FillValue to use for NaNs return to_zarr( # type: ignore

~~What I was seeing was a time coord which had encoding 'dtype': dtype('int64'). Storing the time this way lost the HH:MM on my datetime array.~~ I think I am seeing 'units': 'days since 2022-MM-DD 00:00:00' whereas it should be hours for my data.

Describe the solution you'd like

The message captures the variable/coord name instead of None

It could offer a solution such as "to store floating point data you could possibly use encoding={variable/coord: {"dtype": float, "_Fillvalue": np.nan}"

Describe alternatives you've considered

No response

Additional context

I'll try to come back and write a MCVE

WIP: you can get the warning message by doing: ds = xr.tutorial.open_dataset("air_temperature") ds["time"].encoding # {'units': 'hours since 1800-01-01', 'calendar': 'standard', 'dtype': dtype('float32')} ds.isel(time=0).to_zarr("tmp0.zarr", mode="w") /Users/ray/miniconda3/envs/main/lib/python3.9/site-packages/xarray/core/dataset.py:2060: SerializationWarning: saving variable None with floating point data as an integer dtype without any _FillValue to use for NaNs return to_zarr( # type: ignore

My guess if one of lat, lon, time, air is raising that message

Can't find the associated code in the repo that raises this. 2060 is to_zarr AFICT (https://github.com/pydata/xarray/blob/main/xarray/core/dataset.py#L2066)

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6840/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.928ms · About: xarray-datasette