How do I get the default fill values?

痞子三分冷 提交于 2020-12-06 07:04:29

问题


How can I get the default fill values using netcdf4-python? According to this issue one can get it via netCDF4._default_fillvals, but this gives AttributeError: module 'netCDF4' has no attribute '_default_fillvals' 1.5.0.1. The information is available somewhere, because print(v) tells me filling on, default _FillValue of 9.969209968386869e+36 used. Unfortunately the file has not set the fill value attribute. Short of parsing the output of v.__repr__(), how can I find the default fill value?


回答1:


This is documented in a parenthetical remark in the documentation for Dataset.create_variable.

From the Changelog for version 0.9.7:

* changed netCDF4._default_fillvals to netCDF4.default_fillvals (to make part of public API). Added to docs (issue 94).

From the documentation for the Dataset.create_variable static method:

The optional keyword fill_value can be used to override the default netCDF _FillValue (the value that the variable gets filled with before any data is written to it, defaults given in netCDF4.default_fillvals). If fill_value is set to False, then the variable is not pre-filled.

This was fixed in commit 36f6544b10f791f31c3a0911ea97351e03490c75.



来源:https://stackoverflow.com/questions/56038566/how-do-i-get-the-default-fill-values

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!