html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/1598#issuecomment-333175863,https://api.github.com/repos/pydata/xarray/issues/1598,333175863,MDEyOklzc3VlQ29tbWVudDMzMzE3NTg2Mw==,13837821,2017-09-29T16:37:07Z,2017-09-29T16:37:20Z,CONTRIBUTOR,"@jhamman In brief, it's weird. Engine | encoding['_FillValue'] = False | Do nothing ----- | ----- | ----- netCDF4 | Filling off | Filling on scipy | Filling off | Filling off h5netcdf | Filling on | Filling off So, this is some peculiar behavior. Setting `_FillValue` to `False` works for netCDF4 (as we have seen), has no effect using the scipy engine, and seems to do the opposite of intended for h5netcdf. **Code below:** ``` import xarray as xr import numpy as np import pandas as pd ds = xr.Dataset({'foo': (('x', 'y'), np.random.rand(4, 5))}, coords={'x': [10, 20, 30, 40], 'y': pd.date_range('2000-01-01', periods=5), 'z': ('x', list('abcd'))}) ds.to_netcdf('notset_scipy.nc', engine='scipy') ds.to_netcdf('notset_netcdf4.nc', engine='netcdf4') ds.to_netcdf('notset_h5netcdf.nc', engine='h5netcdf') ds.y.encoding['_FillValue'] = False ds.to_netcdf('False_scipy.nc', engine='scipy') ds.to_netcdf('False_netcdf4.nc', engine='netcdf4') ds.to_netcdf('False_h5netcdf.nc', engine='h5netcdf') ``` **netCDF4** ``` $ ncinfo -v y notset_netcdf4.nc int64 y(y) units: days since 2000-01-01 00:00:00 calendar: proleptic_gregorian unlimited dimensions: current shape = (5,) filling on, default _FillValue of -9223372036854775806 used ``` ``` $ ncinfo -v y False_netcdf4.nc int64 y(y) units: days since 2000-01-01 00:00:00 calendar: proleptic_gregorian unlimited dimensions: current shape = (5,) filling off ``` **scipy** ``` $ ncinfo -v y notset_scipy.nc int32 y(y) units: days since 2000-01-01 00:00:00 calendar: proleptic_gregorian unlimited dimensions: current shape = (5,) filling off ``` ``` $ ncinfo -v y False_scipy.nc int32 y(y) units: days since 2000-01-01 00:00:00 calendar: proleptic_gregorian _FillValue: 0 unlimited dimensions: current shape = (5,) filling off ``` **h5netcdf** ``` $ ncinfo -v y notset_h5netcdf.nc int64 y(y) units: days since 2000-01-01 00:00:00 calendar: proleptic_gregorian unlimited dimensions: current shape = (5,) filling off ``` ``` $ ncinfo -v y False_h5netcdf.nc int64 y(y) _FillValue: 0 units: days since 2000-01-01 00:00:00 calendar: proleptic_gregorian unlimited dimensions: current shape = (5,) filling on ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,261403591 https://github.com/pydata/xarray/issues/1598#issuecomment-333165596,https://api.github.com/repos/pydata/xarray/issues/1598,333165596,MDEyOklzc3VlQ29tbWVudDMzMzE2NTU5Ng==,13837821,2017-09-29T15:55:22Z,2017-09-29T15:55:22Z,CONTRIBUTOR,"> Allowing {'_FillValue': False} to indicate that _FillValue should not be included would be a simple, easy fix, so we should probably do that regardless. Correct me if you're talking about something different, but xarray already supports setting `_FillValue` to `False` to turn off filling. (Is there any use case where filling remains on but without a valid `_FillValue`?) For example, I have a netCDF processing routine using xarray. In the code I have the line for the `lon` dimension: ds.lon.encoding['_FillValue'] = False Which, for the relevant dimension, yields in ncinfo: ``` $ ncinfo -v lon yesfalse.nc float64 lon(lon) units: degrees_east long_name: Longitude epic_code: 502 unlimited dimensions: current shape = (1,) filling off ``` If I comment out that line in my processing routine, I get the following: ``` $ ncinfo -v lon nofalse.nc float64 lon(lon) _FillValue: nan units: degrees_east long_name: Longitude epic_code: 502 unlimited dimensions: current shape = (1,) filling on ``` I agree that changing from `False` to `None` does make better semantic sense.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,261403591