Update upstream source from tag 'upstream/1.5.8'
Update to upstream version '1.5.8'
with Debian dir 79a19b5b2ab1c3112ed87030aadf9f651c249dfa
Bas Couwenberg
2 years ago
9 | 9 |
NETCDF_DIR: ${{ github.workspace }}/..
|
10 | 10 |
NETCDF_EXTRA_CONFIG: --enable-pnetcdf
|
11 | 11 |
CC: mpicc.mpich
|
12 | |
# NO_NET: 1
|
|
12 |
#NO_NET: 1
|
13 | 13 |
strategy:
|
14 | 14 |
matrix:
|
15 | 15 |
python-version: ["3.9"]
|
7 | 7 |
jobs:
|
8 | 8 |
run-serial:
|
9 | 9 |
runs-on: ${{ matrix.os }}
|
|
10 |
#env:
|
|
11 |
# NO_NET: 1
|
10 | 12 |
strategy:
|
11 | 13 |
matrix:
|
12 | |
python-version: ["3.6", "3.7", "3.8", "3.9"]
|
|
14 |
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10" ]
|
13 | 15 |
os: [windows-latest, ubuntu-latest, macos-latest]
|
14 | 16 |
platform: [x64, x32]
|
15 | 17 |
exclude:
|
|
75 | 77 |
export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH"
|
76 | 78 |
which mpirun
|
77 | 79 |
mpirun --version
|
78 | |
mpirun --oversubscribe -np 4 python mpi_example.py
|
|
80 |
mpirun -np 4 python mpi_example.py
|
79 | 81 |
if [ $? -ne 0 ] ; then
|
80 | 82 |
echo "hdf5 mpi test failed!"
|
81 | 83 |
exit 1
|
|
0 |
version 1.5.8 (tag v1.5.8rel)
|
|
1 |
==============================
|
|
2 |
* Fix Enum bug (issue #1128): the enum_dict member of an EnumType read from a file
|
|
3 |
contains invalid values when the enum is large enough (more than 127 or 255
|
|
4 |
members).
|
|
5 |
* Binary wheels for aarch64 and python 3.10.
|
|
6 |
|
0 | 7 |
version 1.5.7 (tag v1.5.7rel)
|
1 | 8 |
==============================
|
2 | 9 |
* don't try to mask vlens with default _FillValue, since vlens don't have a default _FillValue.
|
8 | 8 |
|
9 | 9 |
## News
|
10 | 10 |
For details on the latest updates, see the [Changelog](https://github.com/Unidata/netcdf4-python/blob/master/Changelog).
|
|
11 |
|
|
12 |
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.
|
11 | 13 |
|
12 | 14 |
6/22/2021: Version [1.5.7](https://pypi.python.org/pypi/netCDF4/1.5.7) released.
|
13 | 15 |
Fixed OverflowError on Windows when reading data with dimension sizes greater than 2**32-1.
|
|
57 | 59 |
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__`.
|
58 | 60 |
|
59 | 61 |
08/10/2018: Version [1.4.1](https://pypi.python.org/pypi/netCDF4/1.4.1) released. The old slicing behavior
|
60 | |
(numpy array returned unless missing values are present, otherwise masked array returned) is renabled
|
|
62 |
(numpy array returned unless missing values are present, otherwise masked array returned) is re-enabled
|
61 | 63 |
via `set_always_mask(False)`.
|
62 | 64 |
|
63 | 65 |
05/11/2018: Version [1.4.0](https://pypi.python.org/pypi/netCDF4/1.4.0) released. The netcdftime package is no longer
|
27 | 27 |
|
28 | 28 |
### Triggering a build
|
29 | 29 |
|
30 | |
You will need write permision to the github repository to trigger new builds
|
|
30 |
You will need write permission to the github repository to trigger new builds
|
31 | 31 |
on the travis-ci interface. Contact us on the mailing list if you need this.
|
32 | 32 |
|
33 | 33 |
You can trigger a build by:
|
2 | 2 |
import numpy as np
|
3 | 3 |
import matplotlib.pyplot as plt
|
4 | 4 |
|
5 | |
# use real data from CFS reanlysis.
|
|
5 |
# use real data from CFS reanalysis.
|
6 | 6 |
# note: we're reading GRIB2 data!
|
7 | 7 |
URL="http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cmd_flxf/2010/201007/20100701/flxf00.gdas.2010070100.grb2"
|
8 | 8 |
nc = netCDF4.Dataset(URL)
|
0 | 0 |
"""
|
1 | |
Version 1.5.7
|
|
1 |
Version 1.5.8
|
2 | 2 |
-------------
|
3 | 3 |
|
4 | 4 |
# Introduction
|
|
1203 | 1203 |
# Python 3.7+ guarantees order; older versions need OrderedDict
|
1204 | 1204 |
from collections import OrderedDict
|
1205 | 1205 |
|
1206 | |
__version__ = "1.5.7"
|
|
1206 |
__version__ = "1.5.8"
|
1207 | 1207 |
|
1208 | 1208 |
# Initialize numpy
|
1209 | 1209 |
import posixpath
|
|
2467 | 2467 |
|
2468 | 2468 |
def isopen(self):
|
2469 | 2469 |
"""
|
2470 | |
**`close(self)`**
|
2471 | |
|
2472 | |
is the Dataset open or closed?
|
|
2470 |
**`isopen(self)`**
|
|
2471 |
|
|
2472 |
Is the Dataset open or closed?
|
2473 | 2473 |
"""
|
2474 | 2474 |
return bool(self._isopen)
|
2475 | 2475 |
|
|
5978 | 5978 |
# then use that to create a EnumType instance.
|
5979 | 5979 |
# called by _get_types, _get_vars.
|
5980 | 5980 |
cdef int ierr, _grpid, nmem
|
5981 | |
cdef char enum_val
|
|
5981 |
cdef ndarray enum_val
|
5982 | 5982 |
cdef nc_type base_xtype
|
5983 | 5983 |
cdef char enum_namstring[NC_MAX_NAME+1]
|
5984 | 5984 |
cdef size_t nmembers
|
|
5997 | 5997 |
raise KeyError("unsupported component type for ENUM")
|
5998 | 5998 |
# loop over members, build dict.
|
5999 | 5999 |
enum_dict = {}
|
|
6000 |
enum_val = numpy.empty(1,dt)
|
6000 | 6001 |
for nmem from 0 <= nmem < nmembers:
|
6001 | 6002 |
with nogil:
|
6002 | 6003 |
ierr = nc_inq_enum_member(_grpid, xtype, nmem, \
|
6003 | |
enum_namstring, &enum_val)
|
|
6004 |
enum_namstring,PyArray_DATA(enum_val))
|
6004 | 6005 |
_ensure_nc_success(ierr)
|
6005 | 6006 |
name = enum_namstring.decode('utf-8')
|
6006 | |
enum_dict[name] = int(enum_val)
|
|
6007 |
enum_dict[name] = enum_val.item()
|
6007 | 6008 |
return EnumType(group, dt, enum_name, enum_dict, typeid=xtype)
|
6008 | 6009 |
|
6009 | 6010 |
cdef _strencode(pystr,encoding=None):
|
234 | 234 |
unlim = False
|
235 | 235 |
# convert boolean index to integer array.
|
236 | 236 |
if np.iterable(ea) and ea.dtype.kind =='b':
|
237 | |
# check that boolen array not too long
|
|
237 |
# check that boolean array not too long
|
238 | 238 |
if not unlim and shape[i] != len(ea):
|
239 | 239 |
msg="""
|
240 | 240 |
Boolean array must have the same shape as the data along this dimension."""
|
|
538 | 538 |
sys.stderr.write(usage)
|
539 | 539 |
sys.exit(0)
|
540 | 540 |
|
541 | |
# filename passed as last argumenbt
|
|
541 |
# filename passed as last argument
|
542 | 542 |
try:
|
543 | 543 |
filename = pargs[-1]
|
544 | 544 |
except IndexError:
|
9 | 9 |
integer data stored with a signed integer type in netcdf-3.
|
10 | 10 |
If _Unsigned=True, a view to the data as unsigned integers is returned.
|
11 | 11 |
set_autoscale can be used to turn this off (default is on)
|
12 | |
See issue #656 (pull reqeust #658).
|
|
12 |
See issue #656 (pull request #658).
|
13 | 13 |
"""
|
14 | 14 |
def test_unsigned(self):
|
15 | 15 |
f = netCDF4.Dataset("ubyte.nc")
|
42 | 42 |
f = netCDF4.Dataset(self.file,'w')
|
43 | 43 |
# try to set a dataset attribute with one of the reserved names.
|
44 | 44 |
f.setncattr('file_format','netcdf4_format')
|
45 | |
# test attribute renameing
|
|
45 |
# test attribute renaming
|
46 | 46 |
f.stratt_tmp = STRATT
|
47 | 47 |
f.renameAttribute('stratt_tmp','stratt')
|
48 | 48 |
f.emptystratt = EMPTYSTRATT
|
62 | 62 |
assert_array_equal(data.mask, datain_masked.mask)
|
63 | 63 |
f.close()
|
64 | 64 |
|
|
65 |
class EnumDictTestCase(unittest.TestCase):
|
|
66 |
# issue 1128
|
|
67 |
def setUp(self):
|
|
68 |
DT = np.int16; BITS = 8
|
|
69 |
self.STORED_VAL = DT(2**BITS)
|
|
70 |
self.VAL_MAP = {f'bits_{n}': DT(2**n) for n in range(1,BITS+1)}
|
|
71 |
self.VAL_MAP['invalid'] = 0
|
|
72 |
self.file = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
|
|
73 |
with netCDF4.Dataset(file, 'w') as nc:
|
|
74 |
# The enum is created with dtype=int16, so it will allow BITS values up to 15
|
|
75 |
et = nc.createEnumType(DT, 'etype', self.VAL_MAP)
|
|
76 |
ev = nc.createVariable('evar', et)
|
|
77 |
# Succeeds because the created EnumType does keep the correct dict
|
|
78 |
ev[...] = self.STORED_VAL
|
|
79 |
def tearDown(self):
|
|
80 |
os.remove(self.file)
|
|
81 |
def runTest(self):
|
|
82 |
with netCDF4.Dataset(file, 'r') as nc:
|
|
83 |
read_var = nc['evar']
|
|
84 |
assert(read_var[...] == self.STORED_VAL)
|
|
85 |
assert(read_et.enum_dict == self.VAL_MAP)
|
|
86 |
|
65 | 87 |
if __name__ == '__main__':
|
66 | 88 |
unittest.main()
|
55 | 55 |
# integer array slice.
|
56 | 56 |
v[:,i,:] = -100
|
57 | 57 |
self.data[:,i,:] = -100
|
58 | |
# boolen array slice.
|
|
58 |
# boolean array slice.
|
59 | 59 |
v[ib2] = -200
|
60 | 60 |
self.data[ib2] = -200
|
61 | 61 |
v[ib3,:,:] = -300
|
25 | 25 |
|
26 | 26 |
def test_no_such_file_raises(self):
|
27 | 27 |
fname = 'not_a_nc_file.nc'
|
28 | |
with self.assertRaisesRegexp(IOError, fname):
|
|
28 |
with self.assertRaisesRegex(IOError, fname):
|
29 | 29 |
netCDF4.Dataset(fname, 'r')
|
30 | 30 |
|
31 | 31 |
|
95 | 95 |
self.assertTrue(np.all(self.v_ma.mask == v.mask))
|
96 | 96 |
self.assertTrue(np.all(self.v_ma.mask == v2.mask))
|
97 | 97 |
# treating _FillValue as valid_min/valid_max was
|
98 | |
# too suprising, revert to old behaviour (issue #761)
|
|
98 |
# too surprising, revert to old behaviour (issue #761)
|
99 | 99 |
#self.assertTrue(np.all(self.v_ma.mask == v3.mask))
|
100 | 100 |
# check that underlying data is same as in netcdf file
|
101 | 101 |
v = f.variables['v']
|
23 | 23 |
|
24 | 24 |
def runTest(self):
|
25 | 25 |
"""test for issue 90 (array shape should not be modified by
|
26 | |
assigment to netCDF variable)"""
|
|
26 |
assignment to netCDF variable)"""
|
27 | 27 |
f = Dataset(self.file, 'a')
|
28 | 28 |
v = f.variables['data']
|
29 | 29 |
v[0] = data
|