home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 2035725001

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
2035725001 I_kwDOAMm_X855VrLJ 8542 xr.to_netcdf() alters time dimension 25990952 closed 0     10 2023-12-11T13:49:55Z 2023-12-21T16:39:01Z 2023-12-21T16:39:01Z NONE      

What is your issue?

Hi! I was downloading some data from single files (15min temporal resolution with some smaller gaps here and there) and wanted to save it for further processing. If I reopen the netcdf file, the time dimensions is distorted in a way I cannot really understand. Basically, it changes the 15min difference into something between the first timestamp (e.g. 2018-01-01 00:00:00) and something a few hours later. However, the timestamps are also unordered as the latest time seems to be somewhere in the middle.

my steps are basically a download script which is not really reproducible as it needs login tokens but afterwards everything is purely xarray:

Then, I simply call ds.to_netcdf('filename.nc') and when I re-open it withxr.open_dataset('filename.nc') I get this funny data below where the ds.time.max() is array('2018-01-01T09:06:04.000000000', dtype='datetime64[ns]') with argmax=array(7383, dtype=int64), so it is not even increasing.

Interestingly, saving it, opening it and assigning (ds.assign_coords(time=correct_time)) the correct time values from the ds previously saved and then saving it again seems to be a workaround but I would like to understand if it me missing something or it might be a bug? I had to re-download quite a lot of data due to this as I was not able to recover the correct time dimension from the altered dimension. If I open the corrupted one with decode_times=False it gives me seconds since 2018-01-01 with only np.unique(ds.time) = 16384 whereas len(ds.time) = 174910.

Thanks in advance!

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8542/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 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.739ms · About: xarray-datasette