コード例 #1
0
    dates = []
    for filename in files:
        date=datetime.datetime.strptime(filename.split('.')[-2],'%Y')
        dates.append( date )

    avg_files = [os.path.join(yeardir,k) for k in files]
   
    if len(avg_files) > 0 : 
        command = ['ncra','-O']+ avg_files + [os.path.join(longtermdir,'%s_fluxes.%04d-%04d.nc'%(avg,min(dates).year, max(dates).year))]
        status = subprocess.check_call(command)

if __name__ == "__main__":

    from da.tools.initexit import CycleControl

    sys.path.append('../../')

    dacycle = CycleControl(args={'rc':'../../ctdas-ei-nobcb-zoom-ecoregions.rc'})
    dacycle.setup()
    dacycle.parse_times()

    while dacycle['time.end'] < dacycle['time.finish']:
        time_avg(dacycle,avg='flux1x1')
        time_avg(dacycle,avg='transcom')
        time_avg(dacycle,avg='transcom_extended')
        time_avg(dacycle,avg='olson')
        time_avg(dacycle,avg='olson_extended')
        time_avg(dacycle,avg='country')
        dacycle.advance_cycle_times()

コード例 #2
0
    ncf.close()

    logging.info("------------------- Finished time averaging---------------------------------")

    return saveas

if __name__ == "__main__":
    from da.tools.initexit import CycleControl
    from da.carbondioxide.dasystem import CO2DaSystem 
    from da.carbondioxide.statevector import CO2StateVector 

    sys.path.append('../../')

    logging.root.setLevel(logging.DEBUG)

    dacycle = CycleControl(args={'rc':'../../ctdas-od-gfed2-glb6x4-obspack-full.rc'})
    dasystem = CO2DaSystem('../rc/carbontracker_ct09_opfnew.rc')
    dacycle.dasystem = dasystem
    dacycle.setup()
    dacycle.parse_times()



    statevector = CO2StateVector()
    statevector.setup(dacycle)

    while dacycle['time.start'] < dacycle['time.finish']:
        save_weekly_avg_1x1_data(dacycle, statevector)
        save_weekly_avg_state_data(dacycle, statevector)
        save_weekly_avg_tc_data(dacycle, statevector)
        save_weekly_avg_ext_tc_data(dacycle)
コード例 #3
0
ファイル: dasgridded.py プロジェクト: njuhewei/CTDAS-Lagrange
from da.analysis.expand_fluxes import save_weekly_avg_1x1_data, save_weekly_avg_state_data, save_weekly_avg_tc_data, save_weekly_avg_ext_tc_data
from da.analysis.expand_molefractions import write_mole_fractions

#################################################################################################
# Parse and validate the command line options, start logging
#################################################################################################

start_logger()

opts, args = validate_opts_args(parse_options())

#################################################################################################
# Create the Cycle Control object for this job
#################################################################################################

dacycle = CycleControl(opts, args)

platform = MaunaloaPlatform()
dasystem = CO2GriddedDaSystem(dacycle['da.system.rc'])
obsoperator = TM5ObservationOperator(dacycle['da.obsoperator.rc'])
samples = CO2Observations()
statevector = CO2GriddedStateVector()
optimizer = CO2Optimizer()

##########################################################################################
################### ENTER THE PIPELINE WITH THE OBJECTS PASSED BY THE USER ###############
##########################################################################################

logging.info(header + "Entering Pipeline " + footer)
ensemble_smoother_pipeline(dacycle, platform, dasystem, samples, statevector,
                           obsoperator, optimizer)
コード例 #4
0
        # close the file

        status = ncf_out.close()

    return None


if __name__ == "__main__":
    import logging
    from da.tools.initexit import CycleControl
    from da.carbondioxide.dasystem import CO2DaSystem

    sys.path.append('../../')

    logging.root.setLevel(logging.DEBUG)

    dacycle = CycleControl(args={'rc': '../../ctdas-stilt-proto.rc'})
    dasystem = CO2DaSystem('carbontracker_griddedNA.rc')
    dacycle.dasystem = dasystem
    dacycle.setup()
    dacycle.parse_times()

    while dacycle['time.start'] < dacycle['time.finish']:

        outfile = write_mole_fractions(dacycle)

        dacycle.advance_cycle_times()

    sys.exit(0)