Skip to content

Commit

Permalink
fix further warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pat-schmitt committed Sep 10, 2024
1 parent f97b90d commit f490684
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions oggm/core/dynamic_spinup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,8 @@ def dynamic_melt_f_run(
with utils.DisableLogger():
ds = utils.compile_run_output(gdir, input_filesuffix=output_filesuffix,
path=False)
dmdtda_mdl = ((ds.volume.loc[yr1_ref_mb].values -
ds.volume.loc[yr0_ref_mb].values) /
dmdtda_mdl = ((ds.volume.loc[yr1_ref_mb].values[0] -
ds.volume.loc[yr0_ref_mb].values[0]) /
gdir.rgi_area_m2 /
(yr1_ref_mb - yr0_ref_mb) *
cfg.PARAMS['ice_density'])
Expand Down Expand Up @@ -1960,10 +1960,8 @@ def cost_fct(melt_f, model_dynamic_spinup_end):
model_dynamic_spinup_end.append(copy.deepcopy(model_dynamic_spinup))

# calculate the mismatch of dmdtda
try:
cost = float(dmdtda_mdl - ref_dmdtda)
except:
t = 1
cost = float(dmdtda_mdl - ref_dmdtda)

return cost

def init_cost_fun():
Expand Down
4 changes: 2 additions & 2 deletions oggm/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3858,9 +3858,9 @@ def reset_melt_f():

df_ref_dmdtda = utils.get_geodetic_mb_dataframe().loc[gdir.rgi_id]
sel = df_ref_dmdtda.loc[df_ref_dmdtda['period'] == ref_period]
ref_dmdtda = float(sel['dmdtda'])
ref_dmdtda = float(sel['dmdtda'].iloc[0])
ref_dmdtda *= 1000 # kg m-2 yr-1
err_ref_dmdtda = float(sel['err_dmdtda'])
err_ref_dmdtda = float(sel['err_dmdtda'].iloc[0])
err_ref_dmdtda *= 1000 # kg m-2 yr-1

melt_f_max = 1000 * 12 / 365
Expand Down

0 comments on commit f490684

Please sign in to comment.