6
6
Functions to train global trend module of MESMER.
7
7
"""
8
8
9
+ import warnings
9
10
10
11
import numpy as np
11
12
import xarray as xr
@@ -126,7 +127,7 @@ def train_gt(var, targ, esm, time, cfg, save_params=True):
126
127
var_all = np .unique (var_all , axis = 0 )
127
128
128
129
params_gt ["saod" ], params_gt ["hist" ] = train_gt_ic_OLSVOLC (
129
- var_all , gt_lowess_hist , params_gt ["time" ]["hist" ], cfg
130
+ var_all , gt_lowess_hist , params_gt ["time" ]["hist" ]
130
131
)
131
132
elif params_gt ["method" ] == "LOWESS" :
132
133
params_gt ["hist" ] = gt_lowess_hist
@@ -201,7 +202,7 @@ def train_gt_ic_LOWESS(data):
201
202
return gt_lowess , frac_lowess_name
202
203
203
204
204
- def train_gt_ic_OLSVOLC (var , gt_lowess , time , cfg ):
205
+ def train_gt_ic_OLSVOLC (var , gt_lowess , time , cfg = None ):
205
206
"""
206
207
Derive global trend (emissions + volcanoes) parameters from single ESM ic ensemble
207
208
by adding volcanic spikes to LOWESS trend.
@@ -214,8 +215,8 @@ def train_gt_ic_OLSVOLC(var, gt_lowess, time, cfg):
214
215
1d array of smooth global trend of variable
215
216
time : np.ndarray
216
217
1d array of years
217
- cfg : module
218
- config file containing metadata needed to load in stratospheric AOD time series
218
+ cfg : None
219
+ Passing cfg is no longer required.
219
220
220
221
Returns
221
222
-------
@@ -231,14 +232,17 @@ def train_gt_ic_OLSVOLC(var, gt_lowess, time, cfg):
231
232
232
233
"""
233
234
234
- # specify necessary variables from cfg file
235
- dir_obs = cfg .dir_obs
235
+ if cfg is not None :
236
+ warnings .warn (
237
+ "Passing ``cfg`` to ``train_gt_ic_OLSVOLC`` is no longer necessary" ,
238
+ FutureWarning ,
239
+ )
236
240
237
241
nr_runs , nr_ts = var .shape
238
242
239
243
# account for volcanic eruptions in historical time period
240
244
# load in observed stratospheric aerosol optical depth
241
- aod_obs = load_strat_aod (time , dir_obs )
245
+ aod_obs = load_strat_aod (time )
242
246
# drop "year" coords - aod_obs does not have coords (currently)
243
247
aod_obs = aod_obs .drop_vars ("year" )
244
248
0 commit comments