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

Author

Hongyuan Jia

Methods


Method new()

Create an EPW morpher.

Usage

EpwMorpher$new(
  store,
  epw,
  site_id = NULL,
  recipe = epw_morph_recipe("belcher"),
  label = NULL
)

Arguments

store

An EsgStore object.

epw

EPW path or an eplusr::Epw object.

site_id

Optional site identifier.

recipe

EPW morphing recipe.

label

Optional source label.


Method required_variables()

Return recipe-required CMIP variable IDs.

Usage

EpwMorpher$required_variables()


Method 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,
  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.

baseline_id

Optional baseline summary ID.

by

Climate grouping columns.

strict

Whether required-data issues are errors.


Method summarise_climate()

Summarise extracted climate data by period and month.

Usage

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

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.


Method summarise_baseline()

Summarise baseline EPW weather by month.

Usage

EpwMorpher$summarise_baseline(overwrite = FALSE)

Arguments

overwrite

Whether to replace existing rows.


Method plan()

Create a morphing plan and monthly factors.

Usage

EpwMorpher$plan(
  summary_id,
  reference_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.

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.


Method preview_plan()

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

Usage

EpwMorpher$preview_plan(
  summary_id,
  reference_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.

baseline_id

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

by

Climate grouping columns.

strict

Whether missing required variables are blocking errors.


Method diagnose()

Diagnose a morphing plan.

Usage

EpwMorpher$diagnose(morph_id)

Arguments

morph_id

Morphing plan ID.


Method check()

Abort if a morphing plan has blocking diagnostics.

Usage

EpwMorpher$check(morph_id)

Arguments

morph_id

Morphing plan ID.


Method run()

Execute a morphing plan and write hourly result Parquet files.

Usage

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

Arguments

morph_id

Morphing plan ID.

overwrite

Whether to overwrite existing result files.

resume

Whether to reuse complete existing results.


Method write_epw()

Write future EPW files from morphing results.

Usage

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

Arguments

morph_id

Morphing plan ID.

dir

Output directory. 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.


Method workflow()

Run the store-native EPW morphing workflow.

Usage

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

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().

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.


Method status()

Return morphing plan status rows.

Usage

EpwMorpher$status(morph_id = NULL)

Arguments

morph_id

Optional morphing plan IDs.


Method outputs()

Return future EPW output rows.

Usage

EpwMorpher$outputs(morph_id = NULL)

Arguments

morph_id

Optional morphing plan IDs.


Method clone()

The objects of this class are cloneable with this method.

Usage

EpwMorpher$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.