Exemplo n.º 1
0
def test_ensembleenvelope(directory, sourcefiles, var, sd, ed, cwd):
    """ Tests ensemble_envelope_timeseries
    
    Parameters
    ----------
    directory : string
                the directory to link the files to
    sourcefiles : list
                  a list of the locations of the files to link
    var :  string
           the variable plotted
    sd : int
         start date for time slice
    ed : int
         end date for time slice
    cwd : string 
          directory of the test modules
    """
    ctt.loadtestfiles(directory, sourcefiles)
    filepattern = '*.nc'
    ens = cd.mkensemble(filepattern)
    ens = cd.time_slice(ens, sd, ed)
    ens = cd.remap(ens, 'r360x180', delete=True)
    ens = cd.my_operator(ens, my_cdo_str='cdo -fldmean -yearmean {infile} {outfile}', output_prefix='processed_', delete=True)
    cd.ens_stats(ens, var)
    cd.ensemble_envelope_timeseries(ens, 'ENS-MEAN_processed_remap_ts_Amon_CanESM2_historical_R-MEAN_195001-200012.nc', 'ENS-STD_processed_remap_ts_Amon_CanESM2_historical_STD_195001-200012.nc', var, pdf='ensenv')    
    plotcompare(directory, cwd, 'ensenv')
    os.system('rm  ensenv.pdf')               
Exemplo n.º 2
0
def test_my_operator(directory, sourcefiles, var, e1name, e2name):
    ctt.loadtestfiles(directory, sourcefiles)
    filepattern = "*.nc"
    ens = cd.mkensemble(filepattern)
    ens = cd.cat_experiments(ens, var, exp1_name=e1name, exp2_name=e2name)
    filepattern = "*.nc"
    ens = cd.mkensemble(filepattern)
    my_cdo_str = "cdo remapdis,r1x180 -zonmean -seldate,1950-01-01,2000-12-31\
             -sub {infile} -timmean -seldate,1950-01-01,2000-12-31 {infile}\
             {outfile}"
    ens = cd.my_operator(ens, my_cdo_str, output_prefix="test_", delete=True)
    data = ctt.sha(ens)
    return data
Exemplo n.º 3
0
def test_my_operator(directory, sourcefiles, var, e1name, e2name):
    ctt.loadtestfiles(directory, sourcefiles)
    filepattern = '*.nc'
    ens = cd.mkensemble(filepattern)
    ens = cd.cat_experiments(ens, var, exp1_name=e1name, exp2_name=e2name)
    filepattern = '*.nc'
    ens = cd.mkensemble(filepattern)
    my_cdo_str = 'cdo remapdis,r1x180 -zonmean -seldate,1950-01-01,2000-12-31\
             -sub {infile} -timmean -seldate,1950-01-01,2000-12-31 {infile}\
             {outfile}'

    ens = cd.my_operator(ens, my_cdo_str, output_prefix='test_', delete=True)
    data = ctt.sha(ens)
    return data
Exemplo n.º 4
0
def test_ensembleenvelope(directory, sourcefiles, var, sd, ed, cwd):
    """ Tests ensemble_envelope_timeseries
    
    Parameters
    ----------
    directory : string
                the directory to link the files to
    sourcefiles : list
                  a list of the locations of the files to link
    var :  string
           the variable plotted
    sd : int
         start date for time slice
    ed : int
         end date for time slice
    cwd : string 
          directory of the test modules
    """
    ctt.loadtestfiles(directory, sourcefiles)
    filepattern = '*.nc'
    ens = cd.mkensemble(filepattern)
    ens = cd.time_slice(ens, sd, ed)
    ens = cd.remap(ens, 'r360x180', delete=True)
    ens = cd.my_operator(
        ens,
        my_cdo_str='cdo -fldmean -yearmean {infile} {outfile}',
        output_prefix='processed_',
        delete=True)
    cd.ens_stats(ens, var)
    cd.ensemble_envelope_timeseries(
        ens,
        'ENS-MEAN_processed_remap_ts_Amon_CanESM2_historical_R-MEAN_195001-200012.nc',
        'ENS-STD_processed_remap_ts_Amon_CanESM2_historical_STD_195001-200012.nc',
        var,
        pdf='ensenv')
    plotcompare(directory, cwd, 'ensenv')
    os.system('rm  ensenv.pdf')