fgmax_tools module for working with topography data¶
See also
Documentation auto-generated from the module docstrings¶
fgmax_tools module: $CLAW/geoclaw/src/python/geoclaw/fgmax_tools.py
Tools to specify an fgmax grid for keeping track of maximum flow depth, etc. and to read in the fgmax output after doing a GeoClaw run.
- class clawpack.geoclaw.fgmax_tools.FGmaxGrid¶
New class introduced in 5.2.1 to keep store information both about the fgmax input data and the output generated by a GeoClaw run.
- bounding_box()¶
Return the bounding box of the grid as a list [x1,x2,y1,y2]
- interp_dz(dtopo_path, dtopo_type)¶
Compute approximate values of deformation dz on X,Y grid using a specified dtopo file. Also calculates B0 = B - dz, attempting to recover the pre-event topography from the GeoClaw run topography stored in B.
- ps4_to_arrays(verbose=True)¶
for point_style==4, convert lists of fgmax values into masked arrays based on the topo_style==3 file self.xy_fname that was used to specify the fgmax points in the GeoClaw run.
- read_fgmax_grids_data(fgno, data_file='fgmax_grids.data')¶
Read input info for fgmax grid number fgno from the data file fgmax_grids.data, which should have been created by setrun.py. This file now contains info about all fgmax grids.
- read_output(fgno=None, outdir=None, verbose=True, indexing='ij')¶
Read the GeoClaw results on the fgmax grid numbered fgno.
- indexing=’ij’ gives backward compatibility.
X[i,j],Y[i,j] corresponds to point x[i],y[j]
Alternatively, can set indexing==’xy’ so that X,Y and other arrays have same layout as topo arrays:
X[j,i],Y[j,i] corresponds to point x[i],y[j]
This is useful if you want to save the fgmax results in same format as topofiles, using topotools.Topography.write().
- write_to_fgmax_data(fid)¶
Write the fgmax grid data to the file specified by fid, normally the fgmax_grids.data file that is read in by the GeoClaw Fortran code.
- clawpack.geoclaw.fgmax_tools.adjust_fgmax_1d(x1_desired, x2_desired, x1_domain, dx)¶
Adjust the upper and lower limits of a grid so that equally spaced grid points with spacing dx lie exactly at cell centers, so that no interpolation is needed for fgmax values. Note that parameter names refer to x limits, but works equally well for y values.
- Input:
x1_desired, x2_desired: approximate desired limits of fgmax grid
x1_domain: lower edge of computational domain
dx: Mesh spacing on fine grid that fgmax grid should conform to
- Output:
x1_new, x2_new: limits to set so (x2-x1) is integer multiple of dx and points are at cell centers of computational grid
npoints: number of points to specify, so that linspace(x1_new, x2_new, npoints) gives points with spacing `dx.