Skip to content

Commit

Permalink
Added config dataclass to steps nowcast, v2
Browse files Browse the repository at this point in the history
  • Loading branch information
sidekock committed Oct 31, 2024
1 parent 5aaf24d commit fa9a1ef
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pysteps/nowcasts/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from pysteps.timeseries import autoregression, correlation
from pysteps.nowcasts.utils import compute_percentile_mask, nowcast_main_loop

from dataclasses import dataclass, field
from dataclasses import field
from typing import Optional, Dict, Any, Callable

try:
Expand Down Expand Up @@ -99,6 +99,8 @@ def __init__(self, precip, velocity, timesteps, steps_config, **kwargs):
self.recomp_method = None
self.xy_coords = None

self.mu_0 = None

# Additional variables for time measurement
self.start_time_init = None
self.init_time = None
Expand Down Expand Up @@ -542,7 +544,7 @@ def _apply_noise_and_ar_model(self):
self.gamma[i, 0], self.gamma[i, 1]
)

# Estimate the parameters of the AR model using autocorrelation coefficients
# Estimate the parameters of the AR model using auto-correlation coefficients
self.phi = np.empty((self.config.n_cascade_levels, self.config.ar_order + 1))
for i in range(self.config.n_cascade_levels):
self.phi[i, :] = autoregression.estimate_ar_params_yw(self.gamma[i, :])
Expand Down Expand Up @@ -571,12 +573,12 @@ def _apply_noise_and_ar_model(self):

for _ in range(self.config.n_ens_members):
# Create random state for precipitation noise generator
rs = np.random.RandomState(self.seed)
rs = np.random.RandomState(self.config.seed)
self.random_generator_precip.append(rs)
self.seed = rs.randint(0, high=int(1e9)) # Update seed after generating

# Create random state for motion perturbations generator
rs = np.random.RandomState(self.seed)
rs = np.random.RandomState(self.config.seed)
self.random_generator_motion.append(rs)
self.seed = rs.randint(0, high=int(1e9)) # Update seed after generating
else:
Expand Down

0 comments on commit fa9a1ef

Please sign in to comment.