-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pandas as pd | ||
|
||
from wind_up.constants import TIMESTAMP_COL, TOGGLE_DIR | ||
from wind_up.models import WindUpConfig | ||
|
||
|
||
def check_toggle_files_exist(cfg: WindUpConfig) -> None: | ||
if cfg.toggle is not None: | ||
toggle_df = pd.read_parquet(TOGGLE_DIR / cfg.asset.name / cfg.toggle.toggle_filename) | ||
if ( | ||
not toggle_df.groupby(level="TurbineName").idxmin()[TIMESTAMP_COL] <= cfg.analysis_first_dt_utc_start | ||
and toggle_df.groupby(level="TurbineName").idxmax()[TIMESTAMP_COL] >= cfg.analysis_last_dt_utc_start | ||
): | ||
msg = ( | ||
f"toggle file {cfg.toggle.toggle_filename} does not cover the analysis period " | ||
f"{cfg.analysis_first_dt_utc_start} to {cfg.analysis_last_dt_utc_start}" | ||
) | ||
raise RuntimeError(msg) | ||
|
||
|
||
def check_input_data(cfg: WindUpConfig) -> None: | ||
print(f"\nchecking input data for {cfg.assessment_name}") | ||
# see if all the input files needed for this cfg exists | ||
check_toggle_files_exist(cfg=cfg) |