fig = plt.figure(figsize=(15, 15)) #fig = plt.figure(figsize=(len(ordered_list)*5, 12)) n_runs = len(ordered_list) max_val = sample_cube[:, :, :].data.max() min_val = sample_cube[:, :, :].data.min() min_val = np.min(sample_cube[:, :, :].data[np.nonzero( sample_cube[:, :, :].data)]) vertical_levels = np.linspace(min_val, max_val, 9).tolist() diff_levels = np.linspace(-max_val, max_val, 18).tolist() cube_list = [] #lats=sample_cube.coord('grid_latitude').points-52 #lons=sample_cube.coord('grid_longitude').points[:]-180 #lons=np.arange(-0.02*250,250*0.02,0.02)[0:] lons, lats = stc.unrotated_grid(sample_cube) #lats=np.arange(-0.02*250-52,250*0.02-52,0.02) for run in ordered_list: cube = run_dict[run].cube try: cube.remove_coord('surface_altitude') except: a = 8754784 cube_list.append(cube) import copy sub_plots = [] time_coord = copy.copy(sample_cube.coord('time')) time_coord.convert_units('seconds since 1970-01-01 00:00:0.0') first = []
cube_m = iris.load( ukl.Obtain_name( '/nfs/a201/eejvt/CASIM/SO_KALLI/NO_CLOUD_SQUEME/MEYERS/All_time_steps/', 'm01s02i205_toa_outgoing_longwave_flux'))[0] #cube=cube.extract(iris.Constraint(time=jl.find_nearest_vector(cube.coord('time').points,t13))) #cube_csb=cube_csb[13,:,:] #cube=cube[12,:,:] #cube_nh=cube_nh[13,:,:] #cube_3ord=cube_3ord[13,:,:] #cube_2m=cube_2m[13,:,:] ##cube_con=cube_con[13,:,:] #cube_oldm=cube_oldm[13,:,:] #%% model_lons, model_lats = stc.unrotated_grid(cube) #times_range=np.argwhere((times_ceres >= tdi) & (times_ceres <=tde)) times_range = np.logical_and([times_ceres >= tdi], [times_ceres <= tde])[0] sat_lon = lon[times_range] sat_lat = lat[times_range] sat_LW = LW[times_range] coord = np.zeros([len(sat_lon), 2]) coord[:, 0] = sat_lon coord[:, 1] = sat_lat cm = plt.cm.RdBu_r #model_lons=np.linspace(-5,20,500) X, Y = np.meshgrid(model_lons, model_lats) #Xo,Yo=np.meshgrid(lon_old,lat_old) #data_old= sc.interpolate.griddata(coord_model, cube_oldm.data.flatten(), (X,Y), method='linear') #grid_z0 = sc.interpolate.griddata(coord, sat_SW, (X,Y), method='nearest') grid_z1 = sc.interpolate.griddata(coord, sat_LW, (X, Y), method='linear')
Xsat[np.isnan(LWP)] = np.nan Ysat[np.isnan(LWP)] = np.nan Xsat_flat = Xsat.flatten() Ysat_flat = Ysat.flatten() LWP_flat = LWP.flatten() Xsat_flat = Xsat_flat[np.logical_not(np.isnan(Xsat_flat))] Ysat_flat = Ysat_flat[np.logical_not(np.isnan(Ysat_flat))] LWP_flat = LWP_flat[np.logical_not(np.isnan(LWP_flat))] def check_nan(array): return np.isnan(array).any() model_lons, model_lats = stc.unrotated_grid(cube_DM10) max_lon, min_lon = model_lons.max(), model_lons.min() max_lat, min_lat = model_lats.max(), model_lats.min() coord = np.zeros([len(Xsat_flat), 2]) coord[:, 0] = Xsat_flat coord[:, 1] = Ysat_flat cm = plt.cm.RdBu_r #model_lons=np.linspace(-5,20,500) X, Y = np.meshgrid(model_lons, model_lats) grid_z1 = sc.interpolate.griddata(coord, LWP_flat, (X, Y), method='linear') plt.imshow(grid_z1) it = 15 runs_dict = OrderedDict() runs_dict['Satellite'] = grid_z1 #runs_dict['GLOBAL']=cube_global[it].data
code = 'm01s01i208' cloud_top = iris.load( ukl.Obtain_name(sim_path + 'TRY2/ALL_ICE_PROC/' + sub_folder, code))[0] cloud_top = iris.load( ukl.Obtain_name(sim_path + 'TRY2/LARGE_DOMAIN/' + sub_folder, code))[0] mb = netCDF4.Dataset( path + 'modis/' + 'MYD06_L2.A2014343.1325.006.2014344210847.nc', 'r') mb.variables['Cloud_Mask_1km'] #plt.imshow(mb.variables['Cloud_Fraction']) sat_dat = mb.variables['Cloud_Fraction'][:, ].flatten() sat_dat = mb.variables['Cloud_Mask_1km'][:, ].flatten() coord = np.zeros([len(sat_lon), 2]) coord[:, 0] = sat_lon coord[:, 1] = sat_lat cm = plt.cm.RdBu_r model_lons, model_lats = stc.unrotated_grid(cloud_top) X, Y = np.meshgrid(model_lons, model_lats) reload(stc) grid_z1 = sc.interpolate.griddata(coord, sat_data, (X, Y), method='linear') grid_z1[np.isnan(grid_z1)] = 0 plt.figure() plt.subplot(121) plt.imshow(grid_z1) #plt.xlim(0,600) plt.subplot(122) plt.imshow(cloud_top.data[12, ]) plt.show() #%% sim_path = '/nfs/a201/eejvt/CASIM/SO_KALLI/'