Skip to content

Commit d8b1cb1

Browse files
author
Jeff Whitaker
authored
Merge pull request #1121 from Unidata/v1.5.7rel
prepare for v1.5.7 release
2 parents 3376418 + 26761d0 commit d8b1cb1

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

Changelog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
version 1.5.7 (not yet released)
2-
=================================
1+
version 1.5.7 (tag v1.5.7rel)
2+
==============================
33
* don't try to mask vlens with default _FillValue, since vlens don't have a default _FillValue.
44
This gets rid of numpy DeprecationWarning (issue #1099).
55
* update docs to reflect the fact that a variable must be in collective mode before writing

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
## News
1111
For details on the latest updates, see the [Changelog](https://github.com/Unidata/netcdf4-python/blob/master/Changelog).
1212

13+
6/22/2021: Version [1.5.7](https://pypi.python.org/pypi/netCDF4/1.5.7) released.
14+
Fixed OverflowError on Windows when reading data with dimension sizes greater than 2**32-1.
15+
Masked arrays no longer returned for vlens.
16+
1317
2/15/2021: Version [1.5.6](https://pypi.python.org/pypi/netCDF4/1.5.6) released. Added `Dataset.fromcdl` and `Dataset.tocdl`, which require `ncdump` and `ncgen` utilities to be in `$PATH`. Removed python 2.7 support.
1418

1519
12/20/2020: Version [1.5.5.1](https://pypi.python.org/pypi/netCDF4/1.5.5.1) released.

docs/index.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -641,11 +641,9 @@ <h2 id="groups-in-a-netcdf-file">Groups in a netCDF file</h2>
641641
object yields summary information about it's contents.</p>
642642

643643
<div class="codehilite"><pre><span></span><code><span class="o">&gt;&gt;&gt;</span> <span class="k">def</span> <span class="nf">walktree</span><span class="p">(</span><span class="n">top</span><span class="p">):</span>
644-
<span class="o">...</span> <span class="n">values</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="n">groups</span><span class="o">.</span><span class="n">values</span><span class="p">()</span>
645-
<span class="o">...</span> <span class="k">yield</span> <span class="n">values</span>
644+
<span class="o">...</span> <span class="k">yield</span> <span class="n">top</span><span class="o">.</span><span class="n">groups</span><span class="o">.</span><span class="n">values</span><span class="p">()</span>
646645
<span class="o">...</span> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">top</span><span class="o">.</span><span class="n">groups</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
647-
<span class="o">...</span> <span class="k">for</span> <span class="n">children</span> <span class="ow">in</span> <span class="n">walktree</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
648-
<span class="o">...</span> <span class="k">yield</span> <span class="n">children</span>
646+
<span class="o">...</span> <span class="k">yield from</span> <span class="n">walktree</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
649647
<span class="o">&gt;&gt;&gt;</span> <span class="nb">print</span><span class="p">(</span><span class="n">rootgrp</span><span class="p">)</span>
650648
<span class="o">&lt;</span><span class="k">class</span> <span class="err">&#39;</span><span class="nc">netCDF4</span><span class="o">.</span><span class="n">_netCDF4</span><span class="o">.</span><span class="n">Dataset</span><span class="s1">&#39;&gt;</span>
651649
<span class="n">root</span> <span class="n">group</span> <span class="p">(</span><span class="n">NETCDF4</span> <span class="n">data</span> <span class="n">model</span><span class="p">,</span> <span class="n">file</span> <span class="nb">format</span> <span class="n">HDF5</span><span class="p">):</span>
@@ -987,8 +985,9 @@ <h2 id="writing-data-to-and-retrieving-data-from-a-netcdf-variable">Writing data
987985
The result will be a numpy scalar array.</p>
988986

989987
<p>By default, netcdf4-python returns numpy masked arrays with values equal to the
990-
<code>missing_value</code> or <code>_FillValue</code> variable attributes masked. The
991-
<code><a href="#Dataset.set_auto_mask">Dataset.set_auto_mask</a></code> <code><a href="#Dataset">Dataset</a></code> and <code><a href="#Variable">Variable</a></code> methods
988+
<code>missing_value</code> or <code>_FillValue</code> variable attributes masked for primitive and
989+
enum data types.
990+
The <code><a href="#Dataset.set_auto_mask">Dataset.set_auto_mask</a></code> <code><a href="#Dataset">Dataset</a></code> and <code><a href="#Variable">Variable</a></code> methods
992991
can be used to disable this feature so that
993992
numpy arrays are always returned, with the missing values included. Prior to
994993
version 1.4.0 the default behavior was to only return masked arrays when the
@@ -1596,7 +1595,7 @@ <h2 id="in-memory-diskless-datasets">In-memory (diskless) Datasets</h2>
15961595
the parallel IO example, which is in <code>examples/mpi_example.py</code>.
15971596
Unit tests are in the <code>test</code> directory.</p>
15981597

1599-
<p><strong>contact</strong>: Jeffrey Whitaker <a href="ma&#x69;&#108;&#x74;o&#58;&#x6a;&#101;&#102;f&#114;&#x65;&#121;&#46;&#x73;&#x2e;&#x77;&#x68;&#105;&#116;&#97;&#107;&#x65;&#x72;&#64;&#110;&#x6f;aa&#x2e;&#103;&#x6f;&#x76;">&#x6a;&#101;&#102;f&#114;&#x65;&#121;&#46;&#x73;&#x2e;&#x77;&#x68;&#105;&#116;&#97;&#107;&#x65;&#x72;&#64;&#110;&#x6f;aa&#x2e;&#103;&#x6f;&#x76;</a></p>
1598+
<p><strong>contact</strong>: Jeffrey Whitaker <a href="&#x6d;&#x61;&#105;&#x6c;&#116;&#111;&#58;&#106;&#101;&#x66;&#x66;&#114;&#x65;&#x79;&#x2e;&#115;&#46;&#x77;&#x68;&#x69;t&#x61;&#107;&#x65;&#x72;&#64;&#110;oa&#97;&#46;&#103;&#x6f;&#x76;">&#106;&#101;&#x66;&#x66;&#114;&#x65;&#x79;&#x2e;&#115;&#46;&#x77;&#x68;&#x69;t&#x61;&#107;&#x65;&#x72;&#64;&#110;oa&#97;&#46;&#103;&#x6f;&#x76;</a></p>
16001599

16011600
<p><strong>copyright</strong>: 2008 by Jeffrey Whitaker.</p>
16021601

@@ -2403,7 +2402,8 @@ <h2 id="in-memory-diskless-datasets">In-memory (diskless) Datasets</h2>
24032402
<div class="docstring"><p><strong><code>set_auto_mask(self, True_or_False)</code></strong></p>
24042403

24052404
<p>Call <code><a href="#Variable.set_auto_mask">Variable.set_auto_mask</a></code> for all variables contained in this <code><a href="#Dataset">Dataset</a></code> or
2406-
<code><a href="#Group">Group</a></code>, as well as for all variables in all its subgroups.</p>
2405+
<code><a href="#Group">Group</a></code>, as well as for all variables in all its subgroups. Only affects
2406+
Variables with primitive or enum types (not compound or vlen Variables).</p>
24072407

24082408
<p><strong><code>True_or_False</code></strong>: Boolean determining if automatic conversion to masked arrays
24092409
shall be applied for all variables.</p>
@@ -2744,7 +2744,8 @@ <h2 id="in-memory-diskless-datasets">In-memory (diskless) Datasets</h2>
27442744
<p><strong><code><a href="#Variable.mask">mask</a></code></strong>: If True, data is automatically converted to/from masked
27452745
arrays when missing values or fill values are present. Default is <code>True</code>, can be
27462746
reset using <code><a href="#Variable.set_auto_mask">Variable.set_auto_mask</a></code> and <code><a href="#Variable.set_auto_maskandscale">Variable.set_auto_maskandscale</a></code>
2747-
methods.</p>
2747+
methods. Only relevant for Variables with primitive or enum types (ignored
2748+
for compound and vlen Variables).</p>
27482749

27492750
<p><strong><code><a href="#Variable.chartostring">chartostring</a></code></strong>: If True, data is automatically converted to/from character
27502751
arrays to string arrays when the <code>_Encoding</code> variable attribute is set.

test/tst_slicing.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from numpy.random import seed, randint
33
from numpy.testing import assert_array_equal, assert_equal,\
44
assert_array_almost_equal
5-
import tempfile, unittest, os, random
5+
import tempfile, unittest, os, random, sys
66
import numpy as np
77

88
file_name = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
@@ -35,8 +35,8 @@ def setUp(self):
3535
vu[:,::-1,:] = data
3636

3737
v1[:] = data[:, 0, 0]
38-
#v2[0:2**31] = 1 # issue 1112 (overflow on windows)
39-
v2[2**31] = 1 # issue 1112 (overflow on windows)
38+
if sys.maxsize > 2**32:
39+
v2[2**31] = 1 # issue 1112 (overflow on windows)
4040
f.close()
4141

4242
def tearDown(self):
@@ -82,8 +82,8 @@ def test_1d(self):
8282
v2 = f.variables['data1dx']
8383
d = data[:,0,0]
8484
assert_equal(v1[:], d)
85-
#assert_equal(v2[:], np.ones(2**31,dtype=np.uint8))
86-
assert_equal(v2[2**31], 1)
85+
if sys.maxsize > 2**32:
86+
assert_equal(v2[2**31], 1)
8787
assert_equal(v1[4:], d[4:])
8888
# test return of array scalar.
8989
assert_equal(v1[0].shape, ())

0 commit comments

Comments
 (0)