Skip to content
Snippets Groups Projects
Commit 1c78d728 authored by Christoph.Fischer's avatar Christoph.Fischer
Browse files

support for data with scalar time

parent b54fcf4a
No related branches found
No related tags found
No related merge requests found
...@@ -153,6 +153,11 @@ class IdentificationTechnique(ABC): ...@@ -153,6 +153,11 @@ class IdentificationTechnique(ABC):
time_dim_in_input = (time_dim is not None) time_dim_in_input = (time_dim is not None)
if time_dim_in_input and time_dim in dataset.dims: if time_dim_in_input and time_dim in dataset.dims:
split_dimensions.append(time_dim) split_dimensions.append(time_dim)
time_var_value = None
if not time_dim_in_input and 'time' in dataset.variables:
# time dimension as scalar in dataset, also remember it
time_var_value = dataset.variables['time'].data
time_var_value = str(np.datetime_as_string(time_var_value, unit='s'))
time_dim_len = len(dataset.coords[time_dim].values) if time_dim_in_input else 1 time_dim_len = len(dataset.coords[time_dim].values) if time_dim_in_input else 1
# search init_time # search init_time
...@@ -210,8 +215,10 @@ class IdentificationTechnique(ABC): ...@@ -210,8 +215,10 @@ class IdentificationTechnique(ABC):
valid_time = dataset.coords[time_dim].data[t] valid_time = dataset.coords[time_dim].data[t]
timestep.valid_time = str(np.datetime_as_string(valid_time, unit='s')) timestep.valid_time = str(np.datetime_as_string(valid_time, unit='s'))
cur_indices[time_dim] = valid_time cur_indices[time_dim] = valid_time
elif time_var_value is not None:
timestep.valid_time = time_var_value
# ID to access this object block in protobuf set # ID to access this object block in protobuf set
sets_id = len(self.pb_dataset.sets) - 1 sets_id = len(self.pb_dataset.sets) - 1
tl_id = len(s_i.timesteps) - 1 tl_id = len(s_i.timesteps) - 1
index_field.loc[cur_indices] = (sets_id, tl_id) index_field.loc[cur_indices] = (sets_id, tl_id)
......
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