gfail.gfailrun¶
- gfail.gfailrun.run_gfail(args)[source]¶
Runs ground failure.
- Parameters
args – dictionary or argument parser Namespace output by bin/gfail program.
- Returns
Names of created files.
- Return type
list
- gfail.gfailrun.getGridURL(gridurl, fname=None)[source]¶
- Parameters
gridurl (str) – url for Shakemap grid.xml file.
fname (str) – file location name, if None, will create a temporary file
- Returns
file object corresponding to the url.
- gfail.gfailrun.getShakefiles(event, outdir, uncert=False, version=None, source='preferred')[source]¶
Download the shakemap grid.xml file and the
- Parameters
URL (event event id or) –
- gfail.gfailrun.getUncert(shakemap, fname=None)[source]¶
download and unzip (if needed) the uncertainty grid corresponding to a shakemap
- Parameters
shakemap – libcomcat ShakeMap product class for the event and version
fname (str) – file location name, if None, will create a temporary file
- Returns
file object corresponding to the url.
- gfail.gfailrun.isURL(gridurl)[source]¶
This function determines if the provided string is a valid url
- Parameters
gridurl (str) – url to check.
- Returns
True if gridurl is a valid url, False otherwise.
- Return type
bool
- gfail.gfailrun.set_default_paths(args)[source]¶
Creates a file called .gfail_defaults that contains default path information to simplify running gfail. Can be overwritten by any manually entered paths. This updates any existing .gfail_defaults file. If args.data_path is ‘reset’ then any existing defaults will be removed.
- Parameters
args (arparser Namespace) – Input arguments.
- Returns
Updates .gfail_defaults file on users path, or creates new one if file does not already exist.
- gfail.gfailrun.get_bounds(shakefile, parameter='pga', threshold=2.0)[source]¶
Get the boundaries of the shakemap that include all areas with shaking above the defined threshold.
- Parameters
shakefile (str) – Path to shakemap file.
parameter (str) – Either ‘pga’ or ‘pgv’.
threshold (float) – Minimum value of parameter of interest, in units of %g for pga and cm/s for pgv. The default value of 2% g is based on minimum pga threshold ever observed to have triggered landslides by Jibson and Harp (2016).
- Returns
A dictionary with keys ‘xmin’, ‘xmax’, ‘ymin’, and ‘ymax’ that defines the boundaries in geographic coordinates.
- Return type
dict
- gfail.gfailrun.check_input_extents(config, shakefile=None, bounds=None)[source]¶
Make sure all input files exist and cover the extent desired
- Parameters
config – configObj of a single model
shakefile – path to ShakeMap grid.xml file (used for bounds). If not provided, bounds must be provided
bounds – dictionary of bounds with keys: ‘xmin’, ‘xmax’, ‘ymin’, ‘ymax’
- Returns
- notcovered: list of files that do not cover the entire area
defined by bounds or shakefile
- newbounds: new dictionary of bounds of subarea of original
bounds or shakefile extent that is covered by all input files
- Return type
tuple containing