diff --git a/src/openalea/adel/astk_interface.py b/src/openalea/adel/astk_interface.py index c22e1fcc..5cf99890 100644 --- a/src/openalea/adel/astk_interface.py +++ b/src/openalea/adel/astk_interface.py @@ -297,7 +297,7 @@ def grow(self, g, time_control): except: data = time_control tt = self.thermal_time(data.index, data) - dday = tt[-1] + dday = tt.iloc[-1] # refg = self.setup_canopy(age = self.canopy_age) self.canopy_age += dday diff --git a/src/openalea/adel/dresser.py b/src/openalea/adel/dresser.py index fd58ca7a..0ed591b8 100644 --- a/src/openalea/adel/dresser.py +++ b/src/openalea/adel/dresser.py @@ -310,7 +310,8 @@ def plant_table(dimT, convert=None): inplace=True, ) if convert is not None: - df.loc[:, ("Ll", "Lw_shape", "Gl", "Gd", "El", "Ed")] *= convert + cols = ["Ll", "Lw_shape", "Gl", "Gd", "El", "Ed"] + df[cols] *= convert # add mandatory topological info and sort from base to top df.loc[:, "axe_id"] = "MS" df.loc[:, "ms_insertion"] = 0 diff --git a/src/openalea/adel/postprocessing.py b/src/openalea/adel/postprocessing.py index cc556d64..dc58eaf2 100644 --- a/src/openalea/adel/postprocessing.py +++ b/src/openalea/adel/postprocessing.py @@ -356,12 +356,10 @@ def phenology(adel_output_df): if indexes_of_all_non_null_Lsen.size == 0: SSI = 0.0 else: - nonzero_Lvsen_indexes = group.index[group.Lvsen.to_numpy().nonzero()] - SSI = group["numphy"][nonzero_Lvsen_indexes[0]] - 1 - if len(nonzero_Lvsen_indexes) > 0: - Lvsen_values = group["Lvsen"].loc[nonzero_Lvsen_indexes] - L_shape_values = group["L_shape"].loc[nonzero_Lvsen_indexes] - SSI += (Lvsen_values / L_shape_values).sum() + nz = group.loc[group["Lvsen"] != 0] + if not nz.empty: + SSI = nz["numphy"].iloc[0] - 1 + SSI += (nz["Lvsen"] / nz["L_shape"]).sum() # indexes_of_all_null_Lshape = L_shape[L_shape == 0.0].index HS_final = group["HS_final"][group.first_valid_index()]