Skip to content

[Option Appraisal Module] [Package 1: Measures] Split 1: Adds MeasureConfig dataclasses for serializable measure configuration.#1276

Draft
spjuhel wants to merge 11 commits intodevelopfrom
feature/option-appraisal-dataclasses
Draft

[Option Appraisal Module] [Package 1: Measures] Split 1: Adds MeasureConfig dataclasses for serializable measure configuration.#1276
spjuhel wants to merge 11 commits intodevelopfrom
feature/option-appraisal-dataclasses

Conversation

@spjuhel
Copy link
Copy Markdown
Collaborator

@spjuhel spjuhel commented Apr 7, 2026

Changes proposed in this PR:

This PR introduces a new module defining a family of dataclasses that encode adaptation measure parameters in a serializable, declarative form. This is a preparatory step for the broader Measure/MeasureSet rework.

The objective is to retain the possibility to define measures from modifiers in addition to the upcoming system that will use python functions directly, and provide a (better) user interface for this.

no existing code is changed.

New dataclasses:

  • MeasureConfig top-level configuration for a single measure, aggregating all modifier configs below.
  • ImpfsetModifierConfig parameters for modifying impact functions (intensity, MDD, PAA scaling, optional replacement)
  • HazardModifierConfig parameters for modifying hazard (intensity scaling, frequency cutoff, optional replacement)
  • ExposuresModifierConfig parameters for modifying exposures (impact function remapping, zeroing regions, optional replacement)
  • CostIncomeConfig serializable representation of cost/income cash flow parameters

All configs inherit from the abstract _ModifierConfig base, which provides shared to_dict/from_dict and a __repr__ that highlights non-default fields.

MeasureConfig supports full serialization to/from dict, YAML, and legacy Excel rows (from_row), which will serve as the migration path for the existing file-based I/O in MeasureSet.

PR Author Checklist

PR Reviewer Checklist

@chahank
Copy link
Copy Markdown
Member

chahank commented Apr 7, 2026

Excellent idea!

spjuhel added 7 commits April 7, 2026 10:22
Cleans-up, Docstringfies

Better to_dict, color parser, and post_inits

Removes duplicate docstring
…MADA-project/climada_python into feature/option-appraisal-dataclasses
@spjuhel spjuhel changed the title [Option Appraisal Module] - Adds MeasureConfig dataclasses for serializable measure configuration. [Option Appraisal Module] [Package 1: Measures] Split 1: Adds MeasureConfig dataclasses for serializable measure configuration. Apr 7, 2026
@spjuhel
Copy link
Copy Markdown
Collaborator Author

spjuhel commented Apr 8, 2026

@chahank

Question: Should measures (defined by MeasureConfig) be specific to a hazard? (I see reasons for both yes and no)

Currently, they are specific (thus configs require you to provide haz_type).

I see how you could want modifications of impact function to be for multiple hazards
But also you should probably not be able to apply a shift in intensity for multiple hazards?

Any opinion on that?

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.

2 participants