from pygoda import ncgoda import os import numpy as np import matplotlib.pyplot as plt os.chdir( '/home/server/student/homes/kniezgod/model_runs/F.C5.2deg.wiso.defaultSSTICE_kn002' ) c = ncgoda("F.C5.2deg.wiso.defaultSSTICE_kn002_JJA_climo.nc") os.chdir('../F.C5.2deg.wiso.obs6kSST_kn003') t = ncgoda("F.C5.2deg.wiso.obs6kSST_kn003_JJA_climo.nc") ################## ### 90E to 90W ### ################## box = [-66.5, 66.5, -90, 90] c.variable("OMEGA", box) c.data = c.isobar(85000) t.variable("OMEGA", box) t.data = t.isobar(85000) cZM = np.mean(c.data, axis=1) tZM = np.mean(t.data, axis=1) clat_interp = np.linspace(c.boxlat[0], c.boxlat[-1], num=1000) tlat_interp = np.linspace(t.boxlat[0], t.boxlat[-1], num=1000) cZM_interp = np.interp(clat_interp, c.boxlat, cZM) tZM_interp = np.interp(tlat_interp, c.boxlat, tZM) c_lat_of_max_cldhgh = clat_interp[list(cZM_interp * -1).index(
var_is_3d = True if not var_is_3d: var = V vname = V else: var = V[3:-3] vname = V[3:] pressure = int(V[-3:]) * 100 for n, date in enumerate(date_list): print date # Find the file and open it nc_path, nc_file = findClimoFile(grep + date + "*", directory) nc = ncgoda(nc_path) # Read in the variable data if var == "PRECT_d18O": nc.PRECT_d18O(box) elif var == "PRECT_dD": nc.PRECT_dD(box) elif var == "PRECT_dxs": nc.PRECT_dxs(box) elif var == "QFLX_d18O": nc.QFLX_d18O(box) elif var == "QFLX_dD": nc.QFLX_dD(box) elif var == "fluxDelta": nc.fluxDelta(box) elif var == "Column_d18OV":
if not var_is_3d: var = V vname = V else: var = V[3:-3] vname = V[3:] pressure = int(V[-3:]) * 100 for n, date in enumerate(date_list): print date c_nc_path, c_nc_file = findClimoFile(grep + date + "*", control_directory) t_nc_path, t_nc_file = findClimoFile(grep + date + "*", test_directory) #print c_nc_path #print t_nc_path c_nc = ncgoda(c_nc_path) t_nc = ncgoda(t_nc_path) # Extract the variable data # Special variables if var == "PRECT_d18O": t_nc.PRECT_d18O(box) c_nc.PRECT_d18O(box) elif var == "PRECT_dD": t_nc.PRECT_dD(box) c_nc.PRECT_dD(box) elif var == "PRECT_dxs": t_nc.PRECT_dxs(box) c_nc.PRECT_dxs(box)