Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-netCDF4 for openSUSE:Factory 
checked in at 2023-01-07 17:19:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-netCDF4 (Old)
 and      /work/SRC/openSUSE:Factory/.python-netCDF4.new.1563 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-netCDF4"

Sat Jan  7 17:19:59 2023 rev:15 rq:1056768 version:1.6.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-netCDF4/python-netCDF4.changes    
2022-09-19 16:03:52.078235506 +0200
+++ /work/SRC/openSUSE:Factory/.python-netCDF4.new.1563/python-netCDF4.changes  
2023-01-07 17:23:20.751455840 +0100
@@ -1,0 +2,11 @@
+Sat Jan  7 12:25:27 UTC 2023 - Dirk Müller <dmuel...@suse.com>
+
+- update to 1.6.2:
+ * Added ``netCDF4.__has_set_alignment__`` property to help identify if the
+   underlying netcdf4 supports setting the HDF5 alignment.
+ * Slicing multi-dimensional variables with an all False boolean index array
+   now returns an empty numpy array (instead of raising an exception - issue 
#1197).
+   Behavior now consistent with numpy slicing.
+ * fix problem with compiling using netcdf-c < 4.9.0 (issue #1209)
+
+-------------------------------------------------------------------

Old:
----
  netCDF4-1.6.1.tar.gz

New:
----
  netCDF4-1.6.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-netCDF4.spec ++++++
--- /var/tmp/diff_new_pack.NROl5Z/_old  2023-01-07 17:23:21.335459325 +0100
+++ /var/tmp/diff_new_pack.NROl5Z/_new  2023-01-07 17:23:21.343459372 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-netCDF4
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python3-%{**}}
 Name:           python-netCDF4
-Version:        1.6.1
+Version:        1.6.2
 Release:        0
 Summary:        Python interface to netCDF 3 and 4
 License:        HPND AND MIT

++++++ netCDF4-1.6.1.tar.gz -> netCDF4-1.6.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/Changelog new/netCDF4-1.6.2/Changelog
--- old/netCDF4-1.6.1/Changelog 2022-09-15 03:10:57.000000000 +0200
+++ new/netCDF4-1.6.2/Changelog 2022-11-15 20:49:44.000000000 +0100
@@ -1,3 +1,12 @@
+ version 1.6.2 (tag v1.6.2rel)
+==============================
+ * Added ``netCDF4.__has_set_alignment__`` property to help identify if the
+   underlying netcdf4 supports setting the HDF5 alignment.
+ * Slicing multi-dimensional variables with an all False boolean index array
+   now returns an empty numpy array (instead of raising an exception - issue 
#1197).
+   Behavior now consistent with numpy slicing.
+ * fix problem with compiling using netcdf-c < 4.9.0 (issue #1209)
+
  version 1.6.1 (tag v1.6.1rel)
 ==============================
  * add Dataset methods has_<name>_filter (where <name>=zstd,blosc,bzip2,szip)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/PKG-INFO new/netCDF4-1.6.2/PKG-INFO
--- old/netCDF4-1.6.1/PKG-INFO  2022-09-15 03:11:18.000000000 +0200
+++ new/netCDF4-1.6.2/PKG-INFO  2022-11-15 20:50:01.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: netCDF4
-Version: 1.6.1
+Version: 1.6.2
 Summary: Provides an object-oriented python interface to the netCDF version 4 
library.
 Home-page: http://github.com/Unidata/netcdf4-python
 Download-URL: http://python.org/pypi/netCDF4
@@ -19,6 +19,7 @@
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: System :: Archiving :: Compression
 Classifier: Operating System :: OS Independent
+Requires-Python: >=3.6
 License-File: LICENSE
 
 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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/README.md new/netCDF4-1.6.2/README.md
--- old/netCDF4-1.6.1/README.md 2022-09-15 03:10:57.000000000 +0200
+++ new/netCDF4-1.6.2/README.md 2022-11-15 20:49:44.000000000 +0100
@@ -10,6 +10,11 @@
 ## News
 For details on the latest updates, see the 
[Changelog](https://github.com/Unidata/netcdf4-python/blob/master/Changelog).
 
+11/15/2022:  Version [1.6.2](https://pypi.python.org/pypi/netCDF4/1.6.2) 
released. Fix for
+compilation with netcdf-c < 4.9.0 (issue 
[#1209](https://github.com/Unidata/netcdf4-python/issues/1209)).  
+Slicing multi-dimensional variables with an all False boolean index array
+now returns an empty numpy array (instead of raising an exception - issue 
[#1197](https://github.com/Unidata/netcdf4-python/issues/1197)).
+
 09/18/2022:  Version [1.6.1](https://pypi.python.org/pypi/netCDF4/1.6.1) 
released.  GIL now
 released for all C lib calls, `set_alignment` and `get_alignment` module 
functions
 added to modify/retrieve HDF5 data alignment properties. Added `Dataset` 
methods to 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/include/netCDF4.pxi 
new/netCDF4-1.6.2/include/netCDF4.pxi
--- old/netCDF4-1.6.1/include/netCDF4.pxi       2022-09-15 03:10:57.000000000 
+0200
+++ new/netCDF4-1.6.2/include/netCDF4.pxi       2022-11-15 20:49:44.000000000 
+0100
@@ -367,7 +367,6 @@
 
     int nc_inq_enum_ident(int ncid, nc_type xtype, long long value, char 
*identifier) nogil
 
-
 IF HAS_QUANTIZATION_SUPPORT:
     cdef extern from "netcdf.h":
         cdef enum:
@@ -377,6 +376,8 @@
             NC_QUANTIZE_BITROUND
         int nc_def_var_quantize(int ncid, int varid, int quantize_mode, int 
nsd) nogil
         int nc_inq_var_quantize(int ncid, int varid, int *quantize_modep, int 
*nsdp) nogil
+
+IF HAS_NCFILTER:
     cdef extern from "netcdf_filter.h":
         int nc_inq_filter_avail(int ncid, unsigned filterid) nogil
 
@@ -395,7 +396,6 @@
             H5Z_FILTER_ZSTD
         int nc_def_var_zstandard(int ncid, int varid, int level) nogil
         int nc_inq_var_zstandard(int ncid, int varid, int* hasfilterp, int 
*levelp) nogil
-        int nc_inq_filter_avail(int ncid, unsigned id) nogil
 
 IF HAS_BZIP2_SUPPORT:
     cdef extern from "netcdf_filter.h":
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/pyproject.toml 
new/netCDF4-1.6.2/pyproject.toml
--- old/netCDF4-1.6.1/pyproject.toml    1970-01-01 01:00:00.000000000 +0100
+++ new/netCDF4-1.6.2/pyproject.toml    2022-11-15 20:49:44.000000000 +0100
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["setuptools>=41.2", "cython>=0.19", "oldest-supported-numpy"]
+build-backend = "setuptools.build_meta"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/setup.py new/netCDF4-1.6.2/setup.py
--- old/netCDF4-1.6.1/setup.py  2022-09-15 03:10:57.000000000 +0200
+++ new/netCDF4-1.6.2/setup.py  2022-11-15 20:49:44.000000000 +0100
@@ -3,11 +3,10 @@
 import shutil
 import configparser
 from setuptools import setup, Extension, find_namespace_packages
-from distutils.dist import Distribution
+from setuptools.dist import Distribution
 
 setuptools_extra_kwargs = {
     "install_requires": ["numpy>=1.9","cftime"],
-    "setup_requires": ['setuptools>=18.0', "cython>=0.19"],
     "entry_points": {
         'console_scripts': [
             'ncinfo = netCDF4.utils:ncinfo',
@@ -71,6 +70,7 @@
     has_zstandard = False
     has_bzip2 = False
     has_blosc = False
+    has_ncfilter = False
     has_set_alignment = False
 
     for d in inc_dirs:
@@ -117,6 +117,8 @@
                     has_bzip2 = True
                 if line.startswith('EXTERNL int nc_def_var_blosc'):
                     has_blosc = True
+                if line.startswith('EXTERNL int nc_inq_filter_avail'):
+                    has_ncfilter = True
 
         ncmetapath = os.path.join(d,'netcdf_meta.h')
         if os.path.exists(ncmetapath):
@@ -144,7 +146,7 @@
     return has_rename_grp, has_nc_inq_path, has_nc_inq_format_extended, \
            has_cdf5_format, has_nc_open_mem, has_nc_create_mem, \
            has_parallel4_support, has_pnetcdf_support, has_szip_support, 
has_quantize, \
-           has_zstandard, has_bzip2, has_blosc, has_set_alignment
+           has_zstandard, has_bzip2, has_blosc, has_set_alignment, has_ncfilter
 
 
 def getnetcdfvers(libdirs):
@@ -558,7 +560,7 @@
     has_rename_grp, has_nc_inq_path, has_nc_inq_format_extended, \
     has_cdf5_format, has_nc_open_mem, has_nc_create_mem, \
     has_parallel4_support, has_pnetcdf_support, has_szip_support, 
has_quantize, \
-    has_zstandard, has_bzip2, has_blosc, has_set_alignment = \
+    has_zstandard, has_bzip2, has_blosc, has_set_alignment, has_ncfilter = \
     check_api(inc_dirs,netcdf_lib_version)
     # for netcdf 4.4.x CDF5 format is always enabled.
     if netcdf_lib_version is not None and\
@@ -566,11 +568,12 @@
         has_cdf5_format = True
 
     # disable parallel support if mpi4py not available.
-    try:
-        import mpi4py
-    except ImportError:
-        has_parallel4_support = False
-        has_pnetcdf_support = False
+    #try:
+    #    import mpi4py
+    #except ImportError:
+    #    f.write('disabling mpi parallel support because mpi4py not found\n')
+    #    has_parallel4_support = False
+    #    has_pnetcdf_support = False
 
     f = open(osp.join('include', 'constants.pyx'), 'w')
     if has_rename_grp:
@@ -672,9 +675,17 @@
         sys.stdout.write('netcdf lib does not have nc_set_alignment 
function\n')
         f.write('DEF HAS_SET_ALIGNMENT = 0\n')
 
+    if has_ncfilter:
+        sys.stdout.write('netcdf lib has nc_inq_filter_avail function\n')
+        f.write('DEF HAS_NCFILTER = 1\n')
+    else:
+        sys.stdout.write('netcdf lib does not have nc_inq_filter_avail 
function\n')
+        f.write('DEF HAS_NCFILTER = 0\n')
+
     f.close()
 
     if has_parallel4_support or has_pnetcdf_support:
+        import mpi4py
         inc_dirs.append(mpi4py.get_include())
         # mpi_incdir should not be needed if using nc-config
         # (should be included in nc-config --cflags)
@@ -742,6 +753,7 @@
       package_dir={'':'src'},
       package_data={"netCDF4.plugins": ["lib__nc*"]},
       ext_modules=ext_modules,
+      python_requires=">=3.6",
       **setuptools_extra_kwargs)
 
 # remove plugin files copied from outside source tree
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/src/netCDF4/__init__.py 
new/netCDF4-1.6.2/src/netCDF4/__init__.py
--- old/netCDF4-1.6.1/src/netCDF4/__init__.py   2022-09-15 03:10:57.000000000 
+0200
+++ new/netCDF4-1.6.2/src/netCDF4/__init__.py   2022-11-15 20:49:44.000000000 
+0100
@@ -9,7 +9,8 @@
                        __has_nc_create_mem__, __has_cdf5_format__,
                        __has_parallel4_support__, __has_pnetcdf_support__,
                        __has_quantization_support__, __has_zstandard_support__,
-                       __has_bzip2_support__, __has_blosc_support__, 
__has_szip_support__)
+                       __has_bzip2_support__, __has_blosc_support__, 
__has_szip_support__,
+                       __has_set_alignment__)
 import os
 __all__ =\
 
['Dataset','Variable','Dimension','Group','MFDataset','MFTime','CompoundType','VLType','date2num','num2date','date2index','stringtochar','chartostring','stringtoarr','getlibversion','EnumType','get_chunk_cache','set_chunk_cache','set_alignment','get_alignment']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/src/netCDF4/_netCDF4.pyx 
new/netCDF4-1.6.2/src/netCDF4/_netCDF4.pyx
--- old/netCDF4-1.6.1/src/netCDF4/_netCDF4.pyx  2022-09-15 03:10:57.000000000 
+0200
+++ new/netCDF4-1.6.2/src/netCDF4/_netCDF4.pyx  2022-11-15 20:49:44.000000000 
+0100
@@ -1,5 +1,5 @@
 """
-Version 1.6.1
+Version 1.6.2
 -------------
 
 # Introduction
@@ -1230,7 +1230,7 @@
     # Python 3.7+ guarantees order; older versions need OrderedDict
     from collections import OrderedDict
 
-__version__ = "1.6.1"
+__version__ = "1.6.2"
 
 # Initialize numpy
 import posixpath
@@ -3543,15 +3543,21 @@
 **`has_szip_filter(self)`**
 returns True if szip compression filter is available"""
         cdef int ierr
-        IF HAS_SZIP_SUPPORT:
-            with nogil:
-                ierr = nc_inq_filter_avail(self._grpid, H5Z_FILTER_SZIP)
-            if ierr:
+        IF HAS_NCFILTER:
+            IF HAS_SZIP_SUPPORT:
+                with nogil:
+                    ierr = nc_inq_filter_avail(self._grpid, H5Z_FILTER_SZIP)
+                if ierr:
+                    return False
+                else:
+                    return True
+            ELSE:
                 return False
-            else:
-                return True
         ELSE:
-            return False
+             IF HAS_SZIP_SUPPORT:
+                 return True
+             ELSE:
+                 return False
 
 cdef class Group(Dataset):
     """
@@ -4953,7 +4959,7 @@
         # put_ind for this dimension is set to -1 by _StartCountStride.
         squeeze = data.ndim * [slice(None),]
         for i,n in enumerate(put_ind.shape[:-1]):
-            if n == 1 and put_ind[...,i].ravel()[0] == -1:
+            if n == 1 and put_ind.size > 0 and put_ind[...,i].ravel()[0] == -1:
                 squeeze[i] = 0
 
         # Reshape the arrays so we can iterate over them.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/src/netCDF4/utils.py 
new/netCDF4-1.6.2/src/netCDF4/utils.py
--- old/netCDF4-1.6.1/src/netCDF4/utils.py      2022-09-15 03:10:57.000000000 
+0200
+++ new/netCDF4-1.6.2/src/netCDF4/utils.py      2022-11-15 20:49:44.000000000 
+0100
@@ -457,7 +457,7 @@
     out = []
 
     for i, n in enumerate(s):
-        if n == 1:
+        if n == 1 and count.size > 0:
             c = count[..., i].ravel()[0] # All elements should be identical.
             out.append(c)
         else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/src/netCDF4.egg-info/PKG-INFO 
new/netCDF4-1.6.2/src/netCDF4.egg-info/PKG-INFO
--- old/netCDF4-1.6.1/src/netCDF4.egg-info/PKG-INFO     2022-09-15 
03:11:16.000000000 +0200
+++ new/netCDF4-1.6.2/src/netCDF4.egg-info/PKG-INFO     2022-11-15 
20:49:59.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: netCDF4
-Version: 1.6.1
+Version: 1.6.2
 Summary: Provides an object-oriented python interface to the netCDF version 4 
library.
 Home-page: http://github.com/Unidata/netcdf4-python
 Download-URL: http://python.org/pypi/netCDF4
@@ -19,6 +19,7 @@
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: System :: Archiving :: Compression
 Classifier: Operating System :: OS Independent
+Requires-Python: >=3.6
 License-File: LICENSE
 
 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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/src/netCDF4.egg-info/SOURCES.txt 
new/netCDF4-1.6.2/src/netCDF4.egg-info/SOURCES.txt
--- old/netCDF4-1.6.1/src/netCDF4.egg-info/SOURCES.txt  2022-09-15 
03:11:17.000000000 +0200
+++ new/netCDF4-1.6.2/src/netCDF4.egg-info/SOURCES.txt  2022-11-15 
20:50:00.000000000 +0100
@@ -7,6 +7,7 @@
 README.wheels.md
 checkversion.py
 create_docs.sh
+pyproject.toml
 setup.cfg
 setup.py
 docs/index.html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/test/tst_alignment.py 
new/netCDF4-1.6.2/test/tst_alignment.py
--- old/netCDF4-1.6.1/test/tst_alignment.py     2022-09-15 03:10:57.000000000 
+0200
+++ new/netCDF4-1.6.2/test/tst_alignment.py     2022-11-15 20:49:44.000000000 
+0100
@@ -1,5 +1,6 @@
 import numpy as np
 from netCDF4 import set_alignment, get_alignment, Dataset
+from netCDF4 import __has_set_alignment__
 import netCDF4
 import os
 import subprocess
@@ -23,6 +24,7 @@
 
 class AlignmentTestCase(unittest.TestCase):
     def setUp(self):
+
         self.file = file_name
 
         # This is a global variable in netcdf4, it must be set before File
@@ -57,6 +59,10 @@
             with self.assertRaises(RuntimeError):
                 get_alignment()
 
+    def test_reports_alignment_capabilities(self):
+        # Assert that the library reports that it supports alignment correctly
+        assert has_alignment == __has_set_alignment__
+
     # if we have no support for alignment, we have no guarantees on
     # how the data can be aligned
     @unittest.skipIf(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/test/tst_atts.py 
new/netCDF4-1.6.2/test/tst_atts.py
--- old/netCDF4-1.6.1/test/tst_atts.py  2022-09-15 03:10:57.000000000 +0200
+++ new/netCDF4-1.6.2/test/tst_atts.py  2022-11-15 20:49:44.000000000 +0100
@@ -40,96 +40,95 @@
 
     def setUp(self):
         self.file = FILE_NAME
-        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 renaming
-        f.stratt_tmp = STRATT
-        f.renameAttribute('stratt_tmp','stratt')
-        f.emptystratt = EMPTYSTRATT
-        f.intatt = INTATT
-        f.floatatt = FLOATATT
-        f.seqatt = SEQATT
-        # sequences of strings converted to a single string.
-        f.stringseqatt = STRINGSEQATT
-        f.setncattr_string('stringseqatt_array',STRINGSEQATT) # array of 
NC_STRING
-        g = f.createGroup(GROUP_NAME)
-        f.createDimension(DIM1_NAME, DIM1_LEN)
-        f.createDimension(DIM2_NAME, DIM2_LEN)
-        f.createDimension(DIM3_NAME, DIM3_LEN)
-        g.createDimension(DIM1_NAME, DIM1_LEN)
-        g.createDimension(DIM2_NAME, DIM2_LEN)
-        g.createDimension(DIM3_NAME, DIM3_LEN)
-        g.stratt_tmp = STRATT
-        g.renameAttribute('stratt_tmp','stratt')
-        g.emptystratt = EMPTYSTRATT
-        g.intatt = INTATT
-        g.floatatt = FLOATATT
-        g.seqatt = SEQATT
-        g.stringseqatt = STRINGSEQATT
-        if netCDF4.__version__ > "1.4.2":
-            with self.assertRaises(ValueError):
-                g.arrayatt = [[1, 2], [3, 4]] # issue #841
-        g.setncattr_string('stringseqatt_array',STRINGSEQATT) # array of 
NC_STRING
-        v = f.createVariable(VAR_NAME, 'f8',(DIM1_NAME,DIM2_NAME,DIM3_NAME))
-        # try to set a variable attribute with one of the reserved names.
-        v.setncattr('ndim','three')
-        v.setncatts({'foo': 1})
-        v.setncatts(OrderedDict(bar=2))
-        v.stratt_tmp = STRATT
-        v.renameAttribute('stratt_tmp','stratt')
-        v.emptystratt = EMPTYSTRATT
-        v.intatt = INTATT
-        v.floatatt = FLOATATT
-        v.seqatt = SEQATT
-        v.stringseqatt = STRINGSEQATT
-        v.setncattr_string('stringseqatt_array',STRINGSEQATT) # array of 
NC_STRING
-        v1 = g.createVariable(VAR_NAME, 'f8',(DIM1_NAME,DIM2_NAME,DIM3_NAME))
-        v1.stratt = STRATT
-        v1.emptystratt = EMPTYSTRATT
-        v1.intatt = INTATT
-        v1.floatatt = FLOATATT
-        v1.seqatt = SEQATT
-        v1.stringseqatt = STRINGSEQATT
-        v1.setncattr_string('stringseqatt_array',STRINGSEQATT) # array of 
NC_STRING
-        # issue #959: should not be able to set _FillValue after var creation
-        try:
-            v1._FillValue(-999.)
-        except AttributeError:
-            pass
-        else:
-            raise ValueError('This test should have failed.')
-        try:
-            v1.setncattr('_FillValue',-999.)
-        except AttributeError:
-            pass
-        else:
-            raise ValueError('This test should have failed.')
-        # issue #485 (triggers segfault in C lib
-        # with version 1.2.1 without pull request #486)
-        f.foo = np.array('bar','S')
-        f.foo = np.array('bar','U')
-        # issue #529 write string attribute as NC_CHAR unless
-        # it can't be decoded to ascii.  Add setncattr_string
-        # method to force NC_STRING.
-        f.charatt = 'foo' # will be written as NC_CHAR
-        f.setncattr_string('stringatt','bar') # NC_STRING
-        f.cafe = 'caf\xe9' # NC_STRING
-        f.batt = 'caf\xe9'.encode('utf-8') #NC_CHAR
-        v.setncattr_string('stringatt','bar') # NC_STRING
-        # issue #882 - provide an option to always string attribute
-        # as NC_STRINGs. Testing various approaches to setting text 
attributes...
-        f.set_ncstring_attrs(True)
-        f.stringatt_ncstr = 'foo' # will now be written as NC_STRING
-        f.setncattr_string('stringatt_ncstr','bar') # NC_STRING anyway
-        f.caf_ncstr = 'caf\xe9' # NC_STRING anyway
-        f.bat_ncstr = 'caf\xe9'.encode('utf-8') # now NC_STRING
-        g.stratt_ncstr = STRATT # now NC_STRING
-        #g.renameAttribute('stratt_tmp','stratt_ncstr')
-        v.setncattr_string('stringatt_ncstr','bar') # NC_STRING anyway
-        v.stratt_ncstr = STRATT
-        v1.emptystratt_ncstr = EMPTYSTRATT
-        f.close()
+        with netCDF4.Dataset(self.file,'w') as f:
+            # try to set a dataset attribute with one of the reserved names.
+            f.setncattr('file_format','netcdf4_format')
+            # test attribute renaming
+            f.stratt_tmp = STRATT
+            f.renameAttribute('stratt_tmp','stratt')
+            f.emptystratt = EMPTYSTRATT
+            f.intatt = INTATT
+            f.floatatt = FLOATATT
+            f.seqatt = SEQATT
+            # sequences of strings converted to a single string.
+            f.stringseqatt = STRINGSEQATT
+            f.setncattr_string('stringseqatt_array',STRINGSEQATT) # array of 
NC_STRING
+            g = f.createGroup(GROUP_NAME)
+            f.createDimension(DIM1_NAME, DIM1_LEN)
+            f.createDimension(DIM2_NAME, DIM2_LEN)
+            f.createDimension(DIM3_NAME, DIM3_LEN)
+            g.createDimension(DIM1_NAME, DIM1_LEN)
+            g.createDimension(DIM2_NAME, DIM2_LEN)
+            g.createDimension(DIM3_NAME, DIM3_LEN)
+            g.stratt_tmp = STRATT
+            g.renameAttribute('stratt_tmp','stratt')
+            g.emptystratt = EMPTYSTRATT
+            g.intatt = INTATT
+            g.floatatt = FLOATATT
+            g.seqatt = SEQATT
+            g.stringseqatt = STRINGSEQATT
+            if netCDF4.__version__ > "1.4.2":
+                with self.assertRaises(ValueError):
+                    g.arrayatt = [[1, 2], [3, 4]] # issue #841
+            g.setncattr_string('stringseqatt_array',STRINGSEQATT) # array of 
NC_STRING
+            v = f.createVariable(VAR_NAME, 
'f8',(DIM1_NAME,DIM2_NAME,DIM3_NAME))
+            # try to set a variable attribute with one of the reserved names.
+            v.setncattr('ndim','three')
+            v.setncatts({'foo': 1})
+            v.setncatts(OrderedDict(bar=2))
+            v.stratt_tmp = STRATT
+            v.renameAttribute('stratt_tmp','stratt')
+            v.emptystratt = EMPTYSTRATT
+            v.intatt = INTATT
+            v.floatatt = FLOATATT
+            v.seqatt = SEQATT
+            v.stringseqatt = STRINGSEQATT
+            v.setncattr_string('stringseqatt_array',STRINGSEQATT) # array of 
NC_STRING
+            v1 = g.createVariable(VAR_NAME, 
'f8',(DIM1_NAME,DIM2_NAME,DIM3_NAME))
+            v1.stratt = STRATT
+            v1.emptystratt = EMPTYSTRATT
+            v1.intatt = INTATT
+            v1.floatatt = FLOATATT
+            v1.seqatt = SEQATT
+            v1.stringseqatt = STRINGSEQATT
+            v1.setncattr_string('stringseqatt_array',STRINGSEQATT) # array of 
NC_STRING
+            # issue #959: should not be able to set _FillValue after var 
creation
+            try:
+                v1._FillValue(-999.)
+            except AttributeError:
+                pass
+            else:
+                raise ValueError('This test should have failed.')
+            try:
+                v1.setncattr('_FillValue',-999.)
+            except AttributeError:
+                pass
+            else:
+                raise ValueError('This test should have failed.')
+            # issue #485 (triggers segfault in C lib
+            # with version 1.2.1 without pull request #486)
+            f.foo = np.array('bar','S')
+            f.foo = np.array('bar','U')
+            # issue #529 write string attribute as NC_CHAR unless
+            # it can't be decoded to ascii.  Add setncattr_string
+            # method to force NC_STRING.
+            f.charatt = 'foo' # will be written as NC_CHAR
+            f.setncattr_string('stringatt','bar') # NC_STRING
+            f.cafe = 'caf\xe9' # NC_STRING
+            f.batt = 'caf\xe9'.encode('utf-8') #NC_CHAR
+            v.setncattr_string('stringatt','bar') # NC_STRING
+            # issue #882 - provide an option to always string attribute
+            # as NC_STRINGs. Testing various approaches to setting text 
attributes...
+            f.set_ncstring_attrs(True)
+            f.stringatt_ncstr = 'foo' # will now be written as NC_STRING
+            f.setncattr_string('stringatt_ncstr','bar') # NC_STRING anyway
+            f.caf_ncstr = 'caf\xe9' # NC_STRING anyway
+            f.bat_ncstr = 'caf\xe9'.encode('utf-8') # now NC_STRING
+            g.stratt_ncstr = STRATT # now NC_STRING
+            #g.renameAttribute('stratt_tmp','stratt_ncstr')
+            v.setncattr_string('stringatt_ncstr','bar') # NC_STRING anyway
+            v.stratt_ncstr = STRATT
+            v1.emptystratt_ncstr = EMPTYSTRATT
 
     def tearDown(self):
         # Remove the temporary files
@@ -138,87 +137,87 @@
 
     def runTest(self):
         """testing attributes"""
-        f  = netCDF4.Dataset(self.file, 'r')
-        v = f.variables[VAR_NAME]
-        g = f.groups[GROUP_NAME]
-        v1 = g.variables[VAR_NAME]
-        # check attributes in root group.
-        # global attributes.
-        # check __dict__ method for accessing all netCDF attributes.
-        for key,val in ATTDICT.items():
-            if type(val) == np.ndarray:
-                assert f.__dict__[key].tolist() == val.tolist()
-            else:
-                assert f.__dict__[key] == val
-        # check accessing individual attributes.
-        assert f.intatt == INTATT
-        assert f.floatatt == FLOATATT
-        assert f.stratt == STRATT
-        assert f.emptystratt == EMPTYSTRATT
-        assert f.seqatt.tolist() == SEQATT.tolist()
-        #assert f.stringseqatt == ''.join(STRINGSEQATT) # issue 770
-        assert f.stringseqatt == STRINGSEQATT
-        assert f.stringseqatt_array == STRINGSEQATT
-        assert f.getncattr('file_format') == 'netcdf4_format'
-        # variable attributes.
-        # check __dict__ method for accessing all netCDF attributes.
-        for key,val in ATTDICT.items():
-            if type(val) == np.ndarray:
-                assert v.__dict__[key].tolist() == val.tolist()
-            else:
-                assert v.__dict__[key] == val
-        # check accessing individual attributes.
-        assert v.intatt == INTATT
-        assert v.floatatt == FLOATATT
-        assert v.stratt == STRATT
-        assert v.seqatt.tolist() == SEQATT.tolist()
-        #assert v.stringseqatt == ''.join(STRINGSEQATT) # issue 770
-        assert v.stringseqatt == STRINGSEQATT
-        assert v.stringseqatt_array == STRINGSEQATT
-        assert v.getncattr('ndim') == 'three'
-        assert v.getncattr('foo') == 1
-        assert v.getncattr('bar') == 2
-        # check type of attributes using ncdump (issue #529)
-        if not os.getenv('NO_CDL'):
-            ncdump_output = f.tocdl()
-            for line in ncdump_output:
-                line = line.strip('\t\n\r')
-                line = line.strip()# Must be done another time for group 
variables
-                if "stringatt" in line: assert line.startswith('string')
-                if "charatt" in line: assert line.startswith(':')
-                if "cafe" in line: assert line.startswith('string')
-                if "batt" in line: assert line.startswith(':')
-                if "_ncstr" in line: assert line.startswith('string')
-        # check attributes in subgroup.
-        # global attributes.
-        for key,val in ATTDICT.items():
-            if type(val) == np.ndarray:
-                assert g.__dict__[key].tolist() == val.tolist()
-            else:
-                assert g.__dict__[key] == val
-        assert g.intatt == INTATT
-        assert g.floatatt == FLOATATT
-        assert g.stratt == STRATT
-        assert g.emptystratt == EMPTYSTRATT
-        assert g.seqatt.tolist() == SEQATT.tolist()
-        #assert g.stringseqatt == ''.join(STRINGSEQATT) # issue 770
-        assert g.stringseqatt == STRINGSEQATT
-        assert g.stringseqatt_array == STRINGSEQATT
-        for key,val in ATTDICT.items():
-            if type(val) == np.ndarray:
-                assert v1.__dict__[key].tolist() == val.tolist()
-            else:
-                assert v1.__dict__[key] == val
-        assert v1.intatt == INTATT
-        assert v1.floatatt == FLOATATT
-        assert v1.stratt == STRATT
-        assert v1.emptystratt == EMPTYSTRATT
-        assert v1.seqatt.tolist() == SEQATT.tolist()
-        #assert v1.stringseqatt == ''.join(STRINGSEQATT) # issue 770
-        assert v1.stringseqatt == STRINGSEQATT
-        assert v1.stringseqatt_array == STRINGSEQATT
-        assert getattr(v1,'nonexistantatt',None) == None
-        f.close()
+        with netCDF4.Dataset(self.file, 'r') as f:
+            v = f.variables[VAR_NAME]
+            g = f.groups[GROUP_NAME]
+            v1 = g.variables[VAR_NAME]
+            # check attributes in root group.
+            # global attributes.
+            # check __dict__ method for accessing all netCDF attributes.
+            for key,val in ATTDICT.items():
+                if type(val) == np.ndarray:
+                    assert f.__dict__[key].tolist() == val.tolist()
+                else:
+                    assert f.__dict__[key] == val
+            # check accessing individual attributes.
+            assert f.intatt == INTATT
+            assert f.floatatt == FLOATATT
+            assert f.stratt == STRATT
+            assert f.emptystratt == EMPTYSTRATT
+            assert f.seqatt.tolist() == SEQATT.tolist()
+            #assert f.stringseqatt == ''.join(STRINGSEQATT) # issue 770
+            assert f.stringseqatt == STRINGSEQATT
+            assert f.stringseqatt_array == STRINGSEQATT
+            assert f.getncattr('file_format') == 'netcdf4_format'
+            # variable attributes.
+            # check __dict__ method for accessing all netCDF attributes.
+            for key,val in ATTDICT.items():
+                if type(val) == np.ndarray:
+                    assert v.__dict__[key].tolist() == val.tolist()
+                else:
+                    assert v.__dict__[key] == val
+            # check accessing individual attributes.
+            assert v.intatt == INTATT
+            assert v.floatatt == FLOATATT
+            assert v.stratt == STRATT
+            assert v.seqatt.tolist() == SEQATT.tolist()
+            #assert v.stringseqatt == ''.join(STRINGSEQATT) # issue 770
+            assert v.stringseqatt == STRINGSEQATT
+            assert v.stringseqatt_array == STRINGSEQATT
+            assert v.getncattr('ndim') == 'three'
+            assert v.getncattr('foo') == 1
+            assert v.getncattr('bar') == 2
+            # check type of attributes using ncdump (issue #529)
+            if not os.getenv('NO_CDL'):
+                ncdump_output = f.tocdl()
+                for line in ncdump_output:
+                    line = line.strip('\t\n\r')
+                    line = line.strip()# Must be done another time for group 
variables
+                    if "stringatt" in line: assert line.startswith('string')
+                    if "charatt" in line: assert line.startswith(':')
+                    if "cafe" in line: assert line.startswith('string')
+                    if "batt" in line: assert line.startswith(':')
+                    if "_ncstr" in line: assert line.startswith('string')
+            # check attributes in subgroup.
+            # global attributes.
+            for key,val in ATTDICT.items():
+                if type(val) == np.ndarray:
+                    assert g.__dict__[key].tolist() == val.tolist()
+                else:
+                    assert g.__dict__[key] == val
+            assert g.intatt == INTATT
+            assert g.floatatt == FLOATATT
+            assert g.stratt == STRATT
+            assert g.emptystratt == EMPTYSTRATT
+            assert g.seqatt.tolist() == SEQATT.tolist()
+            #assert g.stringseqatt == ''.join(STRINGSEQATT) # issue 770
+            assert g.stringseqatt == STRINGSEQATT
+            assert g.stringseqatt_array == STRINGSEQATT
+            for key,val in ATTDICT.items():
+                if type(val) == np.ndarray:
+                    assert v1.__dict__[key].tolist() == val.tolist()
+                else:
+                    assert v1.__dict__[key] == val
+            assert v1.intatt == INTATT
+            assert v1.floatatt == FLOATATT
+            assert v1.stratt == STRATT
+            assert v1.emptystratt == EMPTYSTRATT
+            assert v1.seqatt.tolist() == SEQATT.tolist()
+            #assert v1.stringseqatt == ''.join(STRINGSEQATT) # issue 770
+            assert v1.stringseqatt == STRINGSEQATT
+            assert v1.stringseqatt_array == STRINGSEQATT
+            assert getattr(v1,'nonexistantatt',None) == None
+
         # issue 915 empty string attribute (ncdump reports 'NIL')
         f = netCDF4.Dataset('test_gold.nc')
         assert f['RADIANCE'].VAR_NOTES == ""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/netCDF4-1.6.1/test/tst_fancyslicing.py 
new/netCDF4-1.6.2/test/tst_fancyslicing.py
--- old/netCDF4-1.6.1/test/tst_fancyslicing.py  2022-09-15 03:10:57.000000000 
+0200
+++ new/netCDF4-1.6.2/test/tst_fancyslicing.py  2022-11-15 20:49:44.000000000 
+0100
@@ -142,6 +142,11 @@
 
         assert_array_equal(v[0], self.data[0])
 
+        # slicing with all False booleans (PR #1197)
+        iby[:] = False
+        data = v[ibx,iby,ibz]
+        assert(data.size == 0)
+
         f.close()
 
     def test_set(self):

Reply via email to