diff --git a/src/troute-routing/troute/routing/compute.py b/src/troute-routing/troute/routing/compute.py index 53e6693cf..a84761ec2 100644 --- a/src/troute-routing/troute/routing/compute.py +++ b/src/troute-routing/troute/routing/compute.py @@ -166,7 +166,8 @@ def _prep_reservoir_da_dataframes(reservoir_usgs_df, reservoir_usace_df, waterbo else: reservoir_usgs_df_sub = pd.DataFrame() reservoir_usgs_df_time = pd.DataFrame().to_numpy().reshape(0,) - waterbody_types_df_sub.loc[waterbody_types_df_sub['reservoir_type'] == 2] = 1 + if not waterbody_types_df_sub.empty: + waterbody_types_df_sub.loc[waterbody_types_df_sub['reservoir_type'] == 2] = 1 # select USACE reservoir DA data waterbodies in sub-domain if not reservoir_usace_df.empty: @@ -178,7 +179,8 @@ def _prep_reservoir_da_dataframes(reservoir_usgs_df, reservoir_usace_df, waterbo else: reservoir_usace_df_sub = pd.DataFrame() reservoir_usace_df_time = pd.DataFrame().to_numpy().reshape(0,) - waterbody_types_df_sub.loc[waterbody_types_df_sub['reservoir_type'] == 3] = 1 + if not waterbody_types_df_sub.empty: + waterbody_types_df_sub.loc[waterbody_types_df_sub['reservoir_type'] == 3] = 1 return reservoir_usgs_df_sub, reservoir_usgs_df_time, reservoir_usace_df_sub, reservoir_usace_df_time, waterbody_types_df_sub