utilities¶
- pyrecodes.utilities.component_inside_bounding_box(component_geometry: Point, polygon: Polygon) bool¶
- pyrecodes.utilities.create_component_geometry_as_point(component_location: list) Point¶
- pyrecodes.utilities.create_component_geometry_from_wkt(geometry_string: str) BaseGeometry¶
- pyrecodes.utilities.create_locality_polygon(bounding_box: list) Polygon¶
- pyrecodes.utilities.format_locality_id(locality_string) int¶
- pyrecodes.utilities.get_class(module_name: str, class_name: str, folder_name: str) object¶
Imports a class from a file
- pyrecodes.utilities.get_locality_coordinates_from_geojson(locality_info: dict) dict¶
- pyrecodes.utilities.json_deepcopy(input: list | dict) list | dict¶
Fast deep copy for nested dicts/lists of JSON-serializable primitives.
- pyrecodes.utilities.read_json_file(file_name: str) dict¶
Reads a JSON file and returns its contents as a dictionary.
- Args:
file_name (str): The name of the JSON file to be read.
- Returns:
dict: The dictionary representation of the JSON data.
- pyrecodes.utilities.resolve_folder_paths(obj: dict | list | str, folder_name: str) dict | list | str¶
Recursively replaces the
{folder}placeholder in all string values withfolder_name.Use
{folder}in system configuration JSON to reference files relative to the input folder without hardcoding its name.- Args:
obj: A dict, list, or string parsed from JSON. folder_name: The folder name passed to
main.run().- Returns:
The same structure with every
{folder}occurrence replaced.
- pyrecodes.utilities.unpack_time_stepping_rules(time_stepping_rules: list) list¶
Unpacks time stepping rules into a list of time steps.