[Git][debian-gis-team/netcdf4-python][master] 4 commits: New upstream version 1.5.8

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Wed Jan 19 18:56:10 GMT 2022



Bas Couwenberg pushed to branch master at Debian GIS Project / netcdf4-python


Commits:
a8010c2a by Bas Couwenberg at 2022-01-19T19:34:19+01:00
New upstream version 1.5.8
- - - - -
dcc12f4b by Bas Couwenberg at 2022-01-19T19:34:21+01:00
Update upstream source from tag 'upstream/1.5.8'

Update to upstream version '1.5.8'
with Debian dir 79a19b5b2ab1c3112ed87030aadf9f651c249dfa
- - - - -
21444d14 by Bas Couwenberg at 2022-01-19T19:34:39+01:00
New upstream release.

- - - - -
6c4ea572 by Bas Couwenberg at 2022-01-19T19:35:31+01:00
Set distribution to unstable.

- - - - -


16 changed files:

- .github/workflows/build.yml
- .github/workflows/miniconda.yml
- Changelog
- README.md
- README.wheels.md
- debian/changelog
- examples/subset.py
- src/netCDF4/_netCDF4.pyx
- src/netCDF4/utils.py
- test/tst_Unsigned.py
- test/tst_atts.py
- test/tst_enum.py
- test/tst_fancyslicing.py
- test/tst_filepath.py
- test/tst_masked4.py
- test/tst_shape.py


Changes:

=====================================
.github/workflows/build.yml
=====================================
@@ -10,7 +10,7 @@ jobs:
       NETCDF_DIR: ${{ github.workspace }}/..
       NETCDF_EXTRA_CONFIG: --enable-pnetcdf
       CC: mpicc.mpich
-#     NO_NET: 1
+      #NO_NET: 1
     strategy:
       matrix:
         python-version: ["3.9"]


=====================================
.github/workflows/miniconda.yml
=====================================
@@ -8,9 +8,11 @@ on:
 jobs:
   run-serial:
     runs-on: ${{ matrix.os }}
+    #env:
+    #  NO_NET: 1
     strategy:
       matrix:
-        python-version: ["3.6", "3.7", "3.8", "3.9"]
+        python-version: ["3.6", "3.7", "3.8", "3.9", "3.10" ]
         os: [windows-latest, ubuntu-latest, macos-latest]
         platform: [x64, x32]
         exclude:
@@ -76,7 +78,7 @@ jobs:
         export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" 
         which mpirun
         mpirun --version
-        mpirun  --oversubscribe -np 4 python mpi_example.py
+        mpirun -np 4 python mpi_example.py
         if [ $? -ne 0 ] ; then
           echo "hdf5 mpi test failed!"
           exit 1


=====================================
Changelog
=====================================
@@ -1,3 +1,10 @@
+ version 1.5.8 (tag v1.5.8rel)
+==============================
+ * Fix Enum bug (issue #1128): the enum_dict member of an EnumType read from a file
+   contains invalid values when the enum is large enough (more than 127 or 255
+   members). 
+ * Binary wheels for aarch64 and python 3.10.
+
  version 1.5.7 (tag v1.5.7rel)
 ==============================
  * don't try to mask vlens with default  _FillValue, since vlens don't have a default _FillValue.


=====================================
README.md
=====================================
@@ -10,6 +10,8 @@
 ## News
 For details on the latest updates, see the [Changelog](https://github.com/Unidata/netcdf4-python/blob/master/Changelog).
 
+10/31/2021:  Version [1.5.8](https://pypi.python.org/pypi/netCDF4/1.5.8) released. Fix Enum bug, add binary wheels for aarch64 and python 3.10.
+
 6/22/2021:  Version [1.5.7](https://pypi.python.org/pypi/netCDF4/1.5.7) released.
 Fixed OverflowError on Windows when reading data with dimension sizes greater than 2**32-1.
 Masked arrays no longer returned for vlens.
@@ -58,7 +60,7 @@ Fixes bug in implementation of NETCDF4_CLASSIC parallel IO support in 1.4.3.
 10/26/2018: Version [1.4.2](https://pypi.python.org/pypi/netCDF4/1.4.2) released. Minor bugfixes, added `Variable.get_dims()` method and `master_file` kwarg for `MFDataset.__init__`.
 
 08/10/2018: Version [1.4.1](https://pypi.python.org/pypi/netCDF4/1.4.1) released. The old slicing behavior
-(numpy array returned unless missing values are present, otherwise masked array returned) is renabled
+(numpy array returned unless missing values are present, otherwise masked array returned) is re-enabled
 via `set_always_mask(False)`.
 
 05/11/2018: Version [1.4.0](https://pypi.python.org/pypi/netCDF4/1.4.0) released. The netcdftime package is no longer


=====================================
README.wheels.md
=====================================
@@ -28,7 +28,7 @@ dynamic libraries apart from those provided as standard by OSX.
 
 ### Triggering a build
 
-You will need write permision to the github repository to trigger new builds
+You will need write permission to the github repository to trigger new builds
 on the travis-ci interface.  Contact us on the mailing list if you need this.
 
 You can trigger a build by:


=====================================
debian/changelog
=====================================
@@ -1,10 +1,11 @@
-netcdf4-python (1.5.7-2) UNRELEASED; urgency=medium
+netcdf4-python (1.5.8-1) unstable; urgency=medium
 
+  * New upstream release.
   * Bump Standards-Version to 4.6.0, no changes.
   * Bump debhelper compat to 12, changes:
     - Drop --list-missing from dh_install
 
- -- Bas Couwenberg <sebastic at debian.org>  Wed, 08 Sep 2021 16:44:13 +0200
+ -- Bas Couwenberg <sebastic at debian.org>  Wed, 19 Jan 2022 19:35:22 +0100
 
 netcdf4-python (1.5.7-1) unstable; urgency=medium
 


=====================================
examples/subset.py
=====================================
@@ -3,7 +3,7 @@ import netCDF4
 import numpy as np
 import matplotlib.pyplot as plt
 
-# use real data from CFS reanlysis.
+# use real data from CFS reanalysis.
 # note:  we're reading GRIB2 data!
 URL="http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cmd_flxf/2010/201007/20100701/flxf00.gdas.2010070100.grb2"
 nc = netCDF4.Dataset(URL)


=====================================
src/netCDF4/_netCDF4.pyx
=====================================
@@ -1,5 +1,5 @@
 """
-Version 1.5.7
+Version 1.5.8
 -------------
 
 # Introduction
@@ -1204,7 +1204,7 @@ if sys.version_info[0:2] < (3, 7):
     # Python 3.7+ guarantees order; older versions need OrderedDict
     from collections import OrderedDict
 
-__version__ = "1.5.7"
+__version__ = "1.5.8"
 
 # Initialize numpy
 import posixpath
@@ -2468,9 +2468,9 @@ Close the Dataset.
 
     def isopen(self):
         """
-**`close(self)`**
+**`isopen(self)`**
 
-is the Dataset open or closed?
+Is the Dataset open or closed?
         """
         return bool(self._isopen)
 
@@ -5979,7 +5979,7 @@ cdef _read_enum(group, nc_type xtype, endian=None):
     # then use that to create a EnumType instance.
     # called by _get_types, _get_vars.
     cdef int ierr, _grpid, nmem
-    cdef char enum_val
+    cdef ndarray enum_val
     cdef nc_type base_xtype
     cdef char enum_namstring[NC_MAX_NAME+1]
     cdef size_t nmembers
@@ -5998,13 +5998,14 @@ cdef _read_enum(group, nc_type xtype, endian=None):
         raise KeyError("unsupported component type for ENUM")
     # loop over members, build dict.
     enum_dict = {}
+    enum_val = numpy.empty(1,dt)
     for nmem from 0 <= nmem < nmembers:
         with nogil:
             ierr = nc_inq_enum_member(_grpid, xtype, nmem, \
-                                      enum_namstring, &enum_val)
+                                      enum_namstring,PyArray_DATA(enum_val))
         _ensure_nc_success(ierr)
         name = enum_namstring.decode('utf-8')
-        enum_dict[name] = int(enum_val)
+        enum_dict[name] = enum_val.item()
     return EnumType(group, dt, enum_name, enum_dict, typeid=xtype)
 
 cdef _strencode(pystr,encoding=None):


=====================================
src/netCDF4/utils.py
=====================================
@@ -235,7 +235,7 @@ def _StartCountStride(elem, shape, dimensions=None, grp=None, datashape=None,\
             unlim = False
         # convert boolean index to integer array.
         if np.iterable(ea) and ea.dtype.kind =='b':
-            # check that boolen array not too long
+            # check that boolean array not too long
             if not unlim and shape[i] != len(ea):
                 msg="""
 Boolean array must have the same shape as the data along this dimension."""
@@ -539,7 +539,7 @@ def ncinfo():
             sys.stderr.write(usage)
             sys.exit(0)
 
-    # filename passed as last argumenbt
+    # filename passed as last argument
     try:
         filename = pargs[-1]
     except IndexError:


=====================================
test/tst_Unsigned.py
=====================================
@@ -10,7 +10,7 @@ class Test_Unsigned(unittest.TestCase):
     integer data stored with a signed integer type in netcdf-3.
     If _Unsigned=True, a view to the data as unsigned integers is returned.
     set_autoscale can be used to turn this off (default is on)
-    See issue #656 (pull reqeust #658).
+    See issue #656 (pull request #658).
     """
     def test_unsigned(self):
         f = netCDF4.Dataset("ubyte.nc")


=====================================
test/tst_atts.py
=====================================
@@ -43,7 +43,7 @@ class VariablesTestCase(unittest.TestCase):
         f = netCDF4.Dataset(self.file,'w')
         # try to set a dataset attribute with one of the reserved names.
         f.setncattr('file_format','netcdf4_format')
-        # test attribute renameing
+        # test attribute renaming
         f.stratt_tmp = STRATT
         f.renameAttribute('stratt_tmp','stratt')
         f.emptystratt = EMPTYSTRATT


=====================================
test/tst_enum.py
=====================================
@@ -63,5 +63,27 @@ class EnumTestCase(unittest.TestCase):
         assert_array_equal(data.mask, datain_masked.mask)
         f.close()
 
+class EnumDictTestCase(unittest.TestCase):
+    # issue 1128
+    def setUp(self):
+        DT = np.int16; BITS = 8
+        self.STORED_VAL = DT(2**BITS)
+        self.VAL_MAP = {f'bits_{n}': DT(2**n) for n in range(1,BITS+1)}
+        self.VAL_MAP['invalid'] = 0
+        self.file = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
+        with netCDF4.Dataset(file, 'w') as nc:
+            # The enum is created with dtype=int16, so it will allow BITS values up to 15
+            et = nc.createEnumType(DT, 'etype', self.VAL_MAP)
+            ev = nc.createVariable('evar', et)
+            # Succeeds because the created EnumType does keep the correct dict
+            ev[...] = self.STORED_VAL
+        def tearDown(self):
+            os.remove(self.file)
+        def runTest(self):
+            with netCDF4.Dataset(file, 'r') as nc:
+                read_var = nc['evar']
+                assert(read_var[...] == self.STORED_VAL)
+                assert(read_et.enum_dict == self.VAL_MAP)
+
 if __name__ == '__main__':
     unittest.main()


=====================================
test/tst_fancyslicing.py
=====================================
@@ -56,7 +56,7 @@ class VariablesTestCase(unittest.TestCase):
         # integer array slice.
         v[:,i,:] = -100
         self.data[:,i,:] = -100
-        # boolen array slice.
+        # boolean array slice.
         v[ib2] = -200
         self.data[ib2] = -200
         v[ib3,:,:] = -300


=====================================
test/tst_filepath.py
=====================================
@@ -26,7 +26,7 @@ class test_filepath(unittest.TestCase):
 
     def test_no_such_file_raises(self):
         fname = 'not_a_nc_file.nc'
-        with self.assertRaisesRegexp(IOError, fname):
+        with self.assertRaisesRegex(IOError, fname):
             netCDF4.Dataset(fname, 'r')
 
 


=====================================
test/tst_masked4.py
=====================================
@@ -96,7 +96,7 @@ class SetValidMinMax(unittest.TestCase):
         self.assertTrue(np.all(self.v_ma.mask == v.mask))
         self.assertTrue(np.all(self.v_ma.mask == v2.mask))
         # treating _FillValue as valid_min/valid_max was
-        # too suprising, revert to old behaviour (issue #761)
+        # too surprising, revert to old behaviour (issue #761)
         #self.assertTrue(np.all(self.v_ma.mask == v3.mask))
         # check that underlying data is same as in netcdf file
         v = f.variables['v']


=====================================
test/tst_shape.py
=====================================
@@ -24,7 +24,7 @@ class ShapeTestCase(unittest.TestCase):
 
     def runTest(self):
         """test for issue 90 (array shape should not be modified by
-        assigment to netCDF variable)"""
+        assignment to netCDF variable)"""
         f  = Dataset(self.file, 'a')
         v = f.variables['data']
         v[0] = data



View it on GitLab: https://salsa.debian.org/debian-gis-team/netcdf4-python/-/compare/cf800158fae252a562e684feb6dd41205b2165c1...6c4ea572483ab1dc3b021949d366dc3ab1442f8b

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/netcdf4-python/-/compare/cf800158fae252a562e684feb6dd41205b2165c1...6c4ea572483ab1dc3b021949d366dc3ab1442f8b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20220119/70f767a4/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list