@@ -154,6 +154,7 @@ def df_from_file_ids(file_id, input_dir, file_specification):
154154 file_name = f"{ input_dir } /{ f } " ,
155155 specification = specification ,
156156 )
157+
157158 file_dfs .append (var_df )
158159
159160 # same file IDs and file type specification will have same variables but
@@ -163,8 +164,8 @@ def df_from_file_ids(file_id, input_dir, file_specification):
163164 if len (fid_dfs ) == 0 :
164165 logger .error ("Could not find any file." )
165166 sys .exit (2 )
166-
167167 fid_dfs = unify_time_index (fid_dfs )
168+
168169 # different file IDs will have different variables but with same timestamps:
169170 # concatenate along variable axis
170171 df = pd .concat (fid_dfs , axis = 0 )
@@ -184,10 +185,12 @@ def unify_time_index(fid_dfs):
184185 # Find out number of time steps in the column MultiIndex.
185186 # Is there an easier way to do so without assuming the order of indices?
186187 time_multiindex_index = df .columns .names .index ("time" )
188+
187189 ntime = len (df .columns .levels [time_multiindex_index ])
188190
189191 unique_times = list (df .columns .levels [time_multiindex_index ])
190192 unique_times .sort ()
193+
191194 df = df .reindex (columns = unique_times , level = time_multiindex_index )
192195
193196 df .columns = df .columns .set_levels (range (ntime ), level = "time" )
@@ -324,7 +327,7 @@ def check_file_with_tolerances(
324327 )
325328
326329 if out == 1 :
327- logger .error (f "RESULT: check FAILED. Errors at the lines { diff } " )
330+ logger .error ("RESULT: check FAILED. Errors at the lines %s" , diff )
328331 sys .exit (1 )
329332
330333 else :
@@ -399,7 +402,7 @@ def check_multiple_solutions(ds1, ds2, existing_cols):
399402 state_col = next ((c for c in state_cols if c in df1 .columns ), None )
400403
401404 if check_col is None or state_col is None :
402- raise KeyError ("Colonne 'check' o ' state' non trovate nei dataset ." )
405+ raise KeyError ("'Check' or “ state” columns not found in datasets ." )
403406
404407 check_ref = df1 .at [idx , check_col ]
405408 check_cur = df2 .at [idx , check_col ]
0 commit comments