From 17cbcc8e79c8ff803385ae72c144f22222750fcf Mon Sep 17 00:00:00 2001 From: Mieszko Makuch Date: Fri, 9 May 2025 10:26:27 +0200 Subject: [PATCH] ISEPOS-2373 Simplify code --- src/seismic_hazard_forecasting.py | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/seismic_hazard_forecasting.py b/src/seismic_hazard_forecasting.py index 0d00306..10ace1e 100644 --- a/src/seismic_hazard_forecasting.py +++ b/src/seismic_hazard_forecasting.py @@ -468,16 +468,6 @@ verbose: {verbose}") else: iml_grid_prep = iml_grid_raw - # TODO Remove. Saving coordinates to - # north, south = lat.max(), lat.min() - # east, west = lon.max(), lon.min() - # bbox_json = {"south": float(south), "west": float(west), - # "north": float(north), "east": float(east)} - # with open("overlay_bounds.json", "w", encoding="utf‑8") as fh: - # json.dump(bbox_json, fh, indent=2) - # - # logger.info(f"Saved bbox to overlay_bounds.json → {bbox_json}") - for j in range(0, len(products)): vmin = min(x for x in iml_grid_prep[j] if x is not np.nan) vmax = max(x for x in iml_grid_prep[j] if x is not np.nan) @@ -528,16 +518,8 @@ verbose: {verbose}") root = tree.getroot() - # Remove any existing tags - for old_meta in root.findall("{http://www.w3.org/2000/svg}metadata"): - root.remove(old_meta) - - # Add new element with the bounding box JSON - meta_elem = ET.SubElement(root, "metadata") - meta_elem.text = json.dumps(bbox_dict) - # (Optional) Also store the bounding box as a data attribute for quick access - root.set("data-bbox", json.dumps(bbox_dict)) + root.set("data-map-bounds", json.dumps(bbox_dict)) tree.write(svg_path, encoding="utf-8", xml_declaration=True) logger.info(f"Embedded bbox into {svg_path} → {bbox_dict}") @@ -546,7 +528,6 @@ verbose: {verbose}") # ----------------------------------------- # Make the color bar - cmap_name = 'viridis' width = 50 height = 500