Description
MCVE Code Sample
from datetime impo
rt datetime
import xarray as xr
import os
def read_data(f, composition, west, east, north, south):
# read data
ds = xr.open_dataset(f, group='PRODUCT')
# subset to region
index = ((ds.longitude > west) & (ds.longitude < east))
ds = ds.where(index)
# read composition
data = ds[composition][0,:,:]
data_units = data.units
# read time
t = ds['time_utc']
st = datetime.strptime(str(t.min(skipna=True).values), '%Y-%m-%dT%H:%M:%S.%fZ')
et = datetime.strptime(str(t.max(skipna=True).values), '%Y-%m-%dT%H:%M:%S.%fZ')
# read lon and lat
lon = data.coords['longitude']
lat = data.coords['latitude']
return lon, lat, data, data_units, st, et
datadir = '/xin/data/TROPOMI/GZ/bug'
os.chdir(datadir)
west = 112.5; east = 114.5; north = 24; south = 22.5;
f = 'S5P_NRTI_L2__O3_____20190825T053303_20190825T053803_09659_01_010107_20190825T061441.nc'
lon, lat, data, data_units, st, et = read_data(f, 'ozone_total_vertical_column',
west, east, north, south)
Problem Description
You can download the data from google drive.
I get errors shown in details, even using skipna=True
.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "bug.py", line 31, in
west, east, north, south)
File "bug.py", line 16, in read_data
st = datetime.strptime(str(t.min(skipna=True).values), '%Y-%m-%dT%H:%M:%S.%fZ')
File "/public/software/anaconda/anaconda3/envs/behr/lib/python3.6/site-packages/xarray-0.11.3-py3.6.egg/xarray/core/common.py", line 25, in wrapped_func
skipna=skipna, allow_lazy=True, **kwargs)
File "/public/software/anaconda/anaconda3/envs/behr/lib/python3.6/site-packages/xarray-0.11.3-py3.6.egg/xarray/core/dataarray.py", line 1597, in reduce
var = self.variable.reduce(func, dim, axis, keep_attrs, **kwargs)
File "/public/software/anaconda/anaconda3/envs/behr/lib/python3.6/site-packages/xarray-0.11.3-py3.6.egg/xarray/core/variable.py", line 1354, in reduce
axis=axis, **kwargs)
File "/public/software/anaconda/anaconda3/envs/behr/lib/python3.6/site-packages/xarray-0.11.3-py3.6.egg/xarray/core/duck_array_ops.py", line 249, in f
raise NotImplementedError(msg)
NotImplementedError: min is not available with skipna=False with the installed version of numpy; upgrade to numpy 1.12 or newer to use skipna=True or skipna=None
Output of xr.show_versions()
xarray: 0.11.3
pandas: 0.20.3
numpy: 1.13.1
scipy: 0.19.1
netCDF4: 1.4.2
pydap: None
h5netcdf: None
h5py: 2.9.0
Nio: None
zarr: None
cftime: 1.0.3.4
PseudonetCDF: None
rasterio: 1.0.21
cfgrib: None
iris: None
bottleneck: None
cyordereddict: None
dask: 1.1.2
distributed: None
matplotlib: 3.0.3
cartopy: 0.17.0
seaborn: 0.9.0
setuptools: 36.4.0
pip: 9.0.1
conda: None
pytest: None
IPython: None
sphinx: None