lakes=['GreatLakes',]+list(great_lakes.values())) # N.B.: individual lakes have to be initialized seperately and added to the set post-hoc, # because they don't share a folder # add aliases lake_list = OrderedDict() for name,lake in list(great_lakes.items()): # do not iter, since dict is changes in for-loop lake_list[name] = lake lake_list[lake.name] = lake lake_list[lake.long_name] = lake ## generate loadGageStation* versions with these basins from datasets.WSC import loadGageStation, loadWSC_Shp, loadWSC_ShpTS, loadWSC_Stn, loadWSC_StnTS addLoadFcts(locals(), locals(), basins=basins, basin_list=basin_list) ## some testing/verification if __name__ == '__main__': ## print basins for name,basin in basin_list.items(): s = ' {:3s} ({:s}): '.format(name,basin.shapetype) if hasattr(basin, 'subbasins'): for subbasin in basin.subbasins: s += ' {:9s}'.format('{:s},'.format(subbasin)) print(s) # if basin.maingage: print(basin.maingage.monthly_file) # ## print Great Lakes # for name,lake in great_lakes.iteritems():
ensembles['all-ens'+suffix] = ensembles['phys-ens'+suffix] + ensembles['mex-ens'+suffix][1:] # N.B.: omit max-ctrl the second time # historical ensembles (no future periods) ensembles['3km-ens'] = ('erai-3km', 'max-3km') # replace names with experiment instances for ensname,enslist in ensembles.items(): ensembles[ensname] = tuple(experiments[expname] for expname in enslist) # make sorted copy WRF_ens = OrderedDict() name_list = list(ensembles.keys()); name_list.sort() for key in name_list: WRF_ens[key] = ensembles[key] ensembles = enss = WRF_ens ## generate loadWRF* versions with these experiments # import datasets.WRF as dataset import inspect,functools from datasets.WRF import loadWRF, loadWRF_Shp, loadWRF_Stn, loadWRF_TS, loadWRF_ShpTS, loadWRF_StnTS, loadWRF_Ensemble, loadWRF_ShpEns, loadWRF_StnEns addLoadFcts(locals(), locals(), exps=WRF_exps, enses=WRF_ens) # loadWRF = functools.partial(loadWRF, exps=WRF_exps) if __name__ == '__main__': ## view/test ensembles for name,members in WRF_ens.items(): s = ' {:s}: '.format(name) for member in members: s += ' {:s},'.format(member.name) print(s)
A package that contains settings for the WesternCanada region projects for use with the geodata package. @author: Andre R. Erler, GPL v3 ''' # import figure settings from figure_settings import getVariableSettings, getFigureSettings, figure_folder # import map projection settings (basemap) try: from map_settings import getSetup, map_folder except ImportError: print("Error importing map settings - 'basemap' is likely no installed.") ## import load functions with GreatLakes experiments into local namespace # import relevant WRF experiments from WRF_experiments import WRF_exps, WRF_ens # import WRF load functions from WRF_experiments import loadWRF, loadWRF_Shp, loadWRF_Stn, loadWRF_TS, loadWRF_ShpTS, loadWRF_StnTS, loadWRF_Ensemble, loadWRF_ShpEns, loadWRF_StnEns # also load CESM experiments and functions from projects.CESM_experiments import CESM_exps, CESM_ens # import CESM load functions from projects.CESM_experiments import loadCESM, loadCESM_Shp, loadCESM_Stn, loadCESM_TS, loadCESM_ShpTS, loadCESM_StnTS, loadCESM_Ensemble, loadCESM_ShpEns, loadCESM_StnEns # add relevant experiments to general load functions from datasets.common import loadDataset, loadClim, loadShpTS, loadStnTS, loadEnsembleTS, addLoadFcts # modify functions (wont affect modified WRF/CESM functions) addLoadFcts(locals(), locals(), WRF_exps=WRF_exps, WRF_ens=WRF_ens, CESM_exps=CESM_exps, CESM_ens=CESM_ens)
ensembles['all-ens' + suffix] = ensembles['phys-ens' + suffix] + ensembles['mex-ens' + suffix][1:] # N.B.: omit max-ctrl the second time # replace names with experiment instances for ensname, enslist in ensembles.iteritems(): ensembles[ensname] = tuple(experiments[expname] for expname in enslist) # make sorted copy WRF_ens = OrderedDict() name_list = ensembles.keys() name_list.sort() for key in name_list: WRF_ens[key] = ensembles[key] ensembles = enss = WRF_ens ## generate loadWRF* versions with these experiments # import datasets.WRF as dataset import inspect, functools from datasets.WRF import loadWRF, loadWRF_Shp, loadWRF_Stn, loadWRF_TS, loadWRF_ShpTS, loadWRF_StnTS, loadWRF_Ensemble, loadWRF_ShpEns, loadWRF_StnEns addLoadFcts(locals(), locals(), exps=WRF_exps, enses=WRF_ens) # loadWRF = functools.partial(loadWRF, exps=WRF_exps) if __name__ == '__main__': ## view/test ensembles for name, members in WRF_ens.iteritems(): s = ' {:s}: '.format(name) for member in members: s += ' {:s},'.format(member.name) print(s)
from projects.CESM_experiments import CESM_exps, CESM_ens # import CESM load functions from projects.CESM_experiments import loadCESM, loadCESM_Shp, loadCESM_Stn, loadCESM_TS, loadCESM_ShpTS, loadCESM_StnTS, loadCESM_Ensemble, loadCESM_ShpEns, loadCESM_StnEns except (ImportError,IOError): CESM_exps = None; CESM_ens = None warn("Error importing CESM experiments.") # add relevant experiments to general load functions from datasets.common import loadDataset, loadEnsembleTS, addLoadFcts try: from datasets.Unity import loadUnity, loadUnity_Shp, loadUnity_Stn, loadUnity_ShpTS, loadUnity_StnTS # loadUnity_TS doesn't exist except (ImportError,IOError): warn("Error importing Unified Observational Dataset 'Unity'.") unity_grid = 'glb1_d02' # Unified Dataset default grid # N.B.: it is recommended to import Unity load fcts. from here # modify functions (wont affect modified WRF/CESM functions) addLoadFcts(locals(), locals(), unity_grid=unity_grid , WRF_exps=WRF_exps, WRF_ens=WRF_ens, CESM_exps=CESM_exps, CESM_ens=CESM_ens) ## import shape dictionaries try: from projects.WSC_basins import basins, provinces, great_lakes # import the dicts with unique entries except (ImportError,IOError): warn("Error importing shape files and/or WSC module.") # import figure with hydro settings from .analysis_settings import loadStationEnsemble, loadShapeEnsemble, loadShapeObservations # load datasets from .analysis_settings import loadStationFit, loadShapeFit from .analysis_settings import exps_rc, variables_rc, constraints_rc from .analysis_settings import climFigAx, climPlot, evaFigAx, distPlot, quantPlot # plotting
# initial condition ensemble ensembles['ens20trcn1x1'] = [tag+'20trcn1x1' for tag in 'tb', 'hab', 'hab', 'hab'] ensembles['ensrcp85cn1x1'] = [tag+'rcp85cn1x1' for tag in 'htb', 'hab', 'hab', 'hab'] ensembles['ensrcp85cn1x1d'] = [tag+'rcp85cn1x1d' for tag in 'htb', 'hab', 'hab', 'hab'] ensembles['mens20trcn1x1'] = [tag+'20trcn1x1' for tag in 'hab', 'hab', 'hab'] ensembles['mensrcp85cn1x1'] = [tag+'rcp85cn1x1' for tag in 'hab', 'hab', 'hab'] ensembles['mensrcp85cn1x1d'] = [tag+'rcp85cn1x1d' for tag in 'hab', 'hab', 'hab'] # add aliases CESM_ens = enss = ensembles # N.B.: static & meta data for the ensemble is copied from the first-listed member; # this includes station attributes, such as the elevation error # replace names with experiment instances for ensname,enslist in ensembles.items(): # don't use iter, because we chagne the dict! members = tuple([experiments[expname] for expname in enslist]) ensembles[ensname] = members ensembles[experiments[ensname].shortname] = members ## generate loadCESM* versions with these experiments from datasets.CESM import loadCESM, loadCESM_Shp, loadCESM_Stn, loadCESM_TS, loadCESM_ShpTS, loadCESM_StnTS, loadCESM_Ensemble, loadCESM_ShpEns, loadCESM_StnEns addLoadFcts(locals(), locals(), exps=CESM_exps, enses=CESM_ens) if __name__ == '__main__': ## view/test ensembles for name,members in CESM_ens.iteritems(): s = ' {:s}: '.format(name) for member in members: s += ' {:s},'.format(member.name) print(s)
ensembles['mensrcp85cn1x1'] = [ tag + 'rcp85cn1x1' for tag in 'hab', 'hab', 'hab' ] ensembles['mensrcp85cn1x1d'] = [ tag + 'rcp85cn1x1d' for tag in 'hab', 'hab', 'hab' ] # N.B.: static & meta data for the ensemble is copied from the first-listed member; # this includes station attributes, such as the elevation error # replace names with experiment instances for ensname, enslist in ensembles.items( ): # don't use iter, because we chagne the dict! members = tuple([experiments[expname] for expname in enslist]) ensembles[ensname] = members ensembles[experiments[ensname].shortname] = members # add aliases CESM_ens = enss = ensembles ## generate loadCESM* versions with these experiments from datasets.CESM import loadCESM, loadCESM_Shp, loadCESM_Stn, loadCESM_TS, loadCESM_ShpTS, loadCESM_StnTS, loadCESM_Ensemble, loadCESM_ShpEns, loadCESM_StnEns addLoadFcts(locals(), locals(), exps=CESM_exps, enses=CESM_ens) if __name__ == '__main__': ## view/test ensembles for name, members in CESM_ens.iteritems(): s = ' {:s}: '.format(name) for member in members: s += ' {:s},'.format(member.name) print(s)
# import figure settings from figure_settings import getVariableSettings, getFigureSettings, figure_folder # import map projection settings (basemap) try: from map_settings import getSetup, map_folder except ImportError: print("Error importing map settings - 'basemap' is likely no installed.") ## import load functions with GreatLakes experiments into local namespace # import relevant WRF experiments from WRF_experiments import WRF_exps, WRF_ens # import WRF load functions from WRF_experiments import loadWRF, loadWRF_Shp, loadWRF_Stn, loadWRF_TS, loadWRF_ShpTS, loadWRF_StnTS, loadWRF_Ensemble, loadWRF_ShpEns, loadWRF_StnEns # also load CESM experiments and functions from projects.CESM_experiments import CESM_exps, CESM_ens # import CESM load functions from projects.CESM_experiments import loadCESM, loadCESM_Shp, loadCESM_Stn, loadCESM_TS, loadCESM_ShpTS, loadCESM_StnTS, loadCESM_Ensemble, loadCESM_ShpEns, loadCESM_StnEns # add relevant experiments to general load functions from datasets.common import loadDataset, loadClim, loadShpTS, loadStnTS, loadEnsembleTS, addLoadFcts # modify functions (wont affect modified WRF/CESM functions) addLoadFcts(locals(), locals(), WRF_exps=WRF_exps, WRF_ens=WRF_ens, CESM_exps=CESM_exps, CESM_ens=CESM_ens)