Skip to content
Snippets Groups Projects
Commit df93b9fc authored by leufen1's avatar leufen1
Browse files

include create_n_bootstrap_realizations in estimate_sample_uncertainty, added left-over todos

parent 167d408e
Branches
Tags
7 merge requests!353add developments to release v1.5.0,!352Resolve "release v1.5.0",!351Lukas issue337 bug ci pipeline fails for docs,!350Resolve "upgrade code to TensorFlow V2",!342Include sample-uncertainty to wrf workflow,!337Resolve "Test Set Sample Uncertainty in PostProcessing",!259Draft: Resolve "WRF-Datahandler should inherit from SingleStationDatahandler"
Pipeline #80853 passed
...@@ -525,8 +525,8 @@ def calculate_average(data: xr.DataArray, **kwargs) -> xr.DataArray: ...@@ -525,8 +525,8 @@ def calculate_average(data: xr.DataArray, **kwargs) -> xr.DataArray:
return data.mean(**kwargs) return data.mean(**kwargs)
def create_n_bootstrap_realizations(data: xr.DataArray, dim_name_time, dim_name_model, n_boots: int = 1000, def create_n_bootstrap_realizations(data: xr.DataArray, dim_name_time: str, dim_name_model: str, n_boots: int = 1000,
dim_name_boots='boots') -> xr.DataArray: dim_name_boots: str = 'boots') -> xr.DataArray:
""" """
Create n bootstrap realizations and calculate averages across realizations Create n bootstrap realizations and calculate averages across realizations
...@@ -546,8 +546,7 @@ def create_n_bootstrap_realizations(data: xr.DataArray, dim_name_time, dim_name_ ...@@ -546,8 +546,7 @@ def create_n_bootstrap_realizations(data: xr.DataArray, dim_name_time, dim_name_
for boot in range(n_boots): for boot in range(n_boots):
res[boot] = (calculate_average( res[boot] = (calculate_average(
create_single_bootstrap_realization(data, dim_name_time=dim_name_time), create_single_bootstrap_realization(data, dim_name_time=dim_name_time),
dim=dim_name_time dim=dim_name_time, skipna=True))
))
return res return res
......
...@@ -131,10 +131,15 @@ class PostProcessing(RunEnvironment): ...@@ -131,10 +131,15 @@ class PostProcessing(RunEnvironment):
self.plot() self.plot()
def estimate_sample_uncertainty(self, separate_ahead=False): def estimate_sample_uncertainty(self, separate_ahead=False):
#todo: set n_boots
#todo: visualize
#todo: write results on disk
block_length = self.data_store.get_default("uncertainty_estimate_block_length", default="1m") block_length = self.data_store.get_default("uncertainty_estimate_block_length", default="1m")
evaluate_competitors = self.data_store.get_default("uncertainty_estimate_evaluate_competitors", default=True) evaluate_competitors = self.data_store.get_default("uncertainty_estimate_evaluate_competitors", default=True)
block_mse = self.calculate_block_mse(evaluate_competitors=evaluate_competitors, separate_ahead=separate_ahead, block_mse = self.calculate_block_mse(evaluate_competitors=evaluate_competitors, separate_ahead=separate_ahead,
block_length=block_length) block_length=block_length)
res = statistics.create_n_bootstrap_realizations(block_mse, self.index_dim, self.model_type_dim, n_boots=10)
res
def calculate_block_mse(self, evaluate_competitors=True, separate_ahead=False, block_length="1m"): def calculate_block_mse(self, evaluate_competitors=True, separate_ahead=False, block_length="1m"):
path = self.data_store.get("forecast_path") path = self.data_store.get("forecast_path")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment