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

FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated #422

Open
yyplanton opened this issue Sep 17, 2020 · 1 comment

Comments

@yyplanton
Copy link

Warnings are raised when selecting a latitudinal range while reading some observational datasets.

Raised when a netCDF file is read:
/opt/miniconda3/envs/cdat/lib/python3.7/site-packages/cdms2/fvariable.py:103: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
result = result[revlist]

from cdms2 import open as CDMS2open
filename = "precip.mon.mean.nc"
variable = "precip"
ff = CDMS2open(filename)
tab = ff(variable, latitude=(-5, 5))

The preceding code uses CPC Merged Analysis of Precipitation (CMAP) Precipitation Mean (Standard Monthly) (probably raises the same warning with other variables) downloaded from https://psl.noaa.gov/data/gridded/data.cmap.html
I encountered the same warning with:

Raised when the same netCDF file is read but a 'dataset' was created with the cdscan utility (e.g., cdscan -x CMAP_precip.xml precip.mon.mean.nc):
/opt/miniconda3/envs/cdat/lib/python3.7/site-packages/numpy/ma/core.py:3225: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
dout = self.data[indx]

In the case of HadISST1 (HadISST_sst.nc) dataset created with the cdscan utility a second warning is raised:
/opt/miniconda3/envs/cdat/lib/python3.7/site-packages/numpy/ma/core.py:3257: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
mout = _mask[indx]

@jypeter
Copy link
Member

jypeter commented Nov 27, 2020

I'm also regularly getting this warning when working with totally unrelated netcdf files. It's annoying because it can hide other useful warnings

I hope this has disappeared in the latest version of cdms2 (I'm still using cdms2 from CDAT 8.0)

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

No branches or pull requests

2 participants