Commit 2afc6235 authored by Peters, Wouter's avatar Peters, Wouter
Browse files

update of names of functions in io

parent 3eca0791
......@@ -93,7 +93,7 @@ def save_weekly_avg_1x1_data(dacycle, statevector):
#
filename = os.path.join(dacycle['dir.output'], 'flux1x1_%s_%s.nc' % (startdate.strftime('%Y%m%d%H'), enddate.strftime('%Y%m%d%H')))
file = io.CT_Read(filename, 'read')
file = io.ct_read(filename, 'read')
bio = np.array(file.get_variable(dacycle.dasystem['background.co2.bio.flux']))
ocean = np.array(file.get_variable(dacycle.dasystem['background.co2.ocean.flux']))
fire = np.array(file.get_variable(dacycle.dasystem['background.co2.fires.flux']))
......@@ -272,7 +272,7 @@ def save_weekly_avg_state_data(dacycle, statevector):
#
filename = os.path.join(dacycle['dir.output'], 'flux1x1_%s_%s.nc' % (startdate.strftime('%Y%m%d%H'), enddate.strftime('%Y%m%d%H')))
file = io.CT_Read(filename, 'read')
file = io.ct_read(filename, 'read')
bio = np.array(file.get_variable(dacycle.dasystem['background.co2.bio.flux']))
ocean = np.array(file.get_variable(dacycle.dasystem['background.co2.ocean.flux']))
fire = np.array(file.get_variable(dacycle.dasystem['background.co2.fires.flux']))
......@@ -469,7 +469,7 @@ def save_weekly_avg_tc_data(dacycle, statevector):
ncf = io.CT_CDF(saveas, 'write')
dimdate = ncf.add_date_dim()
dimidateformat = ncf.add_date_dim_format()
dimregs = ncf.AddRegionDim(type='tc')
dimregs = ncf.add_region_dim(type='tc')
#
# set title and tell GMT that we are using "pixel registration"
#
......@@ -491,7 +491,7 @@ def save_weekly_avg_tc_data(dacycle, statevector):
logging.error("Needed input file (%s) does not exist yet, please create file first, returning..." % infile)
return None
ncf_in = io.CT_Read(infile, 'read')
ncf_in = io.ct_read(infile, 'read')
# Transform data one by one
......@@ -599,7 +599,7 @@ def save_weekly_avg_ext_tc_data(dacycle):
ncf = io.CT_CDF(saveas, 'write')
dimdate = ncf.add_date_dim()
dimidateformat = ncf.add_date_dim_format()
dimregs = ncf.AddRegionDim(type='tc_ext')
dimregs = ncf.add_region_dim(type='tc_ext')
#
# set title and tell GMT that we are using "pixel registration"
#
......@@ -616,7 +616,7 @@ def save_weekly_avg_ext_tc_data(dacycle):
logging.error("Needed input file (%s) does not exist yet, please create file first, returning..." % infile)
return None
ncf_in = io.CT_Read(infile, 'read')
ncf_in = io.ct_read(infile, 'read')
# Transform data one by one
......@@ -743,7 +743,7 @@ def save_weekly_avg_agg_data(dacycle, region_aggregate='olson'):
elif region_aggregate == "transcom":
regionmask = tc.transcommask
dimname = 'tc'
dimregs = ncf.AddRegionDim(type='tc')
dimregs = ncf.add_region_dim(type='tc')
elif region_aggregate == "country":
......@@ -808,7 +808,7 @@ def save_weekly_avg_agg_data(dacycle, region_aggregate='olson'):
logging.error("Needed input file (%s) does not exist yet, please create file first, returning..." % infile)
return None
ncf_in = io.CT_Read(infile, 'read')
ncf_in = io.ct_read(infile, 'read')
# Transform data one by one
......@@ -930,7 +930,7 @@ def save_time_avg_data(dacycle, infile, avg='monthly'):
else:
pass
file = io.CT_Read(infile, 'read')
file = io.ct_read(infile, 'read')
datasets = file.variables.keys()
date = file.get_variable('date')
globatts = file.ncattrs()
......@@ -1023,7 +1023,7 @@ if __name__ == "__main__":
logging.root.setLevel(logging.DEBUG)
dacycle = CycleControl(args={'rc':'../../ctdas-od-gfed2-nam1x1-obspack-full-gridded.rc'})
dacycle = CycleControl(args={'rc':'../../ctdas-od-gfed2-glb6x4-obspack-full.rc'})
dacycle.initialize()
dacycle.parse_times()
......@@ -1035,23 +1035,17 @@ if __name__ == "__main__":
statevector.initialize(dacycle)
while dacycle['time.end'] < dacycle['time.finish']:
savedas_1x1 = save_weekly_avg_1x1_data(dacycle, statevector)
savedas_state = save_weekly_avg_state_data(dacycle, statevector)
savedas_tc = save_weekly_avg_tc_data(dacycle, statevector)
savedas_tcext = save_weekly_avg_ext_tc_data(dacycle)
savedas_olson = save_weekly_avg_agg_data(dacycle, region_aggregate='olson')
savedas_transcom = save_weekly_avg_agg_data(dacycle, region_aggregate='transcom')
savedas_country = save_weekly_avg_agg_data(dacycle, region_aggregate='country')
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)
save_weekly_avg_agg_data(dacycle, region_aggregate='olson')
save_weekly_avg_agg_data(dacycle, region_aggregate='transcom')
save_weekly_avg_agg_data(dacycle, region_aggregate='country')
dacycle.advance_cycle_times()
statevector = None # free memory
for avg in ['monthly', 'yearly', 'longterm']:
savedas_1x1 = save_time_avg_data(dacycle, savedas_1x1, avg)
savedas_state = save_time_avg_data(dacycle, savedas_state, avg)
savedas_tc = save_time_avg_data(dacycle, savedas_tc, avg)
savedas_tcext = save_time_avg_data(dacycle, savedas_tcext, avg)
sys.exit(0)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment