Skip to content

Commit

Permalink
remove prototype/utils.py after #298, #299, and #300
Browse files Browse the repository at this point in the history
  • Loading branch information
mathause committed Sep 21, 2023
1 parent c854fa4 commit c3bf5e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 151 deletions.
12 changes: 7 additions & 5 deletions mesmer/prototype/calibrate_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import scipy.stats
import xarray as xr

from ..core.computation import (
calc_gaspari_cohn_correlation_matrices,
calc_geodist_exact,
)
from .calibrate import AutoRegression1D, AutoRegression1DOrderSelection
from .utils import calculate_gaspari_cohn_correlation_matrices


def _get_predictor_dims(predictors):
Expand Down Expand Up @@ -185,10 +188,9 @@ def calibrate_auto_regressive_process_with_spatially_correlated_errors_multiple_
for gridpoint, gridpoint_vals in target.groupby("gridpoint")
}

gaspari_cohn_correlation_matrices = calculate_gaspari_cohn_correlation_matrices(
target.lat,
target.lon,
localisation_radii,
geodist = calc_geodist_exact(target.lon, target.lat)
gaspari_cohn_correlation_matrices = calc_gaspari_cohn_correlation_matrices(
geodist, localisation_radii
)

localised_empirical_covariance_matrix = (
Expand Down
141 changes: 0 additions & 141 deletions mesmer/prototype/utils.py

This file was deleted.

15 changes: 10 additions & 5 deletions tests/integration/test_prototype.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
from mesmer.calibrate_mesmer.train_gv import train_gv
from mesmer.calibrate_mesmer.train_lt import train_lt
from mesmer.calibrate_mesmer.train_lv import train_lv
from mesmer.core.computation import (
calc_gaspari_cohn_correlation_matrices,
calc_geodist_exact,
)
from mesmer.prototype.calibrate import LinearRegression
from mesmer.prototype.calibrate_multiple import (
calibrate_auto_regressive_process_multiple_scenarios_and_ensemble_members,
calibrate_auto_regressive_process_with_spatially_correlated_errors_multiple_scenarios_and_ensemble_members,
flatten_predictors_and_target,
)
from mesmer.prototype.utils import calculate_gaspari_cohn_correlation_matrices


class _MockConfig:
Expand Down Expand Up @@ -325,11 +328,13 @@ def _do_legacy_run_train_lv(
.values
)

gaspari_cohn_correlation_matrices = calculate_gaspari_cohn_correlation_matrices(
latitudes=esm_tas_residual_local_variability.lat,
longitudes=esm_tas_residual_local_variability.lon,
localisation_radii=localisation_radii,
geodist = calc_geodist_exact(
esm_tas_residual_local_variability.lon, esm_tas_residual_local_variability.lat
)
gaspari_cohn_correlation_matrices = calc_gaspari_cohn_correlation_matrices(
geodist, localisation_radii
)

gaspari_cohn_correlation_matrices = {
k: v.values for k, v in gaspari_cohn_correlation_matrices.items()
}
Expand Down

0 comments on commit c3bf5e0

Please sign in to comment.