We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Indexing a vlen variable produces inconsistent results:
import netCDF4 as nc import numpy as np nc_out = nc.Dataset("ex.nc", "w", diskless=True, persist=False) t = nc_out.createDimension("t", None) v = nc_out.createVariable("s", str, ("t",)) v[0] = "aaa" v[1] = "bbb" v[2] = "ccc" v[3] = "ddd" print("1. ", v[:]) print("2. ", v[np.arange(4)]) print("3. ", v[np.array([0, 1, 2])]) print("4. ", v[np.array([0, 3, 2])])
Produces the following output:
1. ['aaa' 'bbb' 'ccc' 'ddd'] 2. ['aaa' 'bbb' 'ccc' 'ddd'] 3. ['aaa' 'bbb' 'ccc'] 4. [array('aaa', dtype=object) array('ddd', dtype=object) array('ccc', dtype=object)]
The result of number 4 is surprising and seems to be a bug. Items 1, 2, and 3 show expected behavior. The issue occurs when indexing out of order.
The text was updated successfully, but these errors were encountered:
Merge pull request #1309 from Unidata/issue1306
5dbda10
fix for issue #1306
closed by PR #1309
Sorry, something went wrong.
No branches or pull requests
Summary
Indexing a vlen variable produces inconsistent results:
Produces the following output:
The result of number 4 is surprising and seems to be a bug. Items 1, 2, and 3 show expected behavior. The issue occurs when indexing out of order.
Versions
The text was updated successfully, but these errors were encountered: