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

MFDataset Variable with lenth 1 dimension cannot be sliced #34

Closed
dopplershift opened this issue Feb 26, 2014 · 3 comments
Closed

MFDataset Variable with lenth 1 dimension cannot be sliced #34

dopplershift opened this issue Feb 26, 2014 · 3 comments

Comments

@dopplershift
Copy link
Member

From barr...@gmail.com on January 04, 2010 11:04:45

To reproduce the problem follow the directions in the Documentation section
7 (Reading data from a multi-file netCDF dataset) with these modifications.

  1. add the creation of a y dimensions with a length of 1
  2. create the x variable with both the x and y dimensions

What is the expected output?
[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99]

What do you see instead?
Traceback (most recent call last):
...
File "utils.pyx", line 503, in netCDF4._Variable.getitem (netCDF4.c:28767)
ValueError: array dimensions are not compatible for copy

What version of the product are you using?
v 0.8.2

On what operating system?
Mac and Linux Please provide any additional information below. I think the source of the problem is the squeeze in the comments below.
/* "/Users/jsw/python/netcdf4-python/utils.pyx":503

  •         lstArr = numpy.concatenate(lstArr)
    
  •         if dat.dtype != data.dtype: data = data.astype(dat.dtype)
    
  •         data[tuple(ind)] = lstArr.squeeze()             # <<<<<<<<<<<<<<
    
  •     # Remove extra singleton dimensions.
    
    */

There are cases where there are intentional singleton dimensions (e.g. CMAQ
single layer files).

Thanks a ton!

Original issue: http://code.google.com/p/netcdf4-python/issues/detail?id=34

@dopplershift
Copy link
Member Author

From whitaker.jeffrey@gmail.com on January 04, 2010 10:44:48

Thanks for the report. It's now fixed in svn.

-Jeff

@dopplershift
Copy link
Member Author

From barr...@gmail.com on January 04, 2010 11:03:14

Wow you're good!

@dopplershift
Copy link
Member Author

From whitaker.jeffrey@gmail.com on February 25, 2014 18:04:09

Status: Fixed

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

No branches or pull requests

1 participant