Commit 4a0b1d38 authored by Dan Baston's avatar Dan Baston

Add steps for time-integrated forcing summaries

parent 24a2f6ba
Pipeline #76622484 passed with stages
in 17 minutes and 50 seconds
......@@ -172,7 +172,11 @@ class TestCFSConfig(unittest.TestCase):
# forcing
assertBuilt(ws.forcing(yearmon=yearmon, window=1))
assertBuilt(ws.forcing_summary(yearmon=yearmon, target=target))
assertBuilt(ws.forcing_summary(yearmon=yearmon, target=target, window=1))
# integrated forcing
assertBuilt(ws.forcing(yearmon=yearmon, window=3))
assertBuilt(ws.forcing_summary(yearmon=yearmon, target=target, window=3))
# results
assertBuilt(ws.results(yearmon=yearmon, window=1))
......@@ -255,9 +259,9 @@ class TestCFSConfig(unittest.TestCase):
all_adjusted_monthly_composites = step_for_target(steps, 'all_adjusted_composites')
self.assertEqual(len(all_adjusted_monthly_composites.dependencies), num_outputs)
# a forcing summary is produced for each forecast month
# a forcing summary is produced for each forecast month / integration period
forcing_summaries = step_for_target(steps, 'forcing_summaries')
self.assertEqual(len(forcing_summaries.dependencies), len(self.config.forecast_targets(yearmon)))
self.assertEqual(len(forcing_summaries.dependencies), len(self.config.forecast_targets(yearmon))*(1 + len(self.config.integration_windows())))
# a results summary is produced for each forecast month / integration period
results_summaries = step_for_target(steps, 'results_summaries')
......
......@@ -260,8 +260,8 @@ class TestWorkspacePaths(unittest.TestCase):
def test_forcing_summary(self):
self.assertEqual(
join(self.root, 'forcing_summary', 'forcing_summary_201612_trgt201708.nc'),
self.ws.forcing_summary(yearmon='201612', target='201708')
join(self.root, 'forcing_summary', 'forcing_summary_1mo_201612_trgt201708.nc'),
self.ws.forcing_summary(yearmon='201612', target='201708', window=1)
)
def test_fit_obs(self):
......
......@@ -402,13 +402,13 @@ def fit_var(config: ConfigBase,
]
def forcing_summary(workspace: DefaultWorkspace, ensemble_members: List[str], *, yearmon: str, target: str) \
def forcing_summary(workspace: DefaultWorkspace, ensemble_members: List[str], *, yearmon: str, target: str, window: int) \
-> List[Step]:
return [
wsim_integrate(
inputs=[workspace.forcing(yearmon=yearmon, target=target, member=member, window=1) for member in ensemble_members],
inputs=[workspace.forcing(yearmon=yearmon, target=target, member=member, window=window) for member in ensemble_members],
stats=['q25', 'q50', 'q75'],
output=workspace.forcing_summary(yearmon=yearmon, target=target)
output=workspace.forcing_summary(yearmon=yearmon, target=target, window=window)
)
]
......
......@@ -156,16 +156,17 @@ def monthly_forecast(config: Config,
target=target,
member=member)
steps += meta_steps['forcing_summaries'].require(forcing_summary(config.workspace(),
config.forecast_ensemble_members(yearmon),
yearmon=yearmon,
target=target))
for window in [1] + config.integration_windows():
# Summarize forecast ensemble
steps += meta_steps['results_summaries'].require(
result_summary(config.workspace(), config.forecast_ensemble_members(yearmon),
yearmon=yearmon, target=target, window=window))
steps += meta_steps['forcing_summaries'].require(forcing_summary(config.workspace(),
config.forecast_ensemble_members(yearmon),
yearmon=yearmon,
target=target,
window=window))
steps += return_period_summary(config.workspace(), config.forecast_ensemble_members(yearmon),
yearmon=yearmon, target=target, window=window)
steps += standard_anomaly_summary(config.workspace(), config.forecast_ensemble_members(yearmon),
......
......@@ -405,8 +405,8 @@ class DefaultWorkspace:
return self.make_path('anom', yearmon=yearmon, window=window, target=target, summary=True)
def forcing_summary(self, *, yearmon: str, target: str) -> str:
return self.make_path('forcing', yearmon=yearmon, target=target, summary=True)
def forcing_summary(self, *, yearmon: str, target: str, window: int) -> str:
return self.make_path('forcing', yearmon=yearmon, target=target, window= window, summary=True)
def results_summary(self, *, yearmon: str, window: int, target: Optional[str]=None) -> str:
return self.make_path('results', yearmon=yearmon, window=window, target=target, summary=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment