Earthquake plate calculation

From XuShuwenn/RedAct · View interactive version

Earthquake plate calculation is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Find the earthquake furthest from the Pacific plate boundary within the Pacific plate using GeoPandas and distance calculations.

How to use this skill

Skill file

Earthquake Pacific Plate Distance Analysis

When to Use

Input Files

Output Format

JSON at /root/answer.json:

{
  "id": "earthquake_id",
  "place": "location description",
  "time": "",
  "magnitude": ,
  "latitude": ,
  "longitude": ,
  "distance_km":
}

Execution Protocol

Execution Protocol

Key Steps

  1. Read the current task/system instructions for execution mechanics before any analysis step. If they require a specific tool/action schema, allowed tool names, or exact completion token, use that protocol verbatim for every invocation and for the final response; do not substitute other tool-call styles, aliases, or a prose completion.
  1. Inspect the raw earthquake, plate, and boundary files first (top-level shape, feature paths, geometry types, property/column names, CRS, feature counts, and a few sample values) before writing parsing or filter logic.
  1. If the earthquake file is GeoJSON-like feature data, parse feature properties/coordinates explicitly and normalize it into a GeoDataFrame with Point geometry early so containment, reprojection, and distance calculations stay in one consistent workflow.
  2. Inspect the earthquake, plate, and boundary schemas first (geometry types, column/property names, CRS, feature counts, and a few sample values) before writing filters or output extraction logic.
  1. Load plate polygons, inspect available identifier/name columns, and explicitly confirm the authoritative Pacific plate identifier/code from the data itself (for example, a validated row showing PlateName = Pacific and its matching stable code such as Code = PA if the dataset uses those fields). Keep visible evidence of the exact matching row(s) used before reusing that identifier downstream.
  1. Use the confirmed Pacific plate polygon only for containment: filter earthquakes within that polygon before any ranking or distance calculation
  1. Load plate boundary lines separately, inspect boundary identifier/side fields, and select only the verified Pacific-boundary segments using the same confirmed Pacific identifier (for example rows where PlateA or PlateB matches the verified Pacific code); verify the selected features plausibly trace that same plate boundary, then combine them into one validated geometry before nearest-distance calculations
  1. Calculate each in-plate earthquake's minimum distance to the verified Pacific plate boundary lines, not the polygon exterior as a shortcut. Keep containment/topology checks in EPSG:4326, then reproject both the filtered earthquakes and verified boundary geometry to a meter-based CRS for the main full-set distance pass; never measure directly in EPSG:4326 degrees
  2. Because this is a Pacific-wide / antimeridian-spanning problem, geodesically validate the winner and nearby top candidates before finalizing, and do not let sampled vertices, midpoint shortcuts, or other approximations determine the winner
  3. Compute the final exact distance metric for the full filtered in-plate set, then take the argmax of the validated distances; do not shortlist candidates with approximations and only exact-check a few finalists.

9a. After selecting the argmax, read back that winning earthquake row from the same filtered dataset used for distance computation and map each required output field (id, place, time, magnitude, latitude, longitude) from observed source columns/properties before writing /root/answer.json; do not reconstruct winner metadata from guessed field names, stale earlier samples, or a different intermediate table.

  1. Round distance_km to 2 decimal places after converting from meters to kilometers
  2. Prefer a small reproducible script for the full workflow (load, inspect columns, isolate Pacific polygon/boundaries, filter earthquakes, compute distances, write /root/answer.json) instead of ad hoc interactive steps when the analysis has multiple geospatial transforms
  1. If you create a script or JSON artifact, write the actual executable/data content, not comment-only scaffolding, pseudocode, or a prose description of intended logic. Immediately read the file back and confirm it contains runnable code/data matching the intended artifact type before executing or trusting it.
  1. Treat results as valid only if the logged command or script run is concrete and reproducible; if a command is malformed, non-executable, or merely descriptive, rerun with an explicit executable command before trusting any output.
  2. Never use placeholder shell text as if it were a command. Write the exact executable command instead of descriptions like inspect the earthquake JSON structure, run the analysis script, or list relevant JSON files.
  3. When creating a script, write full runnable code only: real imports, concrete data loading, actual geometry/filter/distance logic, and explicit output writing. Do not save TODOs, English placeholders, or comment-only scaffolding as if they were executable.
  4. Keep the decisive workflow in this order unless inspected data proves a required adjustment: inspect schemas -> confirm Pacific polygon identifier -> filter earthquakes inside that polygon -> derive matching Pacific boundary segments with the same identifier -> reproject both filtered earthquakes and verified boundary geometry to a meter-based CRS -> compute exact distances for the full filtered set -> take the argmax -> write and read back /root/answer.json.

Validation

Validation

Tips

Final Check

Final Check

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.