#print(of) #data = np.load(of) #snod = data['snow'] #it = data['ice'] ##get rid of nans #m1 = np.ma.masked_invalid(it) ##it = np.ma.masked_invalid(it) #snod = snod[m1.mask == False] #it = it[m1.mask == False] #load the csv data created in tt_grid.py fname = glob(inpath_table + '*/magna+gem2-transect-' + date + '*' + loc + '*.csv')[0] snod = getColumn(fname, 5, delimiter=',', magnaprobe=False) it = getColumn(fname, 6, delimiter=',', magnaprobe=False) snod = np.array(snod, dtype=np.float) it = np.array(it, dtype=np.float) #print(it) #exit() #means and modes mn = np.mean(snod) print(mn) #mni = np.mean(it) #find mode hist = np.histogram(it, bins=irbins) srt = np.argsort(hist[0]) #indexes that would sort the array
#dates = ['20200123'] print(loc) colors = plt.cm.rainbow(np.linspace(0, 1, len(dates))) inpath = '../data/MCS/MP/' outpath = '../plots_AGU/' inpath_grid = '../data/grids_AGU/' outname = 'profile_'+loc+str(stp)+'.png' #choose one 'most perfct' MP track to compare to the others fname = glob(inpath+'*/magnaprobe-transect-'+fixed_date+'*'+loc+'-track-icecs-xy_corr.csv')[0] print(fname) mxx = getColumn(fname,3, delimiter=',', magnaprobe=False) mxx = np.array(mxx,dtype=np.float) myy = getColumn(fname,4, delimiter=',', magnaprobe=False) myy = np.array(myy,dtype=np.float) #fix cooridinate shift if fixed_date == '20200220': mxx = mxx-10 if loc == 'Nloop': myy = myy-3 if fixed_date == '20191222': mxx = mxx+3 myy = myy+3
nit_ts=[] for dd in range(0,len(dates)): date = dates[dd] dt = datetime.strptime(date, '%Y%m%d') dt_list.append(dt) print(date) #outname = 'profile_'+date+'_'+loc+'gridded.png' if gridded==False: #choose one 'most perfct' MP track to compare to the others fname = glob(inpath_table+'*/magna+gem2-transect-'+date+'*'+loc+'.csv')[0] print(fname) mxx = getColumn(fname,3, delimiter=',', magnaprobe=False) myy = getColumn(fname,4, delimiter=',', magnaprobe=False) snod = getColumn(fname,5, delimiter=',', magnaprobe=False) it = getColumn(fname,6, delimiter=',', magnaprobe=False) mxx = np.array(mxx,dtype=np.float) myy = np.array(myy,dtype=np.float) si = np.array(snod,dtype=np.float) it = np.array(it,dtype=np.float) else: inf = inpath_grid+loc+'_'+stp+'m_'+method_gem2+ch_name+'_track_test.npz' inf = inpath_grid+loc+'_'+stp+'m_'+method_gem2+ch_name+'_track.npz' data = np.load(inf) transect_snow = data['snow']
loc = 'Nloop' dates = [ '20191024', '20191031', '20191107', '20191114', '20191121', '20191128', '20191205', '20191219', '20191226', '20200102', '20200109', '20200116', '20200130', '20200206', '20200220', '20200227', '20200305', '20200320', '20200326', '20200403', '20200416', '20200424', '20200430', '20200507' ] inpath_snow = '../data/MCS/MP/' inpath_grid = '../data/grids_AGU/' outpath = '../plots_AGU/' #MP coordinates (for a day with good spacing!) fn = glob(inpath_snow + '*/magnaprobe-transect-' + '20200116' + '*' + loc + '-track-icecs-xy_corr.csv')[0] x_track = getColumn(fn, 3, delimiter=',', magnaprobe=False) y_track = getColumn(fn, 4, delimiter=',', magnaprobe=False) x_track = np.array(x_track, dtype=np.float) y_track = np.array(y_track, dtype=np.float) #storage space transect_snow = np.zeros((len(x_track), 2 + len(dates))) transect_ice = np.zeros((len(x_track), 2 + len(dates))) #print(transect_snow.shape) transect_snow[:, 0] = x_track transect_snow[:, 1] = y_track dt_list = []
#print(xx) #print(yy) #ice thickness data fname = glob(inpath_ice + date_gem2 + '*/mosaic-*-*-gem2-*-channel-thickness.csv')[0] mit1, mit2, mit3, mit4, mit5, mit6, mit7, mit8, mit9, mit10 = ridge_thick( fname) #print(mit1) #MP fname = glob(inpath_snow + '*/magnaprobe-transect-' + date + '*' + loc + '-track-icecs-xy_corr.csv')[0] print(fname) dt = getColumn(fname, 0, delimiter=',', magnaprobe=False) lon = getColumn(fname, 1, delimiter=',', magnaprobe=False) lat = getColumn(fname, 2, delimiter=',', magnaprobe=False) mxx = getColumn(fname, 3, delimiter=',', magnaprobe=False) mxx = np.array(mxx, dtype=np.float) myy = getColumn(fname, 4, delimiter=',', magnaprobe=False) myy = np.array(myy, dtype=np.float) #get some meta data for the MP transect: dx = mxx[1:] - mxx[:-1] dy = myy[1:] - myy[:-1] d = np.sum(np.sqrt(dx**2 + dy**2)) print('transect length:') print(d)
import numpy as np from glob import glob from tt_func import getColumn import matplotlib.pyplot as plt #GEM-2 inpath = '../../../MOSAiC/thickness_workspace/01-ice-thickness/20200220-PS122-2_25-117/' outpath = '../plots/' fname = 'mosaic-transect-20200220-gem2-556-track-icecs-xy.csv' xx = getColumn(inpath + fname, 3, delimiter=',', magnaprobe=False) xx = np.array(xx, dtype=np.float) yy = getColumn(inpath + fname, 4, delimiter=',', magnaprobe=False) yy = np.array(yy, dtype=np.float) #print(xx) #MP inpath = '../data/' outpath = '../plots/' #early date fname = '20200102_Sloop_MP_transect_track-icecs-xy.csv' mxx1 = getColumn(inpath + fname, 3, delimiter=',', magnaprobe=False) mxx1 = np.array(mxx1, dtype=np.float) myy1 = getColumn(inpath + fname, 4, delimiter=',', magnaprobe=False) myy1 = np.array(myy1, dtype=np.float) fname = '20200102_Nloop_MP_transect_track-icecs-xy.csv'
print(loc) print(date) print(date_gem2) #we need to merge all GEM-2 survery for that day first #coordinates xx = [] yy = [] fname = glob(inpath_ice+date_gem2+'*/mosaic-transect-*-gem2-*-track-icecs-xy.csv') for fn in fname: print(fname) x = getColumn(fn,3, delimiter=',', magnaprobe=False) y = getColumn(fn,4, delimiter=',', magnaprobe=False) xx.extend(x); yy.extend(y) xx_full = np.array(xx,dtype=np.float) yy_full = np.array(yy,dtype=np.float) #ice thickness data tt18 = []; tt5 = []; tt93 = [] fname = glob(inpath_ice+date_gem2+'*/mosaic-transect-*-gem2-*-channel-thickness.csv') for fn in fname: #time, record_id, longitude, latitude, xc, yc, f1525Hz_hcp_i, f1525Hz_hcp_q, f5325Hz_hcp_i, f5325Hz_hcp_q, f18325Hz_hcp_i, f18325Hz_hcp_q, f63025Hz_hcp_i, f63025Hz_hcp_q, f93075Hz_hcp_i, f93075Hz_hcp_q t18 = getColumn(fn,10, delimiter=',', magnaprobe=False) #take 18KHz ip t5 = getColumn(fn,8, delimiter=',', magnaprobe=False) #take 5KHz ip
#if date == '20191024': continue #Nloop has partially different track here - more resembling the planned square #if date == '20191031': continue #Nloop has partially different track here - even more strange... #if date == '20200123': continue #long transect if date == '20200716': continue #missing data and bad coordinates if date == '20200717': continue #bad GEM-2 coordinates if date == '20200723': continue if date == '20200724': continue if date == '20200116': #there is something wrong with the GEM-2 coordintes for this date - was supposed to be a regular transect day (good data) #try to use a GEM-2 file for one week earlier fname = flist[7] print(fname) xx = getColumn(fname, 3, delimiter=',', magnaprobe=False) xx = np.array(xx, dtype=np.float) yy = getColumn(fname, 4, delimiter=',', magnaprobe=False) yy = np.array(yy, dtype=np.float) #GEM-2 files contain nans xx = np.ma.masked_invalid(xx) yy = np.ma.masked_invalid(yy) dx = xx[1:] - xx[:-1] dy = yy[1:] - yy[:-1] d = np.sum(np.sqrt(dx**2 + dy**2)) print('transect length:') print(d)