Codebase list netcdf4-python / 7dd7397
New upstream version 1.5.1 Bas Couwenberg 5 years ago
14 changed file(s) with 497 addition(s) and 856 deletion(s). Raw diff Collapse all Expand all
0 version 1.5.1 (tag v1.5.1rel)
1 ==============================
2 * fix issue #908 by adding workaround for incorrect value returned
3 by nc_inq_var_fill for netcdf-c < 4.5.1.
4 * fix bug writing slice to unlimited dimension that is not the first
5 (leftmost). Issue #906.
6 * make sure data gets converted to type of scale_factor when add_offset=0
7 and scale_factor=1 (issue #913).
8 * fix for reading empty (NIL) string attributes (issue #915).
9
010 version 1.5.0.1 (tag v1.5.0.1rel)
111 ==================================
212 * binary wheels for linux and macosx rebuilt against netcdf-c 4.6.3 (instead
+0
-47
PKG-INFO less more
0 Metadata-Version: 1.1
1 Name: netCDF4
2 Version: 1.5.0
3 Author: Jeff Whitaker
4 Author-email: jeffrey s whitaker at noaa gov
5 Home-page: https://github.com/Unidata/netcdf4-python
6 Summary: python/numpy interface to netCDF library (versions 3 and 4)
7 License: OSI Approved
8 Description: netCDF version 4 has many features not found in earlier versions of the library
9 and is implemented on
10 top of HDF5. This module can read and write files in both the new netCDF 4 and
11 the old netCDF 3
12 format, and can create files that are readable by HDF5 clients. The API modelled
13 after
14 Scientific.IO.NetCDF, and should be familiar to users of that module.
15
16 Most new features of netCDF 4 are implemented, such as multiple unlimited
17 dimensions, groups and zlib data compression. All the new numeric data types
18 (such as 64 bit and unsigned integer types) are implemented. Compound,
19 variable length (vlen), and enumerated (enum) data types are supported, but
20 the opaque type is not. Mixtures of compound, vlen and/or enum data types are not supported.
21
22 This project has a `Github repository
23 <https://github.com/Unidata/netcdf4-python>`_ where you may access
24 the most
25 up-to-date source.
26
27 `Documentation
28 <http://unidata.github.io/netcdf4-python>`_
29
30 `Changelog
31 <https://github.com/Unidata/netcdf4-python/blob/master/Changelog>`_
32
33 Also available in the `Anaconda scientific python distribution <https://store.continuum.io/cshop/anaconda/>`_
34
35 Download source tarball and binary wheels below...
36 Keywords: numpy netcdf data science network oceanography meteorology climate
37 Platform: any
38 Classifier: Intended Audience :: Science/Research
39 Classifier: Programming Language :: Python :: 2
40 Classifier: Programming Language :: Python :: 2.7
41 Classifier: Programming Language :: Python :: 3
42 Classifier: Programming Language :: Python :: 3.3
43 Classifier: Programming Language :: Python :: 3.4
44 Classifier: Programming Language :: Python :: 3.5
45 Classifier: Topic :: Scientific/Engineering
46
99 ## News
1010 For details on the latest updates, see the [Changelog](https://github.com/Unidata/netcdf4-python/blob/master/Changelog).
1111
12 04/30/2019: Version [1.5.1](https://pypi.python.org/pypi/netCDF4/1.5.1) released. Bugfixes, no new features.
13
1214 04/02/2019: Version [1.5.0.1](https://pypi.python.org/pypi/netCDF4/1.5.0.1) released. Binary wheels for macos x
1315 and linux rebuilt with netcdf-c 4.6.3 (instead of 4.4.1.1). Added read-shared capability for faster reads
1416 of NETCDF3 files (mode='rs').
33 <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
44
55 <title>netCDF4 API documentation</title>
6 <meta name="description" content="Version 1.5.0
6 <meta name="description" content="Version 1.5.1
77 -------------
88 - - -
99
11731173
11741174
11751175 <ul>
1176 <li class="mono"><a href="#netCDF4.MFDataset.__init__">__init__</a></li>
1177 <li class="mono"><a href="#netCDF4.MFDataset.close">close</a></li>
11761178 <li class="mono"><a href="#netCDF4.MFDataset.createCompoundType">createCompoundType</a></li>
11771179 <li class="mono"><a href="#netCDF4.MFDataset.createDimension">createDimension</a></li>
11781180 <li class="mono"><a href="#netCDF4.MFDataset.createEnumType">createEnumType</a></li>
11841186 <li class="mono"><a href="#netCDF4.MFDataset.get_variables_by_attributes">get_variables_by_attributes</a></li>
11851187 <li class="mono"><a href="#netCDF4.MFDataset.getncattr">getncattr</a></li>
11861188 <li class="mono"><a href="#netCDF4.MFDataset.isopen">isopen</a></li>
1189 <li class="mono"><a href="#netCDF4.MFDataset.ncattrs">ncattrs</a></li>
11871190 <li class="mono"><a href="#netCDF4.MFDataset.renameAttribute">renameAttribute</a></li>
11881191 <li class="mono"><a href="#netCDF4.MFDataset.renameDimension">renameDimension</a></li>
11891192 <li class="mono"><a href="#netCDF4.MFDataset.renameGroup">renameGroup</a></li>
12001203 <li class="mono"><a href="#netCDF4.MFDataset.setncattr_string">setncattr_string</a></li>
12011204 <li class="mono"><a href="#netCDF4.MFDataset.setncatts">setncatts</a></li>
12021205 <li class="mono"><a href="#netCDF4.MFDataset.sync">sync</a></li>
1203 <li class="mono"><a href="#netCDF4.MFDataset.__init__">__init__</a></li>
1204 <li class="mono"><a href="#netCDF4.MFDataset.close">close</a></li>
1205 <li class="mono"><a href="#netCDF4.MFDataset.ncattrs">ncattrs</a></li>
12061206 </ul>
12071207
12081208 </li>
12791279
12801280 <header id="section-intro">
12811281 <h1 class="title"><span class="name">netCDF4</span> module</h1>
1282 <h2>Version 1.5.0</h2>
1282 <h2>Version 1.5.1</h2>
12831283 <hr />
12841284 <h1>Introduction</h1>
12851285 <p>netcdf4-python is a Python interface to the netCDF C library.</p>
26202620 <h3>Ancestors (in MRO)</h3>
26212621 <ul class="class_list">
26222622 <li><a href="#netCDF4.CompoundType">CompoundType</a></li>
2623 <li>__builtin__.object</li>
2623 <li>builtins.object</li>
26242624 </ul>
26252625 <h3>Class variables</h3>
26262626 <div class="item">
27512751 <h3>Ancestors (in MRO)</h3>
27522752 <ul class="class_list">
27532753 <li><a href="#netCDF4.Dataset">Dataset</a></li>
2754 <li>__builtin__.object</li>
2754 <li>builtins.object</li>
27552755 </ul>
27562756 <h3>Class variables</h3>
27572757 <div class="item">
29282928 modified. <code>w</code> means write; a new file is created, an existing file with
29292929 the same name is deleted. <code>a</code> and <code>r+</code> mean append (in analogy with
29302930 serial files); an existing file is opened for reading and writing.
2931 Appending <code>s</code> to modes <code>w</code>, <code>r+</code> or <code>a</code> will enable unbuffered shared
2931 Appending <code>s</code> to modes <code>r</code>, <code>w</code>, <code>r+</code> or <code>a</code> will enable unbuffered shared
29322932 access to <code>NETCDF3_CLASSIC</code>, <code>NETCDF3_64BIT_OFFSET</code> or
29332933 <code>NETCDF3_64BIT_DATA</code> formatted files.
29342934 Unbuffered access may be useful even if you don't need shared
36733673 <h3>Ancestors (in MRO)</h3>
36743674 <ul class="class_list">
36753675 <li><a href="#netCDF4.Dimension">Dimension</a></li>
3676 <li>__builtin__.object</li>
3676 <li>builtins.object</li>
36773677 </ul>
36783678 <h3>Class variables</h3>
36793679 <div class="item">
37713771 <h3>Ancestors (in MRO)</h3>
37723772 <ul class="class_list">
37733773 <li><a href="#netCDF4.EnumType">EnumType</a></li>
3774 <li>__builtin__.object</li>
3774 <li>builtins.object</li>
37753775 </ul>
37763776 <h3>Class variables</h3>
37773777 <div class="item">
38593859 <ul class="class_list">
38603860 <li><a href="#netCDF4.Group">Group</a></li>
38613861 <li><a href="#netCDF4.Dataset">Dataset</a></li>
3862 <li>__builtin__.object</li>
3862 <li>builtins.object</li>
38633863 </ul>
38643864 <h3>Class variables</h3>
38653865 <div class="item">
38663866 <p id="netCDF4.Group.cmptypes" class="name">var <span class="ident">cmptypes</span></p>
38673867
3868 <p class="inheritance">
3869 <strong>Inheritance:</strong>
3870 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.cmptypes">cmptypes</a></code>
3871 </p>
3872
3873
3874
3875 <div class="desc inherited"><p>The <code>cmptypes</code> dictionary maps the names of
3876 compound types defined for the <a href="#netCDF4.Group"><code>Group</code></a> or <a href="#netCDF4.Dataset"><code>Dataset</code></a> to instances of the
3877 <a href="#netCDF4.CompoundType"><code>CompoundType</code></a> class.</p></div>
3868
3869
3870
38783871 <div class="source_cont">
38793872 </div>
38803873
38823875 <div class="item">
38833876 <p id="netCDF4.Group.data_model" class="name">var <span class="ident">data_model</span></p>
38843877
3885 <p class="inheritance">
3886 <strong>Inheritance:</strong>
3887 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.data_model">data_model</a></code>
3888 </p>
3889
3890
3891
3892 <div class="desc inherited"><p><code>data_model</code> describes the netCDF
3893 data model version, one of <code>NETCDF3_CLASSIC</code>, <code>NETCDF4</code>,
3894 <code>NETCDF4_CLASSIC</code>, <code>NETCDF3_64BIT_OFFSET</code> or <code>NETCDF3_64BIT_DATA</code>.</p></div>
3878
3879
3880
38953881 <div class="source_cont">
38963882 </div>
38973883
38993885 <div class="item">
39003886 <p id="netCDF4.Group.dimensions" class="name">var <span class="ident">dimensions</span></p>
39013887
3902 <p class="inheritance">
3903 <strong>Inheritance:</strong>
3904 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.dimensions">dimensions</a></code>
3905 </p>
3906
3907
3908
3909 <div class="desc inherited"><p>The <code>dimensions</code> dictionary maps the names of
3910 dimensions defined for the <a href="#netCDF4.Group"><code>Group</code></a> or <a href="#netCDF4.Dataset"><code>Dataset</code></a> to instances of the
3911 <a href="#netCDF4.Dimension"><code>Dimension</code></a> class.</p></div>
3888
3889
3890
39123891 <div class="source_cont">
39133892 </div>
39143893
39163895 <div class="item">
39173896 <p id="netCDF4.Group.disk_format" class="name">var <span class="ident">disk_format</span></p>
39183897
3919 <p class="inheritance">
3920 <strong>Inheritance:</strong>
3921 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.disk_format">disk_format</a></code>
3922 </p>
3923
3924
3925
3926 <div class="desc inherited"><p><code>disk_format</code> describes the underlying
3927 file format, one of <code>NETCDF3</code>, <code>HDF5</code>, <code>HDF4</code>,
3928 <code>PNETCDF</code>, <code>DAP2</code>, <code>DAP4</code> or <code>UNDEFINED</code>. Only available if using
3929 netcdf C library version &gt;= 4.3.1, otherwise will always return
3930 <code>UNDEFINED</code>.</p></div>
3898
3899
3900
39313901 <div class="source_cont">
39323902 </div>
39333903
39353905 <div class="item">
39363906 <p id="netCDF4.Group.enumtypes" class="name">var <span class="ident">enumtypes</span></p>
39373907
3938 <p class="inheritance">
3939 <strong>Inheritance:</strong>
3940 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.enumtypes">enumtypes</a></code>
3941 </p>
3942
3943
3944
3945 <div class="desc inherited"><p>The <code>enumtypes</code> dictionary maps the names of
3946 Enum types defined for the <a href="#netCDF4.Group"><code>Group</code></a> or <a href="#netCDF4.Dataset"><code>Dataset</code></a> to instances of the
3947 <a href="#netCDF4.EnumType"><code>EnumType</code></a> class.</p></div>
3908
3909
3910
39483911 <div class="source_cont">
39493912 </div>
39503913
39523915 <div class="item">
39533916 <p id="netCDF4.Group.file_format" class="name">var <span class="ident">file_format</span></p>
39543917
3955 <p class="inheritance">
3956 <strong>Inheritance:</strong>
3957 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.file_format">file_format</a></code>
3958 </p>
3959
3960
3961
3962 <div class="desc inherited"><p>same as <code>data_model</code>, retained for backwards compatibility.</p></div>
3918
3919
3920
39633921 <div class="source_cont">
39643922 </div>
39653923
39673925 <div class="item">
39683926 <p id="netCDF4.Group.groups" class="name">var <span class="ident">groups</span></p>
39693927
3970 <p class="inheritance">
3971 <strong>Inheritance:</strong>
3972 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.groups">groups</a></code>
3973 </p>
3974
3975
3976
3977 <div class="desc inherited"><p>The groups dictionary maps the names of groups created for
3978 this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> to instances of the <a href="#netCDF4.Group"><code>Group</code></a> class (the
3979 <a href="#netCDF4.Dataset"><code>Dataset</code></a> class is simply a special case of the <a href="#netCDF4.Group"><code>Group</code></a> class which
3980 describes the root group in the netCDF4 file).</p></div>
3928
3929
3930
39813931 <div class="source_cont">
39823932 </div>
39833933
39853935 <div class="item">
39863936 <p id="netCDF4.Group.keepweakref" class="name">var <span class="ident">keepweakref</span></p>
39873937
3988 <p class="inheritance">
3989 <strong>Inheritance:</strong>
3990 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.keepweakref">keepweakref</a></code>
3991 </p>
3992
3993
3994
3995 <div class="desc inherited"><p>If <code>True</code>, child Dimension and Variables objects only keep weak references to
3996 the parent Dataset or Group.</p></div>
3938
3939
3940
39973941 <div class="source_cont">
39983942 </div>
39993943
40123956 <div class="item">
40133957 <p id="netCDF4.Group.parent" class="name">var <span class="ident">parent</span></p>
40143958
4015 <p class="inheritance">
4016 <strong>Inheritance:</strong>
4017 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.parent">parent</a></code>
4018 </p>
4019
4020
4021
4022 <div class="desc inherited"><p><code>parent</code> is a reference to the parent
4023 <a href="#netCDF4.Group"><code>Group</code></a> instance. <code>None</code> for the root group or <a href="#netCDF4.Dataset"><code>Dataset</code></a> instance</p></div>
3959
3960
3961
40243962 <div class="source_cont">
40253963 </div>
40263964
40283966 <div class="item">
40293967 <p id="netCDF4.Group.path" class="name">var <span class="ident">path</span></p>
40303968
4031 <p class="inheritance">
4032 <strong>Inheritance:</strong>
4033 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.path">path</a></code>
4034 </p>
4035
4036
4037
4038 <div class="desc inherited"><p><code>path</code> shows the location of the <a href="#netCDF4.Group"><code>Group</code></a> in
4039 the <a href="#netCDF4.Dataset"><code>Dataset</code></a> in a unix directory format (the names of groups in the
4040 hierarchy separated by backslashes). A <a href="#netCDF4.Dataset"><code>Dataset</code></a> instance is the root
4041 group, so the path is simply <code>'/'</code>.</p></div>
3969
3970
3971
40423972 <div class="source_cont">
40433973 </div>
40443974
40463976 <div class="item">
40473977 <p id="netCDF4.Group.variables" class="name">var <span class="ident">variables</span></p>
40483978
4049 <p class="inheritance">
4050 <strong>Inheritance:</strong>
4051 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.variables">variables</a></code>
4052 </p>
4053
4054
4055
4056 <div class="desc inherited"><p>The <code>variables</code> dictionary maps the names of variables
4057 defined for this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> to instances of the <a href="#netCDF4.Variable"><code>Variable</code></a>
4058 class.</p></div>
3979
3980
3981
40593982 <div class="source_cont">
40603983 </div>
40613984
40633986 <div class="item">
40643987 <p id="netCDF4.Group.vltypes" class="name">var <span class="ident">vltypes</span></p>
40653988
4066 <p class="inheritance">
4067 <strong>Inheritance:</strong>
4068 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.vltypes">vltypes</a></code>
4069 </p>
4070
4071
4072
4073 <div class="desc inherited"><p>The <code>vltypes</code> dictionary maps the names of
4074 variable-length types defined for the <a href="#netCDF4.Group"><code>Group</code></a> or <a href="#netCDF4.Dataset"><code>Dataset</code></a> to instances of the
4075 <a href="#netCDF4.VLType"><code>VLType</code></a> class.</p></div>
3989
3990
3991
40763992 <div class="source_cont">
40773993 </div>
40783994
41094025 <p>def <span class="ident">close</span>(</p><p>self)</p>
41104026 </div>
41114027
4112 <p class="inheritance">
4113 <strong>Inheritance:</strong>
4114 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.close">close</a></code>
4115 </p>
41164028
41174029
41184030
41294041 <p>def <span class="ident">createCompoundType</span>(</p><p>self, datatype, datatype_name)</p>
41304042 </div>
41314043
4132 <p class="inheritance">
4133 <strong>Inheritance:</strong>
4134 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createCompoundType">createCompoundType</a></code>
4135 </p>
4136
4137
4138
4139 <div class="desc inherited"><p>Creates a new compound data type named <code>datatype_name</code> from the numpy
4044
4045
4046
4047 <div class="desc"><p>Creates a new compound data type named <code>datatype_name</code> from the numpy
41404048 dtype object <code>datatype</code>.</p>
41414049 <p><strong><em>Note</em></strong>: If the new compound data type contains other compound data types
41424050 (i.e. it is a 'nested' compound type, where not all of the elements
41554063 <p>def <span class="ident">createDimension</span>(</p><p>self, dimname, size=None)</p>
41564064 </div>
41574065
4158 <p class="inheritance">
4159 <strong>Inheritance:</strong>
4160 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createDimension">createDimension</a></code>
4161 </p>
4162
4163
4164
4165 <div class="desc inherited"><p>Creates a new dimension with the given <code>dimname</code> and <code>size</code>.</p>
4066
4067
4068
4069 <div class="desc"><p>Creates a new dimension with the given <code>dimname</code> and <code>size</code>.</p>
41664070 <p><code>size</code> must be a positive integer or <code>None</code>, which stands for
41674071 "unlimited" (default is <code>None</code>). Specifying a size of 0 also
41684072 results in an unlimited dimension. The return value is the <a href="#netCDF4.Dimension"><code>Dimension</code></a>
41814085 <p>def <span class="ident">createEnumType</span>(</p><p>self, datatype, datatype_name, enum_dict)</p>
41824086 </div>
41834087
4184 <p class="inheritance">
4185 <strong>Inheritance:</strong>
4186 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createEnumType">createEnumType</a></code>
4187 </p>
4188
4189
4190
4191 <div class="desc inherited"><p>Creates a new Enum data type named <code>datatype_name</code> from a numpy
4088
4089
4090
4091 <div class="desc"><p>Creates a new Enum data type named <code>datatype_name</code> from a numpy
41924092 integer dtype object <code>datatype</code>, and a python dictionary
41934093 defining the enum fields and values.</p>
41944094 <p>The return value is the <a href="#netCDF4.EnumType"><code>EnumType</code></a> class instance describing the new
42044104 <p>def <span class="ident">createGroup</span>(</p><p>self, groupname)</p>
42054105 </div>
42064106
4207 <p class="inheritance">
4208 <strong>Inheritance:</strong>
4209 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createGroup">createGroup</a></code>
4210 </p>
4211
4212
4213
4214 <div class="desc inherited"><p>Creates a new <a href="#netCDF4.Group"><code>Group</code></a> with the given <code>groupname</code>.</p>
4107
4108
4109
4110 <div class="desc"><p>Creates a new <a href="#netCDF4.Group"><code>Group</code></a> with the given <code>groupname</code>.</p>
42154111 <p>If <code>groupname</code> is specified as a path, using forward slashes as in unix to
42164112 separate components, then intermediate groups will be created as necessary
42174113 (analogous to <code>mkdir -p</code> in unix). For example,
42314127 <p>def <span class="ident">createVLType</span>(</p><p>self, datatype, datatype_name)</p>
42324128 </div>
42334129
4234 <p class="inheritance">
4235 <strong>Inheritance:</strong>
4236 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createVLType">createVLType</a></code>
4237 </p>
4238
4239
4240
4241 <div class="desc inherited"><p>Creates a new VLEN data type named <code>datatype_name</code> from a numpy
4130
4131
4132
4133 <div class="desc"><p>Creates a new VLEN data type named <code>datatype_name</code> from a numpy
42424134 dtype object <code>datatype</code>.</p>
42434135 <p>The return value is the <a href="#netCDF4.VLType"><code>VLType</code></a> class instance describing the new
42444136 datatype.</p></div>
42534145 <p>def <span class="ident">createVariable</span>(</p><p>self, varname, datatype, dimensions=(), zlib=False, complevel=4, shuffle=True, fletcher32=False, contiguous=False, chunksizes=None, endian=&#39;native&#39;, least_significant_digit=None, fill_value=None)</p>
42544146 </div>
42554147
4256 <p class="inheritance">
4257 <strong>Inheritance:</strong>
4258 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createVariable">createVariable</a></code>
4259 </p>
4260
4261
4262
4263 <div class="desc inherited"><p>Creates a new variable with the given <code>varname</code>, <code>datatype</code>, and
4148
4149
4150
4151 <div class="desc"><p>Creates a new variable with the given <code>varname</code>, <code>datatype</code>, and
42644152 <code>dimensions</code>. If dimensions are not given, the variable is assumed to be
42654153 a scalar.</p>
42664154 <p>If <code>varname</code> is specified as a path, using forward slashes as in unix to
43704258 <p>def <span class="ident">delncattr</span>(</p><p>self,name,value)</p>
43714259 </div>
43724260
4373 <p class="inheritance">
4374 <strong>Inheritance:</strong>
4375 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.delncattr">delncattr</a></code>
4376 </p>
4377
4378
4379
4380 <div class="desc inherited"><p>delete a netCDF dataset or group attribute. Use if you need to delete a
4261
4262
4263
4264 <div class="desc"><p>delete a netCDF dataset or group attribute. Use if you need to delete a
43814265 netCDF attribute with the same name as one of the reserved python
43824266 attributes.</p></div>
43834267 <div class="source_cont">
43914275 <p>def <span class="ident">filepath</span>(</p><p>self,encoding=None)</p>
43924276 </div>
43934277
4394 <p class="inheritance">
4395 <strong>Inheritance:</strong>
4396 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.filepath">filepath</a></code>
4397 </p>
4398
4399
4400
4401 <div class="desc inherited"><p>Get the file system path (or the opendap URL) which was used to
4278
4279
4280
4281 <div class="desc"><p>Get the file system path (or the opendap URL) which was used to
44024282 open/create the Dataset. Requires netcdf &gt;= 4.1.2. The path
44034283 is decoded into a string using <code>sys.getfilesystemencoding()</code> by default, this can be
44044284 changed using the <code>encoding</code> kwarg.</p></div>
44134293 <p>def <span class="ident">get_variables_by_attributes</span>(</p><p>...)</p>
44144294 </div>
44154295
4416 <p class="inheritance">
4417 <strong>Inheritance:</strong>
4418 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.get_variables_by_attributes">get_variables_by_attributes</a></code>
4419 </p>
4420
4421
4422
4423 <div class="desc inherited"><p>Returns a list of variables that match specific conditions.</p>
4296
4297
4298
4299 <div class="desc"><p>Returns a list of variables that match specific conditions.</p>
44244300 <p>Can pass in key=value parameters and variables are returned that
44254301 contain all of the matches. For example,</p>
44264302 <div class="codehilite"><pre><span></span><span class="o">&gt;&gt;&gt;</span> <span class="c1"># Get variables with x-axis attribute.</span>
44524328 <p>def <span class="ident">getncattr</span>(</p><p>self,name)</p>
44534329 </div>
44544330
4455 <p class="inheritance">
4456 <strong>Inheritance:</strong>
4457 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.getncattr">getncattr</a></code>
4458 </p>
4459
4460
4461
4462 <div class="desc inherited"><p>retrieve a netCDF dataset or group attribute.
4331
4332
4333
4334 <div class="desc"><p>retrieve a netCDF dataset or group attribute.
44634335 Use if you need to get a netCDF attribute with the same
44644336 name as one of the reserved python attributes.</p>
44654337 <p>option kwarg <code>encoding</code> can be used to specify the
44754347 <p>def <span class="ident">isopen</span>(</p><p>...)</p>
44764348 </div>
44774349
4478 <p class="inheritance">
4479 <strong>Inheritance:</strong>
4480 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.isopen">isopen</a></code>
4481 </p>
4482
4483
4484
4485 <div class="desc inherited"><p>is the Dataset open or closed?</p></div>
4350
4351
4352
4353 <div class="desc"><p>is the Dataset open or closed?</p></div>
44864354 <div class="source_cont">
44874355 </div>
44884356
44944362 <p>def <span class="ident">ncattrs</span>(</p><p>self)</p>
44954363 </div>
44964364
4497 <p class="inheritance">
4498 <strong>Inheritance:</strong>
4499 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.ncattrs">ncattrs</a></code>
4500 </p>
4501
4502
4503
4504 <div class="desc inherited"><p>return netCDF global attribute names for this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> in a list.</p></div>
4365
4366
4367
4368 <div class="desc"><p>return netCDF global attribute names for this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> in a list.</p></div>
45054369 <div class="source_cont">
45064370 </div>
45074371
45134377 <p>def <span class="ident">renameAttribute</span>(</p><p>self, oldname, newname)</p>
45144378 </div>
45154379
4516 <p class="inheritance">
4517 <strong>Inheritance:</strong>
4518 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.renameAttribute">renameAttribute</a></code>
4519 </p>
4520
4521
4522
4523 <div class="desc inherited"><p>rename a <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> attribute named <code>oldname</code> to <code>newname</code>.</p></div>
4380
4381
4382
4383 <div class="desc"><p>rename a <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> attribute named <code>oldname</code> to <code>newname</code>.</p></div>
45244384 <div class="source_cont">
45254385 </div>
45264386
45324392 <p>def <span class="ident">renameDimension</span>(</p><p>self, oldname, newname)</p>
45334393 </div>
45344394
4535 <p class="inheritance">
4536 <strong>Inheritance:</strong>
4537 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.renameDimension">renameDimension</a></code>
4538 </p>
4539
4540
4541
4542 <div class="desc inherited"><p>rename a <a href="#netCDF4.Dimension"><code>Dimension</code></a> named <code>oldname</code> to <code>newname</code>.</p></div>
4395
4396
4397
4398 <div class="desc"><p>rename a <a href="#netCDF4.Dimension"><code>Dimension</code></a> named <code>oldname</code> to <code>newname</code>.</p></div>
45434399 <div class="source_cont">
45444400 </div>
45454401
45514407 <p>def <span class="ident">renameGroup</span>(</p><p>self, oldname, newname)</p>
45524408 </div>
45534409
4554 <p class="inheritance">
4555 <strong>Inheritance:</strong>
4556 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.renameGroup">renameGroup</a></code>
4557 </p>
4558
4559
4560
4561 <div class="desc inherited"><p>rename a <a href="#netCDF4.Group"><code>Group</code></a> named <code>oldname</code> to <code>newname</code> (requires netcdf &gt;= 4.3.1).</p></div>
4410
4411
4412
4413 <div class="desc"><p>rename a <a href="#netCDF4.Group"><code>Group</code></a> named <code>oldname</code> to <code>newname</code> (requires netcdf &gt;= 4.3.1).</p></div>
45624414 <div class="source_cont">
45634415 </div>
45644416
45704422 <p>def <span class="ident">renameVariable</span>(</p><p>self, oldname, newname)</p>
45714423 </div>
45724424
4573 <p class="inheritance">
4574 <strong>Inheritance:</strong>
4575 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.renameVariable">renameVariable</a></code>
4576 </p>
4577
4578
4579
4580 <div class="desc inherited"><p>rename a <a href="#netCDF4.Variable"><code>Variable</code></a> named <code>oldname</code> to <code>newname</code></p></div>
4425
4426
4427
4428 <div class="desc"><p>rename a <a href="#netCDF4.Variable"><code>Variable</code></a> named <code>oldname</code> to <code>newname</code></p></div>
45814429 <div class="source_cont">
45824430 </div>
45834431
45894437 <p>def <span class="ident">set_always_mask</span>(</p><p>self, True_or_False)</p>
45904438 </div>
45914439
4592 <p class="inheritance">
4593 <strong>Inheritance:</strong>
4594 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_always_mask">set_always_mask</a></code>
4595 </p>
4596
4597
4598
4599 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_always_mask"><code>set_always_mask</code></a> for all variables contained in
4440
4441
4442
4443 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_always_mask"><code>set_always_mask</code></a> for all variables contained in
46004444 this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all
46014445 variables in all its subgroups.</p>
46024446 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic conversion of
46164460 <p>def <span class="ident">set_auto_chartostring</span>(</p><p>self, True_or_False)</p>
46174461 </div>
46184462
4619 <p class="inheritance">
4620 <strong>Inheritance:</strong>
4621 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_auto_chartostring">set_auto_chartostring</a></code>
4622 </p>
4623
4624
4625
4626 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_auto_chartostring"><code>set_auto_chartostring</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
4463
4464
4465
4466 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_auto_chartostring"><code>set_auto_chartostring</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
46274467 <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all variables in all its subgroups.</p>
46284468 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic conversion of
46294469 all character arrays &lt;--&gt; string arrays should be performed for
46424482 <p>def <span class="ident">set_auto_mask</span>(</p><p>self, True_or_False)</p>
46434483 </div>
46444484
4645 <p class="inheritance">
4646 <strong>Inheritance:</strong>
4647 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_auto_mask">set_auto_mask</a></code>
4648 </p>
4649
4650
4651
4652 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_auto_mask"><code>set_auto_mask</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
4485
4486
4487
4488 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_auto_mask"><code>set_auto_mask</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
46534489 <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all variables in all its subgroups.</p>
46544490 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic conversion to masked arrays
46554491 shall be applied for all variables.</p>
46664502 <p>def <span class="ident">set_auto_maskandscale</span>(</p><p>self, True_or_False)</p>
46674503 </div>
46684504
4669 <p class="inheritance">
4670 <strong>Inheritance:</strong>
4671 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_auto_maskandscale">set_auto_maskandscale</a></code>
4672 </p>
4673
4674
4675
4676 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_auto_maskandscale"><code>set_auto_maskandscale</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
4505
4506
4507
4508 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_auto_maskandscale"><code>set_auto_maskandscale</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
46774509 <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all variables in all its subgroups.</p>
46784510 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic conversion to masked arrays
46794511 and variable scaling shall be applied for all variables.</p>
46904522 <p>def <span class="ident">set_auto_scale</span>(</p><p>self, True_or_False)</p>
46914523 </div>
46924524
4693 <p class="inheritance">
4694 <strong>Inheritance:</strong>
4695 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_auto_scale">set_auto_scale</a></code>
4696 </p>
4697
4698
4699
4700 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_auto_scale"><code>set_auto_scale</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
4525
4526
4527
4528 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_auto_scale"><code>set_auto_scale</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
47014529 <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all variables in all its subgroups.</p>
47024530 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic variable scaling
47034531 shall be applied for all variables.</p>
47144542 <p>def <span class="ident">set_fill_off</span>(</p><p>self)</p>
47154543 </div>
47164544
4717 <p class="inheritance">
4718 <strong>Inheritance:</strong>
4719 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_fill_off">set_fill_off</a></code>
4720 </p>
4721
4722
4723
4724 <div class="desc inherited"><p>Sets the fill mode for a <a href="#netCDF4.Dataset"><code>Dataset</code></a> open for writing to <code>off</code>.</p>
4545
4546
4547
4548 <div class="desc"><p>Sets the fill mode for a <a href="#netCDF4.Dataset"><code>Dataset</code></a> open for writing to <code>off</code>.</p>
47254549 <p>This will prevent the data from being pre-filled with fill values, which
47264550 may result in some performance improvements. However, you must then make
47274551 sure the data is actually written before being read.</p></div>
47364560 <p>def <span class="ident">set_fill_on</span>(</p><p>self)</p>
47374561 </div>
47384562
4739 <p class="inheritance">
4740 <strong>Inheritance:</strong>
4741 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_fill_on">set_fill_on</a></code>
4742 </p>
4743
4744
4745
4746 <div class="desc inherited"><p>Sets the fill mode for a <a href="#netCDF4.Dataset"><code>Dataset</code></a> open for writing to <code>on</code>.</p>
4563
4564
4565
4566 <div class="desc"><p>Sets the fill mode for a <a href="#netCDF4.Dataset"><code>Dataset</code></a> open for writing to <code>on</code>.</p>
47474567 <p>This causes data to be pre-filled with fill values. The fill values can be
47484568 controlled by the variable's <code>_Fill_Value</code> attribute, but is usually
47494569 sufficient to the use the netCDF default <code>_Fill_Value</code> (defined
47624582 <p>def <span class="ident">set_ncstring_attrs</span>(</p><p>self, True_or_False)</p>
47634583 </div>
47644584
4765 <p class="inheritance">
4766 <strong>Inheritance:</strong>
4767 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_ncstring_attrs">set_ncstring_attrs</a></code>
4768 </p>
4769
4770
4771
4772 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_ncstring_attrs"><code>set_ncstring_attrs</code></a> for all variables contained in
4585
4586
4587
4588 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_ncstring_attrs"><code>set_ncstring_attrs</code></a> for all variables contained in
47734589 this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all its
47744590 subgroups and their variables.</p>
47754591 <p><strong><code>True_or_False</code></strong>: Boolean determining if all string attributes are
47884604 <p>def <span class="ident">setncattr</span>(</p><p>self,name,value)</p>
47894605 </div>
47904606
4791 <p class="inheritance">
4792 <strong>Inheritance:</strong>
4793 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.setncattr">setncattr</a></code>
4794 </p>
4795
4796
4797
4798 <div class="desc inherited"><p>set a netCDF dataset or group attribute using name,value pair.
4607
4608
4609
4610 <div class="desc"><p>set a netCDF dataset or group attribute using name,value pair.
47994611 Use if you need to set a netCDF attribute with the
48004612 with the same name as one of the reserved python attributes.</p></div>
48014613 <div class="source_cont">
48094621 <p>def <span class="ident">setncattr_string</span>(</p><p>self,name,value)</p>
48104622 </div>
48114623
4812 <p class="inheritance">
4813 <strong>Inheritance:</strong>
4814 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.setncattr_string">setncattr_string</a></code>
4815 </p>
4816
4817
4818
4819 <div class="desc inherited"><p>set a netCDF dataset or group string attribute using name,value pair.
4624
4625
4626
4627 <div class="desc"><p>set a netCDF dataset or group string attribute using name,value pair.
48204628 Use if you need to ensure that a netCDF attribute is created with type
48214629 <code>NC_STRING</code> if the file format is <code>NETCDF4</code>.</p></div>
48224630 <div class="source_cont">
48304638 <p>def <span class="ident">setncatts</span>(</p><p>self,attdict)</p>
48314639 </div>
48324640
4833 <p class="inheritance">
4834 <strong>Inheritance:</strong>
4835 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.setncatts">setncatts</a></code>
4836 </p>
4837
4838
4839
4840 <div class="desc inherited"><p>set a bunch of netCDF dataset or group attributes at once using a python dictionary.
4641
4642
4643
4644 <div class="desc"><p>set a bunch of netCDF dataset or group attributes at once using a python dictionary.
48414645 This may be faster when setting a lot of attributes for a <code>NETCDF3</code>
48424646 formatted file, since nc_redef/nc_enddef is not called in between setting
48434647 each attribute</p></div>
48524656 <p>def <span class="ident">sync</span>(</p><p>self)</p>
48534657 </div>
48544658
4855 <p class="inheritance">
4856 <strong>Inheritance:</strong>
4857 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.sync">sync</a></code>
4858 </p>
4859
4860
4861
4862 <div class="desc inherited"><p>Writes all buffered data in the <a href="#netCDF4.Dataset"><code>Dataset</code></a> to the disk file.</p></div>
4659
4660
4661
4662 <div class="desc"><p>Writes all buffered data in the <a href="#netCDF4.Dataset"><code>Dataset</code></a> to the disk file.</p></div>
48634663 <div class="source_cont">
48644664 </div>
48654665
49044704 <ul class="class_list">
49054705 <li><a href="#netCDF4.MFDataset">MFDataset</a></li>
49064706 <li><a href="#netCDF4.Dataset">Dataset</a></li>
4907 <li>__builtin__.object</li>
4707 <li>builtins.object</li>
49084708 </ul>
49094709 <h3>Class variables</h3>
49104710 <div class="item">
49114711 <p id="netCDF4.MFDataset.cmptypes" class="name">var <span class="ident">cmptypes</span></p>
49124712
4913 <p class="inheritance">
4914 <strong>Inheritance:</strong>
4915 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.cmptypes">cmptypes</a></code>
4916 </p>
4917
4918
4919
4920 <div class="desc inherited"><p>The <code>cmptypes</code> dictionary maps the names of
4921 compound types defined for the <a href="#netCDF4.Group"><code>Group</code></a> or <a href="#netCDF4.Dataset"><code>Dataset</code></a> to instances of the
4922 <a href="#netCDF4.CompoundType"><code>CompoundType</code></a> class.</p></div>
4713
4714
4715
49234716 <div class="source_cont">
49244717 </div>
49254718
49274720 <div class="item">
49284721 <p id="netCDF4.MFDataset.data_model" class="name">var <span class="ident">data_model</span></p>
49294722
4930 <p class="inheritance">
4931 <strong>Inheritance:</strong>
4932 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.data_model">data_model</a></code>
4933 </p>
4934
4935
4936
4937 <div class="desc inherited"><p><code>data_model</code> describes the netCDF
4938 data model version, one of <code>NETCDF3_CLASSIC</code>, <code>NETCDF4</code>,
4939 <code>NETCDF4_CLASSIC</code>, <code>NETCDF3_64BIT_OFFSET</code> or <code>NETCDF3_64BIT_DATA</code>.</p></div>
4723
4724
4725
49404726 <div class="source_cont">
49414727 </div>
49424728
49444730 <div class="item">
49454731 <p id="netCDF4.MFDataset.dimensions" class="name">var <span class="ident">dimensions</span></p>
49464732
4947 <p class="inheritance">
4948 <strong>Inheritance:</strong>
4949 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.dimensions">dimensions</a></code>
4950 </p>
4951
4952
4953
4954 <div class="desc inherited"><p>The <code>dimensions</code> dictionary maps the names of
4955 dimensions defined for the <a href="#netCDF4.Group"><code>Group</code></a> or <a href="#netCDF4.Dataset"><code>Dataset</code></a> to instances of the
4956 <a href="#netCDF4.Dimension"><code>Dimension</code></a> class.</p></div>
4733
4734
4735
49574736 <div class="source_cont">
49584737 </div>
49594738
49614740 <div class="item">
49624741 <p id="netCDF4.MFDataset.disk_format" class="name">var <span class="ident">disk_format</span></p>
49634742
4964 <p class="inheritance">
4965 <strong>Inheritance:</strong>
4966 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.disk_format">disk_format</a></code>
4967 </p>
4968
4969
4970
4971 <div class="desc inherited"><p><code>disk_format</code> describes the underlying
4972 file format, one of <code>NETCDF3</code>, <code>HDF5</code>, <code>HDF4</code>,
4973 <code>PNETCDF</code>, <code>DAP2</code>, <code>DAP4</code> or <code>UNDEFINED</code>. Only available if using
4974 netcdf C library version &gt;= 4.3.1, otherwise will always return
4975 <code>UNDEFINED</code>.</p></div>
4743
4744
4745
49764746 <div class="source_cont">
49774747 </div>
49784748
49804750 <div class="item">
49814751 <p id="netCDF4.MFDataset.enumtypes" class="name">var <span class="ident">enumtypes</span></p>
49824752
4983 <p class="inheritance">
4984 <strong>Inheritance:</strong>
4985 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.enumtypes">enumtypes</a></code>
4986 </p>
4987
4988
4989
4990 <div class="desc inherited"><p>The <code>enumtypes</code> dictionary maps the names of
4991 Enum types defined for the <a href="#netCDF4.Group"><code>Group</code></a> or <a href="#netCDF4.Dataset"><code>Dataset</code></a> to instances of the
4992 <a href="#netCDF4.EnumType"><code>EnumType</code></a> class.</p></div>
4753
4754
4755
49934756 <div class="source_cont">
49944757 </div>
49954758
49974760 <div class="item">
49984761 <p id="netCDF4.MFDataset.file_format" class="name">var <span class="ident">file_format</span></p>
49994762
5000 <p class="inheritance">
5001 <strong>Inheritance:</strong>
5002 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.file_format">file_format</a></code>
5003 </p>
5004
5005
5006
5007 <div class="desc inherited"><p>same as <code>data_model</code>, retained for backwards compatibility.</p></div>
4763
4764
4765
50084766 <div class="source_cont">
50094767 </div>
50104768
50124770 <div class="item">
50134771 <p id="netCDF4.MFDataset.groups" class="name">var <span class="ident">groups</span></p>
50144772
5015 <p class="inheritance">
5016 <strong>Inheritance:</strong>
5017 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.groups">groups</a></code>
5018 </p>
5019
5020
5021
5022 <div class="desc inherited"><p>The groups dictionary maps the names of groups created for
5023 this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> to instances of the <a href="#netCDF4.Group"><code>Group</code></a> class (the
5024 <a href="#netCDF4.Dataset"><code>Dataset</code></a> class is simply a special case of the <a href="#netCDF4.Group"><code>Group</code></a> class which
5025 describes the root group in the netCDF4 file).</p></div>
4773
4774
4775
50264776 <div class="source_cont">
50274777 </div>
50284778
50304780 <div class="item">
50314781 <p id="netCDF4.MFDataset.keepweakref" class="name">var <span class="ident">keepweakref</span></p>
50324782
5033 <p class="inheritance">
5034 <strong>Inheritance:</strong>
5035 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.keepweakref">keepweakref</a></code>
5036 </p>
5037
5038
5039
5040 <div class="desc inherited"><p>If <code>True</code>, child Dimension and Variables objects only keep weak references to
5041 the parent Dataset or Group.</p></div>
4783
4784
4785
50424786 <div class="source_cont">
50434787 </div>
50444788
50464790 <div class="item">
50474791 <p id="netCDF4.MFDataset.parent" class="name">var <span class="ident">parent</span></p>
50484792
5049 <p class="inheritance">
5050 <strong>Inheritance:</strong>
5051 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.parent">parent</a></code>
5052 </p>
5053
5054
5055
5056 <div class="desc inherited"><p><code>parent</code> is a reference to the parent
5057 <a href="#netCDF4.Group"><code>Group</code></a> instance. <code>None</code> for the root group or <a href="#netCDF4.Dataset"><code>Dataset</code></a> instance</p></div>
4793
4794
4795
50584796 <div class="source_cont">
50594797 </div>
50604798
50624800 <div class="item">
50634801 <p id="netCDF4.MFDataset.path" class="name">var <span class="ident">path</span></p>
50644802
5065 <p class="inheritance">
5066 <strong>Inheritance:</strong>
5067 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.path">path</a></code>
5068 </p>
5069
5070
5071
5072 <div class="desc inherited"><p><code>path</code> shows the location of the <a href="#netCDF4.Group"><code>Group</code></a> in
5073 the <a href="#netCDF4.Dataset"><code>Dataset</code></a> in a unix directory format (the names of groups in the
5074 hierarchy separated by backslashes). A <a href="#netCDF4.Dataset"><code>Dataset</code></a> instance is the root
5075 group, so the path is simply <code>'/'</code>.</p></div>
4803
4804
4805
50764806 <div class="source_cont">
50774807 </div>
50784808
50804810 <div class="item">
50814811 <p id="netCDF4.MFDataset.variables" class="name">var <span class="ident">variables</span></p>
50824812
5083 <p class="inheritance">
5084 <strong>Inheritance:</strong>
5085 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.variables">variables</a></code>
5086 </p>
5087
5088
5089
5090 <div class="desc inherited"><p>The <code>variables</code> dictionary maps the names of variables
5091 defined for this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> to instances of the <a href="#netCDF4.Variable"><code>Variable</code></a>
5092 class.</p></div>
4813
4814
4815
50934816 <div class="source_cont">
50944817 </div>
50954818
50974820 <div class="item">
50984821 <p id="netCDF4.MFDataset.vltypes" class="name">var <span class="ident">vltypes</span></p>
50994822
4823
4824
4825
4826 <div class="source_cont">
4827 </div>
4828
4829 </div>
4830 <h3>Static methods</h3>
4831
4832 <div class="item">
4833 <div class="name def" id="netCDF4.MFDataset.__init__">
4834 <p>def <span class="ident">__init__</span>(</p><p>self, files, check=False, aggdim=None, exclude=[], master_file=None)</p>
4835 </div>
4836
51004837 <p class="inheritance">
51014838 <strong>Inheritance:</strong>
5102 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.vltypes">vltypes</a></code>
4839 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.__init__">__init__</a></code>
51034840 </p>
51044841
5105
5106
5107 <div class="desc inherited"><p>The <code>vltypes</code> dictionary maps the names of
5108 variable-length types defined for the <a href="#netCDF4.Group"><code>Group</code></a> or <a href="#netCDF4.Dataset"><code>Dataset</code></a> to instances of the
5109 <a href="#netCDF4.VLType"><code>VLType</code></a> class.</p></div>
5110 <div class="source_cont">
5111 </div>
5112
5113 </div>
5114 <h3>Static methods</h3>
4842
4843
4844 <div class="desc"><p><strong><code>__init__(self, files, check=False, aggdim=None, exclude=[],
4845 master_file=None)</code></strong></p>
4846 <p>Open a Dataset spanning multiple files, making it look as if it was a
4847 single file. Variables in the list of files that share the same
4848 dimension (specified with the keyword <code>aggdim</code>) are aggregated. If
4849 <code>aggdim</code> is not specified, the unlimited is aggregated. Currently,
4850 <code>aggdim</code> must be the leftmost (slowest varying) dimension of each
4851 of the variables to be aggregated.</p>
4852 <p><strong><code>files</code></strong>: either a sequence of netCDF files or a string with a
4853 wildcard (converted to a sorted list of files using glob) If
4854 the <code>master_file</code> kwarg is not specified, the first file
4855 in the list will become the "master" file, defining all the
4856 variables with an aggregation dimension which may span
4857 subsequent files. Attribute access returns attributes only from "master"
4858 file. The files are always opened in read-only mode.</p>
4859 <p><strong><code>check</code></strong>: True if you want to do consistency checking to ensure the
4860 correct variables structure for all of the netcdf files. Checking makes
4861 the initialization of the MFDataset instance much slower. Default is
4862 False.</p>
4863 <p><strong><code>aggdim</code></strong>: The name of the dimension to aggregate over (must
4864 be the leftmost dimension of each of the variables to be aggregated).
4865 If None (default), aggregate over the unlimited dimension.</p>
4866 <p><strong><code>exclude</code></strong>: A list of variable names to exclude from aggregation.
4867 Default is an empty list.</p>
4868 <p><strong><code>master_file</code></strong>: file to use as "master file", defining all the
4869 variables with an aggregation dimension and all global attributes.</p></div>
4870 <div class="source_cont">
4871 </div>
4872
4873 </div>
4874
4875
4876 <div class="item">
4877 <div class="name def" id="netCDF4.MFDataset.close">
4878 <p>def <span class="ident">close</span>(</p><p>self)</p>
4879 </div>
4880
4881
4882
4883
4884 <div class="desc"><p><strong><code>close(self)</code></strong></p>
4885 <p>close all the open files.</p></div>
4886 <div class="source_cont">
4887 </div>
4888
4889 </div>
4890
51154891
51164892 <div class="item">
51174893 <div class="name def" id="netCDF4.MFDataset.createCompoundType">
51184894 <p>def <span class="ident">createCompoundType</span>(</p><p>self, datatype, datatype_name)</p>
51194895 </div>
51204896
5121 <p class="inheritance">
5122 <strong>Inheritance:</strong>
5123 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createCompoundType">createCompoundType</a></code>
5124 </p>
5125
5126
5127
5128 <div class="desc inherited"><p>Creates a new compound data type named <code>datatype_name</code> from the numpy
4897
4898
4899
4900 <div class="desc"><p>Creates a new compound data type named <code>datatype_name</code> from the numpy
51294901 dtype object <code>datatype</code>.</p>
51304902 <p><strong><em>Note</em></strong>: If the new compound data type contains other compound data types
51314903 (i.e. it is a 'nested' compound type, where not all of the elements
51444916 <p>def <span class="ident">createDimension</span>(</p><p>self, dimname, size=None)</p>
51454917 </div>
51464918
5147 <p class="inheritance">
5148 <strong>Inheritance:</strong>
5149 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createDimension">createDimension</a></code>
5150 </p>
5151
5152
5153
5154 <div class="desc inherited"><p>Creates a new dimension with the given <code>dimname</code> and <code>size</code>.</p>
4919
4920
4921
4922 <div class="desc"><p>Creates a new dimension with the given <code>dimname</code> and <code>size</code>.</p>
51554923 <p><code>size</code> must be a positive integer or <code>None</code>, which stands for
51564924 "unlimited" (default is <code>None</code>). Specifying a size of 0 also
51574925 results in an unlimited dimension. The return value is the <a href="#netCDF4.Dimension"><code>Dimension</code></a>
51704938 <p>def <span class="ident">createEnumType</span>(</p><p>self, datatype, datatype_name, enum_dict)</p>
51714939 </div>
51724940
5173 <p class="inheritance">
5174 <strong>Inheritance:</strong>
5175 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createEnumType">createEnumType</a></code>
5176 </p>
5177
5178
5179
5180 <div class="desc inherited"><p>Creates a new Enum data type named <code>datatype_name</code> from a numpy
4941
4942
4943
4944 <div class="desc"><p>Creates a new Enum data type named <code>datatype_name</code> from a numpy
51814945 integer dtype object <code>datatype</code>, and a python dictionary
51824946 defining the enum fields and values.</p>
51834947 <p>The return value is the <a href="#netCDF4.EnumType"><code>EnumType</code></a> class instance describing the new
51934957 <p>def <span class="ident">createGroup</span>(</p><p>self, groupname)</p>
51944958 </div>
51954959
5196 <p class="inheritance">
5197 <strong>Inheritance:</strong>
5198 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createGroup">createGroup</a></code>
5199 </p>
5200
5201
5202
5203 <div class="desc inherited"><p>Creates a new <a href="#netCDF4.Group"><code>Group</code></a> with the given <code>groupname</code>.</p>
4960
4961
4962
4963 <div class="desc"><p>Creates a new <a href="#netCDF4.Group"><code>Group</code></a> with the given <code>groupname</code>.</p>
52044964 <p>If <code>groupname</code> is specified as a path, using forward slashes as in unix to
52054965 separate components, then intermediate groups will be created as necessary
52064966 (analogous to <code>mkdir -p</code> in unix). For example,
52204980 <p>def <span class="ident">createVLType</span>(</p><p>self, datatype, datatype_name)</p>
52214981 </div>
52224982
5223 <p class="inheritance">
5224 <strong>Inheritance:</strong>
5225 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createVLType">createVLType</a></code>
5226 </p>
5227
5228
5229
5230 <div class="desc inherited"><p>Creates a new VLEN data type named <code>datatype_name</code> from a numpy
4983
4984
4985
4986 <div class="desc"><p>Creates a new VLEN data type named <code>datatype_name</code> from a numpy
52314987 dtype object <code>datatype</code>.</p>
52324988 <p>The return value is the <a href="#netCDF4.VLType"><code>VLType</code></a> class instance describing the new
52334989 datatype.</p></div>
52424998 <p>def <span class="ident">createVariable</span>(</p><p>self, varname, datatype, dimensions=(), zlib=False, complevel=4, shuffle=True, fletcher32=False, contiguous=False, chunksizes=None, endian=&#39;native&#39;, least_significant_digit=None, fill_value=None)</p>
52434999 </div>
52445000
5245 <p class="inheritance">
5246 <strong>Inheritance:</strong>
5247 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.createVariable">createVariable</a></code>
5248 </p>
5249
5250
5251
5252 <div class="desc inherited"><p>Creates a new variable with the given <code>varname</code>, <code>datatype</code>, and
5001
5002
5003
5004 <div class="desc"><p>Creates a new variable with the given <code>varname</code>, <code>datatype</code>, and
52535005 <code>dimensions</code>. If dimensions are not given, the variable is assumed to be
52545006 a scalar.</p>
52555007 <p>If <code>varname</code> is specified as a path, using forward slashes as in unix to
53595111 <p>def <span class="ident">delncattr</span>(</p><p>self,name,value)</p>
53605112 </div>
53615113
5362 <p class="inheritance">
5363 <strong>Inheritance:</strong>
5364 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.delncattr">delncattr</a></code>
5365 </p>
5366
5367
5368
5369 <div class="desc inherited"><p>delete a netCDF dataset or group attribute. Use if you need to delete a
5114
5115
5116
5117 <div class="desc"><p>delete a netCDF dataset or group attribute. Use if you need to delete a
53705118 netCDF attribute with the same name as one of the reserved python
53715119 attributes.</p></div>
53725120 <div class="source_cont">
53805128 <p>def <span class="ident">filepath</span>(</p><p>self,encoding=None)</p>
53815129 </div>
53825130
5383 <p class="inheritance">
5384 <strong>Inheritance:</strong>
5385 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.filepath">filepath</a></code>
5386 </p>
5387
5388
5389
5390 <div class="desc inherited"><p>Get the file system path (or the opendap URL) which was used to
5131
5132
5133
5134 <div class="desc"><p>Get the file system path (or the opendap URL) which was used to
53915135 open/create the Dataset. Requires netcdf &gt;= 4.1.2. The path
53925136 is decoded into a string using <code>sys.getfilesystemencoding()</code> by default, this can be
53935137 changed using the <code>encoding</code> kwarg.</p></div>
54025146 <p>def <span class="ident">get_variables_by_attributes</span>(</p><p>...)</p>
54035147 </div>
54045148
5405 <p class="inheritance">
5406 <strong>Inheritance:</strong>
5407 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.get_variables_by_attributes">get_variables_by_attributes</a></code>
5408 </p>
5409
5410
5411
5412 <div class="desc inherited"><p>Returns a list of variables that match specific conditions.</p>
5149
5150
5151
5152 <div class="desc"><p>Returns a list of variables that match specific conditions.</p>
54135153 <p>Can pass in key=value parameters and variables are returned that
54145154 contain all of the matches. For example,</p>
54155155 <div class="codehilite"><pre><span></span><span class="o">&gt;&gt;&gt;</span> <span class="c1"># Get variables with x-axis attribute.</span>
54415181 <p>def <span class="ident">getncattr</span>(</p><p>self,name)</p>
54425182 </div>
54435183
5444 <p class="inheritance">
5445 <strong>Inheritance:</strong>
5446 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.getncattr">getncattr</a></code>
5447 </p>
5448
5449
5450
5451 <div class="desc inherited"><p>retrieve a netCDF dataset or group attribute.
5184
5185
5186
5187 <div class="desc"><p>retrieve a netCDF dataset or group attribute.
54525188 Use if you need to get a netCDF attribute with the same
54535189 name as one of the reserved python attributes.</p>
54545190 <p>option kwarg <code>encoding</code> can be used to specify the
54645200 <p>def <span class="ident">isopen</span>(</p><p>...)</p>
54655201 </div>
54665202
5467 <p class="inheritance">
5468 <strong>Inheritance:</strong>
5469 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.isopen">isopen</a></code>
5470 </p>
5471
5472
5473
5474 <div class="desc inherited"><p>is the Dataset open or closed?</p></div>
5203
5204
5205
5206 <div class="desc"><p>is the Dataset open or closed?</p></div>
5207 <div class="source_cont">
5208 </div>
5209
5210 </div>
5211
5212
5213 <div class="item">
5214 <div class="name def" id="netCDF4.MFDataset.ncattrs">
5215 <p>def <span class="ident">ncattrs</span>(</p><p>self)</p>
5216 </div>
5217
5218
5219
5220
5221 <div class="desc"><p><strong><code>ncattrs(self)</code></strong></p>
5222 <p>return the netcdf attribute names from the master file.</p></div>
54755223 <div class="source_cont">
54765224 </div>
54775225
54835231 <p>def <span class="ident">renameAttribute</span>(</p><p>self, oldname, newname)</p>
54845232 </div>
54855233
5486 <p class="inheritance">
5487 <strong>Inheritance:</strong>
5488 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.renameAttribute">renameAttribute</a></code>
5489 </p>
5490
5491
5492
5493 <div class="desc inherited"><p>rename a <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> attribute named <code>oldname</code> to <code>newname</code>.</p></div>
5234
5235
5236
5237 <div class="desc"><p>rename a <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a> attribute named <code>oldname</code> to <code>newname</code>.</p></div>
54945238 <div class="source_cont">
54955239 </div>
54965240
55025246 <p>def <span class="ident">renameDimension</span>(</p><p>self, oldname, newname)</p>
55035247 </div>
55045248
5505 <p class="inheritance">
5506 <strong>Inheritance:</strong>
5507 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.renameDimension">renameDimension</a></code>
5508 </p>
5509
5510
5511
5512 <div class="desc inherited"><p>rename a <a href="#netCDF4.Dimension"><code>Dimension</code></a> named <code>oldname</code> to <code>newname</code>.</p></div>
5249
5250
5251
5252 <div class="desc"><p>rename a <a href="#netCDF4.Dimension"><code>Dimension</code></a> named <code>oldname</code> to <code>newname</code>.</p></div>
55135253 <div class="source_cont">
55145254 </div>
55155255
55215261 <p>def <span class="ident">renameGroup</span>(</p><p>self, oldname, newname)</p>
55225262 </div>
55235263
5524 <p class="inheritance">
5525 <strong>Inheritance:</strong>
5526 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.renameGroup">renameGroup</a></code>
5527 </p>
5528
5529
5530
5531 <div class="desc inherited"><p>rename a <a href="#netCDF4.Group"><code>Group</code></a> named <code>oldname</code> to <code>newname</code> (requires netcdf &gt;= 4.3.1).</p></div>
5264
5265
5266
5267 <div class="desc"><p>rename a <a href="#netCDF4.Group"><code>Group</code></a> named <code>oldname</code> to <code>newname</code> (requires netcdf &gt;= 4.3.1).</p></div>
55325268 <div class="source_cont">
55335269 </div>
55345270
55405276 <p>def <span class="ident">renameVariable</span>(</p><p>self, oldname, newname)</p>
55415277 </div>
55425278
5543 <p class="inheritance">
5544 <strong>Inheritance:</strong>
5545 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.renameVariable">renameVariable</a></code>
5546 </p>
5547
5548
5549
5550 <div class="desc inherited"><p>rename a <a href="#netCDF4.Variable"><code>Variable</code></a> named <code>oldname</code> to <code>newname</code></p></div>
5279
5280
5281
5282 <div class="desc"><p>rename a <a href="#netCDF4.Variable"><code>Variable</code></a> named <code>oldname</code> to <code>newname</code></p></div>
55515283 <div class="source_cont">
55525284 </div>
55535285
55595291 <p>def <span class="ident">set_always_mask</span>(</p><p>self, True_or_False)</p>
55605292 </div>
55615293
5562 <p class="inheritance">
5563 <strong>Inheritance:</strong>
5564 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_always_mask">set_always_mask</a></code>
5565 </p>
5566
5567
5568
5569 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_always_mask"><code>set_always_mask</code></a> for all variables contained in
5294
5295
5296
5297 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_always_mask"><code>set_always_mask</code></a> for all variables contained in
55705298 this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all
55715299 variables in all its subgroups.</p>
55725300 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic conversion of
55865314 <p>def <span class="ident">set_auto_chartostring</span>(</p><p>self, True_or_False)</p>
55875315 </div>
55885316
5589 <p class="inheritance">
5590 <strong>Inheritance:</strong>
5591 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_auto_chartostring">set_auto_chartostring</a></code>
5592 </p>
5593
5594
5595
5596 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_auto_chartostring"><code>set_auto_chartostring</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
5317
5318
5319
5320 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_auto_chartostring"><code>set_auto_chartostring</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
55975321 <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all variables in all its subgroups.</p>
55985322 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic conversion of
55995323 all character arrays &lt;--&gt; string arrays should be performed for
56125336 <p>def <span class="ident">set_auto_mask</span>(</p><p>self, True_or_False)</p>
56135337 </div>
56145338
5615 <p class="inheritance">
5616 <strong>Inheritance:</strong>
5617 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_auto_mask">set_auto_mask</a></code>
5618 </p>
5619
5620
5621
5622 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_auto_mask"><code>set_auto_mask</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
5339
5340
5341
5342 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_auto_mask"><code>set_auto_mask</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
56235343 <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all variables in all its subgroups.</p>
56245344 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic conversion to masked arrays
56255345 shall be applied for all variables.</p>
56365356 <p>def <span class="ident">set_auto_maskandscale</span>(</p><p>self, True_or_False)</p>
56375357 </div>
56385358
5639 <p class="inheritance">
5640 <strong>Inheritance:</strong>
5641 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_auto_maskandscale">set_auto_maskandscale</a></code>
5642 </p>
5643
5644
5645
5646 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_auto_maskandscale"><code>set_auto_maskandscale</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
5359
5360
5361
5362 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_auto_maskandscale"><code>set_auto_maskandscale</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
56475363 <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all variables in all its subgroups.</p>
56485364 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic conversion to masked arrays
56495365 and variable scaling shall be applied for all variables.</p>
56605376 <p>def <span class="ident">set_auto_scale</span>(</p><p>self, True_or_False)</p>
56615377 </div>
56625378
5663 <p class="inheritance">
5664 <strong>Inheritance:</strong>
5665 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_auto_scale">set_auto_scale</a></code>
5666 </p>
5667
5668
5669
5670 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_auto_scale"><code>set_auto_scale</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
5379
5380
5381
5382 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_auto_scale"><code>set_auto_scale</code></a> for all variables contained in this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or
56715383 <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all variables in all its subgroups.</p>
56725384 <p><strong><code>True_or_False</code></strong>: Boolean determining if automatic variable scaling
56735385 shall be applied for all variables.</p>
56845396 <p>def <span class="ident">set_fill_off</span>(</p><p>self)</p>
56855397 </div>
56865398
5687 <p class="inheritance">
5688 <strong>Inheritance:</strong>
5689 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_fill_off">set_fill_off</a></code>
5690 </p>
5691
5692
5693
5694 <div class="desc inherited"><p>Sets the fill mode for a <a href="#netCDF4.Dataset"><code>Dataset</code></a> open for writing to <code>off</code>.</p>
5399
5400
5401
5402 <div class="desc"><p>Sets the fill mode for a <a href="#netCDF4.Dataset"><code>Dataset</code></a> open for writing to <code>off</code>.</p>
56955403 <p>This will prevent the data from being pre-filled with fill values, which
56965404 may result in some performance improvements. However, you must then make
56975405 sure the data is actually written before being read.</p></div>
57065414 <p>def <span class="ident">set_fill_on</span>(</p><p>self)</p>
57075415 </div>
57085416
5709 <p class="inheritance">
5710 <strong>Inheritance:</strong>
5711 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_fill_on">set_fill_on</a></code>
5712 </p>
5713
5714
5715
5716 <div class="desc inherited"><p>Sets the fill mode for a <a href="#netCDF4.Dataset"><code>Dataset</code></a> open for writing to <code>on</code>.</p>
5417
5418
5419
5420 <div class="desc"><p>Sets the fill mode for a <a href="#netCDF4.Dataset"><code>Dataset</code></a> open for writing to <code>on</code>.</p>
57175421 <p>This causes data to be pre-filled with fill values. The fill values can be
57185422 controlled by the variable's <code>_Fill_Value</code> attribute, but is usually
57195423 sufficient to the use the netCDF default <code>_Fill_Value</code> (defined
57325436 <p>def <span class="ident">set_ncstring_attrs</span>(</p><p>self, True_or_False)</p>
57335437 </div>
57345438
5735 <p class="inheritance">
5736 <strong>Inheritance:</strong>
5737 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.set_ncstring_attrs">set_ncstring_attrs</a></code>
5738 </p>
5739
5740
5741
5742 <div class="desc inherited"><p>Call <a href="#netCDF4.Variable.set_ncstring_attrs"><code>set_ncstring_attrs</code></a> for all variables contained in
5439
5440
5441
5442 <div class="desc"><p>Call <a href="#netCDF4.Variable.set_ncstring_attrs"><code>set_ncstring_attrs</code></a> for all variables contained in
57435443 this <a href="#netCDF4.Dataset"><code>Dataset</code></a> or <a href="#netCDF4.Group"><code>Group</code></a>, as well as for all its
57445444 subgroups and their variables.</p>
57455445 <p><strong><code>True_or_False</code></strong>: Boolean determining if all string attributes are
57585458 <p>def <span class="ident">setncattr</span>(</p><p>self,name,value)</p>
57595459 </div>
57605460
5761 <p class="inheritance">
5762 <strong>Inheritance:</strong>
5763 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.setncattr">setncattr</a></code>
5764 </p>
5765
5766
5767
5768 <div class="desc inherited"><p>set a netCDF dataset or group attribute using name,value pair.
5461
5462
5463
5464 <div class="desc"><p>set a netCDF dataset or group attribute using name,value pair.
57695465 Use if you need to set a netCDF attribute with the
57705466 with the same name as one of the reserved python attributes.</p></div>
57715467 <div class="source_cont">
57795475 <p>def <span class="ident">setncattr_string</span>(</p><p>self,name,value)</p>
57805476 </div>
57815477
5782 <p class="inheritance">
5783 <strong>Inheritance:</strong>
5784 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.setncattr_string">setncattr_string</a></code>
5785 </p>
5786
5787
5788
5789 <div class="desc inherited"><p>set a netCDF dataset or group string attribute using name,value pair.
5478
5479
5480
5481 <div class="desc"><p>set a netCDF dataset or group string attribute using name,value pair.
57905482 Use if you need to ensure that a netCDF attribute is created with type
57915483 <code>NC_STRING</code> if the file format is <code>NETCDF4</code>.</p></div>
57925484 <div class="source_cont">
58005492 <p>def <span class="ident">setncatts</span>(</p><p>self,attdict)</p>
58015493 </div>
58025494
5803 <p class="inheritance">
5804 <strong>Inheritance:</strong>
5805 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.setncatts">setncatts</a></code>
5806 </p>
5807
5808
5809
5810 <div class="desc inherited"><p>set a bunch of netCDF dataset or group attributes at once using a python dictionary.
5495
5496
5497
5498 <div class="desc"><p>set a bunch of netCDF dataset or group attributes at once using a python dictionary.
58115499 This may be faster when setting a lot of attributes for a <code>NETCDF3</code>
58125500 formatted file, since nc_redef/nc_enddef is not called in between setting
58135501 each attribute</p></div>
58225510 <p>def <span class="ident">sync</span>(</p><p>self)</p>
58235511 </div>
58245512
5825 <p class="inheritance">
5826 <strong>Inheritance:</strong>
5827 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.sync">sync</a></code>
5828 </p>
5829
5830
5831
5832 <div class="desc inherited"><p>Writes all buffered data in the <a href="#netCDF4.Dataset"><code>Dataset</code></a> to the disk file.</p></div>
5833 <div class="source_cont">
5834 </div>
5835
5836 </div>
5837
5838 <h3>Methods</h3>
5839
5840 <div class="item">
5841 <div class="name def" id="netCDF4.MFDataset.__init__">
5842 <p>def <span class="ident">__init__</span>(</p><p>self, files, check=False, aggdim=None, exclude=[], master_file=None)</p>
5843 </div>
5844
5845 <p class="inheritance">
5846 <strong>Inheritance:</strong>
5847 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.__init__">__init__</a></code>
5848 </p>
5849
5850
5851
5852 <div class="desc"><p>Open a Dataset spanning multiple files, making it look as if it was a
5853 single file. Variables in the list of files that share the same
5854 dimension (specified with the keyword <code>aggdim</code>) are aggregated. If
5855 <code>aggdim</code> is not specified, the unlimited is aggregated. Currently,
5856 <code>aggdim</code> must be the leftmost (slowest varying) dimension of each
5857 of the variables to be aggregated.</p>
5858 <p><strong><code>files</code></strong>: either a sequence of netCDF files or a string with a
5859 wildcard (converted to a sorted list of files using glob) If
5860 the <code>master_file</code> kwarg is not specified, the first file
5861 in the list will become the "master" file, defining all the
5862 variables with an aggregation dimension which may span
5863 subsequent files. Attribute access returns attributes only from "master"
5864 file. The files are always opened in read-only mode.</p>
5865 <p><strong><code>check</code></strong>: True if you want to do consistency checking to ensure the
5866 correct variables structure for all of the netcdf files. Checking makes
5867 the initialization of the MFDataset instance much slower. Default is
5868 False.</p>
5869 <p><strong><code>aggdim</code></strong>: The name of the dimension to aggregate over (must
5870 be the leftmost dimension of each of the variables to be aggregated).
5871 If None (default), aggregate over the unlimited dimension.</p>
5872 <p><strong><code>exclude</code></strong>: A list of variable names to exclude from aggregation.
5873 Default is an empty list.</p>
5874 <p><strong><code>master_file</code></strong>: file to use as "master file", defining all the
5875 variables with an aggregation dimension and all global attributes.</p></div>
5876 <div class="source_cont">
5877 </div>
5878
5879 </div>
5880
5881
5882 <div class="item">
5883 <div class="name def" id="netCDF4.MFDataset.close">
5884 <p>def <span class="ident">close</span>(</p><p>self)</p>
5885 </div>
5886
5887 <p class="inheritance">
5888 <strong>Inheritance:</strong>
5889 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.close">close</a></code>
5890 </p>
5891
5892
5893
5894 <div class="desc"><p>close all the open files.</p></div>
5895 <div class="source_cont">
5896 </div>
5897
5898 </div>
5899
5900
5901 <div class="item">
5902 <div class="name def" id="netCDF4.MFDataset.ncattrs">
5903 <p>def <span class="ident">ncattrs</span>(</p><p>self)</p>
5904 </div>
5905
5906 <p class="inheritance">
5907 <strong>Inheritance:</strong>
5908 <code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.ncattrs">ncattrs</a></code>
5909 </p>
5910
5911
5912
5913 <div class="desc"><p>return the netcdf attribute names from the master file.</p></div>
5513
5514
5515
5516 <div class="desc"><p>Writes all buffered data in the <a href="#netCDF4.Dataset"><code>Dataset</code></a> to the disk file.</p></div>
59145517 <div class="source_cont">
59155518 </div>
59165519
59615564 <ul class="class_list">
59625565 <li><a href="#netCDF4.MFTime">MFTime</a></li>
59635566 <li>netCDF4._netCDF4._Variable</li>
5964 <li>__builtin__.object</li>
5567 <li>builtins.object</li>
59655568 </ul>
5966 <h3>Methods</h3>
5569 <h3>Static methods</h3>
59675570
59685571 <div class="item">
59695572 <div class="name def" id="netCDF4.MFTime.__init__">
59735576
59745577
59755578
5976 <div class="desc"><p>Create a time Variable with units consistent across a multifile
5579 <div class="desc"><p><strong><code>__init__(self, time, units=None, calendar=None)</code></strong></p>
5580 <p>Create a time Variable with units consistent across a multifile
59775581 dataset.</p>
59785582 <p><strong><code>time</code></strong>: Time variable from a <a href="#netCDF4.MFDataset"><code>MFDataset</code></a>.</p>
59795583 <p><strong><code>units</code></strong>: Time units, for example, <code>'days since 1979-01-01'</code>. If <code>None</code>,
59905594
59915595 <div class="item">
59925596 <div class="name def" id="netCDF4.MFTime.ncattrs">
5993 <p>def <span class="ident">ncattrs</span>(</p><p>...)</p>
5597 <p>def <span class="ident">ncattrs</span>(</p><p>self)</p>
59945598 </div>
59955599
59965600
60045608
60055609 <div class="item">
60065610 <div class="name def" id="netCDF4.MFTime.set_always_mask">
6007 <p>def <span class="ident">set_always_mask</span>(</p><p>...)</p>
5611 <p>def <span class="ident">set_always_mask</span>(</p><p>self, val)</p>
60085612 </div>
60095613
60105614
60185622
60195623 <div class="item">
60205624 <div class="name def" id="netCDF4.MFTime.set_auto_chartostring">
6021 <p>def <span class="ident">set_auto_chartostring</span>(</p><p>...)</p>
5625 <p>def <span class="ident">set_auto_chartostring</span>(</p><p>self, val)</p>
60225626 </div>
60235627
60245628
60325636
60335637 <div class="item">
60345638 <div class="name def" id="netCDF4.MFTime.set_auto_mask">
6035 <p>def <span class="ident">set_auto_mask</span>(</p><p>...)</p>
5639 <p>def <span class="ident">set_auto_mask</span>(</p><p>self, val)</p>
60365640 </div>
60375641
60385642
60465650
60475651 <div class="item">
60485652 <div class="name def" id="netCDF4.MFTime.set_auto_maskandscale">
6049 <p>def <span class="ident">set_auto_maskandscale</span>(</p><p>...)</p>
5653 <p>def <span class="ident">set_auto_maskandscale</span>(</p><p>self, val)</p>
60505654 </div>
60515655
60525656
60605664
60615665 <div class="item">
60625666 <div class="name def" id="netCDF4.MFTime.set_auto_scale">
6063 <p>def <span class="ident">set_auto_scale</span>(</p><p>...)</p>
5667 <p>def <span class="ident">set_auto_scale</span>(</p><p>self, val)</p>
60645668 </div>
60655669
60665670
60745678
60755679 <div class="item">
60765680 <div class="name def" id="netCDF4.MFTime.typecode">
6077 <p>def <span class="ident">typecode</span>(</p><p>...)</p>
5681 <p>def <span class="ident">typecode</span>(</p><p>self)</p>
60785682 </div>
60795683
60805684
61065710 <h3>Ancestors (in MRO)</h3>
61075711 <ul class="class_list">
61085712 <li><a href="#netCDF4.VLType">VLType</a></li>
6109 <li>__builtin__.object</li>
5713 <li>builtins.object</li>
61105714 </ul>
61115715 <h3>Class variables</h3>
61125716 <div class="item">
62115815 <h3>Ancestors (in MRO)</h3>
62125816 <ul class="class_list">
62135817 <li><a href="#netCDF4.Variable">Variable</a></li>
6214 <li>__builtin__.object</li>
5818 <li>builtins.object</li>
62155819 </ul>
62165820 <h3>Class variables</h3>
62175821 <div class="item">
69406544 <footer id="footer">
69416545 <p>
69426546 Documentation generated by
6943 <a href="https://github.com/BurntSushi/pdoc">pdoc 0.3.2.dev16</a>
6547 <a href="https://github.com/BurntSushi/pdoc">pdoc 0.3.2.dev29</a>
69446548 </p>
69456549
69466550 <p>pdoc is in the public domain with the
00 """
1 Version 1.5.0.1
1 Version 1.5.1
22 -------------
33 - - -
44
14131413 _ensure_nc_success(ierr, err_cls=AttributeError)
14141414 try:
14151415 result = [values[j].decode(encoding,errors='replace').replace('\x00','')
1416 for j in range(att_len)]
1416 if values[j] else "" for j in range(att_len)]
14171417 finally:
14181418 ierr = nc_free_string(att_len, values) # free memory in netcdf C lib
14191419 finally:
39363936 if (self._grp.path != '/'): ncdump_var.append('path = %s\n' % self._grp.path)
39373937 ncdump_var.append('unlimited dimensions: %s\n' % ', '.join(unlimdims))
39383938 ncdump_var.append('current shape = %s\n' % repr(self.shape))
3939 with nogil:
3940 ierr = nc_inq_var_fill(self._grpid,self._varid,&no_fill,NULL)
3941 _ensure_nc_success(ierr)
3939 if __netcdf4libversion__ < '4.5.1' and\
3940 self._grp.file_format.startswith('NETCDF3'):
3941 # issue #908: no_fill not correct for NETCDF3 files before 4.5.1
3942 # before 4.5.1 there was no way to turn off filling on a
3943 # per-variable basis for classic files.
3944 no_fill=0
3945 else:
3946 with nogil:
3947 ierr = nc_inq_var_fill(self._grpid,self._varid,&no_fill,NULL)
3948 _ensure_nc_success(ierr)
39423949 if self._isprimitive:
39433950 if no_fill != 1:
39443951 try:
43884395 data = data.view('u%s' % data.dtype.itemsize)
43894396
43904397 if self.scale and self._isprimitive and valid_scaleoffset:
4391 # if variable has scale_factor and add_offset attributes, rescale.
4392 if hasattr(self, 'scale_factor') and hasattr(self, 'add_offset') and\
4393 (self.add_offset != 0.0 or self.scale_factor != 1.0):
4394 data = data*self.scale_factor + self.add_offset
4395 # else if variable has only scale_factor attributes, rescale.
4398 # if variable has scale_factor and add_offset attributes, apply
4399 # them.
4400 if hasattr(self, 'scale_factor') and hasattr(self, 'add_offset'):
4401 if self.add_offset != 0.0 or self.scale_factor != 1.0:
4402 data = data*self.scale_factor + self.add_offset
4403 else:
4404 data = data.astype(self.scale_factor.dtype) # issue 913
4405 # else if variable has only scale_factor attribute, rescale.
43964406 elif hasattr(self, 'scale_factor') and self.scale_factor != 1.0:
43974407 data = data*self.scale_factor
4398 # else if variable has only add_offset attributes, rescale.
4408 # else if variable has only add_offset attribute, add offset.
43994409 elif hasattr(self, 'add_offset') and self.add_offset != 0.0:
44004410 data = data + self.add_offset
44014411
44914501 # issue 209: don't return masked array if variable filling
44924502 # is disabled.
44934503 else:
4494 with nogil:
4495 ierr = nc_inq_var_fill(self._grpid,self._varid,&no_fill,NULL)
4496 _ensure_nc_success(ierr)
4504 if __netcdf4libversion__ < '4.5.1' and\
4505 self._grp.file_format.startswith('NETCDF3'):
4506 # issue #908: no_fill not correct for NETCDF3 files before 4.5.1
4507 # before 4.5.1 there was no way to turn off filling on a
4508 # per-variable basis for classic files.
4509 no_fill=0
4510 else:
4511 with nogil:
4512 ierr = nc_inq_var_fill(self._grpid,self._varid,&no_fill,NULL)
4513 _ensure_nc_success(ierr)
44974514 # if no_fill is not 1, and not a byte variable, then use default fill value.
44984515 # from http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c/Fill-Values.html#Fill-Values
44994516 # "If you need a fill value for a byte variable, it is recommended
53035320 # not given, use 'utf-8'.
53045321 encoding = getattr(self,'_Encoding','utf-8')
53055322 for i from 0<=i<totelem:
5306 data[i] = strdata[i].decode(encoding)
5323 if strdata[i]:
5324 data[i] = strdata[i].decode(encoding)
5325 else:
5326 data[i] = "" # issue 915
53075327 # reshape the output array
53085328 data = numpy.reshape(data, shapeout)
53095329 # free string data internally allocated in netcdf C lib
138138 grp : netCDF Group
139139 The netCDF group to which the variable being set belongs to.
140140 datashape : sequence
141 The shape of the data that is being stored. Only needed by __setitime__
141 The shape of the data that is being stored. Only needed by __setitem__
142142 put : True|False (default False). If called from __setitem__, put is True.
143143
144144 Returns
341341 else:
342342 sdim.append(1)
343343
344 # pad datashape with zeros for dimensions not being sliced
345 if datashape:
346 datashapenew = (); i=0
347 for e in elem:
348 if type(e) != slice:
349 datashapenew = datashapenew + (0,)
350 else:
351 datashapenew = datashapenew + (datashape[i],)
352 i+=1
353 datashape = datashapenew
354
344355 # Create the start, count, stride and indices arrays.
345356
346357 sdim.append(max(nDims, 1))
583583
584584 setup(name="netCDF4",
585585 cmdclass=cmdclass,
586 version="1.5.0.1",
586 version="1.5.1",
587587 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.",
588588 author="Jeff Whitaker",
589589 author_email="jeffrey.s.whitaker@noaa.gov",
Binary diff not shown
3737 test_files.remove('tst_dap.py')
3838 test_files.insert(0,'tst_dap.py')
3939
40
4140 # Build the test suite from the tests found in the test files.
4241 testsuite = unittest.TestSuite()
4342 for f in test_files:
Binary diff not shown
218218 assert v1.stringseqatt_array == STRINGSEQATT
219219 assert getattr(v1,'nonexistantatt',None) == None
220220 f.close()
221 # issue 915 empty string attribute (ncdump reports 'NIL')
222 f = netCDF4.Dataset('test_gold.nc')
223 assert f['RADIANCE'].VAR_NOTES == ""
224 f.close()
221225
222226 if __name__ == '__main__':
223227 unittest.main()
0 import netCDF4, unittest
1 import numpy as np
2
3 class Issue908TestCase(unittest.TestCase):
4
5 def setUp(self):
6 nc = netCDF4.Dataset('CRM032_test1.nc')
7 self.nc = nc
8
9 def tearDown(self):
10 self.nc.close()
11
12 def runTest(self):
13 data = self.nc['rgrid'][:]
14 assert(data.all() is np.ma.masked)
15
16 if __name__ == '__main__':
17 unittest.main()
3232
3333 f = Dataset(self.testfile, 'w')
3434 x = f.createDimension('x', None)
35 xx = f.createDimension('xx', 10)
3536 v = f.createVariable('v', "i2", 'x')
37 vv = f.createVariable('vv', "i2", 'xx')
38 vv.add_offset=0; vv.scale_factor=np.float32(1.0)
3639
3740 v[:] = self.v
41 vv[:] = np.ones(10)
3842
3943 # Note: Scale factors are only added after writing, so that no auto-scaling takes place!
4044
104108
105109 f.variables["v"].set_auto_scale(True) # The default anyway...
106110 v_scaled = f.variables['v'][:]
111
112 # issue 913
113 vv_scaled = f.variables['vv'][:]
114 self.assertEqual(vv_scaled.dtype,f.variables['vv'].scale_factor.dtype)
115 assert_array_almost_equal(vv_scaled, np.ones(10))
107116
108117 self.assertEqual(v_scaled.dtype, "f8")
109118 self.assertTrue(isinstance(v_scaled, np.ndarray))
210210 assert_array_equal(data,data2)
211211 nc.close()
212212
213 def test_issue906(self):
214 f = Dataset('test.nc','w')
215 f.createDimension('d1',3)
216 f.createDimension('d2',None)
217 f.createDimension('d3',5)
218 f.createVariable('v2',np.float,('d1','d2','d3'))
219 f['v2'][:] = np.zeros((3,4,5))
220 f['v2'][0,:,0] = np.arange(4)
221 f['v2'][0,:,:] = np.ones((4,5))
222 f.close()
223
213224 if __name__ == '__main__':
214225 unittest.main()