Пример #1
0
def make_plots():
    yyyymmdd = date.strftime("%Y%m%d")
    output_dir = met_root_dir + '/' + yyyymmdd + '/model_files/'
    plots_dir = met_root_dir + '/' + yyyymmdd + '/plots/'

    cmd = ['mkdir', '-p', plots_dir]

    print cmd
    stat = call(cmd)
    print ' stat = ', stat
    if not stat == 0: return False

    arg1 = 'dir_output=\"' + output_dir + '\"'
    arg2 = 'dir_plot=\"' + plots_dir + '\"'
    arg3 = 'case_name=\"' + cesm_case + '\"'

    cmd = 'ncl \'' + arg1 + '\' \'' + arg2 + '\' \'' + arg3 + '\' ' + scripts_dir + '/plotting/plot_surface_values_trop.ncl > /glade/scratch/fvitt/GEOS5_frcst_data/plotting.log.' + yyyymmdd
    print 'cmd = ', cmd
    output = check_output(cmd, shell=True)
    print output

    cmd = 'touch ' + plots_dir + '/.ready_for_xfer'
    print cmd
    stat = os.system(cmd)
    if not stat == 0: return False

    return True
Пример #2
0
def save_output(restart_yyyymmdd):

    yyyymmdd = date.strftime("%Y%m%d")

    data_dir = met_root_dir
    run_dir = scratch_dir + cesm_case + '/run'

    output_arc = data_dir + '/' + yyyymmdd + '/model_files'

    cmd = ['mkdir', '-p', output_arc]

    print cmd

    stat = call(cmd)
    if not stat == 0: return False

    # copy namelists and model output to safe place

    cmd = 'mv ' + run_dir + '/*cam.h*.nc ' + output_arc
    print cmd
    stat = os.system(cmd)
    if not stat == 0: return False

    cmd = 'mv ' + run_dir + '/' + cesm_case + '*cam.i.' + restart_yyyymmdd + '*  ' + output_arc
    print cmd
    stat = os.system(cmd)
    if not stat == 0: return False

    cmd = 'mv ' + run_dir + '/' + cesm_case + '*.r*.' + restart_yyyymmdd + '*  ' + output_arc
    print cmd
    stat = os.system(cmd)
    if not stat == 0: return False

    cmd = 'cp ' + run_dir + '/*_in ' + output_arc
    print cmd
    stat = os.system(cmd)
    if not stat == 0: return False

    cmd = 'cp ' + run_dir + '/rpointer.* ' + output_arc
    print cmd
    stat = os.system(cmd)
    if not stat == 0: return False

    cmd = 'touch ' + output_arc + '/.ready_for_xfer'
    print cmd
    stat = os.system(cmd)
    if not stat == 0: return False

    # do some cleanup ...

    cmd = 'rm ' + run_dir + '/*'
    print cmd
    stat = os.system(cmd)

    #if not stat == 0 : return False

    return True
Пример #3
0
def prepare_geos_forecast():

    time0 = datetime.now()

    d_success = Process_GEOS5_Forecast.download(date,met_root_dir)
    d_success = Process_GEOS5_Forecast.download(date,met_root_dir)

    if not d_success:
        print 'GEOS forecast download FAILED', 'GEOS forecast download FAILED : '+date.strftime("%Y-%m-%d")
        return False

    time1 = datetime.now()

    c_success = Process_GEOS5_Forecast.combine(date,met_root_dir)

    if not c_success:
        # try re-downloading the data ...
        d_success = Process_GEOS5_Forecast.download(date,met_root_dir)
        c_success = Process_GEOS5_Forecast.combine(date,met_root_dir)

    if not c_success:
        print "GEOS combine data FAILED",'GEOS combine data FAILED : '+date.strftime("%Y-%m-%d")
        return False

    time2 = datetime.now()

    r_success = Process_GEOS5_Forecast.regrid(date,met_root_dir)
    if not r_success:
        print "GEOS regrid data FAILED",'GEOS regrid data FAILED : '+date.strftime("%Y-%m-%d")
        return False

    time3 = datetime.now()

    print " ++++++++++++++++++++++++++++++++++++++++++ "
    print "...Download time : ", time1-time0
    print "....Combine time : ", time2-time1
    print ".....Regrid time : ", time3-time2
    print "......Total Time : ", time3-time0
    print " ++++++++++++++++++++++++++++++++++++++++++ "
    return True
Пример #4
0
def export_plots():
    
    yyyymmdd = date.strftime("%Y%m%d")
    plots_dir = met_root_dir+'/'+yyyymmdd+'/plots'

    species = ['BC','CLOX','CO','CO01','CO02','CO03','CO04','CO05','CO06','CO07','CO08','CO09','DUST','EXTINCTdn','NOX','O3','SO2','SO4','SSALT','PM25_SRF']
    basedir = '128.117.136.211:/ur/waccm_forecast_output/'
    for sp in species:
        cmd = 'scp '+plots_dir+'/'+cesm_case+'*_'+sp+'_*' +' '+basedir+sp+'_plots'
        print 'cmd='+cmd
        stat = os.system(cmd)
        if not stat == 0 : return False

    return True
Пример #5
0
def export_history():

    yyyymmdd = date.strftime("%Y%m%d")
    hist_dir = met_root_dir + '/' + yyyymmdd + '/model_files'

    #  cp to modeling2:/amadeus-data/emmons/web/mz4_output/waccm

    dist_loc = 'modeling2.acom.ucar.edu:/amadeus-data/emmons/web/mz4_output/waccm/'
    cmd = 'scp ' + hist_dir + '/*cam.h3*nc ' + dist_loc

    print 'cmd=' + cmd
    stat = os.system(cmd)
    if not stat == 0: return False

    return True
Пример #6
0
def export_plots():

    yyyymmdd = date.strftime("%Y%m%d")
    plots_dir = met_root_dir + '/' + yyyymmdd + '/plots'

    species = [
        'BC', 'CLOX', 'CO', 'DUST', 'EXTINCTdn', 'NOX', 'O3', 'SO2', 'SO4',
        'SSALT'
    ]
    basedir = 'modeling2.acom.ucar.edu:/net/nitrogen.acom.ucar.edu/ur/fvitt/waccm_forecast_output/'
    for sp in species:
        cmd = 'scp ' + plots_dir + '/' + cesm_case + '*_' + sp + '_*' + ' ' + basedir + sp + '_plots'
        print 'cmd=' + cmd
        stat = os.system(cmd)
        if not stat == 0: return False

    return True
Пример #7
0
print " "
print " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "
print " "

days_back = 20
today = datetime.now()
oneday = timedelta(days=1)
success = True
found = False
x = 0

while not found:

    date = today - x * oneday

    yyyymmdd = date.strftime("%Y%m%d")
    yyyy = date.strftime("%Y")
    reanalysis_filepath = '/glade/p/cesm/chwg_dev/met_data/GEOS5/0.9x1.25/' + yyyy + '/GEOS5_09x125_' + yyyymmdd + '.nc'
    print "check for : ", reanalysis_filepath
    found = path.exists(reanalysis_filepath)
    x = x + 1

first_fcst_date = date + oneday

print 'last realn date = ', date.strftime("%Y-%m-%d")
print 'first_fcst_date = ', first_fcst_date.strftime("%Y-%m-%d")
print '          today = ', today.strftime("%Y-%m-%d")

print '           date = ', date.strftime("%Y-%m-%d")

yyyymmdd = today.strftime("%Y%m%d")
Пример #8
0
def prestage_cesm():

    success = prepare_cesm_inputs.update_emissions(date) # don't care if successful -- need to run model regardless...

    success = prepare_cesm_inputs.prepare_inputs(date,cesm_case)
    if not success:
        print 'GEOS forecast prestage CESM FAILED', 'GEOS forecast prestage CESM FAILED : '+date.strftime("%Y-%m-%d")
    return success