Commit c075c24f authored by Cynthia Crowley's avatar Cynthia Crowley

Pass window arg to all calls of workspace.forcing(), add tags/targets to forcing steps

parent 5660a98d
Pipeline #74248941 failed with stages
in 23 minutes and 10 seconds
......@@ -72,7 +72,7 @@ def compute_basin_results(workspace: DefaultWorkspace,
yearmon: str,
target: Optional[str]=None,
member: Optional[str]=None) -> List[Step]:
pixel_forcing = workspace.forcing(yearmon=yearmon, target=target, member=member)
pixel_forcing = workspace.forcing(yearmon=yearmon, target=target, member=member, window=1)
pixel_results = workspace.results(yearmon=yearmon, window=1, target=target, member=member)
basin_results = workspace.results(yearmon=yearmon, window=1, target=target, member=member, basis=Basis.BASIN)
......@@ -121,7 +121,7 @@ def run_lsm(workspace: DefaultWorkspace, static: Static, *,
next_state = workspace.state(yearmon=get_next_yearmon(yearmon))
results = workspace.results(yearmon=yearmon, window=1, target=target, member=member)
forcing = workspace.forcing(yearmon=yearmon, target=target, member=member)
forcing = workspace.forcing(yearmon=yearmon, target=target, member=member, window=1)
return [
wsim_lsm(
......@@ -402,7 +402,7 @@ def forcing_summary(workspace: DefaultWorkspace, ensemble_members: List[str], *,
-> List[Step]:
return [
wsim_integrate(
inputs=[workspace.forcing(yearmon=yearmon, target=target, member=member) for member in ensemble_members],
inputs=[workspace.forcing(yearmon=yearmon, target=target, member=member, window=1) for member in ensemble_members],
stats=['q25', 'q50', 'q75'],
output=workspace.forcing_summary(yearmon=yearmon, target=target)
)
......
......@@ -333,7 +333,7 @@ def compute_plant_losses(workspace: DefaultWorkspace,
basis=Basis.POWER_PLANT)
basin_results = workspace.results(yearmon=yearmon, window=1, basis=Basis.BASIN, target=target, member=member)
forcing = workspace.forcing(yearmon=yearmon, target=target, member=member)
forcing = workspace.forcing(yearmon=yearmon, target=target, member=member, window=1)
rp = workspace.return_period(yearmon=yearmon, target=target, member=member, window=1)
loss_factors = workspace.basin_loss_factors(yearmon=yearmon, target=target, member=member)
......
......@@ -128,7 +128,7 @@ def monthly_forecast(config: Config,
# Assemble forcing inputs for forecast
steps += meta_steps['prepare_forecasts'].require(
create_forcing_file(config.workspace(), config.forecast_data(),
yearmon=yearmon, target=target, member=member))
yearmon=yearmon, target=target, member=member, window=1))
for member in config.forecast_ensemble_members(yearmon):
if config.should_run_lsm(yearmon):
......
......@@ -38,10 +38,16 @@ def spinup(config, meta_steps):
steps += compute_climate_norms(config)
steps += run_lsm_with_monthly_norms(config, years=100)
forcing_1mo = Step.make_empty()
for yearmon in config.historical_yearmons():
steps += config.observed_data().prep_steps(yearmon=yearmon)
steps += create_forcing_file(config.workspace(), config.observed_data(), yearmon=yearmon, window=1)
for step in create_forcing_file(config.workspace(), config.observed_data(), yearmon=yearmon, window=1):
forcing_1mo = forcing_1mo.merge(step)
steps += create_tag(name=config.workspace().tag('spinup_1mo_forcing'),
dependencies=forcing_1mo.targets)
forcing_1mo.replace_targets_with_tag_file(config.workspace().tag('spinup_1mo_forcing'))
steps.append(forcing_1mo)
steps += run_lsm_from_final_norm_state(config)
for month in all_months:
......@@ -317,7 +323,8 @@ def time_integrate_forcing(config:Config, window: int, *, basis: Optional[Basis]
config.workspace().tag('{}spinup_1mo_forcing'.format((basis.value + '_') if basis else '')))
return [
integrate
integrate,
*tag_steps
]
......
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