openquake.hme.utils.utilsΒΆ

Functions

angle_between_planes(strike1, dip1, strike2, ...)

angle_between_rakes(rake1, rake2[, ...])

angles_between_plane_and_planes(strike1, ...)

angles_between_rake_and_rakes(rake1, rakes)

buffer_geojson_polygon(geojson_feature, ...)

Buffer a GeoJSON polygon and return a new GeoJSON dict.

datetime_to_decimal_year(dt)

Convert a Python datetime to decimal year.

datetime_to_string(dt)

deep_update(source, overrides)

Update a nested dictionary or similar mapping.

flatten_list(lol)

Flattens a list of lists (lol).

get_bin_edges_from_mag_bins(mag_bins)

get_cell_eqs(cell_id, eq_gdf, eq_groups)

get_cell_rups(cell_id, rupture_gdf, cell_groups)

get_eq_df_mag_bins(eq_df, mag_bins)

get_mag_bins(min_mag, max_mag, bin_width)

get_mag_bins_from_cfg(cfg)

get_mag_duration_from_comp_table(comp_table, mag)

get_mag_year_from_comp_table(comp_table, mag)

get_model_mfd(rdf, mag_bins[, cumulative, ...])

get_n_eqs_from_mfd(mfd)

get_nonparametric_rupture_occurrence_rate(rup)

get_obs_mfd(eq_df, mag_bins[, t_yrs, ...])

if t_yrs is None or 1.0, then the MFD will be over the entire catalog.

get_poisson_counts_from_mfd_iter(mfd, n_iters)

get_rup_df_mfd(rdf, mag_bins[, cumulative, ...])

mag_to_mo(mag[, c])

Scalar moment [in Nm] from moment magnitude

make_earthquake_gdf_from_csv(eq_csv[, ...])

Reads an earthquake catalog from a CSV file and returns a GeoDataFrame.

mo_to_mag(mo[, c])

From moment magnitude to scalar moment [in Nm]

parallelize(data, func[, cores, partitions])

Function to execute the function func in parallel over the collection of data using the Python multiprocessing (imap) functionality.

pick_andersonian_nodal_plane(strike1, dip1, ...)

Picks strike, dip and rake set most consistent with Andersonian mechanics.

random_dates(start, end, n[, rand_seed])

rupture_list_to_gdf(rupture_list[, gdf, ...])

Creates a Pandas DataFrame or GeoPandas GeoDataFrame from a rupture list.

sample_rups(rup_df, t_yrs[, min_mag, ...])

scale_rup_rate(rup, rate_scale)

strike_dip_to_norm_vec(strike, dip)

subset_source(rupture_gdf, subset_geojson_file)

timestamp_to_decimal_year(timestamp)

Convert a pandas Timestamp to decimal year.

trim_eq_catalog(eq_gdf[, start_date, ...])

trim_eq_catalog_with_completeness_table(...)

trim_inputs(input_data, cfg)

Classes

TqdmLoggingHandler([level])

Class to help tqdm log to both a log file and print to the screen.

Exceptions

MagTooSmallError