-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
xrlint raises some false alarams on coordinate bounds.
To Reproduce
import xarray as xr
import xrlint.all as xrl
global_attrs = {
"Conventions": "CF-1.12",
"title": "My title",
"references": "DOI:1234",
"institution": "My institute",
"source": "My source",
"comment": "My comment",
"history": "My history",
}
lat = xr.DataArray(
[0.5, 1.5, 2.5],
dims="lat",
attrs={
"standard_name": "latitude",
"long_name": "latitude",
"units": "degrees_north",
"bounds": "lat_bounds"
}
)
lat_bounds = xr.DataArray(
[[0, 1], [1, 2], [2, 3]],
dims=("lat", "bounds"),
)
ds = xr.Dataset(
{"lat_bounds": lat_bounds},
coords={"lat": lat},
attrs=global_attrs
)
# Run linter
linter = xrl.new_linter("recommended")
res = linter.validate(ds)
for msg in res.messages:
print(msg.node_path, msg.message)Output
ds Data variable dimension without coordinates: bounds.
ds.data_vars['lat_bounds'].attrs Missing metadata, attributes are empty.
ds.data_vars['lat_bounds'] Missing attribute 'standard_name'.
ds.data_vars['lat_bounds'] Missing attribute 'long_name'.
ds.data_vars['lat_bounds'] Missing attribute 'units'.
Expected behavior
No errors, because bounds share their attributes with the corresponding coordinate variable.
Python Environment
- operating system: Rock Linux
- XRLint version, output of
xrlint --version: 0.5.1 - optional: packages and their versions, output of
pip listorconda list:
Additional context
None
Traceback
None
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working