-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Error in xr.date_range with exactly three parameters provided. #8770
Comments
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! |
Thanks for the report. I think this is because we explicitly set In the meantime you should be able to work around this by explicitly setting |
…e None (#8774) * Fixing issue #8770: Improved frequency parameter logic to set it to 'D' only if periods, start, or end are None. * Addressed feedback: Updated default argument handling in cftime_range to ensure consistency across date range functions * Update doc/whats-new.rst Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com> * Update xarray/tests/test_cftime_offsets.py Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com> * Update xarray/tests/test_cftime_offsets.py Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com> * Input argument period included in test_cftime_range_no_freq and test_date_range_no_freq following #8770 * Update doc/whats-new.rst Co-authored-by: Spencer Clark <spencerkclark@gmail.com> --------- Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com> Co-authored-by: Spencer Clark <spencerkclark@gmail.com>
What happened?
I was trying to create a list of a fixed number of N dates from start to end using the "periods" argument of xr.date_range.
What did you expect to happen?
To obtain a DatetimeIndex object with N period's dates between the starting date and the ending date.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
When running:
Outputs:
DatetimeIndex(['1961-01-01', '1991-01-01'], dtype='datetime64[ns]', freq=None)
Environment
/home/roberto/miniconda3/envs/gs1/lib/python3.11/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
INSTALLED VERSIONS
commit: None
python: 3.11.6 | packaged by conda-forge | (main, Oct 3 2023, 10:40:35) [GCC 12.3.0]
python-bits: 64
OS: Linux
OS-release: 6.5.0-14-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.2
libnetcdf: 4.9.1
xarray: 2023.12.0
pandas: 2.1.4
numpy: 1.26.4
scipy: 1.12.0
netCDF4: 1.6.3
pydap: None
h5netcdf: 1.3.0
h5py: 3.8.0
Nio: 1.5.5
zarr: None
cftime: 1.6.3
nc_time_axis: None
iris: None
bottleneck: 1.3.5
dask: 2023.12.1
distributed: 2023.12.1
matplotlib: 3.8.2
cartopy: 0.22.0
seaborn: 0.13.0
numbagg: None
fsspec: 2023.12.2
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 68.2.2
pip: 23.3.2
conda: None
pytest: None
mypy: None
IPython: 8.20.0
sphinx: None
The text was updated successfully, but these errors were encountered: