Skip to content
Merged
29 changes: 23 additions & 6 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,32 @@

## Version 0.5.0 (in development)

### Incompatible API changes:
### Changes

- Renamed nodes and node properties for consistency and clarity:
- renamed `DataArrayNode` into `VariableNode`
- renamed `DataArrayNode.data_array` into `VariableNode.array`
- Rule `no-empty-chunks` has taken off the `"recommended"` settings
as there is no easy/efficient way to tell whether a dataset has
been written using `write_emtpy_chunks` option or not.
The rule message itself has been fixed. (#45)

- Adjusted messages of rules `var-units` and `time-coordinate`
to be consistent with messages of other rules.

- Core rule `dataset-title-attr` has been moved into `xcube` plugin
and renamed to `xcube/dataset-title` because the core rule `var-descr`
covers checking for dataset titles.

### Incompatible API changes

- Changed general use of term _verify_ into _validate_:
- prefixed `RuleOp` methods by `validate_` for clarity.
- renamed `XRLint.verify_datasets()` into `validate_files()`
- renamed `Lint.verify_dataset()` into `validate()`

- Various changes for improved clarity and consistency
regarding configuration management:
- Renamed nodes and node properties for clarity and consistency:
- renamed `DataArrayNode` into `VariableNode`
- renamed `DataArrayNode.data_array` into `VariableNode.array`

- Various changes for improved clarity regarding configuration management:
- introduced type aliases `ConfigLike` and `ConfigObjectLike`.
- renamed `Config` into `ConfigObject`
- renamed `ConfigList.configs` into `config_objects`
Expand All @@ -25,6 +38,10 @@
- added class method `from_config()` to `ConfigList`.
- removed function `xrlint.config.merge_configs` as it was no longer used.

### Other changes

- Added more tests so we finally reached 100% coverage.

## Version 0.4.1 (from 2025-01-31)

### Changes
Expand Down
15 changes: 8 additions & 7 deletions docs/rule-ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ Dimensions of data variables should have corresponding coordinates.

Contained in: `all`-:material-lightning-bolt: `recommended`-:material-lightning-bolt:

### :material-lightbulb: `dataset-title-attr`

Datasets should be given a non-empty title.

Contained in: `all`-:material-lightning-bolt: `recommended`-:material-alert:

### :material-bug: `grid-mappings`

Grid mappings, if any, shall have valid grid mapping coordinate variables.
Expand Down Expand Up @@ -69,7 +63,7 @@ Contained in: `all`-:material-lightning-bolt: `recommended`-:material-alert:
Empty chunks should not be encoded and written. The rule currently applies to Zarr format only.
[:material-information-variant:](https://docs.xarray.dev/en/stable/generated/xarray.Dataset.to_zarr.html#xarray-dataset-to-zarr)

Contained in: `all`-:material-lightning-bolt: `recommended`-:material-alert:
Contained in: `all`-:material-lightning-bolt: `recommended`-:material-circle-off-outline:

### :material-bug: `time-coordinate`

Expand Down Expand Up @@ -122,6 +116,13 @@ Spatial data variables should encode xcube color mappings in their metadata.

Contained in: `all`-:material-lightning-bolt: `recommended`-:material-alert:

### :material-bug: `dataset-title`

Datasets should be given a non-empty title.
[:material-information-variant:](https://xcube.readthedocs.io/en/latest/cubespec.html#metadata)

Contained in: `all`-:material-lightning-bolt: `recommended`-:material-lightning-bolt:

### :material-lightbulb: `grid-mapping-naming`

Grid mapping variables should be called 'spatial_ref' or 'crs' for compatibility with rioxarray and other packages.
Expand Down
1 change: 0 additions & 1 deletion docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

## Nice to have

- add some more tests so we reach 100% coverage
- support `autofix` feature
- support `md` (markdown) output format
- support formatter op args/kwargs and apply validation schema
Expand Down
36 changes: 29 additions & 7 deletions notebooks/mkdataset.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
import numpy as np
import xarray as xr

nx = 2
ny = 3
nt = 4
nx = 720
ny = 360
nt = 5

ncx = 180
ncy = 180
nct = 1


def make_dataset() -> xr.Dataset:
"""Create a dataset that passes xrlint core rules."""

return xr.Dataset(
attrs=dict(title="SST-Climatology Subset"),
attrs=dict(
Conventions="CF-1.10",
title="SST-Climatology Subset",
history="2025-01-31 17:31:00 - created;",
institution="BC",
source="SST CCI L4",
references="https://climate.esa.int/en/projects/sea-surface-temperature/",
comment="Demo dataset",
),
coords={
"x": xr.DataArray(
np.linspace(-180, 180, nx),
Expand Down Expand Up @@ -53,15 +65,25 @@ def make_dataset() -> xr.Dataset:
"sst": xr.DataArray(
np.random.random((nt, ny, nx)),
dims=["time", "y", "x"],
attrs={"units": "kelvin", "grid_mapping": "spatial_ref"},
attrs={
"standard_name": "sea_surface_temperature",
"long_name": "sea surface temperature",
"units": "kelvin",
"grid_mapping": "spatial_ref",
},
),
"sst_anomaly": xr.DataArray(
np.random.random((nt, ny, nx)),
dims=["time", "y", "x"],
attrs={"units": "kelvin", "grid_mapping": "spatial_ref"},
attrs={
"standard_name": "sea_surface_temperature_anomaly",
"long_name": "sea surface temperature anomaly",
"units": "kelvin",
"grid_mapping": "spatial_ref",
},
),
},
)
).chunk(time=nct, y=ncy, x=ncx)


def make_dataset_with_issues() -> xr.Dataset:
Expand Down
Loading