Merge tag 'upstream/1.5.1.2'
Upstream version 1.5.1.2
Bas Couwenberg
4 years ago
0 | version 1.5.1.2 (tag v1.5.1.2rel) | |
1 | ================================== | |
2 | * fix another slicing bug introduced by the fix to issue #906 (issue #922). | |
3 | ||
0 | 4 | version 1.5.1.1 (tag v1.5.1.1rel) |
1 | 5 | ================================== |
2 | 6 | * fixed __version__ attribute (was set incorrectly in 1.5.1 release). |
9 | 9 | ## News |
10 | 10 | For details on the latest updates, see the [Changelog](https://github.com/Unidata/netcdf4-python/blob/master/Changelog). |
11 | 11 | |
12 | 05/02/2019: Version [1.5.1.1](https://pypi.python.org/pypi/netCDF4/1.5.1.1) released. Fixes incorrect __version__ | |
12 | 05/06/2019: Version [1.5.1.2](https://pypi.python.org/pypi/netCDF4/1.5.1.2) released. Fixes another slicing | |
13 | slicing regression ([issue #922)](https://github.com/Unidata/netcdf4-python/issues/922)) introduced in the 1.5.1 release. | |
14 | ||
15 | 05/02/2019: Version [1.5.1.1](https://pypi.python.org/pypi/netCDF4/1.5.1.1) released. Fixes incorrect `__version__` | |
13 | 16 | module variable in 1.5.1 release, plus a slicing bug ([issue #919)](https://github.com/Unidata/netcdf4-python/issues/919)). |
14 | 17 | |
15 | 18 | 04/30/2019: Version [1.5.1](https://pypi.python.org/pypi/netCDF4/1.5.1) released. Bugfixes, no new features. |
3 | 3 | <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" /> |
4 | 4 | |
5 | 5 | <title>netCDF4 API documentation</title> |
6 | <meta name="description" content="Version 1.5.1.1 | |
6 | <meta name="description" content="Version 1.5.1.2 | |
7 | 7 | --------------- |
8 | 8 | - - - |
9 | 9 | |
1279 | 1279 | |
1280 | 1280 | <header id="section-intro"> |
1281 | 1281 | <h1 class="title"><span class="name">netCDF4</span> module</h1> |
1282 | <h2>Version 1.5.1.1</h2> | |
1282 | <h2>Version 1.5.1.2</h2> | |
1283 | 1283 | <hr /> |
1284 | 1284 | <h1>Introduction</h1> |
1285 | 1285 | <p>netcdf4-python is a Python interface to the netCDF C library.</p> |
0 | 0 | """ |
1 | Version 1.5.1.1 | |
1 | Version 1.5.1.2 | |
2 | 2 | --------------- |
3 | 3 | - - - |
4 | 4 | |
1189 | 1189 | # python3: zip is already python2's itertools.izip |
1190 | 1190 | pass |
1191 | 1191 | |
1192 | __version__ = "1.5.1.1" | |
1192 | __version__ = "1.5.1.2" | |
1193 | 1193 | |
1194 | 1194 | # Initialize numpy |
1195 | 1195 | import posixpath |
364 | 364 | datashape = broadcasted_shape(shape, datashape) |
365 | 365 | |
366 | 366 | # pad datashape with zeros for dimensions not being sliced (issue #906) |
367 | if datashape: | |
367 | # only used when data covers slice over subset of dimensions | |
368 | if datashape and len(datashape) != len(elem) and\ | |
369 | len(datashape) == sum(1 for e in elem if type(e) == slice): | |
368 | 370 | datashapenew = (); i=0 |
369 | 371 | for e in elem: |
370 | if type(e) != slice: | |
372 | if type(e) != slice and not np.iterable(e): # scalar integer slice | |
371 | 373 | datashapenew = datashapenew + (0,) |
372 | else: | |
374 | else: # slice object | |
373 | 375 | datashapenew = datashapenew + (datashape[i],) |
374 | 376 | i+=1 |
375 | 377 | datashape = datashapenew |
406 | 408 | if unlim and e.stop is not None and e.stop > shape[i]: |
407 | 409 | length = e.stop |
408 | 410 | elif unlim and e.stop is None and datashape != (): |
409 | if e.start is None: | |
410 | length = datashape[i] | |
411 | else: | |
412 | length = e.start+datashape[i] | |
411 | try: | |
412 | if e.start is None: | |
413 | length = datashape[i] | |
414 | else: | |
415 | length = e.start+datashape[i] | |
416 | except IndexError: | |
417 | raise IndexError("shape of data does not conform to slice") | |
413 | 418 | else: |
414 | 419 | if unlim and datashape == () and len(dim) == 0: |
415 | 420 | # writing scalar along unlimited dimension using slicing |
583 | 583 | |
584 | 584 | setup(name="netCDF4", |
585 | 585 | cmdclass=cmdclass, |
586 | version="1.5.1.1", | |
586 | version="1.5.1.2", | |
587 | 587 | long_description="netCDF version 4 has many features not found in earlier versions of the library, such as hierarchical groups, zlib compression, multiple unlimited dimensions, and new data types. It is implemented on top of HDF5. This module implements most of the new features, and can read and write netCDF files compatible with older versions of the library. The API is modelled after Scientific.IO.NetCDF, and should be familiar to users of that module.\n\nThis project is hosted on a `GitHub repository <https://github.com/Unidata/netcdf4-python>`_ where you may access the most up-to-date source.", |
588 | 588 | author="Jeff Whitaker", |
589 | 589 | author_email="jeffrey.s.whitaker@noaa.gov", |
234 | 234 | f['v1'][:] = arr |
235 | 235 | assert_array_equal(f['v1'][:],np.broadcast_to(arr,f['v1'].shape)) |
236 | 236 | |
237 | def test_issue922(self): | |
238 | with Dataset(self.file,'w') as f: | |
239 | f.createDimension('d1',3) | |
240 | f.createDimension('d2',None) | |
241 | f.createVariable('v1',np.int,('d2','d1',)) | |
242 | f['v1'][0] = np.arange(3,dtype=np.int) | |
243 | f['v1'][1:3] = np.arange(3,dtype=np.int) | |
244 | assert_array_equal(f['v1'][:], np.broadcast_to(np.arange(3),(3,3))) | |
245 | f.createVariable('v2',np.int,('d1','d2',)) | |
246 | f['v2'][:,0] = np.arange(3,dtype=np.int) | |
247 | f['v2'][:,1:3] = np.arange(6,dtype=np.int).reshape(3,2) | |
248 | assert_array_equal(f['v2'][:,1:3],np.arange(6,dtype=np.int).reshape(3,2)) | |
249 | assert_array_equal(f['v2'][:,0],np.arange(3,dtype=np.int)) | |
250 | ||
237 | 251 | if __name__ == '__main__': |
238 | 252 | unittest.main() |