@@ -144,7 +144,8 @@ def write(self, out_name):
144144 ['vartype' ]])])
145145
146146 def plot (self , nrows , which = 'all' , out_dir = None , xlabel = None ,\
147- ylabel = None , cbar_label = None , title = None , mpl_style = None ):
147+ ylabel = None , cbar_label = None , title = None , mpl_style = None ,
148+ na_val = - 99999 ):
148149 """
149150 Versatile method that plots most parameters in a standard PRMS parameter
150151 file assuming the PRMS model was built on a uniform spatial grid.
@@ -177,6 +178,7 @@ def plot(self, nrows, which='all', out_dir=None, xlabel=None,\
177178 title (str): plot title
178179 mpl_style (str, list): name or list of names of matplotlib style sheets to
179180 use for plot(s).
181+ na_val (float, int): default -99999. Value to mask in plots.
180182
181183 Returns:
182184 None
@@ -235,7 +237,10 @@ def plot(self, nrows, which='all', out_dir=None, xlabel=None,\
235237 try :
236238 plt .figure ()
237239 ax = plt .gca ()
238- im = ax .imshow (params ['{}' .format (p )].reshape (nrows ,ncols ), origin = 'upper' )
240+
241+ d = np .where (params [p ] == na_val , np .nan , params [p ])
242+ im = ax .imshow (d .reshape (nrows ,ncols ), origin = 'upper' )
243+
239244 # origin upper- assumes indices of parameters starts in upper left
240245 divider = make_axes_locatable (ax )
241246 cax = divider .append_axes ("right" , size = "5%" , pad = 0.05 )
@@ -290,7 +295,7 @@ def plot(self, nrows, which='all', out_dir=None, xlabel=None,\
290295 df = pd .DataFrame ()
291296 df .index .name = 'parameter'
292297 for p in p_names :
293- df .set_value ( p , 'value' , params [p ])
298+ df .at [ p , 'value' ] = params [p ]
294299 df .to_html (OPJ (out_dir ,'single_valued_params.html' ))
295300 ################################################################
296301 # plot single parameter, in case of nhru by monthly param,
0 commit comments