Commit a483e797 authored by Bas Couwenberg's avatar Bas Couwenberg

Update upstream source from tag 'upstream/1.5.3'

Update to upstream version '1.5.3'
with Debian dir 443f980abd2bb08d200c7dcb84b55accd8375b1b
parents e221a69e b1a80028
language: python
dist: xenial
dist: bionic
cache: pip
addons:
......
version 1.5.2 (not yet released)
version 1.5.3 (tag v1.5.3rel)
==============================
* make sure arrays are masked that are not filled when auto_fill is off
(issue #972).
* python 3.8 binary wheels.
version 1.5.2 (tag v1.5.2rel)
==============================
* fix for scaling bug when _Unsigned attribute is set and byteorder of data
does not match native byteorder (issue #930).
......
......@@ -10,6 +10,10 @@
## News
For details on the latest updates, see the [Changelog](https://github.com/Unidata/netcdf4-python/blob/master/Changelog).
10/27/2019: Version [1.5.3](https://pypi.python.org/pypi/netCDF4/1.5.3) released]. Fix for
[issue #972](https://github.com/Unidata/netcdf4-python/issues/972), plus binary wheels for
python 3.8.
09/03/2019: Version [1.5.2](https://pypi.python.org/pypi/netCDF4/1.5.2) released. Bugfixes, no new features.
05/06/2019: Version [1.5.1.2](https://pypi.python.org/pypi/netCDF4/1.5.1.2) released. Fixes another slicing
......
This source diff could not be displayed because it is too large. You can view the blob instead.
"""
Version 1.5.2
Version 1.5.3
---------------
- - -
......@@ -1206,7 +1206,7 @@ except ImportError:
# python3: zip is already python2's itertools.izip
pass
__version__ = "1.5.2"
__version__ = "1.5.3"
# Initialize numpy
import posixpath
......@@ -4581,7 +4581,7 @@ rename a `netCDF4.Variable` attribute named `oldname` to `newname`."""
# type, signed or unsigned, because the byte ranges are too
# small to assume one of the values should appear as a missing
# value unless a _FillValue attribute is set explicitly."
if no_fill != 1 and self.dtype.str[1:] not in ['u1','i1']:
if no_fill != 1 or self.dtype.str[1:] not in ['u1','i1']:
fillval = numpy.array(default_fillvals[self.dtype.str[1:]],self.dtype)
has_fillval = data == fillval
# if data is an array scalar, has_fillval will be a boolean.
......
......@@ -596,7 +596,7 @@ else:
setup(name="netCDF4",
cmdclass=cmdclass,
version="1.5.2",
version="1.5.3",
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.",
author="Jeff Whitaker",
author_email="jeffrey.s.whitaker@noaa.gov",
......
......@@ -7,12 +7,14 @@ from numpy import ma
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.random.mtrand import uniform
import netCDF4
from numpy.ma import masked_all
# test automatic conversion of masked arrays, and
# packing/unpacking of short ints.
# create an n1dim by n2dim random ranarr.
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
FILE_NAME2 = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
ndim = 10
ranarr = 100.*uniform(size=(ndim))
ranarr2 = 100.*uniform(size=(ndim))
......@@ -38,6 +40,7 @@ class PrimitiveTypesTestCase(unittest.TestCase):
def setUp(self):
self.file = FILE_NAME
self.file2 = FILE_NAME2
file = netCDF4.Dataset(self.file,'w')
file.createDimension('n', ndim)
foo = file.createVariable('maskeddata', 'f8', ('n',))
......@@ -71,9 +74,21 @@ class PrimitiveTypesTestCase(unittest.TestCase):
v = file.createVariable('v',NP.float,'x',fill_value=-9999)
file.close()
# issue #972: when auto_fill off byte arrays (u1,i1) should
# not be masked, but other datatypes should.
dataset = netCDF4.Dataset(self.file2, "w")
dataset.set_fill_off()
dim = dataset.createDimension("dim", 10)
var1 = dataset.createVariable("var1", "f8", (dim.name,))
var1[:] = masked_all((10,), "f8")
var2 = dataset.createVariable("var2", "u1", (dim.name,))
var2[:] = masked_all((10,), "u1")
dataset.close()
def tearDown(self):
# Remove the temporary files
os.remove(self.file)
os.remove(self.file2)
def runTest(self):
"""testing auto-conversion of masked arrays and packed integers"""
......@@ -118,6 +133,13 @@ class PrimitiveTypesTestCase(unittest.TestCase):
f['variable'][:] = NP.nan
data = f['variable'][:] # should not raise an error
f.close()
# issue #972
dataset = netCDF4.Dataset(self.file2, "r")
var1 = dataset.variables["var1"]
var2 = dataset.variables["var2"]
assert var1[:].mask.all()
assert var2[:].mask.any() == False
dataset.close()
if __name__ == '__main__':
unittest.main()
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment