Beispiel #1
0
def loadEnsembleFit(lfit=True, dist=None, dist_args=None, reference=None, target=None,
                    lglobalScale=False, lrescale=False, lflatten=True, sample_axis=None, 
                    lcrossval=False, ncv=0.2, lbootstrap=False, nbs=100,
                    WRF_exps=None, CESM_exps=None, WRF_ens=None, CESM_ens=None, variable_list=None, 
                    load_list=None, lproduct='outer', lshort=True, datatype=None, **kwargs):
  ''' convenience function to load ensemble time-series data and compute associated distribution ensembles '''
  if lrescale and not lfit: raise ArgumentError
  load_list = [] if load_list is None else load_list[:] # use a copy, since the list may be modified

  # load shape ensemble
  if datatype.lower() == 'shape':
    ensemble = loadShapeEnsemble(variable_list=variable_list, WRF_exps=WRF_exps, CESM_exps=CESM_exps, 
                                 WRF_ens=WRF_ens, CESM_ens=CESM_ens, load_list=load_list, lproduct=lproduct, **kwargs)
  if datatype.lower() == 'station':
    ensemble = loadStationEnsemble(variable_list=variable_list, WRF_exps=WRF_exps, CESM_exps=CESM_exps, 
                                   WRF_ens=WRF_ens, CESM_ens=CESM_ens, load_list=load_list, lproduct=lproduct, **kwargs)
  # N.B.: kwargs are first passed on to loadShapeEnsemble/loadStationEnsemble and then to loadEnsembleTS

  # generate matching datasets with fitted distributions
  fitens, sclens = addDistFit(ensemble=ensemble, lfit=lfit, dist=dist, dist_args=dist_args, lflatten=lflatten, 
                              lrescale=lrescale, reference=reference, target=target, lglobalScale=lglobalScale,   
                              lbootstrap=lbootstrap, nbs=nbs, lcrossval=lcrossval, ncv=ncv,
                              sample_axis=sample_axis, load_list=load_list, lproduct=lproduct, **kwargs)
  # N.B.: kwargs are mainly needed to infer the expanded shape of the ensemble list
  
  # return ensembles (will be wrapped in a list, if BatchLoad is used)
  if lshort:
    if lfit and lrescale: return ensemble, fitens, sclens
    elif lfit: return ensemble, fitens
    else: return ensemble
  else:
    return ensemble, fitens, sclens
def loadShapeEnsemble(variable_list=None, **kwargs):
    ''' wrapper for clim.load.loadShapeEnsemble that sets experiment and variable lists '''
    if variable_list is None: variable_list = variables_rc
    return clim_load.loadShapeEnsemble(variable_list=variable_list,
                                       WRF_exps=WRF_exps,
                                       CESM_exps=CESM_exps,
                                       WRF_ens=WRF_ens,
                                       CESM_ens=CESM_ens,
                                       **kwargs)
def loadShapeEnsemble(variable_list=None, **kwargs):
    """ wrapper for clim.load.loadShapeEnsemble that sets experiment and variable lists """
    if variable_list is None:
        variable_list = variables_rc
    return clim_load.loadShapeEnsemble(
        variable_list=variable_list,
        WRF_exps=WRF_exps,
        CESM_exps=CESM_exps,
        WRF_ens=WRF_ens,
        CESM_ens=CESM_ens,
        **kwargs
    )
def loadShapeEnsemble(variable_list=variables_rc, shapetype=default_shapetype, basin_list=wsc_basins.basin_list, **kwargs):
  ''' wrapper for clim.load.loadShapeEnsemble that sets experiment and variable lists '''
  return clim_load.loadShapeEnsemble(variable_list=variable_list, shapetype=shapetype, WRF_exps=WRF_exps, 
                                     CESM_exps=CESM_exps, WRF_ens=WRF_ens, CESM_ens=CESM_ens, basin_list=basin_list, 
                                     obs_clim='NRCan', obs_ts='CRU', **kwargs)
Beispiel #5
0
def loadEnsembleFit(lfit=True,
                    dist=None,
                    dist_args=None,
                    reference=None,
                    target=None,
                    lglobalScale=False,
                    lrescale=False,
                    lflatten=True,
                    sample_axis=None,
                    lcrossval=False,
                    ncv=0.2,
                    lbootstrap=False,
                    nbs=100,
                    WRF_exps=None,
                    CESM_exps=None,
                    WRF_ens=None,
                    CESM_ens=None,
                    variable_list=None,
                    load_list=None,
                    lproduct='outer',
                    lshort=True,
                    datatype=None,
                    **kwargs):
    ''' convenience function to load ensemble time-series data and compute associated distribution ensembles '''
    if lrescale and not lfit: raise ArgumentError
    load_list = [] if load_list is None else load_list[:]  # use a copy, since the list may be modified

    # load shape ensemble
    if datatype.lower() == 'shape':
        ensemble = loadShapeEnsemble(variable_list=variable_list,
                                     WRF_exps=WRF_exps,
                                     CESM_exps=CESM_exps,
                                     WRF_ens=WRF_ens,
                                     CESM_ens=CESM_ens,
                                     load_list=load_list,
                                     lproduct=lproduct,
                                     **kwargs)
    if datatype.lower() == 'station':
        ensemble = loadStationEnsemble(variable_list=variable_list,
                                       WRF_exps=WRF_exps,
                                       CESM_exps=CESM_exps,
                                       WRF_ens=WRF_ens,
                                       CESM_ens=CESM_ens,
                                       load_list=load_list,
                                       lproduct=lproduct,
                                       **kwargs)
    # N.B.: kwargs are first passed on to loadShapeEnsemble/loadStationEnsemble and then to loadEnsembleTS

    # generate matching datasets with fitted distributions
    fitens, sclens = addDistFit(ensemble=ensemble,
                                lfit=lfit,
                                dist=dist,
                                dist_args=dist_args,
                                lflatten=lflatten,
                                lrescale=lrescale,
                                reference=reference,
                                target=target,
                                lglobalScale=lglobalScale,
                                lbootstrap=lbootstrap,
                                nbs=nbs,
                                lcrossval=lcrossval,
                                ncv=ncv,
                                sample_axis=sample_axis,
                                load_list=load_list,
                                lproduct=lproduct,
                                **kwargs)
    # N.B.: kwargs are mainly needed to infer the expanded shape of the ensemble list

    # return ensembles (will be wrapped in a list, if BatchLoad is used)
    if lshort:
        if lfit and lrescale: return ensemble, fitens, sclens
        elif lfit: return ensemble, fitens
        else: return ensemble
    else:
        return ensemble, fitens, sclens
def loadShapeEnsemble(variable_list=variables_rc, shapetype=default_shapetype, basin_list=None, **kwargs):
  ''' wrapper for clim.load.loadShapeEnsemble that sets experiment and variable lists '''
  return clim_load.loadShapeEnsemble(variable_list=variable_list, shapetype=shapetype, WRF_exps=None, 
                                     CESM_exps=None, WRF_ens=None, CESM_ens=None, basin_list=None, **kwargs)