def filter_earthquakes_within_pacific(earthquakes_gdf, plates_gdf, pacific_id, plate_name_col):
"""
Filter earthquakes that are within the Pacific plate polygon.
Args:
earthquakes_gdf: GeoDataFrame with earthquake points
plates_gdf: GeoDataFrame with plate polygons
pacific_id: Identifier for the Pacific plate
plate_name_col: Column name containing plate identifiers
Returns:
GeoDataFrame containing only earthquakes within Pacific plate
"""
# Get Pacific plate polygon
pacific_plate = plates_gdf[plates_gdf[plate_name_col] == pacific_id]
if len(pacific_plate) == 0:
raise ValueError(f"Pacific plate '{pacific_id}' not found in data")
pacific_polygon = pacific_plate.geometry.iloc[0]
# Filter earthquakes using .within()
earthquakes_in_pacific = earthquakes_gdf[
earthquakes_gdf.geometry.within(pacific_polygon)
].copy()
print(f"Found {len(earthquakes_in_pacific)} earthquakes within Pacific plate")
return earthquakes_in_pacific
Filter Earthquakes Within Pacific Plate
Use the `.within()` geometric method to identify earthquakes that are contained inside the Pacific plate polygon. Use this skill to ensure only earthquakes actually inside the Pacific plate are analyzed.
Filter Earthquakes Within Pacific Plate by cxcscmu · 5f52a82
npx get-skill add cxcscmu/filter-earthquakes-within-pacific-plate File contents
---name: filter-earthquakes-within-pacific-platedescription: Use the `.within()` geometric method to identify earthquakes that are contained inside the Pacific plate polygon. Use this skill to ensure only earthquakes actually inside the Pacific plate are analyzed.metadata: source: https://skillmd.com/skills/cxcscmu/filter-earthquakes-within-pacific-plate---```pythondef filter_earthquakes_within_pacific(earthquakes_gdf, plates_gdf, pacific_id, plate_name_col): """ Filter earthquakes that are within the Pacific plate polygon. Args: earthquakes_gdf: GeoDataFrame with earthquake points plates_gdf: GeoDataFrame with plate polygons pacific_id: Identifier for the Pacific plate plate_name_col: Column name containing plate identifiers Returns: GeoDataFrame containing only earthquakes within Pacific plate """ # Get Pacific plate polygon pacific_plate = plates_gdf[plates_gdf[plate_name_col] == pacific_id] if len(pacific_plate) == 0: raise ValueError(f"Pacific plate '{pacific_id}' not found in data") pacific_polygon = pacific_plate.geometry.iloc[0] # Filter earthquakes using .within() earthquakes_in_pacific = earthquakes_gdf[ earthquakes_gdf.geometry.within(pacific_polygon) ].copy() print(f"Found {len(earthquakes_in_pacific)} earthquakes within Pacific plate") return earthquakes_in_pacific```
cxcscmu/SkillLearnBench commit 5f52a825d6
Frequently asked questions
Run npx get-skill add cxcscmu/filter-earthquakes-within-pacific-plate 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.
Use the `.within()` geometric method to identify earthquakes that are contained inside the Pacific plate polygon. Use this skill to ensure only earthquakes actually inside the Pacific plate are analyzed. 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.