EpwMorpher consumes completed EsgStore extraction outputs and creates future EPW files through a store-backed morphing workflow.

Author

Hongyuan Jia

Methods


EpwMorpher$new()

Create an EPW morpher.

Usage

EpwMorpher$new(
  store,
  epw,
  site_id = NULL,
  transform = monthly_transform("original_morphing"),
  label = NULL
)

Arguments

store

An EsgStore object.

epw

Baseline EPW path, internal EpwFile, or an external object inheriting from "Epw".

site_id

Optional site identifier.

transform

A reusable weather transformation created by a scale-specific transform constructor.

label

Optional source label.


EpwMorpher$required_variables()

Return transform-required CMIP variable IDs.

Usage

EpwMorpher$required_variables()


EpwMorpher$preflight()

Preflight EPW morphing inputs without writing store state.

Usage

EpwMorpher$preflight(
  plan_id = NULL,
  periods = NULL,
  reference_plan_id = NULL,
  reference_periods = NULL,
  summary_id = NULL,
  reference_summary_id = NULL,
  observed_plan_id = NULL,
  observed_periods = NULL,
  observed_summary_id = NULL,
  baseline_id = NULL,
  by = c("source_id", "experiment_id", "variant_label", "period"),
  strict = TRUE
)

Arguments

plan_id

Optional extraction plan IDs.

periods

Optional period table from epw_morph_periods().

reference_plan_id

Optional reference extraction plan IDs for change-factor backends.

reference_periods

Optional reference period table from epw_morph_periods().

summary_id

Optional climate summary ID.

reference_summary_id

Optional reference climate summary ID for change-factor backends.

observed_plan_id

Optional observed-weather extraction plan IDs.

observed_periods

Optional observed-weather period table.

observed_summary_id

Optional observed-weather summary ID.

baseline_id

Optional baseline summary ID.

by

Climate grouping columns.

strict

Whether required-data issues are errors.


EpwMorpher$summarise_climate()

Summarise extracted climate data by period and month.

Usage

EpwMorpher$summarise_climate(
  plan_id,
  periods,
  strict = TRUE,
  overwrite = FALSE,
  input_role = "model_future"
)

Arguments

plan_id

Extraction plan IDs.

periods

Period table from epw_morph_periods().

strict

Whether incomplete extraction coverage is an error.

overwrite

Whether to replace existing rows for this summary.

input_role

Source role used to validate raw variables and frequencies, one of model_future, model_historical, or observed_reference. Workflow calls select this automatically.


EpwMorpher$summarise_baseline()

Summarise baseline EPW weather by month.

Usage

EpwMorpher$summarise_baseline(overwrite = FALSE)

Arguments

overwrite

Whether to replace existing rows.


EpwMorpher$plan()

Create a morphing plan and monthly factors.

Usage

EpwMorpher$plan(
  summary_id,
  reference_summary_id = NULL,
  observed_summary_id = NULL,
  baseline_id = NULL,
  by = c("source_id", "experiment_id", "variant_label", "period"),
  strict = TRUE,
  overwrite = FALSE
)

Arguments

summary_id

Climate summary ID.

reference_summary_id

Optional reference climate summary ID for change-factor backends.

observed_summary_id

Optional observed-weather summary ID.

baseline_id

Baseline summary ID. If NULL, baseline summary is created.

by

Climate grouping columns.

strict

Whether missing required variables are blocking errors.

overwrite

Whether to replace an existing plan.


EpwMorpher$preview_plan()

Preview a morphing plan and monthly factors without writing store state.

Usage

EpwMorpher$preview_plan(
  summary_id,
  reference_summary_id = NULL,
  observed_summary_id = NULL,
  baseline_id = NULL,
  by = c("source_id", "experiment_id", "variant_label", "period"),
  strict = TRUE
)

Arguments

summary_id

Climate summary ID.

reference_summary_id

Optional reference climate summary ID for change-factor backends.

observed_summary_id

Optional observed-weather summary ID.

baseline_id

Baseline summary ID. If NULL, baseline summary is created.

by

Climate grouping columns.

strict

Whether missing required variables are blocking errors.


EpwMorpher$diagnose()

Diagnose a morphing plan.

Usage

EpwMorpher$diagnose(morph_id)

Arguments

morph_id

Morphing plan ID.


EpwMorpher$check()

Abort if a morphing plan has blocking diagnostics.

Usage

EpwMorpher$check(morph_id)

Arguments

morph_id

Morphing plan ID.


EpwMorpher$run()

Execute a morphing plan and write one hourly Parquet file per result member and weather year.

Usage

EpwMorpher$run(morph_id, overwrite = FALSE, resume = TRUE, reporter = NULL)

Arguments

morph_id

Morphing plan ID.

overwrite

Whether to overwrite existing result files.

resume

Whether to reuse complete existing results.

reporter

Optional workflow reporter used by task-level runs.


EpwMorpher$write_epw()

Write one future EPW file for every persisted result member.

Usage

EpwMorpher$write_epw(
  morph_id,
  dir,
  separate = TRUE,
  overwrite = FALSE,
  resume = TRUE,
  reporter = NULL
)

Arguments

morph_id

Morphing plan ID.

dir

Output directory inside the store root. Relative paths are resolved under the store root. If NULL, the workflow stops after writing morph result Parquet files and does not write EPW outputs.

separate

Whether to create case subdirectories.

overwrite

Whether to overwrite existing EPW files.

resume

Whether to reuse complete existing EPW outputs.

reporter

Optional workflow reporter used by task-level runs.


EpwMorpher$workflow()

Run the store-native EPW morphing workflow.

Usage

EpwMorpher$workflow(
  plan_id,
  periods,
  reference_plan_id = NULL,
  reference_periods = NULL,
  observed_plan_id = NULL,
  observed_periods = NULL,
  by = c("source_id", "experiment_id", "variant_label", "period"),
  strict = TRUE,
  dir = "outputs/future-epw",
  separate = TRUE,
  overwrite = FALSE,
  resume = TRUE,
  reporter = NULL
)

Arguments

plan_id

Extraction plan IDs.

periods

Period table from epw_morph_periods().

reference_plan_id

Optional reference extraction plan IDs for change-factor backends.

reference_periods

Optional reference period table from epw_morph_periods().

observed_plan_id

Optional observed-weather extraction plan IDs.

observed_periods

Optional observed-weather period table.

by

Climate grouping columns.

strict

Whether blocking diagnostics should abort the workflow.

dir

Output directory. Relative paths are resolved under the store root.

separate

Whether to create case subdirectories.

overwrite

Whether to overwrite existing plan, result, and EPW outputs.

resume

Whether to reuse complete existing result and EPW outputs.

reporter

Optional workflow reporter used by task-level runs.


EpwMorpher$status()

Return morphing plan status rows.

Usage

EpwMorpher$status(morph_id = NULL)

Arguments

morph_id

Optional morphing plan IDs.


EpwMorpher$process_data()

Read saved execution products for one morphing plan. The result is a list named by case ID. Each entry contains the saved plan and case, runtime options, backend factors, method-specific parts, runtime diagnostics and provenance, plus the associated result manifest rows in results. These are execution products, not preview factors.

Factor tables may summarize hourly values. Use method-specific parts for hourly application parameters where supplied by the backend. Empty or NULL products mean that the backend did not supply them. This interface does not reconstruct unrecorded pipeline stages. Multi-year members share one case payload. Reading checks its SHA256. Older runs without saved process data require an explicit rerun with overwrite = TRUE. No climate data are fetched by this method.

Usage

EpwMorpher$process_data(morph_id, case_id = NULL)

Arguments

morph_id

Morphing plan ID.

case_id

Optional case ID to read.


EpwMorpher$outputs()

Return future EPW output rows.

Usage

EpwMorpher$outputs(morph_id = NULL)

Arguments

morph_id

Optional morphing plan IDs.


EpwMorpher$clone()

The objects of this class are cloneable with this method.

Usage

EpwMorpher$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.