Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions src/python/visclaw/plotpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,10 +1028,9 @@ def plotclaw2kml(plotdata):
# Loop over all gauges
for gnum,gauge in enumerate(gauges):
gaugeno = int(gauge[0])
if plotdata.print_gaugenos != 'all':
if gaugeno not in plotdata.print_gaugenos:
#print('+++ skipping gauge %i, not in print_gaugenos' % gaugeno)
continue # to next gauge
if (plotdata.print_gaugenos.lower() != 'all' or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kml version not working. I think or should be and here, but also if gaugeno is an int the next line doesn't work:

    gaugeno not in plotdata.print_gaugenos):
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'in <string>' requires string as left operand, not int

gaugeno not in plotdata.print_gaugenos):
continue
t1,t2 = gauge[3:5]
x1,y1 = gauge[1:3]
if plotdata.kml_map_topo_to_latlong is not None:
Expand All @@ -1053,7 +1052,7 @@ def plotclaw2kml(plotdata):
# there is only one figure number figno for all gauges
# If user has set 'gaugeno=[]', gauge files will not be added to the KMLfile.

if plotdata.gauges_fignos is not None:
if not plotdata.gauges_fignos:
figno = plotdata.gauges_fignos[0] # use just the first

figname = gauge_pngfile[gaugeno,figno]
Expand Down Expand Up @@ -2960,11 +2959,20 @@ def plotclaw_driver(plotdata, verbose=False, format='ascii'):
# Gauges:
# -------
if os.path.exists(os.path.join(plotdata.outdir,"gauges.data")):
gaugenos = plotdata.print_gaugenos
if gaugenos == 'all':
# Read gauge numbers from setgauges.data if it exists:
setgauges = gaugetools.read_setgauges(plotdata.outdir)
gaugenos = setgauges.gauge_numbers
if isinstance(plotdata.print_gaugenos, str):
if plotdata.print_gaugenos.lower() == 'all':
setgauges = gaugetools.read_setgauges(plotdata.outdir)
gaugenos = setgauges.gauge_numbers
elif plotdata.print_gaugenos.lower() == 'none':
plotdata.print_gaugenos = []
gaugenos = []
else:
raise ValueError(f"Unknown option {plotdata.print_gaguenos}" +
"given for print_gaugenos.")
elif not plotdata.print_gaugenos:
# Handle None, also handles False, but not True
plotdata.print_gaugenos = []
gaugenos = []

plotdata.gauges_gaugenos = gaugenos
plotdata.gauges_fignos = fignos_each_gauge
Expand Down