@@ -128,7 +128,7 @@ def rf_get_coords(rf_fn):
128128 return names , coords
129129# end func
130130
131- def plot_topo (coords , topo_grid , cpt_file , show_colorbar = False ):
131+ def plot_topo (coords , topo_grid , cpt_file , show_colorbar = False , alpha = 1 ):
132132
133133 fig = plt .figure (figsize = (11.69 ,8.27 ))
134134 plt .tick_params (labelsize = 8 )
@@ -189,14 +189,14 @@ def plot_topo(coords, topo_grid, cpt_file, show_colorbar=False):
189189 ls = LightSource (azdeg = 180 , altdeg = 45 )
190190 norm = colors .Normalize (vmin = - 8000 / zscale , vmax = 5000 / zscale )#myb
191191 rgb = ls .shade (topodat , cmap = cmap , norm = norm )
192- im = m .imshow (rgb )
192+ im = m .imshow (rgb , alpha = alpha )
193193
194194 if (show_colorbar ): cbar = fig .colorbar (cm .ScalarMappable (norm = norm , cmap = cmap ))
195195
196196 return fig , m
197197# end func
198198
199- def plot_grav (coords , grav_grid , cpt_file , resolution = 1 , show_colorbar = False ):
199+ def plot_grav (coords , grav_grid , cpt_file , resolution = 1 , show_colorbar = False , alpha = 1 ):
200200 DEG2KM = 111.
201201 dlonlat = resolution / DEG2KM
202202
@@ -259,7 +259,7 @@ def plot_grav(coords, grav_grid, cpt_file, resolution=1, show_colorbar=False):
259259
260260 zvals ,cmap = gmtColormap (cpt_file )
261261 cbinfo = m .pcolormesh (glons , glats , vals , latlon = True , cmap = cmap ,
262- shading = 'auto' , rasterized = True )
262+ shading = 'auto' , rasterized = True , alpha = alpha )
263263
264264 if (show_colorbar ): cbar = fig .colorbar (cbinfo )
265265
@@ -279,6 +279,8 @@ def plot_grav(coords, grav_grid, cpt_file, resolution=1, show_colorbar=False):
279279 type = click .Path ('r' ))
280280@click .argument ('output-path' , required = True ,
281281 type = click .Path (exists = True ))
282+ @click .option ('--alpha' , default = 1. , show_default = True ,
283+ help = 'Alpha value for topography/gravity plot' )
282284@click .option ('--marker-size' , default = 2 , show_default = True ,
283285 help = 'Marker size for stations' )
284286@click .option ('--label-font-size' , default = 5 , show_default = True ,
@@ -290,7 +292,7 @@ def plot_grav(coords, grav_grid, cpt_file, resolution=1, show_colorbar=False):
290292 'station labels need to be moved far apart to reduce clutter' )
291293@click .option ('--show-colorbar' , is_flag = True , default = False , show_default = True ,
292294 help = 'Shows colorbar' )
293- def process (plot_type , rf_file , grid , cpt_file , output_path ,
295+ def process (plot_type , rf_file , grid , cpt_file , output_path , alpha ,
294296 marker_size , label_font_size , adjust_labels , add_arrows , show_colorbar ):
295297
296298 """
@@ -312,9 +314,9 @@ def process(plot_type, rf_file, grid, cpt_file, output_path,
312314 # initialization of map
313315 fig = m = None
314316 if (plot_type == 'topo' ):
315- fig , m = plot_topo (coords , grid , cpt_file , show_colorbar )
317+ fig , m = plot_topo (coords , grid , cpt_file , show_colorbar , alpha )
316318 elif (plot_type == 'grav' ):
317- fig , m = plot_grav (coords , grid , cpt_file , show_colorbar )
319+ fig , m = plot_grav (coords , grid , cpt_file , show_colorbar , alpha )
318320 # end if
319321
320322 ax = fig .axes [0 ]
0 commit comments