### 1) In order for this to work the files "nclcmaps.py" and "__init__.py" ### must be present in the dirctory. ### 2) You must "import nclcmaps" ### 3) The path to nclcmaps.py must be added to tools -> PYTHONPATH manager in SPyder ### 4) Then click "Update module names list" in tolls in Spyder and restart Spyder ## The steps above describe the general steps for adding "non-built in" modules to Spyder ############################################################################### ############################################################################### #Read in colormap and put in proper format colors1 = np.array(nclcmaps.colors['BlWhRe']) #'prcp_1' for precip colors_int = colors1.astype(int) colors = list(colors_int) cmap_precip = nclcmaps.make_cmap(colors, bit=True) colors1_t = np.array(nclcmaps.colors['MPL_Greys']) colors_int_t = colors1_t.astype(int) colors_t = list(colors_int_t) cmap_terrain = nclcmaps.make_cmap(colors_t, bit=True) ############ Variables for cross section ########## # Made so this can be plotted dynamically ######### For u-wind ####### #Choose variable v = eval('ds.u') #Locations for cross section ymid = np.int(v[0, 0, :, 0].size * 0.5)
### 1) In order for this to work the files "nclcmaps.py" and "__init__.py" ### must be present in the dirctory. ### 2) You must "import nclcmaps" ### 3) The path to nclcmaps.py must be added to tools -> PYTHONPATH manager in SPyder ### 4) Then click "Update module names list" in tolls in Spyder and restart Spyder ## The steps above describe the general steps for adding "non-built in" modules to Spyder ############################################################################### ############################################################################### #Read in colormap and put in proper format colors1 = np.array(nclcmaps.colors['amwg256']) #perc2_9lev']) colors_int = colors1.astype(int) colors = list(colors_int) cmap_dth = nclcmaps.make_cmap(colors, bit=True) #Read in colormap and put in proper format colors1 = np.array(nclcmaps.colors['WhiteBlueGreenYellowRed']) #perc2_9lev']) colors_int = colors1.astype(int) colors = list(colors_int) cmap_th = nclcmaps.make_cmap(colors, bit=True) ########## Create Grid ######## ### The code below makes the data terrain following x1d = np.arange(0, num_seeds_x, 1) y1d = np.arange(0, num_seeds_z, 1) z = np.array( ds.zs[0, ymid, :num_seeds_x] ) / 1000 * 30 #Div by 1000 to go to m and mult by 30 to match y dim
### must be present in the dirctory. ### 2) You must "import nclcmaps" ### 3) The path to nclcmaps.py must be added to tools -> PYTHONPATH manager in SPyder ### 4) Then click "Update module names list" in tolls in Spyder and restart Spyder ## The steps above describe the general steps for adding "non-built in" modules to Spyder ############################################################################### ############################################################################### #Read in colormap and put in proper format colors1 = np.array(nclcmaps.colors['MPL_YlGnBu'])#perc2_9lev']) colors_int = colors1.astype(int) colors = list(colors_int) cmap_var = nclcmaps.make_cmap(colors, bit=True) ############################## Plots ######################################## #Use multiple processors to create images def Plotting_Loop(i): #for i in range(0,time_steps): secs = (i*120) fig = plt.figure(num=None, figsize=(12,8), facecolor='w', edgecolor='k')
z = np.zeros((right - left)) + 0.4 for i in range(top): x2d[j, i, :] = x1d for k in range(right - left): z2d[j, :, k] = z1d + z[k] ############################################################################### ############################## Plot ########################################### ############################################################################### #Colormap colors1_t = np.array(nclcmaps.colors['BlueYellowRed']) #amwg256']) colors_int_t = colors1_t.astype(int) colors_t = list(colors_int_t) cmap_wind = nclcmaps.make_cmap(colors_t, bit=True) #cmap_wind = nclcmaps.cmap('ncl_default') #Levels lmin = -10 lmax = 20.01 levels = np.arange(lmin, lmax, 0.25) levels_ticks = np.arange(lmin, lmax, 5) levels_ticks_labels = np.arange(lmin, lmax, 5).astype(int) #Levels wlmin = -5.0 wlmax = 5.01 wlevels = np.arange(wlmin, wlmax, 0.5) wlevels = np.delete(wlevels, np.where(wlevels == 0))
### 1) In order for this to work the files "nclcmaps.py" and "__init__.py" ### must be present in the dirctory. ### 2) You must "import nclcmaps" ### 3) The path to nclcmaps.py must be added to tools -> PYTHONPATH manager in SPyder ### 4) Then click "Update module names list" in tolls in Spyder and restart Spyder ## The steps above describe the general steps for adding "non-built in" modules to Spyder ############################################################################### ############################################################################### #Read in colormap and put in proper format colors1 = np.array(nclcmaps.colors['MPL_YlGnBu']) #perc2_9lev']) colors_int = colors1.astype(int) colors = list(colors_int) cmap_var = nclcmaps.make_cmap(colors, bit=True) colors1_t = np.array(nclcmaps.colors['MPL_Greys']) colors_int_t = colors1_t.astype(int) colors_t = list(colors_int_t) cmap_terrain = nclcmaps.make_cmap(colors_t, bit=True) #%% #%% ############################## Plots ######################################## #for i in range(130,131): for i in range( 0, np.min([
### must be present in the dirctory. ### 2) You must "import nclcmaps" ### 3) The path to nclcmaps.py must be added to tools -> PYTHONPATH manager in SPyder ### 4) Then click "Update module names list" in tolls in Spyder and restart Spyder ## The steps above describe the general steps for adding "non-built in" modules to Spyder ############################################################################### ############################################################################### #Read in colormap and put in proper format colors1 = np.array(nclcmaps.colors['BlWhRe'])#perc2_9lev']) colors_int = colors1.astype(int) colors = list(colors_int) cmap_dif = nclcmaps.make_cmap(colors, bit=True) colors1_t = np.array(nclcmaps.colors['prcp_1']) colors_int_t = colors1_t.astype(int) colors_t = list(colors_int_t) cmap_precip = nclcmaps.make_cmap(colors_t, bit=True) #%% ############################## Plots ########################################
#%% ############################################################################### ############################## Plot XY ######################################## ############################################################################### left = 1500 right = 2050 bottom = 0 top = 50 t_xy = 1 #Colormap colors1_t = np.array(nclcmaps.colors['BlueRed']) #amwg256']) colors_int_t = colors1_t.astype(int) colors_t = list(colors_int_t) cmap_th = nclcmaps.make_cmap(colors_t, bit=True) #cmap_wind = nclcmaps.cmap('ncl_default') #Levels lmin = 0.4 lmax = 0.6 levels = np.arange(lmin, lmax, 0.25) levels_ticks = np.arange(lmin, lmax, 1) levels_ticks_labels = np.arange(lmin, lmax, 1).astype(int) #Colors cland = 'red' cwater = 'blue' skip = 3
for i in range(3600): lat_netcdf[:, i] = lat long_netcdf[i, :] = lon #Figure fig = plt.figure(num=None, figsize=(11, 20), dpi=300, facecolor='w', edgecolor='k') #Read in colormap and put in proper format colors1 = np.array(nclcmaps.colors['WhiteBlueGreenYellowRed']) #perc2_9lev']) colors_int = colors1.astype(int) colors = list(colors_int) cmap_ets = nclcmaps.make_cmap(colors, bit=True) #Levels levels = np.arange(0, 0.8001, 0.05) levels_ticks = np.arange(0, 0.8001, 0.1) levels_el = np.arange(0, 5000, 100) #Sizes top = 22 left = 22 tick = 16 info = 16 dots = 75 cmap = cmap_ets