From 6c967cc3627e04bb3f3b4b17f40064a2ac74c42c Mon Sep 17 00:00:00 2001 From: Randy LeVeque Date: Mon, 21 Oct 2024 16:27:31 -0700 Subject: [PATCH 1/3] Properly set fgout q_out_vars to default Should be `[h,hu,hv,eta]` as in old versions, but now `qmap['eta']` varies depending on equations being solved (e.g. `geoclaw-bouss` or `dclaw`). --- src/python/geoclaw/fgout_tools.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/python/geoclaw/fgout_tools.py b/src/python/geoclaw/fgout_tools.py index de21b51a8..f6fc56c52 100644 --- a/src/python/geoclaw/fgout_tools.py +++ b/src/python/geoclaw/fgout_tools.py @@ -341,9 +341,12 @@ def __init__(self,fgno=None,outdir='.',output_format=None, # Note output_format will be reset by read_fgout_grids_data: self.output_format = output_format - self.q_out_vars = [1,2,3,4] # list of which components to print - # default: h,hu,hv,eta (5=topo) - self.nqout = None # number of vars to print out + # list of which components to print: + try: + # default: h,hu,hv,eta as in previous versions of GeoClaw + self.q_out_vars = [1,2,3,self.qmap['eta']] + except: + self.q_out_vars = [1,2,3] # if qmap['eta'] not defined self.drytol = 1e-3 # used for computing u,v from hu,hv From 12d57bc2d52ea03c231412b41f438d30e8996df4 Mon Sep 17 00:00:00 2001 From: Randy LeVeque Date: Tue, 29 Oct 2024 13:47:33 -0700 Subject: [PATCH 2/3] check if 'eta' in qmap.keys() instead of try-except --- src/python/geoclaw/fgout_tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/geoclaw/fgout_tools.py b/src/python/geoclaw/fgout_tools.py index f6fc56c52..6b957a9d8 100644 --- a/src/python/geoclaw/fgout_tools.py +++ b/src/python/geoclaw/fgout_tools.py @@ -342,10 +342,10 @@ def __init__(self,fgno=None,outdir='.',output_format=None, self.output_format = output_format # list of which components to print: - try: + if 'eta' in self.qmap.keys(): # default: h,hu,hv,eta as in previous versions of GeoClaw self.q_out_vars = [1,2,3,self.qmap['eta']] - except: + else: self.q_out_vars = [1,2,3] # if qmap['eta'] not defined self.drytol = 1e-3 # used for computing u,v from hu,hv From 6f49189ff4fa62eea27eed1bc50a335fa111de31 Mon Sep 17 00:00:00 2001 From: Randy LeVeque Date: Tue, 29 Oct 2024 13:48:05 -0700 Subject: [PATCH 3/3] fix chile2010_fgmax-fgout/plot_fgout.py --- examples/tsunami/chile2010_fgmax-fgout/plot_fgout.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/tsunami/chile2010_fgmax-fgout/plot_fgout.py b/examples/tsunami/chile2010_fgmax-fgout/plot_fgout.py index 8b61666d3..a24f5a68d 100644 --- a/examples/tsunami/chile2010_fgmax-fgout/plot_fgout.py +++ b/examples/tsunami/chile2010_fgmax-fgout/plot_fgout.py @@ -13,6 +13,7 @@ # Instantiate object for reading fgout frames: fgout_grid = fgout_tools.FGoutGrid(fgno, outdir, output_format) +fgout_grid.read_fgout_grids_data() # Plot one frame of fgout data fgframe = 20