Skip to content

Dimension Co-ordinates incorectly saving _FillValue attribute #1865

@ghost

Description

Code Sample, a copy-pastable example if possible

import xarray as xr
import pandas as pd
import numpy as np

temp = 273.15 + 25 * np.random.randn(2, 2)
lon = [0.0, 5.0]
lat = [10.0, 20.0]

ds = xr.Dataset({'temperature': (['lat', 'lon'], temp)},
                coords={'lat': lat,
                        'lon': lon})

ds['lat'].attrs = {
    'standard_name': 'latitude',
    'long_name': 'latitude',
    'units': 'degrees_north',
    'axis': 'Y'}
ds['lon'].attrs = {
    'standard_name': 'longitude',
    'long_name': 'longitude',
    'units': 'degrees_east',
    'axis': 'X'}
ds['temperature'].attrs = {
    'standard_name': 'air_temperature',
    'units': 'K'}
ds.attrs = {
    ('title', 'non-conforming CF 1.6 data produced by xarray 0.10'),
    ('Conventions', 'CF-1.6')}

ds.to_netcdf('/tmp/test.nc')

Problem description

According to the last sentence of the first paragraph of 2.5.1. Missing data, valid and actual range of data in NetCDF Climate and Forecast (CF) Metadata Conventions 1.7:

Missing data is not allowed in coordinate variables.

When I use the conformance checker it issues an INFO message to this point for the co-ordinate variables.

Output of CF-Checker follows...

CHECKING` NetCDF FILE: /tmp/29428.nc
=====================
Using CF Checker Version 3.0.0
Checking against CF Version CF-1.6
Using Standard Name Table Version 48 (2017-11-28T15:32:48Z)
Using Area Type Table Version 6 (22 February 2017)


------------------
Checking variable: temperature
------------------

------------------
Checking variable: lat
------------------
INFO: attribute _FillValue is being used in a non-standard way

------------------
Checking variable: lon
------------------
INFO: attribute _FillValue is being used in a non-standard way

ERRORS detected: 0
WARNINGS given: 0
INFORMATION messages: 2

Expected Output

Co-ordinate variables should not store a _FillValue attribute

Output of xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Linux
OS-release: 4.14.15-1-ARCH
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
xarray: 0.10.0
pandas: 0.22.0
numpy: 1.14.0
scipy: 1.0.0
netCDF4: 1.3.1
h5netcdf: 0.5.0
Nio: None
bottleneck: 1.2.1
cyordereddict: None
dask: 0.16.1
matplotlib: 2.1.2
cartopy: None
seaborn: None
setuptools: 38.4.0
pip: 9.0.1
conda: None
pytest: None
IPython: None
sphinx: None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions