Input conversion and utilities#
Paths are filesystem paths. Create destination directories before conversion. See input files for column and row order.
- dyncfs.convert_input_format.convert_usgs_basic2source_csvs(path_rup_model, path_input_dir, sampling_interval_stf)#
path_rup_modelnames USGSbasic_inversion.param;path_input_diris the destination;sampling_interval_stfis seconds. Write one source CSV per segment with triangular STFs and return[[n_strike,n_dip], ...]. Converts slip cm to m and moment dyne cm to N m. Raises ValueError if no fault segments are found.
- dyncfs.convert_input_format.convert_fsp2source_csvs(path_fsp, path_input_dir, sampling_interval_stf, rise_ratio=0.5)#
Read single/multiple-segment FSP from
path_fsp, write source CSVs intopath_input_dirand return segment shapes. STF interval is seconds;rise_ratioin [0,1] allocates the total rise duration to the increasing branch. Required field and shape checks may raise ValueError.
- dyncfs.convert_input_format.create_triangle_stfs(t_rup, t_ris, t_fal, m0, srate_stf)#
Per-patch arrays
t_rup,t_ris,t_falare rupture delay, rise and fall times in seconds;m0is N m andsrate_stfis Hz. Return moment-rate samples(N,nt)normalized by discrete integration tom0. Durations below one sample become an impulse carrying the moment. Inputs should have matching lengths and nonnegative times.
- dyncfs.convert_input_format.write_source_plane_csv(path_csv, lat_lon_dep, strike, dip, rake, length_strike, length_dip, slip_m, m0, t_rup, t_ris, t_fal, srate_stf, nx, nz)#
Write
path_csvand return None. Coordinates are(N,3)in deg/deg/km; mechanism arrays are degrees; lengths are km; slip is m; moment is N m; STF times are seconds and rate is Hz.nxandnzare counts along strike/dip and must multiply to N. Input is dip-row-major; output is strike-major with dip varying fastest. The function creates triangular STFs and reorders all columns together.
- dyncfs.convert_input_format.convert_source_csvs2coulomb3(config, obs_depth, possion_ratio=0.25, youngs_modulus=800000.0)#
Use configured source geometry to write
config.path_input/coulomb3.inp.obs_depthis km,possion_ratiois dimensionless andyoungs_modulusis bar. Preserve the historical parameter spelling. Returns None; does not run Coulomb3.
- dyncfs.utils.read_source_array(source_inds, path_input, shift2corner=False)#
Read and concatenate numbered source CSVs in ID-list order. Drop rows with missing fields.
shift2corner=Truemoves patch centers to a top-left corner approximation; normal DynCFS computation uses False. Returns the combined numeric array; selected files need equal column counts.
- dyncfs.utils.read_nd(path_nd, with_Q=False)#
Read numeric model rows from
path_nd, skipping single-token labels. Return(-1,4)without Q or(-1,6)with Q.with_Qselects the expected file schema; it does not discard input columns.
- dyncfs.utils.cal_grid_num(value_range, delta, decimals=8)#
Return a grid count for the closed two-entry
value_rangeusing positivedelta, rounding interval arithmetic todecimals. Use the same units for range and delta; grid consumers construct endpoints with linspace.
- dyncfs.utils.ignore_slip_source_array(source_array, slip_thresh)#
Return a copied source array with slip and moment zeroed wherever column 8 is less than
slip_threshin m. Rows and STF columns are retained.
- dyncfs.utils.cut_stf_modify_source_array(source_array, cut_stf)#
Return a copied source array with STF samples at and after the positive index
cut_stfzeroed. Rescale slip and moment by the retained/original STF sum ratio; zero-integral rows get zero ratio. High-level callers skip this function for nonpositive cutoffs.