file_type = 'raw_' LT_array = [] depth_array = [] profile_array = [] grid = pd.DataFrame(columns=[ 'LT', 'c_depth' ]) # Note that there are now row data inserted.for i in range(0,58,2): for i in range(0, 50, 2): c_file = 'C' + ("%07d" % (i, )) c_data = pd.read_pickle(directory + deployment_name + file_type + c_file) [LT, Td, Nsqu, Lo, R, x_sorted, idxs] = TKED.thorpe_scales1(c_data["c_depth"].values * -1, c_data['c_dens'].values, full_output=True) c_data['LT'] = LT grid = pd.concat([grid, c_data]) # plt.plot(LT,c_data["c_depth"].values) # plt.xlabel("Thorpe_scales (m)") # plt.ylabel('Depth (m)') # plt.savefig(outdir+measurement_type+deployment_name+'profile'+str(i)+".png") # plt.clf() #plt.show() grid['c_depth'] = grid['c_depth'].round(0) grid = grid.groupby(grid['c_depth']).mean() grid['LT'] = grid['LT'].interpolate().rolling(5).mean().abs()
# # plt.show() # plt.plot(pres) # plt.show() # # plt.plot(sal) # # plt.show() # plt.plot(sal) # plt.show() CT = gsw.CT_from_t(sal, temp, pres) SA = gsw.SA_from_SP(sal, pres, 174, -43) dens = gsw.sigma0(SA, CT) depth = gsw.z_from_p(pres, -43) dens = np.squeeze(dens) depth = np.squeeze(depth) [LT, Td, Nsqu, Lo, R, x_sorted, idxs] = TKED.thorpe_scales(depth, dens, full_output=True) # plt.plot(sal) # plt.show() # Tdd = pd.Series(Td) # Tdd = Tdd.rolling(100).mean() # Tdd = Tdd**2 # Tdd = Tdd.rolling(100).mean() # Tdd = np.sqrt(Tdd) # plt.plot(Tdd) #plt.show() fig2, (ax2, ax3, ax4) = plt.subplots(1, 3, sharey=True) # Temperature ax2.plot(dens, depth, c='k')
outdir = '../../plots/ctd/LT_D_R/' deployment_name = 'deploy2_' measurement_type = 'ctd_' file_type = 'raw_' for i in range(10): c_file = 'C' + ("%07d" % (i, )) c_data = pd.read_pickle(directory + deployment_name + file_type + c_file) CT = gsw.CT_from_t(c_data['c_sal'], c_data['c_temp'], c_data['c_pres']) SA = gsw.SA_from_SP(c_data['c_sal'], c_data['c_pres'], 174, -43) pdens = gsw.sigma0(SA, CT) c_data["pdens"] = pdens [LT, Td, Nsqu, Lo, R, x_sorted, idxs] = TKED.thorpe_scales(c_data["c_depth"].values * -1, c_data['pdens'].values, full_output=True) #plt.show() # Temperature fig2, (ax2, ax3, ax4) = plt.subplots(1, 3, sharey=True) plt.plot(c_data['pdens'], c_data["c_depth"].values, c='k') ax2.set_ylabel('Depth (m)') #ax2.set_ylim(ax2.get_ylim()[::-1]) #this reverses the yaxis (i.e. deep at the bottom) ax2.set_xlabel('Density (kg/m3)') ax2.xaxis.set_label_position('top') # this moves the label to the top ax2.xaxis.set_ticks_position('top') # this moves the ticks to the top # Salinity ax3.plot(LT, c_data["c_depth"].values, c='k') ax3.set_xlabel('LT (m)') ax3.xaxis.set_label_position('top') # this moves the label to the top
import pandas as pd import numpy as np import matplotlib.pyplot as plt from ocean_tools import TKED directory = '../../Data/deployment_raw/'; outdir = '../../plots/ctd/thorpe/'; deployment_name = 'deploy1_'; measurement_type = 'ctd_'; file_type = 'raw_' i = 0 c_file = 'C'+("%07d" % (i,)) c_data = pd.read_pickle(directory+deployment_name+file_type+c_file) print(c_data["c_depth"].values.shape) [LT,Td,Nsqu,Lo,R,x_sorted,idxs] = TKED.thorpe_scales(c_data["c_depth"].values*-1,c_data['c_dens'].values,full_output=True) print(len(c_data["c_depth"].values*-1)) eps = 0.64*(LT**2)*(Nsqu)**(3/2) plt.plot((Nsqu)) plt.ylabel("Depth (m)") plt.xlabel("Thorpes Scale (m)") plt.show()