Skip to content

Commit c7b5625

Browse files
authored
Merge pull request #34 from znicholls/update-horizontal-labels
Update to match latest version of horizontal labels
2 parents c90d8ea + ae51fef commit c7b5625

4 files changed

Lines changed: 313 additions & 315 deletions

File tree

changelog/34.breaking.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Update horizontal label generation to be in line with Table F3 of [the specification document](https://docs.google.com/document/d/19jzecgymgiiEsTDzaaqeLP6pTvLT-NzCMaq-wu-QoOc/edit?pli=1&tab=t.0) as at September 24 2025.
2+
3+
The horizontal label "hxys" is now just "hs", "hys" is now "hyb".

src/cmip_branded_variable_mapper/horizontal_label.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from __future__ import annotations
66

77

8-
def get_horizontal_label( # noqa: PLR0911
8+
def get_horizontal_label(
99
dimensions: tuple[str, ...],
1010
fallback: str = "hm",
1111
) -> str:
@@ -14,7 +14,7 @@ def get_horizontal_label( # noqa: PLR0911
1414
1515
The logic this should follow is defined in Table F3 of
1616
[Taylor et al.](https://docs.google.com/document/d/19jzecgymgiiEsTDzaaqeLP6pTvLT-NzCMaq-wu-QoOc/edit?pli=1&tab=t.0).
17-
This was last checked on June 14 2025.
17+
This was last checked on September 24 2025.
1818
If updates have been made since,
1919
this code may be out of date with the underlying specification.
2020
@@ -48,23 +48,16 @@ def get_horizontal_label( # noqa: PLR0911
4848
return "hy"
4949

5050
if "site" in dimensions:
51-
return "hxys"
52-
# # TODO: update to new logic
53-
# return "hs"
51+
return "hs"
5452

5553
if latitude_present and basin_present:
56-
return "hys"
57-
# # TODO: update to new logic
58-
# if (latitude_present and basin_present) or (
59-
# "gridlatitude" in dimensions and basin_present
60-
# ):
61-
# return "hyb"
54+
return "hyb"
6255

63-
# # TODO: delete this when update to new logic (maybe, if it hasn't changed again)
64-
if "gridlatitude" in dimensions and basin_present:
65-
return "ht"
66-
67-
if "oline" in dimensions or "siline" in dimensions:
56+
if (
57+
"oline" in dimensions
58+
or "siline" in dimensions
59+
or ("gridlatitude" in dimensions and basin_present)
60+
):
6861
return "ht"
6962

7063
return fallback

0 commit comments

Comments
 (0)