def calculate_distances_to_boundary(earthquakes_proj, boundaries_proj):
"""
Calculate distance from each earthquake to the nearest Pacific boundary.
Args:
earthquakes_proj: GeoDataFrame with earthquakes in EPSG:4087
boundaries_proj: GeoDataFrame with Pacific boundaries in EPSG:4087
Returns:
GeoDataFrame with added 'distance_km' column
"""
# Combine all boundary geometries into single geometry
combined_boundaries = boundaries_proj.geometry.unary_union
# Calculate distance from each earthquake to combined boundary
# EPSG:4087 uses meters, so divide by 1000 for kilometers
earthquakes_proj['distance_km'] = earthquakes_proj.geometry.distance(
combined_boundaries
) / 1000
return earthquakes_proj
Calculate Distance to Nearest Pacific Boundary
Combine all Pacific plate boundary geometries using `.unary_union` and calculate the distance from each earthquake to this combined boundary geometry. Returns the minimum distance in kilometers for each earthquake.
Calculate Distance to Nearest Pacific Boundary by cxcscmu · 202f04d
npx get-skill add cxcscmu/calculate-distance-to-nearest-pacific-boundary File contents
---name: calculate-distance-to-nearest-pacific-boundarydescription: Combine all Pacific plate boundary geometries using `.unary_union` and calculate the distance from each earthquake to this combined boundary geometry. Returns the minimum distance in kilometers for each earthquake.metadata: source: https://skillmd.com/skills/cxcscmu/calculate-distance-to-nearest-pacific-boundary---```pythondef calculate_distances_to_boundary(earthquakes_proj, boundaries_proj): """ Calculate distance from each earthquake to the nearest Pacific boundary. Args: earthquakes_proj: GeoDataFrame with earthquakes in EPSG:4087 boundaries_proj: GeoDataFrame with Pacific boundaries in EPSG:4087 Returns: GeoDataFrame with added 'distance_km' column """ # Combine all boundary geometries into single geometry combined_boundaries = boundaries_proj.geometry.unary_union # Calculate distance from each earthquake to combined boundary # EPSG:4087 uses meters, so divide by 1000 for kilometers earthquakes_proj['distance_km'] = earthquakes_proj.geometry.distance( combined_boundaries ) / 1000 return earthquakes_proj```
cxcscmu/SkillLearnBench commit 202f04da75
Frequently asked questions
Run npx get-skill add cxcscmu/calculate-distance-to-nearest-pacific-boundary in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Combine all Pacific plate boundary geometries using `.unary_union` and calculate the distance from each earthquake to this combined boundary geometry. Returns the minimum distance in kilometers for each earthquake. It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
cxcscmu (@cxcscmu) published this skill. Their other Agent Skills are listed on their SkillMD profile.