Commit 02129e61 authored by karolina's avatar karolina
Browse files

first round of "purification" of analysis files; with no influence on the rest of the code

parent 09e7dfe1
This diff is collapsed.
......@@ -40,33 +40,32 @@ def WriteMixingRatios(DaCycle):
import netCDF4
dirname = 'data_molefractions'
#
dirname = CreateDirs(os.path.join(DaCycle['dir.analysis'],dirname))
dirname = 'data_molefractions'
dirname = CreateDirs(os.path.join(DaCycle['dir.analysis'], dirname))
#
# Some help variables
#
dectime0 = date2num(datetime(2000,1,1))
dt = DaCycle['cyclelength']
startdate = DaCycle['time.start']
enddate = DaCycle['time.end']
dectime0 = date2num(datetime(2000, 1, 1))
dt = DaCycle['cyclelength']
startdate = DaCycle['time.start']
enddate = DaCycle['time.end']
msg = "DA Cycle start date is %s" % startdate.strftime('%Y-%m-%d %H:%M') ; logging.debug(msg)
msg = "DA Cycle end date is %s" % enddate.strftime('%Y-%m-%d %H:%M') ; logging.debug(msg)
logging.debug("DA Cycle start date is %s" % startdate.strftime('%Y-%m-%d %H:%M'))
logging.debug("DA Cycle end date is %s" % enddate.strftime('%Y-%m-%d %H:%M'))
DaCycle['time.sample.stamp'] = "%s_%s"%(startdate.strftime("%Y%m%d%H"),enddate.strftime("%Y%m%d%H"),)
DaCycle['time.sample.stamp'] = "%s_%s" % (startdate.strftime("%Y%m%d%H"), enddate.strftime("%Y%m%d%H"),)
# Step (1): Get the posterior sample output data file for this cycle
infile = os.path.join(DaCycle['dir.output'],'sampleinfo_%s__newstyle.nc'% DaCycle['time.sample.stamp'])
infile = os.path.join(DaCycle['dir.output'], 'sampleinfo_%s__newstyle.nc' % DaCycle['time.sample.stamp'])
ncf_in = io.CT_Read(infile,'read')
ncf_in = io.CT_Read(infile, 'read')
obs_num = ncf_in.GetVariable('obs_num')
obs_val = ncf_in.GetVariable('observed')
obs_num = ncf_in.GetVariable('obs_num')
obs_val = ncf_in.GetVariable('observed')
simulated = ncf_in.GetVariable('modelsamples')
infilename= ncf_in.GetVariable('inputfilename')
infiles = netCDF4.chartostring(infilename).tolist()
infilename = ncf_in.GetVariable('inputfilename')
infiles = netCDF4.chartostring(infilename).tolist()
#infiles = [join(s.compressed(),'') for s in infilename]
......@@ -74,7 +73,7 @@ def WriteMixingRatios(DaCycle):
# Step (2): Get the prior sample output data file for this cycle
infile = os.path.join(DaCycle['dir.output'],'optimizer.%s.nc'% startdate.strftime('%Y%m%d') )
infile = os.path.join(DaCycle['dir.output'], 'optimizer.%s.nc' % startdate.strftime('%Y%m%d'))
if os.path.exists(infile):
optimized_present = True
......@@ -83,18 +82,18 @@ def WriteMixingRatios(DaCycle):
if optimized_present:
ncf_fc_in = io.CT_Read(infile,'read')
ncf_fc_in = io.CT_Read(infile, 'read')
fc_obs_num = ncf_fc_in.GetVariable('obspack_num')
fc_obs_val = ncf_fc_in.GetVariable('observed')
fc_obs_num = ncf_fc_in.GetVariable('obspack_num')
fc_obs_val = ncf_fc_in.GetVariable('observed')
fc_simulated = ncf_fc_in.GetVariable('modelsamplesmean_prior')
fc_simulated_ens = ncf_fc_in.GetVariable('modelsamplesdeviations_prior')
fc_flag = ncf_fc_in.GetVariable('flag')
fc_r = ncf_fc_in.GetVariable('modeldatamismatchvariance').diagonal()
fc_hphtr = ncf_fc_in.GetVariable('totalmolefractionvariance').diagonal()
fc_flag = ncf_fc_in.GetVariable('flag')
fc_r = ncf_fc_in.GetVariable('modeldatamismatchvariance').diagonal()
fc_hphtr = ncf_fc_in.GetVariable('totalmolefractionvariance').diagonal()
filesitecode = ncf_fc_in.GetVariable('sitecode')
fc_sitecodes = netCDF4.chartostring(filesitecode).tolist()
fc_sitecodes = netCDF4.chartostring(filesitecode).tolist()
#fc_sitecodes = [join(s.compressed(),'') for s in filesitecode]
ncf_fc_in.close()
......@@ -102,7 +101,7 @@ def WriteMixingRatios(DaCycle):
# Expand the list of input files with those available from the forecast list
infiles_rootdir = os.path.split(infiles[0])[0]
infiles.extend(os.path.join(infiles_rootdir,f+'.nc') for f in fc_sitecodes)
infiles.extend(os.path.join(infiles_rootdir, f + '.nc') for f in fc_sitecodes)
#Step (2): For each observation timeseries we now have data for, open it and fill with data
......@@ -110,21 +109,21 @@ def WriteMixingRatios(DaCycle):
for orig_file in set(infiles):
if not os.path.exists(orig_file):
msg = "The original input file (%s) could not be found, continuing to next file..."%orig_file ; logging.error(msg)
logging.error("The original input file (%s) could not be found, continuing to next file..." % orig_file)
continue
copy_file = os.path.join(dirname,os.path.split(orig_file)[-1])
copy_file = os.path.join(dirname, os.path.split(orig_file)[-1])
if not os.path.exists(copy_file):
shutil.copy(orig_file,copy_file)
msg = "Copied a new original file (%s) to the analysis directory"%orig_file ; logging.debug(msg)
shutil.copy(orig_file, copy_file)
logging.debug("Copied a new original file (%s) to the analysis directory" % orig_file)
ncf_out = io.CT_CDF(copy_file,'write')
ncf_out = io.CT_CDF(copy_file, 'write')
# Modify the attributes of the file to reflect added data from CTDAS properly
ncf_out.Caution = '==================================================================================='
ncf_out.Caution = '==================================================================================='
try:
ncf_out.History += '\nOriginal observation file modified by user %s on %s\n' % (os.environ['USER'], datetime.today().strftime('%F'),)
except:
......@@ -135,18 +134,18 @@ def WriteMixingRatios(DaCycle):
+ '\nCTDAS Da System was %s' % (DaCycle['da.system'],)\
+ '\nCTDAS Da ObsOperator was %s' % (DaCycle['da.obsoperator'],)
ncf_out.CTDAS_startdate = DaCycle['time.start'].strftime('%F')
ncf_out.CTDAS_enddate = DaCycle['time.finish'].strftime("%F")
ncf_out.CTDAS_enddate = DaCycle['time.finish'].strftime("%F")
ncf_out.original_file = orig_file
# get nobs dimension
if ncf_out.dimensions.has_key('id'):
dimidob = ncf_out.dimensions['id']
dimid = ('id',)
dimidob = ncf_out.dimensions['id']
dimid = ('id',)
elif ncf_out.dimensions.has_key('obs'):
dimidob = ncf_out.dimensions['obs']
dimid = ('obs',)
dimidob = ncf_out.dimensions['obs']
dimid = ('obs',)
if dimidob.isunlimited:
nobs = ncf_out.inq_unlimlen()
......@@ -156,88 +155,88 @@ def WriteMixingRatios(DaCycle):
# add nmembers dimension
dimmembersob = ncf_out.createDimension('nmembers',size=simulated.shape[1])
dimmembers = ('nmembers',)
nmembers = len(dimmembers)
dimmembersob = ncf_out.createDimension('nmembers', size=simulated.shape[1])
dimmembers = ('nmembers',)
nmembers = len(dimmembers)
# Create empty arrays for posterior samples, as well as for forecast sample statistics
savedict = io.std_savedict.copy()
savedict['name'] = "flag_forecast"
savedict['long_name'] = "flag_for_obs_model in forecast"
savedict['units'] = "None"
savedict['dims'] = dimid
savedict['comment'] = 'Flag (0/1/2/99) for observation value, 0 means okay, 1 means QC error, 2 means rejected, 99 means not sampled'
dummy = ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modeldatamismatch"
savedict['long_name'] = "modeldatamismatch"
savedict['units'] = "[mol mol-1]^2"
savedict['dims'] = dimid
savedict['comment'] = 'Variance of mole fractions resulting from model-data mismatch'
status = ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "totalmolefractionvariance_forecast"
savedict['long_name'] = "totalmolefractionvariance of forecast"
savedict['units'] = "[mol mol-1]^2"
savedict['dims'] = dimid
savedict['comment'] = 'Variance of mole fractions resulting from prior state and model-data mismatch'
dummy = ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesmean"
savedict['long_name'] = "mean modelsamples"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid
savedict['comment'] = 'simulated mixing ratios based on optimized state vector'
status = ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesmean_forecast"
savedict['long_name'] = "mean modelsamples from forecast"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid
savedict['comment'] = 'simulated mixing ratios based on prior state vector'
status = ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesstandarddeviation"
savedict['long_name'] = "standard deviaton of modelsamples over all ensemble members"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid
savedict['comment'] = 'std dev of simulated mixing ratios based on optimized state vector'
status = ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesstandarddeviation_forecast"
savedict['long_name'] = "standard deviaton of modelsamples from forecast over all ensemble members"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid
savedict['comment'] = 'std dev of simulated mixing ratios based on prior state vector'
status = ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesensemble"
savedict['long_name'] = "modelsamples over all ensemble members"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid+dimmembers
savedict['comment'] = 'ensemble of simulated mixing ratios based on optimized state vector'
status = ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesensemble_forecast"
savedict['long_name'] = "modelsamples from forecast over all ensemble members"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid+dimmembers
savedict['comment'] = 'ensemble of simulated mixing ratios based on prior state vector'
status = ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "flag_forecast"
savedict['long_name'] = "flag_for_obs_model in forecast"
savedict['units'] = "None"
savedict['dims'] = dimid
savedict['comment'] = 'Flag (0/1/2/99) for observation value, 0 means okay, 1 means QC error, 2 means rejected, 99 means not sampled'
ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modeldatamismatch"
savedict['long_name'] = "modeldatamismatch"
savedict['units'] = "[mol mol-1]^2"
savedict['dims'] = dimid
savedict['comment'] = 'Variance of mole fractions resulting from model-data mismatch'
ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "totalmolefractionvariance_forecast"
savedict['long_name'] = "totalmolefractionvariance of forecast"
savedict['units'] = "[mol mol-1]^2"
savedict['dims'] = dimid
savedict['comment'] = 'Variance of mole fractions resulting from prior state and model-data mismatch'
ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesmean"
savedict['long_name'] = "mean modelsamples"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid
savedict['comment'] = 'simulated mixing ratios based on optimized state vector'
ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesmean_forecast"
savedict['long_name'] = "mean modelsamples from forecast"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid
savedict['comment'] = 'simulated mixing ratios based on prior state vector'
ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesstandarddeviation"
savedict['long_name'] = "standard deviaton of modelsamples over all ensemble members"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid
savedict['comment'] = 'std dev of simulated mixing ratios based on optimized state vector'
ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesstandarddeviation_forecast"
savedict['long_name'] = "standard deviaton of modelsamples from forecast over all ensemble members"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid
savedict['comment'] = 'std dev of simulated mixing ratios based on prior state vector'
ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesensemble"
savedict['long_name'] = "modelsamples over all ensemble members"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid + dimmembers
savedict['comment'] = 'ensemble of simulated mixing ratios based on optimized state vector'
ncf_out.AddVariable(savedict)
savedict = io.std_savedict.copy()
savedict['name'] = "modelsamplesensemble_forecast"
savedict['long_name'] = "modelsamples from forecast over all ensemble members"
savedict['units'] = "mol mol-1"
savedict['dims'] = dimid + dimmembers
savedict['comment'] = 'ensemble of simulated mixing ratios based on prior state vector'
ncf_out.AddVariable(savedict)
else:
msg = "Modifying existing file (%s) in the analysis directory"%copy_file ; logging.debug(msg)
logging.debug("Modifying existing file (%s) in the analysis directory" % copy_file)
ncf_out = io.CT_CDF(copy_file,'write')
ncf_out = io.CT_CDF(copy_file, 'write')
# Get existing file obs_nums to determine match to local obs_nums
......@@ -249,7 +248,7 @@ def WriteMixingRatios(DaCycle):
# Get all obs_nums related to this file, determine their indices in the local arrays
selected_obs_nums = [num for infile,num in zip(infiles,obs_num) if infile == orig_file]
selected_obs_nums = [num for infile, num in zip(infiles, obs_num) if infile == orig_file]
# Optimized data 1st: For each index, get the data and add to the file in the proper file index location
......@@ -257,30 +256,30 @@ def WriteMixingRatios(DaCycle):
for num in selected_obs_nums:
model_index = obs_num.tolist().index(num)
file_index = file_obs_nums.tolist().index(num)
file_index = file_obs_nums.tolist().index(num)
#var = ncf_out.variables['modeldatamismatch'] # Take from optimizer.yyyymmdd.nc file instead
#var[file_index] = mdm[model_index]
var = ncf_out.variables['modelsamplesmean']
var[file_index] = simulated[model_index,0]
var[file_index] = simulated[model_index, 0]
var = ncf_out.variables['modelsamplesstandarddeviation']
var[file_index] = simulated[model_index,1:].std()
var[file_index] = simulated[model_index, 1:].std()
var = ncf_out.variables['modelsamplesensemble']
var[file_index] = simulated[model_index,:]
var[file_index] = simulated[model_index, :]
# Now forecast data too: For each index, get the data and add to the file in the proper file index location
if optimized_present:
selected_fc_obs_nums = [num for sitecode,num in zip(fc_sitecodes,fc_obs_num) if sitecode in orig_file]
selected_fc_obs_nums = [num for sitecode, num in zip(fc_sitecodes, fc_obs_num) if sitecode in orig_file]
for num in selected_fc_obs_nums:
model_index = fc_obs_num.tolist().index(num)
file_index = file_obs_nums.tolist().index(num)
file_index = file_obs_nums.tolist().index(num)
var = ncf_out.variables['modeldatamismatch']
var[file_index] = np.sqrt(fc_r[model_index])
......@@ -289,10 +288,10 @@ def WriteMixingRatios(DaCycle):
var[file_index] = fc_simulated[model_index]
var = ncf_out.variables['modelsamplesstandarddeviation_forecast']
var[file_index] = fc_simulated_ens[model_index,1:].std()
var[file_index] = fc_simulated_ens[model_index, 1:].std()
var = ncf_out.variables['modelsamplesensemble_forecast']
var[file_index] = fc_simulated_ens[model_index,:]
var[file_index] = fc_simulated_ens[model_index, :]
var = ncf_out.variables['totalmolefractionvariance_forecast']
var[file_index] = fc_hphtr[model_index]
......@@ -303,7 +302,7 @@ def WriteMixingRatios(DaCycle):
# close the file
status = ncf_out.close()
status = ncf_out.close()
return None
......@@ -323,10 +322,10 @@ if __name__ == "__main__":
DaCycle.Initialize()
DaCycle.ParseTimes()
DaSystem = CtDaSystem('../rc/carbontracker_ct09_opf.rc')
DaSystem = CtDaSystem('../rc/carbontracker_ct09_opf.rc')
DaSystem.Initialize()
DaCycle.DaSystem = DaSystem
DaCycle.DaSystem = DaSystem
while DaCycle['time.start'] < DaCycle['time.finish']:
......
This diff is collapsed.
......@@ -9,42 +9,42 @@ import logging
import da.tools.io4 as io
from da.tools.general import CreateDirs
fontsize=10
fontsize = 10
def nice_lat(cls):
#
# Convert latitude from decimal to cardinal
#
if cls > 0:
h = 'N'
else:
h = 'S'
#
# Convert latitude from decimal to cardinal
#
if cls > 0:
h = 'N'
else:
h = 'S'
dec, deg = np.math.modf(cls)
dec, deg = np.math.modf(cls)
return string.strip('%2d %2d\'%s' % (abs(deg), round(abs(60 * dec), 0), h))
return string.strip('%2d %2d\'%s' % (abs(deg), round(abs(60 * dec), 0), h))
def nice_lon(cls):
#
# Convert longitude from decimal to cardinal
#
if cls > 0:
h = 'E'
else:
h = 'W'
#
# Convert longitude from decimal to cardinal
#
if cls > 0:
h = 'E'
else:
h = 'W'
dec, deg = np.math.modf(cls)
dec, deg = np.math.modf(cls)
return string.strip('%3d %2d\'%s' % (abs(deg), round(abs(60 * dec), 0), h))
return string.strip('%3d %2d\'%s' % (abs(deg), round(abs(60 * dec), 0), h))
def nice_alt(cls):
#
# Reformat elevation or altitude
#
return string.strip('%10.1f masl' % round(cls, -1))
#
# Reformat elevation or altitude
#
return string.strip('%10.1f masl' % round(cls, -1))
def SummarizeObs(DaCycle,printfmt='html'):
def SummarizeObs(DaCycle, printfmt='html'):
"""***************************************************************************************
Call example:
......@@ -62,24 +62,24 @@ def SummarizeObs(DaCycle,printfmt='html'):
***************************************************************************************"""
sumdir=os.path.join(DaCycle['dir.analysis'],'summary')
sumdir = os.path.join(DaCycle['dir.analysis'], 'summary')
if not os.path.exists(sumdir):
logging.info( "Creating new directory "+sumdir )
logging.info("Creating new directory " + sumdir)
os.makedirs(sumdir)
mrdir=os.path.join(DaCycle['dir.analysis'],'data_molefractions')
mrdir = os.path.join(DaCycle['dir.analysis'], 'data_molefractions')
if not os.path.exists(mrdir):
logging.error( "Input directory does not exist (%s), exiting... "%mrdir )
logging.error("Input directory does not exist (%s), exiting... " % mrdir)
return None
mrfiles = os.listdir(mrdir)
infiles = [os.path.join(mrdir,f) for f in mrfiles if f.endswith('.nc')]
infiles = [os.path.join(mrdir, f) for f in mrfiles if f.endswith('.nc')]
if printfmt == 'tex':
print '\\begin{tabular*}{\\textheight}{l l l l r r r r}'
print 'Code & Name & Lat, Lon, Elev & Lab & N (flagged) & $\\sqrt{R}$ &Inn \\XS &Bias\\\\'
print '\hline\\\\ \n\multicolumn{8}{ c }{Semi-Continuous Surface Samples}\\\\[3pt] '
fmt= '%8s & '+' %55s & '+'%20s &'+'%6s &'+' %4d (%d) & '+' %5.2f & '+' %5.2f & '+'%+5.2f \\\\'
fmt = '%8s & ' + ' %55s & ' + '%20s &' + '%6s &' + ' %4d (%d) & ' + ' %5.2f & ' + ' %5.2f & ' + '%+5.2f \\\\'
elif printfmt == 'html':
tablehead = \
"<TR>\n <TH> Site code </TH> \
......@@ -95,7 +95,7 @@ def SummarizeObs(DaCycle,printfmt='html'):
<TH> H(x)-y (NDJFMA) (&mu;mol mol<sup>-1</sup>) </TH> \n \
</TR>\n"
fmt= """<TR> \n \
fmt = """<TR> \n \
<TD><a href='javascript:LoadCO2Tseries("%s")'>%s </a></TD>\
<TD>%s</TD>\
<TD>%s</TD>\
......@@ -110,39 +110,39 @@ def SummarizeObs(DaCycle,printfmt='html'):
</TR>\n"""
elif printfmt == 'scr':
print 'Code Site NObs flagged R Inn X2'
fmt= '%8s '+' %55s %s %s'+' %4d '+' %4d '+' %5.2f '+' %5.2f'
fmt = '%8s ' + ' %55s %s %s' + ' %4d ' + ' %4d ' + ' %5.2f ' + ' %5.2f'
table=[]
lons=[]
lats=[]
names=[]
nobs=[]
table = []
lons = []
lats = []
names = []
nobs = []
for infile in infiles:
#logging.debug( infile )
f = io.CT_CDF(infile,'read')
date = f.GetVariable('time')
obs = f.GetVariable('value')*1e6
mdm = f.GetVariable('modeldatamismatch')*1e6
simulated = f.GetVariable('modelsamplesmean_forecast')*1e6
simulated_std = f.GetVariable('modelsamplesstandarddeviation_forecast')*1e6
pydates = [dt.datetime(1970,1,1)+dt.timedelta(seconds=int(d)) for d in date]
summer = [i for i,d in enumerate(pydates) if d.month in [6,7,8,9] ]
winter = [i for i,d in enumerate(pydates) if d.month in [11,12,1,2,3,4] ]
diff=((simulated-obs).mean())
diffsummer=((simulated-obs).take(summer).mean())
diffwinter=((simulated-obs).take(winter).mean())
diffstd=((simulated-obs).std())
diffsummerstd=((simulated-obs).take(summer).std())
diffwinterstd=((simulated-obs).take(winter).std())
longsitestring=f.site_name+', '+f.site_country
location=nice_lat(f.site_latitude)+', '+ nice_lon(f.site_longitude)+', '+nice_alt(f.site_elevation)
f = io.CT_CDF(infile, 'read')
date = f.GetVariable('time')
obs = f.GetVariable('value') * 1e6
mdm = f.GetVariable('modeldatamismatch') * 1e6
simulated = f.GetVariable('modelsamplesmean_forecast') * 1e6
simulated_std = f.GetVariable('modelsamplesstandarddeviation_forecast') * 1e6
pydates = [dt.datetime(1970, 1, 1) + dt.timedelta(seconds=int(d)) for d in date]
summer = [i for i, d in enumerate(pydates) if d.month in [6, 7, 8, 9] ]
winter = [i for i, d in enumerate(pydates) if d.month in [11, 12, 1, 2, 3, 4] ]
diff = ((simulated - obs).mean())
diffsummer = ((simulated - obs).take(summer).mean())
diffwinter = ((simulated - obs).take(winter).mean())
diffstd = ((simulated - obs).std())
diffsummerstd = ((simulated - obs).take(summer).std())
diffwinterstd = ((simulated - obs).take(winter).std())
longsitestring = f.site_name + ', ' + f.site_country
location = nice_lat(f.site_latitude) + ', ' + nice_lon(f.site_longitude) + ', ' + nice_alt(f.site_elevation)
if printfmt == 'html':
ss=(f.site_code.upper(),
ss = (f.site_code.upper(),
f.site_code.upper(),
f.dataset_project,
f.lab_abbr,
......@@ -150,39 +150,39 @@ def SummarizeObs(DaCycle,printfmt='html'):
location,
len(np.ma.compressed(mdm)),
mdm.mean(),
np.sqrt((simulated_std**2).mean()),
diff,diffstd,
diffsummer,diffsummerstd,
diffwinter,diffwinterstd)
np.sqrt((simulated_std ** 2).mean()),
diff, diffstd,
diffsummer, diffsummerstd,
diffwinter, diffwinterstd)
table.append(ss)
f.close()
if printfmt == 'tex':
saveas=os.path.join(sumdir,'site_table.tex')
f=open(saveas,'w')
saveas = os.path.join(sumdir, 'site_table.tex')