Ejemplo n.º 1
0
def print_normalized(profid, tosmpyr):    
    prof1 = data.loc[profid,['Layer_bottom','D14C_BulkLayer','SampleYear']]
    mod = C14.cal_D14Ctosmpyr(tau[:,0], tosmpyr)
    newdata['D14C_normalized'] = mod
    prof = newdata.loc[profid,['Layer_bottom','D14C_BulkLayer','D14C_normalized','SampleYear']]
    print prof
Ejemplo n.º 2
0
import mystats as mysm

filename = 'Non_peat_data_synthesis.csv'
data = pd.read_csv(filename,encoding='iso-8859-1',index_col='ProfileID', skiprows=[1])  
profid = data.index.unique() # index of profile start
d14C = prep.getvarxls(data,'D14C_BulkLayer', profid, ':')
sampleyr = prep.getvarxls(data, 'SampleYear', profid, ':')
layerbot = prep.getvarxls(data, 'Layer_bottom', profid, ':')
tau, cost = C14.cal_tau(d14C, sampleyr, 3, False)
np.savez('./Synthesis_allD14C_tau.npz',tau=tau,cost=cost)

taudata = np.load('./Synthesis_allD14C_tau.npz')
tau = taudata['tau']
cost = taudata['cost']

D14C2000 = np.array(C14.cal_D14Ctosmpyr(tau[:,0], 2000))

is_badcost = cost[:,0]>50
data.D14C_BulkLayer[is_badcost]
a = mysm.cal_RMSE(d14C[~is_badcost], D14C2000[~is_badcost])

D14C2000df = pd.DataFrame(data=D14C2000)
D14C2000df.to_csv('normalizedD14C.csv')
#%% verify the D14C normalization approach
newdata = data.copy()

# index of profiles that have multiple year measurements
def print_normalized(profid, tosmpyr):    
    prof1 = data.loc[profid,['Layer_bottom','D14C_BulkLayer','SampleYear']]
    mod = C14.cal_D14Ctosmpyr(tau[:,0], tosmpyr)
    newdata['D14C_normalized'] = mod