Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to write all attributes as NC_CHAR (issue #529) #533

Merged
merged 12 commits into from
Mar 1, 2016
8 changes: 7 additions & 1 deletion Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
version 1.2.3 (not yet released)
===========================
================================
* try to avoid writing NC_STRING attributes if possible, by
trying to convert unicode strings to ascii and write as NC_CHAR (issue
#529). This preserves compatibility with clients (like Matlab) that
can't deal with NC_STRING attributes. A 'setncattr_string' method
was added for Dataset and Variable to that users can force attributes
to be written as NC_STRING if necessary.
* fix failing tests with numpy 1.11 (issues #521 and #522).
* fix indentation bug in nc4tonc3 utility (issue #519).
* add the capability in setup.py to use pkg-config instead of
Expand Down
80 changes: 80 additions & 0 deletions docs/netCDF4/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ <h1>Index</h1>
<li class="mono"><a href="#netCDF4.Dataset.set_fill_off">set_fill_off</a></li>
<li class="mono"><a href="#netCDF4.Dataset.set_fill_on">set_fill_on</a></li>
<li class="mono"><a href="#netCDF4.Dataset.setncattr">setncattr</a></li>
<li class="mono"><a href="#netCDF4.Dataset.setncattr_string">setncattr_string</a></li>
<li class="mono"><a href="#netCDF4.Dataset.setncatts">setncatts</a></li>
<li class="mono"><a href="#netCDF4.Dataset.sync">sync</a></li>
</ul>
Expand Down Expand Up @@ -1150,6 +1151,7 @@ <h1>Index</h1>
<li class="mono"><a href="#netCDF4.Group.set_fill_off">set_fill_off</a></li>
<li class="mono"><a href="#netCDF4.Group.set_fill_on">set_fill_on</a></li>
<li class="mono"><a href="#netCDF4.Group.setncattr">setncattr</a></li>
<li class="mono"><a href="#netCDF4.Group.setncattr_string">setncattr_string</a></li>
<li class="mono"><a href="#netCDF4.Group.setncatts">setncatts</a></li>
<li class="mono"><a href="#netCDF4.Group.sync">sync</a></li>
</ul>
Expand Down Expand Up @@ -1181,6 +1183,7 @@ <h1>Index</h1>
<li class="mono"><a href="#netCDF4.MFDataset.set_fill_off">set_fill_off</a></li>
<li class="mono"><a href="#netCDF4.MFDataset.set_fill_on">set_fill_on</a></li>
<li class="mono"><a href="#netCDF4.MFDataset.setncattr">setncattr</a></li>
<li class="mono"><a href="#netCDF4.MFDataset.setncattr_string">setncattr_string</a></li>
<li class="mono"><a href="#netCDF4.MFDataset.setncatts">setncatts</a></li>
<li class="mono"><a href="#netCDF4.MFDataset.sync">sync</a></li>
<li class="mono"><a href="#netCDF4.MFDataset.__init__">__init__</a></li>
Expand Down Expand Up @@ -1232,6 +1235,7 @@ <h1>Index</h1>
<li class="mono"><a href="#netCDF4.Variable.set_auto_scale">set_auto_scale</a></li>
<li class="mono"><a href="#netCDF4.Variable.set_var_chunk_cache">set_var_chunk_cache</a></li>
<li class="mono"><a href="#netCDF4.Variable.setncattr">setncattr</a></li>
<li class="mono"><a href="#netCDF4.Variable.setncattr_string">setncattr_string</a></li>
<li class="mono"><a href="#netCDF4.Variable.setncatts">setncatts</a></li>
</ul>

Expand Down Expand Up @@ -3201,6 +3205,23 @@ <h3>Static methods</h3>
</div>


<div class="item">
<div class="name def" id="netCDF4.Dataset.setncattr_string">
<p>def <span class="ident">setncattr_string</span>(</p><p>self,name,value)</p>
</div>




<div class="desc"><p>set a netCDF dataset or group string attribute using name,value pair.
Use if you need to ensure that of netCDF attribute is created with type
<code>NC_STRING</code> if the file format is <code>NETCDF4</code>.</p></div>
<div class="source_cont">
</div>

</div>


<div class="item">
<div class="name def" id="netCDF4.Dataset.setncatts">
<p>def <span class="ident">setncatts</span>(</p><p>self,attdict)</p>
Expand Down Expand Up @@ -4307,6 +4328,27 @@ <h3>Static methods</h3>
</div>


<div class="item">
<div class="name def" id="netCDF4.Group.setncattr_string">
<p>def <span class="ident">setncattr_string</span>(</p><p>self,name,value)</p>
</div>

<p class="inheritance">
<strong>Inheritance:</strong>
<code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.setncattr_string">setncattr_string</a></code>
</p>



<div class="desc inherited"><p>set a netCDF dataset or group string attribute using name,value pair.
Use if you need to ensure that of netCDF attribute is created with type
<code>NC_STRING</code> if the file format is <code>NETCDF4</code>.</p></div>
<div class="source_cont">
</div>

</div>


<div class="item">
<div class="name def" id="netCDF4.Group.setncatts">
<p>def <span class="ident">setncatts</span>(</p><p>self,attdict)</p>
Expand Down Expand Up @@ -5173,6 +5215,27 @@ <h3>Static methods</h3>
</div>


<div class="item">
<div class="name def" id="netCDF4.MFDataset.setncattr_string">
<p>def <span class="ident">setncattr_string</span>(</p><p>self,name,value)</p>
</div>

<p class="inheritance">
<strong>Inheritance:</strong>
<code><a href="#netCDF4.Dataset">Dataset</a></code>.<code><a href="#netCDF4.Dataset.setncattr_string">setncattr_string</a></code>
</p>



<div class="desc inherited"><p>set a netCDF dataset or group string attribute using name,value pair.
Use if you need to ensure that of netCDF attribute is created with type
<code>NC_STRING</code> if the file format is <code>NETCDF4</code>.</p></div>
<div class="source_cont">
</div>

</div>


<div class="item">
<div class="name def" id="netCDF4.MFDataset.setncatts">
<p>def <span class="ident">setncatts</span>(</p><p>self,attdict)</p>
Expand Down Expand Up @@ -6038,6 +6101,23 @@ <h3>Static methods</h3>
</div>


<div class="item">
<div class="name def" id="netCDF4.Variable.setncattr_string">
<p>def <span class="ident">setncattr_string</span>(</p><p>self,name,value)</p>
</div>




<div class="desc"><p>set a netCDF variable string attribute using name,value pair.
Use if you need to ensure that of netCDF attribute is created with type
<code>NC_STRING</code> if the file format is <code>NETCDF4</code>.</p></div>
<div class="source_cont">
</div>

</div>


<div class="item">
<div class="name def" id="netCDF4.Variable.setncatts">
<p>def <span class="ident">setncatts</span>(</p><p>self,attdict)</p>
Expand Down
Loading