question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose use_cftime option in open_zarr

See original GitHub issue

use_cftime was recently added as an option to decode_cf and open_dataset to give users a little more control over how times are decoded (#2759). It would be good if it was also available for open_zarr. This perhaps doesn’t have quite the importance, because open_zarr only works for single data stores, so there is no risk of decoding times to different types (e.g. as there was for open_mfdataset, #1263); however, it would still be nice to be able to silence serialization warnings that result from decoding times to cftime objects in some instances, e.g. #2754.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
max-sixtycommented, Mar 4, 2020

@spencerkclark @dcherian for transparency I unpinned this to make room for the broken docs -> github link. Feel free to unpin the build warnings if this is still top-of-mind

1reaction
naomi-hendersoncommented, Aug 27, 2019

@Geektrovert and @spencerkclark - any progress on this? It would be great to have it working in time for the CMIP6 hackathon in order to suppress all of the warning messages when opening zarr stores. For example, a zarr store using cftime.DatetimeGregorian (e.g., cftime.DatetimeGregorian(2349, 12, 16, 12, 0, 0, 0, 4, 350)) will always generate the warning:

/usr/local/python/anaconda3/envs/pangeoJun2019/lib/python3.6/site-packages/xarray/coding/times.py:465: SerializationWarning: Unable to decode time axis into full numpy.datetime64 objects, continuing using cftime.datetime objects instead, reason: dates out of range
  dtype = _decode_cf_datetime_dtype(data, units, calendar, self.use_cftime)
/usr/local/python/anaconda3/envs/pangeoJun2019/lib/python3.6/site-packages/xarray/coding/times.py:465: SerializationWarning: Unable to decode time axis into full numpy.datetime64 objects, continuing using cftime.datetime objects instead, reason: dates out of range
  dtype = _decode_cf_datetime_dtype(data, units, calendar, self.use_cftime)
/usr/local/python/anaconda3/envs/pangeoJun2019/lib/python3.6/site-packages/numpy/core/numeric.py:538: SerializationWarning: Unable to decode time axis into full numpy.datetime64 objects, continuing using cftime.datetime objects instead, reason: dates out of range
  return array(a, dtype, copy=False, order=order)

For the CMIP6 collection, I always use use_cftime=True in open_mfdataset, but then when I make the zarr store and read it back in, it generates these warnings - always a distraction for anyone not used to dealing with this data

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's New - Xarray
Expose use_cftime option in open_zarr() (GH2886, PR3229) By Samnan Rahee and Anderson Banihirwe. Bug fixes#. Fix indexing with datetime64 scalars with pandas ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found