Skip to content

Commit 1ec2512

Browse files
committedJul 29, 2024·
Leave output_format as an argument to FGoutGrids.__init__ but not that
this is ignored since it is read from fgout_grids.data. Also properly handle output_format == 2 for binary32.
1 parent 178403e commit 1ec2512

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎src/python/geoclaw/fgout_tools.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,11 @@ def __init__(self,fgno=None,outdir='.',output_format=None,
321321
self.qmap = {'h':1, 'hu':2, 'hv':3, 'hm':4, 'pb':5, 'hchi':6,
322322
'bdif':7, 'eta':8, 'B':9}
323323
else:
324-
raise InputError('Invalid qmap: %s' % qmap)
324+
raise ValueError('Invalid qmap: %s' % qmap)
325325

326326
# GeoClaw input values:
327+
# Many of these should be read from fgout_grids.data
328+
# using read_fgout_grids_data before using read_frame
327329
self.id = '' # identifier, optional
328330
self.point_style = 2 # only option currently supported
329331
self.npts = None
@@ -335,7 +337,10 @@ def __init__(self,fgno=None,outdir='.',output_format=None,
335337
self.nout = None
336338
self.fgno = fgno
337339
self.outdir = outdir
340+
341+
# Note output_format will be reset by read_fgout_grids_data:
338342
self.output_format = output_format
343+
339344
self.q_out_vars = [1,2,3,4] # list of which components to print
340345
# default: h,hu,hv,eta (5=topo)
341346
self.nqout = None # number of vars to print out
@@ -517,8 +522,13 @@ def read_fgout_grids_data(self, fgno=None, data_file='fgout_grids.data'):
517522
lineno += 1
518523
if output_format == 1:
519524
self.output_format = 'ascii'
525+
elif output_format == 2:
526+
self.output_format = 'binary32'
520527
elif output_format == 3:
521528
self.output_format = 'binary'
529+
else:
530+
raise NotImplementedError("fgout not implemented for " \
531+
+ "output_format %i" % output_format)
522532
print('Reading input for fgno=%i, point_style = %i ' \
523533
% (self.fgno, self.point_style))
524534
if point_style == 2:

0 commit comments

Comments
 (0)
Please sign in to comment.