Skip to content

xarray.open_mfdataset returns inconsistent times #1263

@willirath

Description

@willirath

Problem

I am running into inconsistent time coordinates with a long climate model experiment that exceeds the limits of pandas.tslib.Timestamp (covers roughly 17th to 23rd century).

Currently, xarray.open_mfdataset delegates decoding of the time axis to xarray.open_dataset which decodes either to pandas time stamps or, of this fails, to netcdftime.datetime objects. xarray.open_mfdataset later combines the single-file datasets and just concatenates all the time axes.

Solution

  1. Let auto_combine check for consistency and repair the time axis if necessary.
  2. Let xarray.open_mfdataset prevent xarray.open_dataset from decoding the times for each file and only decode times after everything is combined.

The latter is equivalent to a workaround I use for the moment: Pass decode_times=False to xarray.open_mfdataset and then explicitly call xarray.decode_cf on the dataset.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions