import numpy as np from matplotlib.colors import ListedColormap prfx='/home/abozec/PYTHON/myutilities/' def get_cmaplct64(): """ Load the colormap used by IDL lct=64 """ N = 256 vals = np.ones((N, 4)) ## read cmap_eke f = open(prfx+'cmap_lct64.txt', 'r') # Loop over lines and extract variables of interest t=0 for line in f: #t columns = line.split() #print(columns) vals[t, 0] = float(columns[0])/256 vals[t, 1] = float(columns[1])/256 vals[t, 2] = float(columns[2])/256 t=t+1 f.close() cmaplct64=ListedColormap(vals) return cmaplct64 def get_cmapeke(): """ Load the colormap used by the NAVY for EKE """ N = 30 vals = np.ones((N, 4)) ## read cmap_eke f = open('/home/abozec/PYTHON/myutilities/cmap_eke.txt', 'r') # Loop over lines and extract variables of interest t=0 for line in f: #t columns = line.split() #print(columns) vals[t, 0] = float(columns[0])/256 vals[t, 1] = float(columns[1])/256 vals[t, 2] = float(columns[2])/256 t=t+1 f.close() cmapeke=ListedColormap(vals) return cmapeke def get_cmapfc100(): """ Load the colormap used by the NAVY for SSH 100 """ N = 100 vals = np.ones((N, 4)) ## read cmap_eke f = open('/home/abozec/PYTHON/myutilities/cmap_fc100.txt', 'r') # Loop over lines and extract variables of interest t=0 for line in f: #t columns = line.split() #print(columns) vals[t, 0] = float(columns[0]) vals[t, 1] = float(columns[1]) vals[t, 2] = float(columns[2]) t=t+1 f.close() cmapfc=ListedColormap(vals) return cmapfc def get_cmapspd200(): """ Load the colormap used by the NAVY for SSH 100 """ N = 200 vals = np.ones((N, 4)) ## read cmap_eke f = open('/home/abozec/PYTHON/myutilities/c_spd_200.txt', 'r') # Loop over lines and extract variables of interest t=0 for line in f: #t columns = line.split() #print(columns) vals[t, 0] = float(columns[0]) vals[t, 1] = float(columns[1]) vals[t, 2] = float(columns[2]) t=t+1 f.close() cmapspd=ListedColormap(vals) return cmapspd def get_cmapparula(): """ Load the colormap Matlab parula """ N = 255 vals = np.ones((N, 4)) ## read cmap_eke f = np.fromfile('/home/abozec/PYTHON/myutilities/cmap_parula.dat') # Loop over lines and extract variables of interest vals[:, 0] = f[0:N] vals[:, 1] = f[N:2*N] vals[:, 2] = f[2*N:3*N] cmappar=ListedColormap(vals) return cmappar def get_cmapbluered(): """ Load the colormap BlueRed for Vorticity """ N = 255 vals = np.ones((N, 4)) ## read cmap_bluered f = np.fromfile(prfx+'cmap_bluered.dat',dtype='