source: anuga_work/development/Hinwood_2008/slope.py @ 5590

Last change on this file since 5590 was 5590, checked in by duncan, 16 years ago

Current Hinwood scenario

File size: 23.9 KB
RevLine 
[5413]1
2"""
3Plot up files from the Hinwood project.
4"""
5from os import sep
6import project
[5494]7from copy import deepcopy
[5413]8#from scipy import arange
[5494]9from csv import writer
[5413]10
[5494]11from Numeric import arange, array, zeros, Float, where, greater, less, \
[5503]12     compress, argmin, choose, searchsorted
[5426]13
[5413]14from anuga.fit_interpolate.interpolate import interpolate_sww2csv
[5426]15from anuga.shallow_water.data_manager import csv2dict
[5494]16from anuga.utilities.numerical_tools import ensure_numeric
[5413]17
[5494]18
19SLOPE_STR = 'stage_slopes'
20TIME_STR = 'times'
21
22TIME_BORDER = 5
23LOCATION_BORDER = .5
24
25def load_sensors(quantity_file):
[5532]26    """
27    Load a csv file, where the first row is the column header and
28    the first colum explains the rows.
29    """
[5426]30    #slope, _ = csv2dict(file_sim)
31   
32    # Read the depth file
[5494]33    dfid = open(quantity_file)
[5426]34    lines = dfid.readlines()
35    dfid.close()
[5413]36
[5426]37    title = lines.pop(0)
38    n_time = len(lines)
39    n_sensors = len(lines[0].split(','))-1  # -1 to remove time
[5532]40    times = zeros(n_time, Float)  #Time
[5426]41    depths = zeros(n_time, Float)  #
42    sensors = zeros((n_time,n_sensors), Float)
[5494]43    quantity_locations = title.split(',') #(',')
44    quantity_locations.pop(0) # remove 'time'
[5577]45
46    # Doing j.split(':')[0] drops the y location
[5494]47    locations = [float(j.split(':')[0]) for j in quantity_locations]
48   
[5426]49    for i, line in enumerate(lines):
50        fields = line.split(',') #(',')
51        fields = [float(j) for j in fields]
[5532]52        times[i] = fields[0]
[5426]53        sensors[i] = fields[1:] # 1: to remove time
54
[5532]55    #print "times",times
[5494]56    #print "locations", locations
[5426]57    #print "sensors", sensors
[5532]58    return times, locations, sensors
[5426]59   
[5494]60def load_slopes(stage_file):
61    """
62    Finds the slope, wrt distance of a distance, time, quantity csv file.
63
64    returns the times and slope_locations vectors and the slopes array.
65    """
66    times, locations, sensors = load_sensors(stage_file)
67    n_slope_locations = len(locations)-1
[5426]68    n_time = len(times)
69    slope_locations = zeros(n_slope_locations, Float)  #
70    slopes = zeros((n_time,n_slope_locations), Float)
71
72    # An array of the sensor spacing values
[5494]73    delta_locations = zeros(n_slope_locations, Float)
[5426]74   
75    for i in arange(n_slope_locations):
[5494]76        delta_locations[i] = (locations[i+1] - locations[i])
[5503]77        slope_locations[i] = locations[i] + 0.5*delta_locations[i]
[5426]78   
79    for j in arange(n_time):
80        for i in arange(n_slope_locations):
[5494]81            slopes[j,i] = (sensors[j,i+1] - sensors[j,i])/delta_locations[i]
[5426]82
83    return times, slope_locations, slopes
84
[5494]85
86def graph_contours(times, x_data, z_data,
87                 y_label='Time, seconds',
88                 plot_title="slope",
89                 x_label='x location, m',
90                 save_as=None,
91                 is_interactive=False,
92                 break_xs=None,
93                 break_times=None):
[5532]94    """
95    Currently used to generate stage slope contour graphs.
96
97    Has been generalised a bit.
98    """
[5494]99    # Do not move these imports.  Tornado doesn't have pylab
[5447]100    from pylab import meshgrid, cm, contourf, contour, ion, plot, xlabel, \
101         ylabel, close, legend, savefig, title, figure ,colorbar, show , axis
[5494]102
[5426]103    origin = 'lower'
[5447]104
[5494]105    if is_interactive:
106        ion()
107       
[5447]108    # Can't seem to reshape this info once it is in the function
[5494]109    CS = contourf(x_data, times, z_data, 10,
[5447]110                  cmap=cm.bone,
111                  origin=origin)
[5426]112   
[5494]113    #CS2 = contour(x_data, times, z_data, CS.levels[::1],
114     #             colors = 'r',
115      #            origin=origin,
116       #           hold='on')
117   
118    title(plot_title)
119    xlabel(x_label)
120    ylabel(y_label)
[5426]121
[5447]122    if break_times is not None and break_xs is not None:
123        plot(break_xs, break_times, 'ro')
124   
[5494]125   
[5426]126    # Make a colorbar for the ContourSet returned by the contourf call.
127    cbar = colorbar(CS)
[5494]128
[5426]129    # Add the contour line levels to the colorbar
[5503]130    cbar.ax.set_ylabel('stage slope')
[5426]131    #cbar.add_lines(CS2)
[5494]132         
133    if is_interactive:       
134        raw_input() # Wait for enter pressed
135       
136    if save_as is not None:
137        savefig(save_as)
138    close()  #Need to close this plot
[5426]139
[5494]140def graph_froude(times, x_data, z_data,
141                 y_label='Time, seconds',
142                 plot_title="Froude Number",
143                 x_label='x location, m',
144                 save_as=None,
145                 is_interactive=False,
146                 break_xs=None,
147                 break_times=None):
[5532]148    """
149    Used to generate a froude Number contour graphs.
150
151    """
[5494]152    # Do not move these imports.  Tornado doesn't have pylab
153    from pylab import meshgrid, cm, contourf, contour, ion, plot, xlabel, \
154         ylabel, close, legend, savefig, title, figure ,colorbar, show , axis
[5426]155
[5494]156    origin = 'lower'
157
158    if is_interactive:
159        ion()
160       
161    # Can't seem to reshape this info once it is in the function
[5503]162    #CS = contourf(x_data, times, z_data, [-1,0.6,0.8,1,2,4],
163     #             colors = ('black', 'r', 'g', 'b','r'),
164      #            #cmap=cm.bone,
165       #           origin=origin)
166    CS = contourf(x_data, times, z_data, 10,
167                  #colors = ('black', 'r', 'g', 'b','r'),
168                  cmap=cm.bone,
[5494]169                  origin=origin)
[5413]170   
[5494]171    #CS2 = contour(x_data, times, z_data, CS.levels[::1],
172     #             colors = 'r',
173      #            origin=origin,
174       #           hold='on')
175   
176    title(plot_title)
177    xlabel(x_label)
178    ylabel(y_label)
179
180    if break_times is not None and break_xs is not None:
181        plot(break_xs, break_times, 'yo')
182   
183   
184    # Make a colorbar for the ContourSet returned by the contourf call.
185    cbar = colorbar(CS)
186
187    # Add the contour line levels to the colorbar
[5503]188    cbar.ax.set_ylabel('Froude Number')
[5494]189    #cbar.add_lines(CS2)
190         
191    if is_interactive:       
192        raw_input() # Wait for enter pressed
193       
194    if save_as is not None:
195        savefig(save_as)
196    close()  #Need to close this plot
197   
198def auto_graph_slopes(outputdir_tag, scenarios, is_interactive=False):
[5532]199    """
200    Used to generate all the stage slope contour graphs of a scenario list
201    """
[5494]202    plot_type = ".pdf"
[5413]203    for run_data in scenarios:
[5426]204        id = run_data['scenario_id']
205        outputdir_name = id + outputdir_tag
206        pro_instance = project.Project(['data','flumes','Hinwood_2008'],
207                                       outputdir_name=outputdir_name)
208        end = id + ".csv"
[5494]209        anuga_break_times = []
210        for break_time in run_data['break_times']:
211            anuga_break_times.append( \
212                break_time -  run_data['ANUGA_start_time'])
213        stage_file = pro_instance.outputdir + "fslope_stage_" + end
[5503]214        plot_title = "Stage slope " + id + "\n file:" + \
215                     outputdir_name + "_slope_stage" + plot_type
216        print "Creating ", stage_file
[5494]217        save_as = pro_instance.plots_dir + sep + \
218                            outputdir_name + "_slope_stage" + plot_type
219        times, locations, slopes = load_slopes(stage_file)
[5503]220        #times, slopes = get_band(anuga_break_times[0]-TIME_BORDER,
221         #                          100, times, slopes, 0)
222        #locations, slopes = get_band(
223         #   min(run_data['break_xs'])- 2*LOCATION_BORDER,
224          #  100, locations, slopes, -1)
[5494]225        graph_contours(times, locations, slopes,
[5495]226                       plot_title=plot_title,
227                       break_xs=run_data['break_xs'],
228                       break_times=anuga_break_times,
229                       save_as=save_as,
[5494]230                       is_interactive=is_interactive)
231
232def auto_graph_froudes(outputdir_tag, scenarios, is_interactive=False):
[5532]233    """
234    Used to generate all the Froude number contour graphs of a scenario list
235    """
[5426]236   
[5494]237    plot_type = ".pdf"
238   
239    for run_data in scenarios:
240        id = run_data['scenario_id']
241        outputdir_name = id + outputdir_tag
242        pro_instance = project.Project(['data','flumes','Hinwood_2008'],
243                                       outputdir_name=outputdir_name)
244        end = id + ".csv"
245        anuga_break_times = []
246        for break_time in run_data['break_times']:
247            anuga_break_times.append( \
248                break_time -  run_data['ANUGA_start_time'])
[5503]249        plot_title = "Froude Number" + id + "\n file:" + \
250                     outputdir_name + "_froude" + plot_type
[5494]251        froude_file = pro_instance.outputdir + "fslope_froude_" + end
[5503]252        print "Creating ", froude_file
[5494]253        save_as = pro_instance.plots_dir + sep + \
254                            outputdir_name + "_froude" + plot_type
255        dtimes, locations, sensors = load_sensors(froude_file)
256        dtimes, sensors = get_band(anuga_break_times[0]-TIME_BORDER,
257                                   100, dtimes, sensors, 0)
[5503]258        locations, sensors = get_band(
259            min(run_data['break_xs'])-LOCATION_BORDER,
260            100, locations, sensors, -1)
[5494]261        #print "dtimes", dtimes
262        #print "sensors", sensors
263        #times, slope_locations, slopes = load_slopes(stage_file)
264        graph_froude(dtimes, locations, sensors,
[5495]265                     plot_title=plot_title,
[5494]266                     break_xs=run_data['break_xs'],
267                     break_times=anuga_break_times,
268                     save_as=save_as,
269                     is_interactive=is_interactive)
270       
[5503]271def find_froude(times_froude, locations_froude, froudes_array,
272                times, locations):
[5532]273    """
274    interpolate across location to find froude number values
275    """
276   
[5503]277    if len(times) == 0:
278        return []
279    time_indexes = searchsorted(times_froude, times)
280    location_indexes = searchsorted(locations_froude, locations)
281
282   
283    assert len(time_indexes) == len(location_indexes)
284
285    froudes = []
286    for time_i, loc_i, time, location in map(None, time_indexes,
287                                             location_indexes,
288                                             times, locations):
289        # the time values should be the same
290        assert times_froude[time_i] == time
291
292        # The distance value should be half way between the froude locations
293        midpoint = locations_froude[loc_i-1] + \
294                   (locations_froude[loc_i]-locations_froude[loc_i-1])*0.5
295        #print "location", location
296        #print "midpoint", midpoint
297        assert location == midpoint
298        froude = froudes_array[time_i, loc_i-1] + \
299                   (froudes_array[time_i, loc_i]- \
300                    froudes_array[time_i, loc_i-1])*0.5
301        froudes.append(froude)
302               
303    return froudes
304   
305def auto_find_min_slopes(slope_tag, outputdir_tag, scenarios):
[5494]306    """
[5532]307    Given stage and froude wrt time and location csv files,
308    find the waves and get the froude number and stage slope
309    at the wave face.
310
311    For each wave write a csv file giving the location, stage slope, time and
312    froude number.
[5494]313    """
314   
315    for run_data in scenarios:
316        id = run_data['scenario_id']
317        outputdir_name = id + outputdir_tag
318        pro_instance = project.Project(['data','flumes','Hinwood_2008'],
319                                       outputdir_name=outputdir_name)
320        end = id + ".csv"
321        anuga_break_times = []
322        for break_time in run_data['break_times']:
323            anuga_break_times.append( \
324                break_time -  run_data['ANUGA_start_time'])
325           
[5503]326        stage_file = pro_instance.outputdir + slope_tag + "slope_stage_" + end
327        froude_file = pro_instance.outputdir + slope_tag + "slope_froude_" + \
328                      end
[5494]329       
330        times, slope_locations, slopes = load_slopes(stage_file)
[5503]331        #print "slope_locations", slope_locations
332        times_froude, locations_froude, froudes_a = load_sensors(froude_file)
333        #print "locations_froude", locations_froude
[5494]334        waves = find_min_slopes(times, slope_locations, slopes,
335                                anuga_break_times,
336                                run_data['band_offset'])
[5503]337       
[5494]338        # write the wave info here
[5503]339        # and find the froude values
340        for i, wave in enumerate(waves):
341           
342            id = "wave_" + str(i)
343            wave_file = stage_file[:-4] + '_'+ id + ".csv"
[5494]344            print "wave_file", wave_file
[5503]345            froudes = find_froude(times_froude, locations_froude,
346                             froudes_a, wave[TIME_STR],
347                                  slope_locations)
[5494]348            wave_writer = writer(file(wave_file, "wb"))
[5503]349            wave_writer.writerow(["x location", "min slope", "Time", "Froude"])
[5494]350            wave_writer.writerows(map(None,
351                                      slope_locations,
[5503]352                                      wave[SLOPE_STR],
353                                      wave[TIME_STR],
354                                      froudes))
355
[5532]356def calc_wave_file_min_slope_max_froude(slope_tag, outputdir_tag, scenarios):
357    """
358    Calc the min slope and max froude number in the wave files
359    Used so all graphs have the same axis.
360    """
361    min_slope = 0
362    max_froude = 0
363   
364    for run_data in scenarios:
365        for wave_file, save_as, wave_number in Get_file_name(
366        run_data, outputdir_tag, slope_tag):
367            simulation, _ = csv2dict(wave_file)
368            slope = [float(x) for x in simulation['min slope']]
369            froude = [float(x) for x in simulation['Froude']]
[5494]370           
[5532]371            min_slope = min(min(slope), min_slope)
372           
373            max_froude = max(max(froude), max_froude)
374           
375   
376    return min_slope, max_froude
377
378class Get_file_name:
[5503]379    """
[5532]380    Used to make the file names, and workout the wave number.
381    """
[5503]382   
[5532]383    def __init__(self, run_data, outputdir_tag, slope_tag):
384       
385        self.plot_type = ".pdf"
386        # The scenario data
387        id = run_data['scenario_id']
388       
389        self.outputdir_name = id + outputdir_tag
390        self.pro_instance = project.Project(['data','flumes','Hinwood_2008'],
391                                            outputdir_name=self.outputdir_name)
392        self.wave_number = -1
393        self.max_waves = len(run_data['break_type'])
394        self.slope_tag = slope_tag
395        self.end = id + ".csv"
396
397    def next(self):
398        self.wave_number += 1
399        if self.wave_number >= self.max_waves: raise StopIteration
400        wave_tag = "wave_" + str(self.wave_number)
401        stage_file = self.pro_instance.outputdir + self.slope_tag + \
402                     "slope_stage_" + self.end
403        wave_file = stage_file[:-4] + '_'+ wave_tag + ".csv"
404        save_as = self.pro_instance.plots_dir + sep + \
405                  self.outputdir_name + "_" + wave_tag + self.plot_type
406        return wave_file, save_as, self.wave_number
407
408    def __iter__(self):
409        return self
410       
411
412
413
414def auto_plot_froude_slopes(slope_tag, outputdir_tag, scenarios):
[5503]415    """
[5532]416    Used to generate all the Froude number, stage slope, time graphs
417    of a scenario list
418    """
419
420    slope_min, froude_max = calc_wave_file_min_slope_max_froude(
421        slope_tag, outputdir_tag, scenarios)
[5503]422   
423   
424    for run_data in scenarios:
425        assert len(run_data['break_times']) == len(run_data['break_xs'])
426        assert len(run_data['break_times']) == len(run_data['break_type'])
427       
428        anuga_break_times = []
429        for break_time in run_data['break_times']:
430            anuga_break_times.append( \
431                break_time -  run_data['ANUGA_start_time'])
[5494]432           
[5532]433        for wave_file, save_as, wave_number in Get_file_name(
434        run_data, outputdir_tag, slope_tag):
[5503]435            print "wave_file", wave_file
[5532]436            break_type = run_data['break_type'][wave_number]
437            plot_title = run_data['scenario_id'] + \
438                         ' Wave: ' + str(wave_number) + \
439                         ' Break Type: ' + break_type + '\n' + \
440                         'File: ' + wave_file[34:] # not good!
[5503]441            plot_foude_slope_stage(wave_file,
[5532]442                                   anuga_break_times[wave_number],
443                                   run_data['break_xs'][wave_number],
[5503]444                                   plot_title=plot_title,
445                                   break_type=break_type,
446                                   save_as=save_as,
[5532]447                                   is_interactive=False,
448                                   froude_min=0,
449                                   froude_max=froude_max,
450                                   slope_min=slope_min,
451                                   slope_max=0)
[5494]452       
[5503]453       
[5494]454   
[5503]455def gauges_for_slope(slope_tag, outputdir_tag, scenarios):
[5494]456    """
457    This is used to create a stage file, using gauges relivent to
458    finding a slope.
[5503]459
460    It also create's a frounde file.
[5494]461    """
[5577]462    dx = 0.005
[5426]463    for run_data in scenarios:
[5413]464        point_x = arange(run_data['start_slope_x'],
465                        run_data['finish_slope_x'],
[5426]466                        dx).tolist()
[5577]467        flume_y_middle = 0.0
[5413]468        points = []
469        for gauge_x in point_x:
470            points.append([gauge_x, flume_y_middle])
471        id = run_data['scenario_id']
472   
473        basename = 'zz_' + run_data['scenario_id']
474        outputdir_name = id + outputdir_tag
475        pro_instance = project.Project(['data','flumes','Hinwood_2008'],
476                                       outputdir_name=outputdir_name)
477        end = id + ".csv"
[5494]478        interpolate_sww2csv( \
479            pro_instance.outputdir + basename +".sww",
480            points,
[5503]481            pro_instance.outputdir + slope_tag + "slope_depth_" + end,
482            pro_instance.outputdir + slope_tag + "slope_velocity_x_" + end,
483            pro_instance.outputdir + slope_tag + "slope_velocity_y_" + end,
484            pro_instance.outputdir + slope_tag + "slope_stage_" + end,
485            pro_instance.outputdir + slope_tag + "slope_froude_" + end,
[5494]486            time_thinning=1)
487
488def find_min_slopes(times, slope_locations, slopes,
[5503]489                    anuga_break_times, band_offset):
[5532]490    """
491   
492    """
[5503]493    bands = break_times2bands(anuga_break_times, band_offset)
[5494]494
[5503]495    waves = []
[5494]496    for i,_ in enumerate(bands[0:-1]):
497        max_q, max_q_times = get_min_in_band(bands[i], bands[i+1],
498                                             times, slopes)
[5503]499        waves.append({SLOPE_STR:max_q, TIME_STR:max_q_times})
[5494]500    return waves
501
[5426]502   
[5494]503def get_band(min, max, vector, quantity_array, axis):
504    """
505    Return a band of vector and quantity, within (not including) the
506    min, max.
507
508    For a time band, set the axis to 0.
509    For a location band, set the axis to -1.
[5426]510   
[5494]511    """
[5413]512
[5494]513    SMALL_MIN = -1e10  # Not that small, but small enough
514    vector = ensure_numeric(vector)
515    quantity_array = ensure_numeric(quantity_array)
516
517    assert min > SMALL_MIN
518    no_maxs = where(less(vector,max), vector, SMALL_MIN)
519    #print "no_maxs", no_maxs
520    band_condition = greater(no_maxs, min)
521    band_vector = compress(band_condition, vector, axis=axis)
522    #print "band_time", band_time
523    #print "quantity_array", quantity_array.shape
524    band_quantity = compress(band_condition, quantity_array, axis=axis)
525    return band_vector, band_quantity
526
527def get_min_in_band(min_time, max_time, time_vector, quantity_array):
528    """
529    given a quantity array, with the 2nd axis being
530    time, represented by the time_vector, find the minimum within
531    the time band.
532
533    Assumes times are positive
534    """
535   
536    time_vector = ensure_numeric(time_vector)
537    quantity_array = ensure_numeric(quantity_array)
538
539    band_time, band_quantity  = get_band(min_time, max_time,
540                                         time_vector, quantity_array, 0)
541    #print "band_quantity",band_quantity
[5503]542    try:
543        max_quantity_indices = argmin(band_quantity, axis=0)
544    except:
545        #print "time_vector", time_vector
546        print "min_time",min_time
547        print "max_time", max_time
548        return [],[]
549       
[5494]550    #print "max_quantity_indices", max_quantity_indices
551    max_quantity_times = choose(max_quantity_indices, band_time)
552    #print "max_quantity_times", max_quantity_times
553    max_quantities = choose(max_quantity_indices, band_quantity)
554    #print "max_quantities", max_quantities
555
556    return max_quantities, max_quantity_times
557
558def break_times2bands(break_times, band_offset):
559    """
560    Break_times is a list of times, ascending.
561    bands is a list of times, being the midpoints of break_times, with a min
562    and max band added.
563    """
564    assert len(break_times)>2
565   
566    bands = [] #deepcopy(break_times)
567    bands.append(break_times[0]-0.5*(break_times[1]-break_times[0]))
568
[5503]569
[5494]570    for i,break_x in enumerate(break_times[0:-1]):
571        bands.append(break_times[i]+0.5*(break_times[i+1]-break_times[i]))
572       
573    bands.append(break_times[-1]+0.5*(break_times[-1]-break_times[-2]))
574    bands = ensure_numeric(bands)
575    bands += band_offset
576    return bands
577
[5503]578def plot_foude_slope_stage(wave_file,
579                           break_time,
580                           break_x,
581                           save_as=None,
582                           plot_title="",
583                           is_interactive=False,
584                           break_type="",
[5532]585                           froude_min=None,
586                           froude_max=None,
587                           slope_min=None,
588                           slope_max=None):
[5503]589    """
590    """
591    from pylab import ion, plot, xlabel, ylabel, close, legend, \
592         savefig, title, axis, setp, subplot, grid, axvspan
593    from anuga.shallow_water.data_manager import csv2dict
594
595
596
597    # Load in the csv files and convert info from strings to floats
598    simulation, _ = csv2dict(wave_file)
599    location = [float(x) for x in simulation['x location']]
600    slope = [float(x) for x in simulation['min slope']]
601    time = [float(x) for x in simulation['Time']]
602    froude = [float(x) for x in simulation['Froude']]
603
604    min_location = min(location)
605    max_location = max(location)
606   
607    if is_interactive:
608        ion()
609    # The upper subplot
610    subplot(311)
611    l_froude = plot(location, froude)
612    #setp(l_froude, color='r')
613
614    # Add axis stuff
615    title(plot_title)
616    y_label = "Froude Number"
617    ylabel(y_label)
618    grid(True)
619    axvspan(break_x-0.001,break_x+0.001, facecolor='g')
[5532]620    if froude_min is not None and froude_max is not None:
621        axis(ymin=froude_min, ymax=froude_max)
[5503]622   
623    # The slope subplot
624    subplot(312)
625    l_slope = plot(location, slope)
626    setp(l_slope, color='r')
627
628    # Add axis stuff and legend
629    x_label = "X location, m"
630    y_label = "Stage slope"
631    #xlabel(x_label)
632    ylabel(y_label)
633    grid(True)
634    axvspan(break_x-0.001,break_x+0.001, facecolor='g')
[5532]635    if slope_min is not None and slope_max is not None:
636        axis(ymin=slope_min, ymax=slope_max )
[5503]637
638    # The time, x location subplot
639    subplot(313)
640    l_time = plot(location, time)
641    setp(l_time, color='g')
642    #print "break_x", break_x
643    #print "break_time", break_time
644    plot([break_x], [break_time], 'yo')
645    #plot([break_x-1], [], 'yo')
646
647    # Add axis stuff and legend
648    x_label = "X location, m"
649    y_label = "time, sec"
650    xlabel(x_label)
651    ylabel(y_label)
652    grid(True)
653
654   
655    # The order defines the label
656    #legend((legend_exp, legend_sim),'upper left')
657    #legend(('Wave front'),'upper left')
658   
659    if is_interactive:
660        # Wait for enter pressed
661        raw_input()
662
663    if save_as is not None:
664        savefig(save_as)
665   
666    #Need to close this plot
667    close()
668   
[5426]669#-------------------------------------------------------------
670if __name__ == "__main__":
671    """
672    """
[5455]673    from scenarios import scenarios
[5494]674    #scenarios = [scenarios[0]]
[5503]675    outputdir_tag = "_good_tri_area_0.01_limiterD"
[5590]676    outputdir_tag = "_good_lmts_wdth_0.1_z_0.012_ys_0.01_mta_0.0001_F"
[5503]677    slope_tag = ""
[5494]678    #outputdir_tag = "_test_limiterC"
[5590]679    scenarios = [scenarios[4]] # !!!!!!!!!!!!!!!!!!!!!!
[5503]680    #scenarios = scenarios[4:] # !!!!!!!!!!!!!!!!!!!!!!
681   
[5590]682    #gauges_for_slope(slope_tag, outputdir_tag, scenarios)
[5503]683    #auto_graph_slopes(outputdir_tag, scenarios) #, is_interactive=True)
[5590]684    #auto_find_min_slopes(slope_tag, outputdir_tag, scenarios)
[5503]685    #auto_graph_froudes(outputdir_tag, scenarios)
[5590]686    auto_plot_froude_slopes(slope_tag, outputdir_tag, scenarios)
[5532]687    #g = Get_file_name(scenarios[0], outputdir_tag, slope_tag)
688    #for wave_file, save_as, wave_number in Get_file_name(
689     #   scenarios[0], outputdir_tag, slope_tag):
690      #  print "**************"
Note: See TracBrowser for help on using the repository browser.