Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/46.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix up cell methods for `cnc_tavg-u-hxy-u` (see [#27](https://github.com/WCRP-CMIP/Variable-Registry/issues/27))
37 changes: 37 additions & 0 deletions scripts/27-fixes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
Fixes from #27
"""

from __future__ import annotations

import json
from pathlib import Path


def main():
"""
Apply the fixes
"""
REPO_ROOT = Path(__file__).parents[1]

for branded_variable, new_cell_methods in (
(
"cnc_tavg-u-hxy-u",
"area: time: mean",
),
):
with open(
REPO_ROOT / "src-data" / "variable" / f"{branded_variable}.json"
) as fh:
working = json.load(fh)

working["cell-methods"] = new_cell_methods

with open(
REPO_ROOT / "src-data" / "variable" / f"{branded_variable}.json", "w"
) as fh:
json.dump(working, fh, indent=4)


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion src-data/variable/cnc_tavg-u-hxy-u.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Canopy covered fraction",
"area-label": "u",
"cell-measures": "area: areacella",
"cell-methods": "area: mean where land time: mean",
"cell-methods": "area: time: mean",
"dimensions": [
"longitude",
"latitude",
Expand Down
Loading