Skip to content

cd_summary(): stations sharing a long_name give indistinguishable rows #98

Description

@NewGraphEnvironment

If we do it: a cd_summary() table over several stations that share one long_name says which row is which station. If we never do: two rows read Mean discharge / Annual with different slopes and nothing to tell them apart — while cd_plot_comparison() beside the table labels the same series Mean discharge (q_site1).

Problem

series_check() tells callers that series from several sites need distinct variable names. The natural next step for streamflow is one long_name ("Mean discharge") on every station. cd_summary() (R/cd_summary.R) replaces variable with Parameter = long_name and drops variable, so those rows become indistinguishable. Measured in #93's review with q_site1 / q_site2.

#93 handled the same case in cd_plot_comparison(): a label shared by several variables gets (variable) appended, and facets key on variable + label so nothing can merge.

Proposed Solution

  • In cd_summary(), append (variable) to a Parameter shared by more than one variable — the same rule as cd_plot_comparison(), ideally lifted into one internal helper both call.
  • Test: two stations, one long_name → two distinct Parameter values; registered ERA5 variables unchanged (registry long_names are unique).

A second way to get indistinguishable rows: since #97 a trend table can hold both a raw-value and an anomaly trend of one series (bind_rows(cd_trend(x), cd_trend(ano)), told apart by trend_on). cd_summary() drops trend_on, so those rows differ only by Unit, and for an absolute variable such as tmean not even by that. Whatever disambiguates stations here should also cover trend_on, or cd_summary() should carry it.

Decided (plan gate, 2026-09-29): cd_summary() carries it: a Trend on column (Value/Anomaly) after Period, added only when the table holds both scales, so single-scale output keeps its shape. Chosen over always adding the column and over suffixing Parameter. The station rule landed as the shared helper label_disambiguate() (#108). A third look-alike source, several trend_start values, is #106.

Found by /code-check on #93; the trend_on case by the plan review for #97.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions