from improver import ensemble_copula_coupling # Define two ensembles with different sizes ensemble1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] ensemble2 = [[13, 14, 15], [16, 17, 18], [19, 20, 21]] # Define a coupling strategy coupling_strategy = ensemble_copula_coupling.CouplingStrategy( "percentile_mapping", source_percentiles=[10, 50, 90]) # Coupling the ensembles coupled_ensemble = ensemble_copula_coupling.ensemble_copula_coupling( [ensemble1, ensemble2], coupling_strategy)
from improver import ensemble_copula_coupling # Define two ensembles with different variables ensemble1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] ensemble2 = [[13, 14, 15], [16, 17, 18], [19, 20, 21]] # Define a dictionary mapping the variables of each ensemble variable_mapping = {"ensemble1": ["var1", "var2", "var3"], "ensemble2": ["var4", "var5", "var6"]} # Define a coupling strategy coupling_strategy = ensemble_copula_coupling.CouplingStrategy( "percentile_mapping", source_percentiles=[10, 50, 90]) # Coupling the ensembles coupled_ensemble = ensemble_copula_coupling.ensemble_copula_coupling( [ensemble1, ensemble2], coupling_strategy, variable_mapping=variable_mapping)This example shows how to couple two ensembles with different variables using a percentile mapping strategy. The variable_mapping dictionary is used to map the variables of each ensemble.