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
803075280,MDU6SXNzdWU4MDMwNzUyODA=,4880,Datetime as coordinaets does not convert back to datetime (returns int),33122845,closed,0,,,6,2021-02-07T22:20:11Z,2024-04-28T20:13:33Z,2024-04-28T20:13:32Z,CONTRIBUTOR,,,,"
**What happened**:
datetime was in `np.datetime64` formet. When converted t `datetime.datetime` format it returned an `int`
**What you expected to happen**:
`to get a datetime returned
**Minimal Complete Verifiable Example**:
```python
# Put your MCVE code here
import xarray as xr
import numpy as np
import datetime
date_frame = xr.DataArray(dims='time',coords={'time':pd.date_range('2000-01-01',periods=365)},data=np.zeros(365))
print('pandas date range (datetime): ',pd.date_range('2000-01-01',periods=365)[0])
print('dataframe datetime converted to datetime (int): ',date_frame.coords['time'].data[0].astype(datetime.datetime))
print(""normal numpy datetime64 converted to datetime (datetime): "",np.datetime64(datetime.datetime(2000,1,1)).astype(datetime.datetime))
```
output:
```
pandas date range (datetime): 2000-01-01 00:00:00
dataframe datetime converted to datetime (int): 946684800000000000
normal numpy datetime64 converted to datetime (datetime): 2000-01-01 00:00:00
```
if converted to int, it also gives different lengths of int :
date_frame:
946684800000000000
946684800000000
normal datetime64^
**Anything else we need to know?**:
it is also mentioned in [this SO thread](https://stackoverflow.com/a/58174729/14681457) appears to be a problem in the datetime64....
numpy version 1.20.0
pandas version 1.2.1
**Environment**:
Output of xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.7.9 | packaged by conda-forge | (default, Dec 9 2020, 21:08:20)
[GCC 9.3.0]
python-bits: 64
OS: Linux
OS-release: 5.4.0-59-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: None
libnetcdf: None
xarray: 0.16.2
pandas: 1.2.1
numpy: 1.20.0
scipy: None
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.6.1
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2021.01.1
distributed: 2021.01.1
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 49.6.0.post20210108
pip: 21.0.1
conda: None
pytest: None
IPython: 7.20.0
sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4880/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue
935747115,MDU6SXNzdWU5MzU3NDcxMTU=,5565,Tests fail when no SciPy installed,33122845,closed,0,,,0,2021-07-02T12:58:49Z,2021-07-17T21:05:13Z,2021-07-17T21:05:13Z,CONTRIBUTOR,,,,"
**What happened**:
Tests failed, also reported in #5564 and relatd to #5559
**What you expected to happen**:
**Minimal Complete Verifiable Example**:
```python
cd xarray
pip install -e .
pip install h5netcdf pytest-xdist netcdf4
py.test -n 4
```
```python
======================================================= FAILURES =======================================================
_______________________________________ TestH5NetCDFFileObject.test_open_fileobj _______________________________________
[gw3] linux -- Python 3.9.5 /home/joeperdefloep/miniconda3/envs/xr-dev/bin/python3.9
self =
def test_open_fileobj(self):
# open in-memory datasets instead of local file paths
expected = create_test_data().drop_vars(""dim3"")
expected.attrs[""foo""] = ""bar""
with create_tmp_file() as tmp_file:
expected.to_netcdf(tmp_file, engine=""h5netcdf"")
with open(tmp_file, ""rb"") as f:
with open_dataset(f, engine=""h5netcdf"") as actual:
assert_identical(expected, actual)
f.seek(0)
with open_dataset(f) as actual:
assert_identical(expected, actual)
f.seek(0)
with BytesIO(f.read()) as bio:
with open_dataset(bio, engine=""h5netcdf"") as actual:
assert_identical(expected, actual)
f.seek(0)
with pytest.raises(TypeError, match=""not a valid NetCDF 3""):
> open_dataset(f, engine=""scipy"")
/mnt/e/Git/xarray/xarray/tests/test_backends.py:2887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/mnt/e/Git/xarray/xarray/backends/api.py:483: in open_dataset
backend = plugins.get_backend(engine)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
engine = 'scipy'
def get_backend(engine):
""""""Select open_dataset method based on current engine.""""""
if isinstance(engine, str):
engines = list_engines()
if engine not in engines:
> raise ValueError(
f""unrecognized engine {engine} must be one of: {list(engines)}""
)
E ValueError: unrecognized engine scipy must be one of: ['netcdf4', 'h5netcdf', 'store']
/mnt/e/Git/xarray/xarray/backends/plugins.py:156: ValueError
______________________________________________________ test_3641 _______________________________________________________
[gw0] linux -- Python 3.9.5 /home/joeperdefloep/miniconda3/envs/xr-dev/bin/python3.9
@requires_cftime
def test_3641():
times = xr.cftime_range(""0001"", periods=3, freq=""500Y"")
da = xr.DataArray(range(3), dims=[""time""], coords=[times])
> da.interp(time=[""0002-05-01""])
/mnt/e/Git/xarray/xarray/tests/test_interp.py:733:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/mnt/e/Git/xarray/xarray/core/dataarray.py:1687: in interp
ds = self._to_temp_dataset().interp(
/mnt/e/Git/xarray/xarray/core/dataset.py:3146: in interp
variables[name] = missing.interp(var, var_indexers, method, **kwargs)
/mnt/e/Git/xarray/xarray/core/missing.py:633: in interp
interped = interp_func(
/mnt/e/Git/xarray/xarray/core/missing.py:752: in interp_func
return _interpnd(var, x, new_x, func, kwargs)
/mnt/e/Git/xarray/xarray/core/missing.py:770: in _interpnd
return _interp1d(var, x, new_x, func, kwargs)
/mnt/e/Git/xarray/xarray/core/missing.py:758: in _interp1d
rslt = func(x, var, assume_sorted=True, **kwargs)(np.ravel(new_x))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[AttributeError(""'ScipyInterpolator' object has no attribute 'method'"") raised in repr()] ScipyInterpolator object at 0x7f1aa547fc40>
xi =
array([0.00000e+00, 1.57788e+19]), yi = array([0, 1]), method = 'linear'
fill_value = None, assume_sorted = True, copy = False, bounds_error = False, order = None, kwargs = {}
def __init__(
self,
xi,
yi,
method=None,
fill_value=None,
assume_sorted=True,
copy=False,
bounds_error=False,
order=None,
**kwargs,
):
> from scipy.interpolate import interp1d
E ModuleNotFoundError: No module named 'scipy'
/mnt/e/Git/xarray/xarray/core/missing.py:129: ModuleNotFoundError
=================================================== warnings summary ===================================================
xarray/tests/test_dataarray.py::TestReduce1D::test_min[x3-5-2-1]
xarray/tests/test_dataarray.py::TestReduce1D::test_max[x3-5-2-1]
xarray/tests/test_dataarray.py::TestReduce2D::test_min[x2-minindex2-maxindex2-nanindex2]
xarray/tests/test_dataarray.py::TestReduce2D::test_max[x2-minindex2-maxindex2-nanindex2]
/home/joeperdefloep/miniconda3/envs/xr-dev/lib/python3.9/site-packages/numpy/core/fromnumeric.py:86: RuntimeWarning: invalid value encountered in reduce
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=============================================== short test summary info ================================================
FAILED xarray/tests/test_backends.py::TestH5NetCDFFileObject::test_open_fileobj - ValueError: unrecognized engine sci...
FAILED xarray/tests/test_interp.py::test_3641 - ModuleNotFoundError: No module named 'scipy'
============= 2 failed, 8243 passed, 3776 skipped, 29 xfailed, 26 xpassed, 4 warnings in 229.01s (0:03:49) =============
```
**Anything else we need to know?**:
**Environment**:
Output of xr.show_versions()
INSTALLED VERSIONS
------------------
commit: a874739378f28f68c4e184c5bf1cebdb749dc836
python: 3.9.5 | packaged by conda-forge | (default, Jun 19 2021, 00:32:32)
[GCC 9.3.0]
python-bits: 64
OS: Linux
OS-release: 4.19.128-microsoft-standard
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.0
libnetcdf: 4.7.4
xarray: 0.18.2.dev69+gc472f8a4
pandas: 1.2.5
numpy: 1.21.0
scipy: None
netCDF4: 1.5.7
pydap: None
h5netcdf: 0.11.0
h5py: 3.3.0
Nio: None
zarr: None
cftime: 1.5.0
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 49.6.0.post20210108
pip: 21.1.3
conda: None
pytest: 6.2.4
IPython: None
sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5565/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue
935692190,MDExOlB1bGxSZXF1ZXN0NjgyNTYyNjQx,5564,added netCDF4 requirement to failing tests,33122845,closed,0,,,4,2021-07-02T11:43:16Z,2021-07-17T21:05:00Z,2021-07-17T21:04:59Z,CONTRIBUTOR,,0,pydata/xarray/pulls/5564,"
- [x] Closes #4985 #5565
- [x] Tests added
- [x] Passes `pre-commit run --all-files`
- [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst`
- [x] New functions/methods are listed in `api.rst`
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5564/reactions"", ""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull
812416075,MDU6SXNzdWU4MTI0MTYwNzU=,4930,xr.open_zarr converts 0 values to nan,33122845,closed,0,,,0,2021-02-19T23:01:15Z,2021-02-20T10:43:01Z,2021-02-20T10:43:01Z,CONTRIBUTOR,,,,"
**What happened**:
It returned an array of nan values
**What you expected to happen**:
an array of zeroes
**Minimal Complete Verifiable Example**:
[ZeroToNan.zip](https://github.com/zarr-developers/zarr-python/files/6013339/ZeroToNan.zip)
```python
# Your code here
z = zarr.open('ZeroToNan.zip')
print(z['foo__a'][:])
print(xr.open_zarr(z.store).foo__a.values)
```
**Anything else we need to know?**:
I also posted this problem [here](https://github.com/benbovy/xarray-simlab/issues/172) and [here](https://github.com/zarr-developers/zarr-python/issues/703)
**Environment**:
Output of xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.9.1 | packaged by conda-forge | (default, Jan 26 2021, 01:34:10)
[GCC 9.3.0]
python-bits: 64
OS: Linux
OS-release: 5.4.0-59-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: None
libnetcdf: None
xarray: 0.16.2
pandas: 1.2.1
numpy: 1.20.0
scipy: None
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.6.1
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2021.02.0
distributed: 2021.02.0
matplotlib: 3.3.4
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 49.6.0.post20210108
pip: 21.0.1
conda: None
pytest: 6.2.2
IPython: 7.20.0
sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4930/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue