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/6091#issuecomment-1008222099,https://api.github.com/repos/pydata/xarray/issues/6091,1008222099,IC_kwDOAMm_X848GD-T,13301940,2022-01-09T03:30:55Z,2022-01-09T03:30:55Z,MEMBER,"> Ha, thanks. It makes sense now. Shall we close this?
Great! I'm closing this for the time being... ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1085619598
https://github.com/pydata/xarray/issues/6091#issuecomment-998910844,https://api.github.com/repos/pydata/xarray/issues/6091,998910844,IC_kwDOAMm_X847iit8,30388627,2021-12-21T16:15:14Z,2021-12-21T16:15:14Z,NONE,"Ha, thanks. It makes sense now. Shall we close this?","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1085619598
https://github.com/pydata/xarray/issues/6091#issuecomment-998789248,https://api.github.com/repos/pydata/xarray/issues/6091,998789248,IC_kwDOAMm_X847iFCA,13301940,2021-12-21T13:41:33Z,2021-12-21T13:42:23Z,MEMBER,"> Note that I can't reproduce it using this example:
I could be wrong but it appears that when you introduce a `_FillValue` in your dataarray, you end up with the same outcome:
```python
In [53]: import numpy as np
...: import xarray as xr
...:
...: da = xr.DataArray(np.array([1,2,4294967295], dtype='uint')).rename('test_array')
In [56]: da.encoding['_FillValue'] = 4294967295
```
```python
In [62]: da.to_netcdf(""test.nc"", engine='netcdf4')
In [63]: !ncdump -h test.nc
netcdf test {
dimensions:
dim_0 = 3 ;
variables:
uint64 test_array(dim_0) ;
test_array:_FillValue = 4294967295ULL ;
data:
test_array = 1, 2, _ ;
}
```
```python
In [64]: d = Dataset(""test.nc"")
In [65]: d
Out[65]:
root group (NETCDF4 data model, file format HDF5):
dimensions(sizes): dim_0(3)
variables(dimensions): uint64 test_array(dim_0)
groups:
In [66]: xr.open_dataset('test.nc')
Out[66]:
Dimensions: (dim_0: 3)
Dimensions without coordinates: dim_0
Data variables:
test_array (dim_0) float64 ...
```
```python
In [67]: xr.open_dataset('test.nc').test_array
Out[67]:
array([ 1., 2., nan])
Dimensions without coordinates: dim_0
```
Notice that xarray is using `np.NaN` as a sentinel value for the `missing` / `fill_values`. Because `np.NaN` is a float, this forces the entire array of integers to become floating pointing numbers...
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1085619598