Skip to content

feat: climate risk from cmip cordex - #18

Open
jdroenner wants to merge 1 commit into
mainfrom
cmip_cordex
Open

feat: climate risk from cmip cordex#18
jdroenner wants to merge 1 commit into
mainfrom
cmip_cordex

Conversation

@jdroenner

Copy link
Copy Markdown
Member

No description provided.

@coveralls

coveralls commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

Coverage is 85.756%cmip_cordex into main. No base build found for main.

@jdroenner jdroenner changed the title feat: climeate rist from cmip cordex feat: climate risk from cmip cordex Jul 8, 2026

@ChristianBeilschmidt ChristianBeilschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Konnte das aus Gründen (Karte) nicht anwenden. Aber hier schon mal meine Kommentare.

Comment thread k8s/pod.yaml Outdated
volumeMounts:
- name: pgdata
mountPath: /var/lib/postgresql/data
mountPath: /var/lib/postgresql/18/docker

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warum ist das anders, obwohl sich sonst nichts an der Container-Config geändert hat?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread rust-toolchain.toml Outdated
Comment thread backend/Cargo.toml Outdated
Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated

/// Calculates climate-risk indicators from CORDEX/CMIP5 climate data for a given point and time window.
#[derive(Debug, Clone)]
pub struct ClimateCordex5Process;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vielleicht mehr User-facing benennen. Was macht der User damit?

Cordex sagt ja mehr über die Quelldaten.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ich hab es umbenannt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, am besten auch noch Modul umbenennen.

Comment on lines +1023 to +1042
let wfl_ids =
try_join_all(variable_workflows.map(|wfl| register_workflow_handler(configuration, wfl)))
.await;

let wfl_ids = match wfl_ids {
Ok(id) => id,
Err(e) => {
if let Some(error) = error_response(&e) {
anyhow::bail!("Failed to register a workflow `{e}`: {error:?}");
}
anyhow::bail!("Failed to register a workflow `{e}`");
}
};

let wfl_id_str = wfl_ids
.iter()
.map(|workflow_id| workflow_id.id.to_string())
.collect::<Vec<_>>();

for (wf_id, v) in wfl_id_str.iter().zip(var_props.iter()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die Variablen-Namen werden in einem Monat kryptisch sein. Ist nicht so gebräuchlich, also ausschreiben?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kryptische Variablennamen sind ausgeschrieben (z.B. model statt m, workflow statt wfl).

Comment thread rust-toolchain.toml Outdated
@@ -0,0 +1 @@
./backend/rust-toolchain.toml No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage am besten > 80% lassen.

Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated
Comment thread backend/src/processes/climate_cordex_cmip5.rs Outdated
Comment thread frontend/src/app/create-new-auto/simple-form-field.ts Outdated

@ChristianBeilschmidt ChristianBeilschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich konnte jetzt erst einmal nur Code-only anschauen. Müssen noch mal wegen der Daten sprechen.

Comment on lines +41 to +47
/// Name of a row property that carries the cell color (hex) for this column.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub color_field: Option<String>,
/// Name of a row property that carries a ready-to-display label for this column.
/// When set, the frontend renders it instead of the raw value.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub label_field: Option<String>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check: Sind das validate table schema Felder (https://datapackage.org/standard/table-schema/)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erledigt. Alle verwendeten Feld-Typen sind gültige Table-Schema-Typen (string/number/integer/boolean). Die nicht standardkonformen list/itemType wurden durch type: "array" mit items-Deskriptor ersetzt.

String,
Number,
Integer,
Percentage,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Es gibt keinen Percentage-Typ bei TableSchema: https://datapackage.org/standard/table-schema/#field-types

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Percentage ist jetzt nur noch ein Units-Helfer und taucht nicht mehr als Table-Schema-Feld-Typ auf. Die Prozent-Anzeige (z.B. "+10 days (+20 %)") läuft über die biois-Extension (labelField/colorField).


impl Default for YearRange {
fn default() -> Self {
YearRange(20)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich denke nicht, dass das ein guter Default ist.
Wenn das bei dem einen Prozess sinnvoll ist, dann vielleicht den Default dort definieren.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Der Default wurde aus units.rs entfernt und ist jetzt prozesslokal definiert (default_year_range() in climate_risk).

}
}

/// Length of a climate window in years (e.g., 5-30 years).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Length of a climate window in years (e.g., 5-30 years).
/// Length of a time window in years (e.g., 5 years).

Hat ja nicht immer was mit Klima zu tun und man kann kein von bis angeben.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring wie vorgeschlagen angepasst: Length of a time window in years (e.g., 5 years).

pub region: Option<CordexRegion>,
}

#[derive(Deserialize, Serialize, Debug, JsonSchema, ToSchema, Clone)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brauchst du bei den Ausgaben immer auch Deserialize?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Für die Ausgaben wird nur noch Serialize benötigt; Deserialize ist auf die Eingabetypen beschränkt.

</td>
}
}
@case (ColumnType.Percentage) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Den Typ gibt es ja nicht in TableSchema

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erledigt - der Feld-Typ heißt jetzt array (mit items-Deskriptor) statt list, konform zu Table Schema.

<mat-chip class="cell-content">
<span
class="color-dot"
[style.background-color]="element[column.colorField]"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Irgendwie fühlt es sich falsch an, eine Spalte mit Farbwerten zu haben.
Evtl. finden wir andere Felder für Metadaten oder müssen eine Extension machen (https://datapackage.org/standard/extensions/).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die Farb-/Label-Werte sind jetzt hiddenFields und über eine Table-Schema-Extension (biois.display mit kind/labelField/colorField) an die Datenfelder gebunden. Keine sichtbare Farbwert-Spalte mehr.

Comment on lines +100 to +106
title:
typeof innerValue === 'object' &&
innerValue !== null &&
'name' in innerValue &&
typeof innerValue.name === 'string'
? innerValue.name
: this.fieldName(key),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woh, was ist hier passiert? Evtl. eine Funktion mit Doc?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Der Code ist in benannte Funktionen mit Doc-Kommentaren zerlegt (u.a. dataResourceTitle, fixDataValue).


/// Calculates climate-risk indicators from CORDEX/CMIP5 climate data for a given point and time window.
#[derive(Debug, Clone)]
pub struct ClimateCordex5Process;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, am besten auch noch Modul umbenennen.

Comment thread backend/Cargo.toml Outdated
@jdroenner

Copy link
Copy Markdown
Member Author

Alle Review-Kommentare wurden adressiert. Zusammenfassung der Änderungen:

Backend (climate_risk):

  • Modul aufgeteilt in compute.rs / types.rs / workflow.rs / mod.rs
  • Eingaben werden am Prozessrand typisiert via parse_inputs (mit Fehlerkontext) konvertiert; keine rohen JSON-Werte mehr
  • expect aus dem User-Input-Pfad entfernt (Result-Propagation)
  • ProbabilityClass als Enum modelliert, Schwellwerte aus return_period_years() (1:20_000 bis 1:5); 365.25 als DAYS_PER_JULIAN_YEAR
  • Überlappende Regionen: nearest_containing wählt die nächstgelegene enthaltene Bounding Box (mit Test)
  • Tests: alle it_...-Konvention, approx-Asserts, Props-Tests konsolidiert
  • Anzeige (Label/Farbe) über biois-Table-Schema-Extension mit hiddenFields statt sichtbarer Farbspalten

Table Schema (shared):

  • Nicht standardkonforme Typen list/itemType ersetzt durch array + items-Deskriptor (gültige Table-Schema-Felder)
  • Percentage nur noch Units-Helfer, kein Feld-Typ

Frontend:

  • array-Typ-Unterstützung, hiddenFields-Filterung, resolveItemsSchema/resolveSchemaRef-Refactoring, JSDoc ergänzt

Prüfungen: cargo test --lib 146 passed (11 bekannte bb8-Timeouts der DB), Clippy/Fmt clean, Frontend 95 Tests + Lint/Prettier clean. @ChristianBeilschmidt gerne erneut reviewen.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants