Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFTime offsets missing for milli- and micro-seconds #4097

Closed
aulemahal opened this issue May 26, 2020 · 0 comments · Fixed by #4758
Closed

CFTime offsets missing for milli- and micro-seconds #4097

aulemahal opened this issue May 26, 2020 · 0 comments · Fixed by #4758

Comments

@aulemahal
Copy link
Contributor

The smallest cftime offset defined in xarray.coding.cftime_offsets.py is "second" (S), but the precision of cftime objects goes down to the millisecond (L) and microsecond (U). They should be easily added.

PR #4033 adds a xr.infer_freq that supports the two, but they are currently untested as xr.cftime_range cannot generate an index.

MCVE Code Sample

xr.cftime_range("2000-01-01", periods=3, freq='10L')

Expected Output

CFTimeIndex([2000-01-01 00:00:00, 2000-01-01 00:00:00.010000,
             2000-01-01 00:00:00.020000],
            dtype='object')

Problem Description

An error gets raised : ValueError: Invalid frequency string provided .

Versions

Output of xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.8.2 | packaged by conda-forge | (default, Apr 24 2020, 08:20:52)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 5.6.13-arch1-1
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: fr_CA.utf8
LOCALE: fr_CA.UTF-8
libhdf5: 1.10.5
libnetcdf: 4.7.4

xarray: 0.15.2.dev9+g6378a711.d20200505
pandas: 1.0.3
numpy: 1.18.4
scipy: 1.4.1
netCDF4: 1.5.3
pydap: None
h5netcdf: None
h5py: 2.10.0
Nio: None
zarr: None
cftime: 1.1.1.2
nc_time_axis: 1.2.0
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2.16.0
distributed: 2.16.0
matplotlib: 3.2.1
cartopy: None
seaborn: None
numbagg: None
pint: 0.11
setuptools: 46.1.3.post20200325
pip: 20.0.2
conda: None
pytest: 5.4.1
IPython: 7.13.0
sphinx: 3.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants