Skip to content

Commit

Permalink
fix gap fill test
Browse files Browse the repository at this point in the history
  • Loading branch information
vergauwenthomas committed Sep 2, 2024
1 parent 31dc3de commit dfe6f40
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions tests/push_test/gap_and_fill_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def get_unfilled_station_solutions():
)

dataset.import_data_from_file()
dataset.coarsen_time_resolution(freq="1H")
dataset.coarsen_time_resolution(freq="1h")
dataset.apply_quality_control()
dataset.convert_outliers_to_gaps()

Expand Down Expand Up @@ -186,7 +186,7 @@ def _create_interpolation_solution():
overwrite_fill=True,
method="time",
max_consec_fill=10,
max_lead_to_gap_distance="2H",
max_lead_to_gap_distance="2h",
max_trail_to_gap_distance=None,
)

Expand All @@ -199,7 +199,7 @@ def _create_interpolation_solution():
overwrite_fill=True,
method="nearest",
max_consec_fill=4,
max_lead_to_gap_distance="2H",
max_lead_to_gap_distance="2h",
max_trail_to_gap_distance=None,
)
trg_sta_file = os.path.join(solution.solutions_dir, station_inter_sol_df)
Expand Down Expand Up @@ -227,7 +227,7 @@ def get_interp_solution():
overwrite_fill=True,
method="time",
max_consec_fill=10,
max_lead_to_gap_distance="2H",
max_lead_to_gap_distance="2h",
max_trail_to_gap_distance=None,
)

Expand All @@ -245,7 +245,7 @@ def get_interp_solution():
overwrite_fill=True,
method="linear",
max_consec_fill=4,
max_lead_to_gap_distance="2H",
max_lead_to_gap_distance="2h",
max_trail_to_gap_distance=None,
)
# check if this methods overwrites the linear fille
Expand All @@ -254,7 +254,7 @@ def get_interp_solution():
overwrite_fill=True,
method="nearest",
max_consec_fill=4,
max_lead_to_gap_distance="2H",
max_lead_to_gap_distance="2h",
max_trail_to_gap_distance=None,
)

Expand Down Expand Up @@ -368,9 +368,7 @@ def get_modeldata():
def _create_raw_gapfil_solution():
print("SOLUTION WILL BE OVERWRITTEN !!!!!")
trg_path = os.path.join(solution.solutions_dir, raw_gapfill_sol_file)
dataset.fill_gaps_with_raw_modeldata(
Modeldata=era, obstype="temp", overwrite_fill=True
)
dataset.fill_gaps_with_raw_modeldata(Model=era, obstype="temp", overwrite_fill=True)
dataset.get_full_status_df().to_pickle(trg_path)


Expand All @@ -382,7 +380,7 @@ def get_raw_gapfill_sol():
return pd.read_pickle(trg_path)


dataset.fill_gaps_with_raw_modeldata(Modeldata=era, obstype="temp", overwrite_fill=True)
dataset.fill_gaps_with_raw_modeldata(Model=era, obstype="temp", overwrite_fill=True)
# test raw gapfill on dataset
diff_df = solution.test_df_are_equal(
testdf=dataset.get_full_status_df(), solutiondf=get_raw_gapfill_sol()
Expand All @@ -399,7 +397,7 @@ def _create_debias_gapfil_solution():
print("SOLUTION WILL BE OVERWRITTEN !!!!!")
trg_path = os.path.join(solution.solutions_dir, debias_gapfill_sol_file)
dataset.fill_gaps_with_debiased_modeldata(
Modeldata=era,
Model=era,
obstype="temp",
overwrite_fill=True,
leading_period_duration="15h",
Expand All @@ -419,7 +417,7 @@ def get_debias_gapfill_sol():


dataset.fill_gaps_with_debiased_modeldata(
Modeldata=era,
Model=era,
obstype="temp",
overwrite_fill=True,
leading_period_duration="15h",
Expand All @@ -445,7 +443,7 @@ def _create_diur_debias_gapfil_solution():
print("SOLUTION WILL BE OVERWRITTEN !!!!!")
trg_path = os.path.join(solution.solutions_dir, diur_debias_gapfill_sol_file)
dataset.fill_gaps_with_diurnal_debiased_modeldata(
Modeldata=era,
Model=era,
obstype="temp",
overwrite_fill=True,
leading_period_duration="48h",
Expand All @@ -464,7 +462,7 @@ def get_diur_debias_gapfill_sol():


dataset.fill_gaps_with_diurnal_debiased_modeldata(
Modeldata=era,
Model=era,
obstype="temp",
overwrite_fill=True,
leading_period_duration="48h",
Expand All @@ -489,7 +487,7 @@ def _create_weight_diur_debias_gapfil_solution():
print("SOLUTION WILL BE OVERWRITTEN !!!!!")
trg_path = os.path.join(solution.solutions_dir, weight_diur_debias_gapfill_sol_file)
dataset.fill_gaps_with_weighted_diurnal_debias_modeldata(
Modeldata=era,
Model=era,
obstype="temp",
overwrite_fill=True,
leading_period_duration="58h",
Expand Down Expand Up @@ -517,12 +515,12 @@ def get_weight_diur_debias_gapfill_sol():


dataset.fill_gaps_with_weighted_diurnal_debias_modeldata(
Modeldata=era,
Model=era,
obstype="temp",
overwrite_fill=True,
leading_period_duration="58H",
leading_period_duration="58h",
min_lead_debias_sample_size=1,
trailing_period_duration="24H",
trailing_period_duration="24h",
min_trail_debias_sample_size=1,
)

Expand Down

0 comments on commit dfe6f40

Please sign in to comment.