Skip to content
Snippets Groups Projects
Commit 92450ea9 authored by MALOU THIBAULT's avatar MALOU THIBAULT
Browse files

improve the raise of error when the integration time window for the first...

improve the raise of error when the integration time window for the first observation starts before the temporal domain
parent fbf275cd
No related branches found
No related tags found
No related merge requests found
Pipeline #245723 passed with warnings
...@@ -156,11 +156,7 @@ class Obs: ...@@ -156,11 +156,7 @@ class Obs:
self.dt_obs_operator = dt_obs_operator self.dt_obs_operator = dt_obs_operator
self.nb_dt_in_obs_time_window = int((self.dt_obs_operator // self.msh.dt) + 1) self.nb_dt_in_obs_time_window = int((self.dt_obs_operator // self.msh.dt) + 1)
if np.min(self.t_obs) < self.dt_obs_operator: # self.nb_dt_in_obs_time_window = int(np.ceil(dt_obs_operator / msh.dt))
raise ValueError(
"The time window of integration of the observation operator for the first observation starts before the temporal domain."
+ " This is probably because the integration time window is too large or the observation times are inaccurate."
)
# Exception to make sure that the accumulation time windows do not overlapp for a given sensor # Exception to make sure that the accumulation time windows do not overlapp for a given sensor
for X_sensor in self.X_sensors: for X_sensor in self.X_sensors:
indexes_sensor = [x == X_sensor[0] and y == X_sensor[1] for x, y in zip(self.X_obs[:, 0], self.X_obs[:, 1])] indexes_sensor = [x == X_sensor[0] and y == X_sensor[1] for x, y in zip(self.X_obs[:, 0], self.X_obs[:, 1])]
...@@ -183,6 +179,11 @@ class Obs: ...@@ -183,6 +179,11 @@ class Obs:
np.abs(self.t_obs.reshape((self.N_obs, 1)) - msh.t_array.reshape((1, msh.t_array.size))), axis=1 np.abs(self.t_obs.reshape((self.N_obs, 1)) - msh.t_array.reshape((1, msh.t_array.size))), axis=1
) )
for i in range(1, self.nb_dt_in_obs_time_window): for i in range(1, self.nb_dt_in_obs_time_window):
if (self.index_obs_to_index_time_est[:, i - 1] <= 0).any():
raise ValueError(
"The time window of integration of the observation operator for the first observation starts before the temporal domain."
+ " This is probably because the integration time window is too large or the observation times are inaccurate."
)
self.index_obs_to_index_time_est[:, i] = self.index_obs_to_index_time_est[:, i - 1] - 1 self.index_obs_to_index_time_est[:, i] = self.index_obs_to_index_time_est[:, i - 1] - 1
# initialization of the dictionnary containing the indexes of the observations given the time index # initialization of the dictionnary containing the indexes of the observations given the time index
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment