File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828import pandas as pd
2929import sklearn .model_selection
3030import torch
31+ import xarray as xr
3132from scipy import stats
3233from scipy .optimize import minimize
3334
@@ -891,9 +892,15 @@ def run(list_packed_vars):
891892
892893 # optionally adjust ref_startyear based on earliest available elevation calibration data (must be <= 2000)
893894 if args .spinup :
894- args . ref_startyear = min (
895+ min_ref_startyear = min (
895896 2000 , * (int (date [:4 ]) for pair in gdir .elev_change_1d ['dates' ] for date in pair )
896897 )
898+ # check if min_ref_startyear in spinup flowlines
899+ with xr .open_dataset (
900+ gdir .get_filepath ('model_geometry' , filesuffix = '_dynamic_spinup_pygem_mb' )
901+ ) as ds :
902+ min_spinup_yr = int (ds .time .values .min ())
903+ args .ref_startyear = max (min_ref_startyear , min_spinup_yr )
897904 # adjust dates table and climate data
898905 mask = gdir .dates_table ['year' ] >= args .ref_startyear
899906 gdir .dates_table = gdir .dates_table .loc [mask ].reset_index (drop = True )
You can’t perform that action at this time.
0 commit comments