Skip to content

Commit

Permalink
fix for issue #906
Browse files Browse the repository at this point in the history
  • Loading branch information
jswhit committed Apr 7, 2019
1 parent 522e152 commit e16fd6b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion netCDF4/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _StartCountStride(elem, shape, dimensions=None, grp=None, datashape=None,\
grp : netCDF Group
The netCDF group to which the variable being set belongs to.
datashape : sequence
The shape of the data that is being stored. Only needed by __setitime__
The shape of the data that is being stored. Only needed by __setitem__
put : True|False (default False). If called from __setitem__, put is True.
Returns
Expand Down Expand Up @@ -342,6 +342,16 @@ def _StartCountStride(elem, shape, dimensions=None, grp=None, datashape=None,\
else:
sdim.append(1)

# pad datashape with zeros for dimensions not being sliced
datashapenew = (); i=0
for e in elem:
if type(e) != slice:
datashapenew = datashapenew + (0,)
else:
datashapenew = datashapenew + (datashape[i],)
i+=1
datashape = datashapenew

# Create the start, count, stride and indices arrays.

sdim.append(max(nDims, 1))
Expand Down

0 comments on commit e16fd6b

Please # to comment.