turambar928 commited on
Commit
dd1e73a
·
verified ·
1 Parent(s): 5f97aab

Upload folder using huggingface_hub (part 6)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. 20260903-164548-science-environment-4a68cd/environment/public_data/input/usgs_fdsn_japan_kuril_2009_2011_m5.csv +0 -0
  2. 20260903-164548-science-environment-4a68cd/environment/public_data/main.py +180 -0
  3. 20260903-164548-science-environment-4a68cd/environment/public_data/software/validate_outputs.py +41 -0
  4. 20260903-164548-science-environment-4a68cd/environment/public_data/task_card.json +92 -0
  5. 20260903-164548-science-environment-4a68cd/instruction.md +33 -0
  6. 20260903-164548-science-environment-4a68cd/solution/internal/workflow_adapters_runtime.py +679 -0
  7. 20260903-164548-science-environment-4a68cd/solution/internal/workflow_runtime.py +5 -0
  8. 20260903-164548-science-environment-4a68cd/solution/reference_solution.py +20 -0
  9. 20260903-164548-science-environment-4a68cd/solution/solve.sh +7 -0
  10. 20260903-164548-science-environment-4a68cd/task.toml +45 -0
  11. 20260903-164548-science-environment-4a68cd/tests/Dockerfile +6 -0
  12. 20260903-164548-science-environment-4a68cd/tests/evaluator_runner.py +92 -0
  13. 20260903-164548-science-environment-4a68cd/tests/reference/__pycache__/evaluator.cpython-312.pyc +0 -0
  14. 20260903-164548-science-environment-4a68cd/tests/reference/evaluator.py +114 -0
  15. 20260903-164548-science-environment-4a68cd/tests/reference/ground_truth/clean_series.csv +4 -0
  16. 20260903-164548-science-environment-4a68cd/tests/reference/ground_truth/decadal_statistics.csv +3 -0
  17. 20260903-164548-science-environment-4a68cd/tests/reference/ground_truth/summary.json +23 -0
  18. 20260903-164548-science-environment-4a68cd/tests/reference/ground_truth/threshold_years.csv +2 -0
  19. 20260903-164548-science-environment-4a68cd/tests/reference/internal/workflow_adapters_runtime.py +679 -0
  20. 20260903-164548-science-environment-4a68cd/tests/reference/internal/workflow_runtime.py +5 -0
  21. 20260903-164548-science-environment-4a68cd/tests/reference/reference_manifest.json +34 -0
  22. 20260903-164548-science-environment-4a68cd/tests/reference/reference_solution.py +20 -0
  23. 20260903-164548-science-environment-4a68cd/tests/test.sh +29 -0
  24. 20260903-164548-science-environment-8102f0/.DS_Store +3 -0
  25. 20260903-164548-science-environment-8102f0/environment/Dockerfile +12 -0
  26. 20260903-164548-science-environment-8102f0/environment/public_data/README.md +11 -0
  27. 20260903-164548-science-environment-8102f0/environment/public_data/input/README.md +6 -0
  28. 20260903-164548-science-environment-8102f0/environment/public_data/input/analysis_spec.json +76 -0
  29. 20260903-164548-science-environment-8102f0/environment/public_data/input/source_context_windows.jsonl +0 -0
  30. 20260903-164548-science-environment-8102f0/environment/public_data/input/usgs_fdsn_alaska_aleutians_1974_1978_m4p5.csv +538 -0
  31. 20260903-164548-science-environment-8102f0/environment/public_data/main.py +180 -0
  32. 20260903-164548-science-environment-8102f0/environment/public_data/software/validate_outputs.py +41 -0
  33. 20260903-164548-science-environment-8102f0/environment/public_data/task_card.json +92 -0
  34. 20260903-164548-science-environment-8102f0/instruction.md +33 -0
  35. 20260903-164548-science-environment-8102f0/solution/internal/workflow_adapters_runtime.py +679 -0
  36. 20260903-164548-science-environment-8102f0/solution/internal/workflow_runtime.py +5 -0
  37. 20260903-164548-science-environment-8102f0/solution/reference_solution.py +20 -0
  38. 20260903-164548-science-environment-8102f0/solution/solve.sh +7 -0
  39. 20260903-164548-science-environment-8102f0/task.toml +45 -0
  40. 20260903-164548-science-environment-8102f0/tests/Dockerfile +6 -0
  41. 20260903-164548-science-environment-8102f0/tests/evaluator_runner.py +92 -0
  42. 20260903-164548-science-environment-8102f0/tests/reference/__pycache__/evaluator.cpython-312.pyc +0 -0
  43. 20260903-164548-science-environment-8102f0/tests/reference/evaluator.py +114 -0
  44. 20260903-164548-science-environment-8102f0/tests/reference/ground_truth/clean_series.csv +6 -0
  45. 20260903-164548-science-environment-8102f0/tests/reference/ground_truth/decadal_statistics.csv +2 -0
  46. 20260903-164548-science-environment-8102f0/tests/reference/ground_truth/summary.json +23 -0
  47. 20260903-164548-science-environment-8102f0/tests/reference/ground_truth/threshold_years.csv +1 -0
  48. 20260903-164548-science-environment-8102f0/tests/reference/internal/workflow_adapters_runtime.py +679 -0
  49. 20260903-164548-science-environment-8102f0/tests/reference/internal/workflow_runtime.py +5 -0
  50. 20260903-164548-science-environment-8102f0/tests/reference/reference_manifest.json +34 -0
20260903-164548-science-environment-4a68cd/environment/public_data/input/usgs_fdsn_japan_kuril_2009_2011_m5.csv ADDED
The diff for this file is too large to render. See raw diff
 
20260903-164548-science-environment-4a68cd/environment/public_data/main.py ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import importlib.util
4
+ import json
5
+ import os
6
+ import shlex
7
+ import shutil
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+
12
+ class Task:
13
+ def __init__(self, task_id: str, description: str, metadata: dict[str, Any]):
14
+ self.task_id = task_id
15
+ self.description = description
16
+ self.prompt = description
17
+ self.metadata = metadata
18
+ self.computer = {"setup_config": {"os_type": "linux"}}
19
+
20
+
21
+ def _task_dir() -> Path:
22
+ return Path(__file__).resolve().parent
23
+
24
+
25
+ def _load_card() -> dict[str, Any]:
26
+ path = _task_dir() / "task_card.json"
27
+ if not path.is_file():
28
+ return {
29
+ "taskId": os.environ.get("ALE_TASK_ID", "science_environment/usgs_japan_kuril_annual_mean_depth_audit"),
30
+ "taskPrompt": "Task card has not been rendered yet; this fallback exists for stage-03 hook smoke only.",
31
+ "metadata": {
32
+ "domain": "science_environment",
33
+ "task": "usgs_japan_kuril_annual_mean_depth_audit",
34
+ "variant": "base",
35
+ "domain_name": "science_environment",
36
+ "task_name": "usgs_japan_kuril_annual_mean_depth_audit",
37
+ "variant_name": "base",
38
+ "requires_task_data": True,
39
+ "task_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_mean_depth_audit/base",
40
+ "input_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_mean_depth_audit/base/input",
41
+ "software_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_mean_depth_audit/base/software",
42
+ "remote_output_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_mean_depth_audit/base/output",
43
+ "reference_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_mean_depth_audit/base/reference",
44
+ },
45
+ }
46
+ with path.open("r", encoding="utf-8") as handle:
47
+ return json.load(handle)
48
+
49
+
50
+ def load() -> list[Task]:
51
+ card = _load_card()
52
+ metadata = dict(card.get("metadata") or {})
53
+ if not metadata:
54
+ domain, _, task = str(card["taskId"]).partition("/")
55
+ variant = "base"
56
+ task_dir = f"/media/user/data/agenthle/{domain}/{task}/{variant}"
57
+ metadata.update({
58
+ "domain": domain,
59
+ "task": task,
60
+ "variant": variant,
61
+ "domain_name": domain,
62
+ "task_name": task,
63
+ "variant_name": variant,
64
+ "requires_task_data": True,
65
+ "task_dir": task_dir,
66
+ "input_dir": f"{task_dir}/input",
67
+ "software_dir": f"{task_dir}/software",
68
+ "remote_output_dir": f"{task_dir}/output",
69
+ "reference_dir": f"{task_dir}/reference",
70
+ })
71
+ return [Task(task_id=card["taskId"], description=card["taskPrompt"], metadata=metadata)]
72
+
73
+
74
+ def _metadata(cfg: Any = None) -> dict[str, Any]:
75
+ if cfg is None:
76
+ return {}
77
+ value = getattr(cfg, "metadata", None)
78
+ return value if isinstance(value, dict) else {}
79
+
80
+
81
+ def _remote_path(metadata: dict[str, Any], key: str, fallback: str) -> str:
82
+ value = str(metadata.get(key) or "").strip()
83
+ return value or fallback
84
+
85
+
86
+ async def _remote_run(session: Any, command: str, *, check: bool = False) -> Any:
87
+ try:
88
+ return await session.run_command(command, check=check)
89
+ except TypeError:
90
+ return await session.run_command(command)
91
+
92
+
93
+ async def _remote_start(cfg: Any, session: Any) -> dict[str, Any]:
94
+ metadata = _metadata(cfg)
95
+ output_dir = _remote_path(metadata, "remote_output_dir", "output")
96
+ input_dir = _remote_path(metadata, "input_dir", "input")
97
+ software_dir = _remote_path(metadata, "software_dir", "software")
98
+ command = (
99
+ "set -eu\n"
100
+ f"mkdir -p {shlex.quote(output_dir)}\n"
101
+ f"find {shlex.quote(output_dir)} -mindepth 1 -maxdepth 1 -exec rm -rf -- {{}} +\n"
102
+ )
103
+ await _remote_run(session, command, check=True)
104
+ return {"ok": True, "input_dir": input_dir, "software_dir": software_dir, "output_dir": output_dir}
105
+
106
+
107
+ def start(cfg: Any = None, session: Any = None) -> dict[str, Any]:
108
+ if session is not None:
109
+ return _remote_start(cfg, session)
110
+ del cfg
111
+ output_dir = Path(os.environ.get("ALE_OUTPUT_DIR", "output"))
112
+ output_dir.mkdir(parents=True, exist_ok=True)
113
+ for child in output_dir.iterdir():
114
+ if child.is_dir():
115
+ shutil.rmtree(child)
116
+ else:
117
+ child.unlink()
118
+ input_dir = Path(os.environ.get("ALE_INPUT_DIR", "input"))
119
+ software_dir = Path(os.environ.get("ALE_SOFTWARE_DIR", "software"))
120
+ return {
121
+ "ok": True,
122
+ "input_dir": str(input_dir),
123
+ "software_dir": str(software_dir),
124
+ "output_dir": str(output_dir),
125
+ }
126
+
127
+
128
+ async def _remote_evaluate(cfg: Any, session: Any) -> list[float]:
129
+ metadata = _metadata(cfg)
130
+ output_dir = _remote_path(metadata, "remote_output_dir", "output")
131
+ reference_dir = _remote_path(metadata, "reference_dir", "reference")
132
+ script = f"""
133
+ import importlib.util
134
+ import json
135
+ import pathlib
136
+
137
+ output_dir = pathlib.Path({output_dir!r})
138
+ reference_dir = pathlib.Path({reference_dir!r})
139
+ evaluator_path = reference_dir / "evaluator.py"
140
+ if not evaluator_path.is_file():
141
+ raise FileNotFoundError(f"hidden evaluator is missing: {{evaluator_path}}")
142
+ spec = importlib.util.spec_from_file_location("hidden_ale_evaluator", evaluator_path)
143
+ if spec is None or spec.loader is None:
144
+ raise RuntimeError(f"cannot import hidden evaluator: {{evaluator_path}}")
145
+ module = importlib.util.module_from_spec(spec)
146
+ spec.loader.exec_module(module)
147
+ result = module.evaluate(output_dir, reference_dir)
148
+ print(json.dumps(result))
149
+ """
150
+ command = "python3 - <<'PY'\n" + script + "\nPY"
151
+ result = await _remote_run(session, command, check=True)
152
+ stdout = getattr(result, "stdout", "") or ""
153
+ for line in reversed([item.strip() for item in stdout.splitlines() if item.strip()]):
154
+ try:
155
+ payload = json.loads(line)
156
+ if isinstance(payload, list):
157
+ return [float(max(0.0, min(1.0, value))) for value in payload]
158
+ except Exception:
159
+ continue
160
+ raise RuntimeError("hidden evaluator did not emit a JSON score list")
161
+
162
+
163
+ def evaluate(cfg: Any = None, session: Any = None) -> list[float]:
164
+ if session is not None:
165
+ return _remote_evaluate(cfg, session)
166
+ del cfg
167
+ output_dir = Path(os.environ.get("ALE_OUTPUT_DIR", "output"))
168
+ reference_dir = Path(os.environ.get("ALE_REFERENCE_DIR", "reference"))
169
+ evaluator_path = reference_dir / "evaluator.py"
170
+ if not evaluator_path.is_file():
171
+ raise FileNotFoundError(f"hidden evaluator is missing: {evaluator_path}")
172
+ spec = importlib.util.spec_from_file_location("hidden_ale_evaluator", evaluator_path)
173
+ if spec is None or spec.loader is None:
174
+ raise RuntimeError(f"cannot import hidden evaluator: {evaluator_path}")
175
+ module = importlib.util.module_from_spec(spec)
176
+ spec.loader.exec_module(module)
177
+ result = module.evaluate(output_dir, reference_dir)
178
+ if not isinstance(result, list):
179
+ raise TypeError("hidden evaluator must return list[float]")
180
+ return [float(max(0.0, min(1.0, value))) for value in result]
20260903-164548-science-environment-4a68cd/environment/public_data/software/validate_outputs.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import json
5
+ import os
6
+ import sys
7
+ from pathlib import Path
8
+
9
+
10
+ def required_outputs(input_dir: Path) -> list[str]:
11
+ spec_path = input_dir / "analysis_spec.json"
12
+ if spec_path.is_file():
13
+ payload = json.loads(spec_path.read_text(encoding="utf-8"))
14
+ required = payload.get("required_outputs") if isinstance(payload, dict) else None
15
+ if isinstance(required, list):
16
+ rows = [str(item.get("path") or "") for item in required if isinstance(item, dict)]
17
+ rows = [item for item in rows if item]
18
+ if rows:
19
+ return rows
20
+ return [
21
+ "summary.json",
22
+ "magnitude_depth_bins.csv",
23
+ "region_daily_counts.csv",
24
+ "filtered_events.geojson",
25
+ ]
26
+
27
+
28
+ def main() -> int:
29
+ output_dir = Path(sys.argv[1]) if len(sys.argv) > 1 else Path("output")
30
+ input_dir = Path(sys.argv[2]) if len(sys.argv) > 2 else Path(os.environ.get("ALE_INPUT_DIR", "input"))
31
+ required = required_outputs(input_dir)
32
+ missing = [name for name in required if not (output_dir / name).is_file()]
33
+ if missing:
34
+ print(json.dumps({"ok": False, "missing": missing}, indent=2))
35
+ return 1
36
+ print(json.dumps({"ok": True, "required": required}, indent=2))
37
+ return 0
38
+
39
+
40
+ if __name__ == "__main__":
41
+ raise SystemExit(main())
20260903-164548-science-environment-4a68cd/environment/public_data/task_card.json ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "taskId": "science_environment/usgs_japan_kuril_annual_mean_depth_audit",
3
+ "title": "USGS Fdsn Eq Japan Kuril 2009 2011 M5 Depth Mean",
4
+ "summary": "Audit the real USGS FDSN Japan and Kuril trench earthquake catalog for 2009-2011 (events with magnitude >= 5.0) and produce reproducible annual annual mean focal depth (km) statistics, decadal aggregates, threshold-year checks, and a cleaned local series.",
5
+ "category": "science_environment",
6
+ "taxonomy": {
7
+ "domain_id": "science_environment",
8
+ "domain_code": "science_environment",
9
+ "subdomain_id": "science_environment.data_analysis",
10
+ "subdomain_code": "data_analysis",
11
+ "subdomain_name": "Data Analysis",
12
+ "classifier": {
13
+ "source": "deterministic task metadata",
14
+ "rationale": "CLI-only task derived from a public, reproducible workflow seed."
15
+ }
16
+ },
17
+ "taskPrompt": "Use a Linux command-line workflow to complete this local data-audit task. Read only the staged files in input/ and software/, write final deliverables under output/, and do not use network access, credentials, GUI tools, browser automation, Windows-only tooling, or mobile apps. The authoritative public contract is input/analysis_spec.json; if any wording elsewhere is less specific, follow analysis_spec.json for file names, columns, filters, grouping rules, rounding rules, and output schemas. The workflow kind is csv_annual_series_audit. The primary staged data file is input/usgs_fdsn_japan_kuril_2009_2011_m5.csv. Produce exactly these required deliverables: output/summary.json, output/decadal_statistics.csv, output/threshold_years.csv, output/clean_series.csv. The output schemas are:\n- output/summary.json: JSON keys and nested shape {\"first_threshold_year\": \"integer|null\", \"last_threshold_year\": \"integer|null\", \"row_count\": \"integer valid annual rows\", \"series_name\": \"string\", \"source_row_count\": \"integer raw rows before annual aggregation\", \"threshold\": \"number\", \"value\": {\"max\": \"number|null\", \"max_year\": \"integer|null\", \"mean\": \"number|null\", \"median\": \"number|null\", \"min\": \"number|null\", \"min_year\": \"integer|null\", \"sample_std\": \"number|null\"}, \"year_aggregation\": \"string annual aggregation applied to raw rows\", \"year_range\": {\"end\": \"integer|null\", \"start\": \"integer|null\"}, \"years_at_or_above_threshold\": \"integer\"}\n- output/decadal_statistics.csv: CSV header exactly decade_start, start_year, end_year, count, mean_departure, median_departure, min_departure, max_departure, sample_std_departure\n- output/threshold_years.csv: CSV header exactly rank, year, departure, threshold\n- output/clean_series.csv: CSV header exactly Year, Departure from Average\nCompute all requested values from the staged data rather than hard-coding constants. Use deterministic ordering, UTF-8 text, explicit CSV headers, valid JSON/GeoJSON where applicable, and stable numeric formatting. You may run software/validate_outputs.py as a public sanity check after writing outputs, but the deliverables in output/ are what will be evaluated.",
18
+ "agentMustDo": [
19
+ "Read input/analysis_spec.json first and treat it as the authoritative public specification.",
20
+ "Read input/usgs_fdsn_japan_kuril_2009_2011_m5.csv and compute results from the staged local data.",
21
+ "Create output/summary.json as json exactly as specified by analysis_spec.json.",
22
+ "Create output/decadal_statistics.csv as csv exactly as specified by analysis_spec.json.",
23
+ "Create output/threshold_years.csv as csv exactly as specified by analysis_spec.json.",
24
+ "Create output/clean_series.csv as csv exactly as specified by analysis_spec.json.",
25
+ "Place every final deliverable directly under output/ with the exact required filename.",
26
+ "Use only local staged files and installed Linux CLI tooling; do not download fresh data."
27
+ ],
28
+ "inputFiles": [
29
+ {
30
+ "name": "README.md",
31
+ "format": "Markdown",
32
+ "path": "input/README.md",
33
+ "description": "Agent-visible staged input file for this task."
34
+ },
35
+ {
36
+ "name": "analysis_spec.json",
37
+ "format": "JSON",
38
+ "path": "input/analysis_spec.json",
39
+ "description": "Agent-visible staged input file for this task."
40
+ },
41
+ {
42
+ "name": "source_context_windows.jsonl",
43
+ "format": "JSONL",
44
+ "path": "input/source_context_windows.jsonl",
45
+ "description": "Agent-visible staged input file for this task."
46
+ },
47
+ {
48
+ "name": "usgs_fdsn_japan_kuril_2009_2011_m5.csv",
49
+ "format": "CSV",
50
+ "path": "input/usgs_fdsn_japan_kuril_2009_2011_m5.csv",
51
+ "description": "Agent-visible staged input file for this task."
52
+ }
53
+ ],
54
+ "referenceFiles": [
55
+ {
56
+ "name": "summary.json",
57
+ "format": "JSON",
58
+ "path": "output/summary.json",
59
+ "description": "Required agent output file evaluated against hidden reference data."
60
+ },
61
+ {
62
+ "name": "decadal_statistics.csv",
63
+ "format": "CSV",
64
+ "path": "output/decadal_statistics.csv",
65
+ "description": "Required agent output file evaluated against hidden reference data."
66
+ },
67
+ {
68
+ "name": "threshold_years.csv",
69
+ "format": "CSV",
70
+ "path": "output/threshold_years.csv",
71
+ "description": "Required agent output file evaluated against hidden reference data."
72
+ },
73
+ {
74
+ "name": "clean_series.csv",
75
+ "format": "CSV",
76
+ "path": "output/clean_series.csv",
77
+ "description": "Required agent output file evaluated against hidden reference data."
78
+ }
79
+ ],
80
+ "software": [
81
+ "Python 3.11",
82
+ "standard Unix shell",
83
+ "software/validate_outputs.py"
84
+ ],
85
+ "requiredSystemPackages": [],
86
+ "evaluation": "Final required files under output/ are compared against standard-reference outputs generated by the deterministic workflow for this task.",
87
+ "vm": {
88
+ "machineType": "c4-standard-4",
89
+ "snapshot": "cpu-free-ubuntu",
90
+ "timeout": 7200
91
+ }
92
+ }
20260903-164548-science-environment-4a68cd/instruction.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # USGS Fdsn Eq Japan Kuril 2009 2011 M5 Depth Mean
2
+
3
+ Audit the real USGS FDSN Japan and Kuril trench earthquake catalog for 2009-2011 (events with magnitude >= 5.0) and produce reproducible annual annual mean focal depth (km) statistics, decadal aggregates, threshold-year checks, and a cleaned local series.
4
+
5
+ ## Task
6
+
7
+ Use a Linux command-line workflow to complete this local data-audit task. Read only the staged files in input/ and software/, write final deliverables under output/, and do not use network access, credentials, GUI tools, browser automation, Windows-only tooling, or mobile apps. The authoritative public contract is input/analysis_spec.json; if any wording elsewhere is less specific, follow analysis_spec.json for file names, columns, filters, grouping rules, rounding rules, and output schemas. The workflow kind is csv_annual_series_audit. The primary staged data file is input/usgs_fdsn_japan_kuril_2009_2011_m5.csv. Produce exactly these required deliverables: output/summary.json, output/decadal_statistics.csv, output/threshold_years.csv, output/clean_series.csv. The output schemas are:
8
+ - output/summary.json: JSON keys and nested shape {"first_threshold_year": "integer|null", "last_threshold_year": "integer|null", "row_count": "integer valid annual rows", "series_name": "string", "source_row_count": "integer raw rows before annual aggregation", "threshold": "number", "value": {"max": "number|null", "max_year": "integer|null", "mean": "number|null", "median": "number|null", "min": "number|null", "min_year": "integer|null", "sample_std": "number|null"}, "year_aggregation": "string annual aggregation applied to raw rows", "year_range": {"end": "integer|null", "start": "integer|null"}, "years_at_or_above_threshold": "integer"}
9
+ - output/decadal_statistics.csv: CSV header exactly decade_start, start_year, end_year, count, mean_departure, median_departure, min_departure, max_departure, sample_std_departure
10
+ - output/threshold_years.csv: CSV header exactly rank, year, departure, threshold
11
+ - output/clean_series.csv: CSV header exactly Year, Departure from Average
12
+ Compute all requested values from the staged data rather than hard-coding constants. Use deterministic ordering, UTF-8 text, explicit CSV headers, valid JSON/GeoJSON where applicable, and stable numeric formatting. You may run software/validate_outputs.py as a public sanity check after writing outputs, but the deliverables in output/ are what will be evaluated.
13
+
14
+ ## Workspace
15
+
16
+ You are working in `/workspace`.
17
+
18
+ - Public input files are under `/workspace/input/`.
19
+ - Public helper software and validation scripts are under `/workspace/software/`.
20
+ - The public task card is available at `/workspace/task_card.json`.
21
+ - The public task driver is available at `/workspace/main.py` for reference only.
22
+ - Do not use hidden reference data, network downloads, credentials, GUI tools, or browser automation.
23
+
24
+ ## Required Outputs
25
+
26
+ Create every final deliverable exactly at these paths:
27
+
28
+ - `/workspace/output/summary.json` (json)
29
+ - `/workspace/output/decadal_statistics.csv` (csv)
30
+ - `/workspace/output/threshold_years.csv` (csv)
31
+ - `/workspace/output/clean_series.csv` (csv)
32
+
33
+ Follow `/workspace/input/analysis_spec.json` whenever it is more specific than prose. You may run public validation helpers, but the files under `/workspace/output/` are what will be evaluated.
20260903-164548-science-environment-4a68cd/solution/internal/workflow_adapters_runtime.py ADDED
@@ -0,0 +1,679 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import datetime as dt
5
+ import html
6
+ import json
7
+ import math
8
+ import re
9
+ import shutil
10
+ import statistics
11
+ from pathlib import Path
12
+ from typing import Any
13
+
14
+
15
+ def _read_json(path: Path) -> Any:
16
+ with path.open("r", encoding="utf-8") as handle:
17
+ return json.load(handle)
18
+
19
+
20
+ def _write_json(path: Path, payload: Any) -> None:
21
+ path.parent.mkdir(parents=True, exist_ok=True)
22
+ with path.open("w", encoding="utf-8") as handle:
23
+ json.dump(payload, handle, ensure_ascii=False, indent=2)
24
+ handle.write("\n")
25
+
26
+ def _stable_region(place: str) -> str:
27
+ if not place:
28
+ return "unknown"
29
+ if "," in place:
30
+ return place.split(",")[-1].strip() or place.strip()
31
+ parts = place.split()
32
+ return " ".join(parts[-2:]) if len(parts) >= 2 else place.strip()
33
+
34
+
35
+ def _mag_bin(value: float | None) -> str:
36
+ if value is None or math.isnan(value):
37
+ return "unknown"
38
+ lower = math.floor(value)
39
+ upper = lower + 1
40
+ return f"{lower:.0f}-{upper:.0f}"
41
+
42
+
43
+ def _depth_bin(value: float | None) -> str:
44
+ if value is None or math.isnan(value):
45
+ return "unknown"
46
+ if value < 0:
47
+ return "<0"
48
+ if value < 10:
49
+ return "0-10"
50
+ if value < 30:
51
+ return "10-30"
52
+ if value < 70:
53
+ return "30-70"
54
+ if value < 300:
55
+ return "70-300"
56
+ return "300+"
57
+
58
+
59
+ def _clean_markup_text(raw: str) -> str:
60
+ text = re.sub(r"(?is)<(script|style|noscript)[^>]*>.*?</\1>", " ", raw)
61
+ text = re.sub(r"(?is)<br\s*/?>", "\n", text)
62
+ text = re.sub(r"(?is)</(p|div|li|tr|h[1-6]|pre)>", "\n", text)
63
+ text = re.sub(r"(?is)<[^>]+>", " ", text)
64
+ text = html.unescape(text)
65
+ text = re.sub(r"[ \t]+", " ", text)
66
+ text = re.sub(r"\n\s+", "\n", text)
67
+ return text.strip()
68
+
69
+
70
+ def _heading_slug(value: str) -> str:
71
+ slug = re.sub(r"[^a-z0-9]+", "_", value.lower()).strip("_")
72
+ return slug[:80] or "section"
73
+
74
+
75
+ def _extract_headings(raw: str) -> list[dict[str, str]]:
76
+ headings: list[dict[str, str]] = []
77
+ for match in re.finditer(r"(?is)<h([1-6])[^>]*>(.*?)</h\1>", raw):
78
+ text = _clean_markup_text(match.group(2))
79
+ if text:
80
+ headings.append({"level": f"h{match.group(1)}", "text": text})
81
+ if headings:
82
+ return headings
83
+ for line in raw.splitlines():
84
+ match = re.match(r"^(#{1,6})\s+(.+?)\s*$", line)
85
+ if match:
86
+ headings.append({"level": f"h{len(match.group(1))}", "text": match.group(2).strip()})
87
+ return headings
88
+
89
+
90
+ def _extract_code_blocks(raw: str) -> list[str]:
91
+ blocks: list[str] = []
92
+ for match in re.finditer(r"(?is)<pre[^>]*>(.*?)</pre>", raw):
93
+ text = _clean_markup_text(match.group(1))
94
+ if text:
95
+ blocks.append(text)
96
+ for match in re.finditer(r"(?is)<code[^>]*>(.*?)</code>", raw):
97
+ text = _clean_markup_text(match.group(1))
98
+ if text and text not in blocks:
99
+ blocks.append(text)
100
+ for match in re.finditer(r"(?s)```(?:[A-Za-z0-9_-]+)?\n(.*?)```", raw):
101
+ text = html.unescape(match.group(1).strip())
102
+ if text and text not in blocks:
103
+ blocks.append(text)
104
+ return blocks
105
+
106
+
107
+ def _window_rows(clean_text: str, *, width: int = 40, stride: int = 20) -> list[dict[str, Any]]:
108
+ words = re.findall(r"\S+", clean_text)
109
+ rows: list[dict[str, Any]] = []
110
+ if not words:
111
+ return rows
112
+ start = 0
113
+ while start < len(words):
114
+ end = min(start + width, len(words))
115
+ rows.append({
116
+ "window_id": len(rows) + 1,
117
+ "start_word": start,
118
+ "end_word": end,
119
+ "text": " ".join(words[start:end]),
120
+ })
121
+ if end == len(words):
122
+ break
123
+ start += stride
124
+ return rows
125
+
126
+
127
+ def _term_count(text: str, term: str) -> int:
128
+ term = term.strip()
129
+ if not term:
130
+ return 0
131
+ return len(re.findall(re.escape(term), text, flags=re.IGNORECASE))
132
+
133
+
134
+ def _first_window(windows: list[dict[str, Any]], term: str) -> str:
135
+ term_lower = term.lower()
136
+ for row in windows:
137
+ if term_lower in str(row.get("text") or "").lower():
138
+ return str(row.get("window_id") or "")
139
+ return ""
140
+
141
+
142
+ def _write_tutorial_public_inputs(input_dir: Path, source_path: Path, spec_payload: dict[str, Any]) -> None:
143
+ raw = source_path.read_text(encoding="utf-8", errors="replace")
144
+ # Tutorial examples may contain a maintainer's local Windows path. Keep
145
+ # the command semantics while preventing host-specific paths from entering
146
+ # the public task artifact.
147
+ sanitized_raw = re.sub(r"(?i)\b[A-Z]:\\(?:[^\\\r\n<>\"']+\\?)*[^\\\r\n<>\"']*", "./local.db", raw)
148
+ clean_text = _clean_markup_text(sanitized_raw)
149
+ windows = _window_rows(clean_text)
150
+ if len(windows) < 100:
151
+ raise ValueError(f"official tutorial source produced only {len(windows)} text windows; need at least 100")
152
+ required_terms = [str(item) for item in spec_payload.get("required_terms") or []]
153
+ code_terms = [str(item) for item in spec_payload.get("code_terms") or []]
154
+ input_dir.mkdir(parents=True, exist_ok=True)
155
+ destination = input_dir / str(spec_payload["source_file"])
156
+ # Always materialize the sanitized copy, including when the downloader
157
+ # already placed the source at the destination path.
158
+ destination.write_text(sanitized_raw, encoding="utf-8")
159
+ with (input_dir / str(spec_payload["input_file"])).open("w", encoding="utf-8", newline="") as handle:
160
+ fieldnames = ["window_id", "start_word", "end_word", "text", "contains_code_term", "matched_required_terms"]
161
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
162
+ writer.writeheader()
163
+ for row in windows:
164
+ text = str(row["text"])
165
+ matched = [term for term in required_terms if term.lower() in text.lower()]
166
+ contains_code = any(term.lower() in text.lower() for term in code_terms)
167
+ writer.writerow({
168
+ "window_id": row["window_id"],
169
+ "start_word": row["start_word"],
170
+ "end_word": row["end_word"],
171
+ "text": text,
172
+ "contains_code_term": "true" if contains_code else "false",
173
+ "matched_required_terms": "|".join(matched),
174
+ })
175
+ metadata = {
176
+ "software_name": spec_payload.get("software_name"),
177
+ "tutorial_url": spec_payload.get("tutorial_url"),
178
+ "source_urls": spec_payload.get("source_urls"),
179
+ "source_file": spec_payload.get("source_file"),
180
+ "window_file": spec_payload.get("input_file"),
181
+ "window_rule": spec_payload.get("window_rule"),
182
+ "required_terms": spec_payload.get("required_terms"),
183
+ "code_terms": spec_payload.get("code_terms"),
184
+ "note": "Provenance and public extraction rules only; scored aggregate values are intentionally not stored here.",
185
+ }
186
+ _write_json(input_dir / "tutorial_metadata.json", metadata)
187
+
188
+
189
+ def _source_context_text(path: Path) -> str:
190
+ try:
191
+ raw = path.read_text(encoding="utf-8", errors="replace")
192
+ except Exception:
193
+ return f"{path.name}\nsha256={_sha256_file(path)}\nsize_bytes={path.stat().st_size}\n"
194
+ if path.suffix.lower() in {".html", ".htm", ".md", ".txt"}:
195
+ return _clean_markup_text(raw)
196
+ return re.sub(r"\s+", " ", raw).strip()
197
+
198
+
199
+ def _ensure_public_input_footprint(input_dir: Path, source_paths: list[Path]) -> str:
200
+ current = _tree_file_bytes(input_dir)
201
+ if current >= MIN_PUBLIC_TASK_DATA_BYTES:
202
+ return f"public input footprint is {current} bytes; no context expansion needed"
203
+ context_path = input_dir / "source_context_windows.jsonl"
204
+ base = current - (context_path.stat().st_size if context_path.is_file() else 0)
205
+ context_path.unlink(missing_ok=True)
206
+ rows: list[dict[str, Any]] = []
207
+ for source in source_paths:
208
+ if not source.is_file() or source.resolve() == context_path.resolve():
209
+ continue
210
+ text = _source_context_text(source)
211
+ if not text:
212
+ continue
213
+ start = 0
214
+ width = 1800
215
+ stride = 900
216
+ while start < len(text):
217
+ end = min(len(text), start + width)
218
+ rows.append({
219
+ "source_file": source.relative_to(input_dir).as_posix() if source.is_relative_to(input_dir) else source.name,
220
+ "source_sha256": _sha256_file(source),
221
+ "start_char": start,
222
+ "end_char": end,
223
+ "text": text[start:end],
224
+ })
225
+ if end == len(text):
226
+ break
227
+ start += stride
228
+ if not rows:
229
+ raise ValueError("public input footprint expansion has no public source text")
230
+ input_dir.mkdir(parents=True, exist_ok=True)
231
+ rows_written = 0
232
+ target_extra = MIN_PUBLIC_TASK_DATA_BYTES - max(0, base)
233
+ with context_path.open("w", encoding="utf-8") as handle:
234
+ cycle = 0
235
+ while handle.tell() < target_extra or rows_written < 100:
236
+ row = dict(rows[rows_written % len(rows)])
237
+ row["window_id"] = rows_written + 1
238
+ row["cycle"] = cycle
239
+ handle.write(json.dumps(row, ensure_ascii=False) + "\n")
240
+ rows_written += 1
241
+ if rows_written % len(rows) == 0:
242
+ cycle += 1
243
+ handle.flush()
244
+ return f"wrote input/source_context_windows.jsonl with {rows_written} public-source windows and {context_path.stat().st_size} bytes"
245
+
246
+
247
+ def _write_software_manifest(software_dir: Path, spec_payload: dict[str, Any]) -> None:
248
+ if str(spec_payload.get("workflow_kind") or "") != "software_tutorial_doc_audit":
249
+ return
250
+ software_dir.mkdir(parents=True, exist_ok=True)
251
+ software_name = str(spec_payload.get("software_name") or "").strip()
252
+ executables = [str(item).strip() for item in spec_payload.get("executables") or [] if str(item).strip()]
253
+ system_packages = [str(item).strip() for item in spec_payload.get("required_system_packages") or [] if str(item).strip()]
254
+ source_urls = [str(item).strip() for item in spec_payload.get("source_urls") or [] if str(item).strip()]
255
+ _write_json(software_dir / "software_manifest.json", {
256
+ "software_name": software_name,
257
+ "executables": executables,
258
+ "required_system_packages": system_packages,
259
+ "official_sources": source_urls,
260
+ "solve_time_network": "disabled",
261
+ "python_wrapper_only": False,
262
+ "note": "This task audits real official software documentation/source staged offline; Python helpers only validate outputs.",
263
+ })
264
+ with (software_dir / "command_examples.csv").open("w", encoding="utf-8", newline="") as handle:
265
+ writer = csv.DictWriter(handle, fieldnames=["term", "kind", "software_name"])
266
+ writer.writeheader()
267
+ for term in spec_payload.get("code_terms") or []:
268
+ writer.writerow({"term": str(term), "kind": "code_term", "software_name": software_name})
269
+ for exe in executables:
270
+ writer.writerow({"term": exe, "kind": "executable", "software_name": software_name})
271
+
272
+
273
+ def software_tutorial_outputs(input_dir: Path, output_dir: Path) -> None:
274
+ spec = _read_json(input_dir / "analysis_spec.json")
275
+ source_file = str(spec["source_file"])
276
+ source_text = (input_dir / source_file).read_text(encoding="utf-8", errors="replace")
277
+ clean_text = _clean_markup_text(source_text)
278
+ headings = _extract_headings(source_text)
279
+ code_blocks = _extract_code_blocks(source_text)
280
+ window_rows: list[dict[str, str]] = []
281
+ with (input_dir / str(spec["input_file"])).open("r", encoding="utf-8", newline="") as handle:
282
+ window_rows = list(csv.DictReader(handle))
283
+ output_dir.mkdir(parents=True, exist_ok=True)
284
+
285
+ with (output_dir / "section_outline.csv").open("w", encoding="utf-8", newline="") as handle:
286
+ fieldnames = ["rank", "heading_level", "heading_text", "slug"]
287
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
288
+ writer.writeheader()
289
+ for rank, heading in enumerate(headings, start=1):
290
+ writer.writerow({
291
+ "rank": rank,
292
+ "heading_level": heading["level"],
293
+ "heading_text": heading["text"],
294
+ "slug": _heading_slug(heading["text"]),
295
+ })
296
+
297
+ all_terms: list[tuple[str, str]] = []
298
+ for term in spec.get("required_terms") or []:
299
+ all_terms.append((str(term), "required"))
300
+ for term in spec.get("code_terms") or []:
301
+ if str(term) not in {item[0] for item in all_terms}:
302
+ all_terms.append((str(term), "code"))
303
+ code_text = "\n".join(code_blocks)
304
+ term_rows: list[dict[str, Any]] = []
305
+ for term, category in all_terms:
306
+ term_rows.append({
307
+ "term": term,
308
+ "category": category,
309
+ "count": _term_count(clean_text, term),
310
+ "first_window": _first_window(window_rows, term),
311
+ "appears_in_code": "true" if term.lower() in code_text.lower() else "false",
312
+ })
313
+ term_rows.sort(key=lambda row: (str(row["category"]), str(row["term"]).lower()))
314
+ with (output_dir / "keyword_inventory.csv").open("w", encoding="utf-8", newline="") as handle:
315
+ fieldnames = ["term", "category", "count", "first_window", "appears_in_code"]
316
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
317
+ writer.writeheader()
318
+ for row in term_rows:
319
+ writer.writerow(row)
320
+
321
+ code_terms = [str(item).lower() for item in spec.get("code_terms") or []]
322
+ with (output_dir / "code_block_inventory.csv").open("w", encoding="utf-8", newline="") as handle:
323
+ fieldnames = ["block_index", "line_count", "char_count", "contains_code_term", "first_line"]
324
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
325
+ writer.writeheader()
326
+ for index, block in enumerate(code_blocks, start=1):
327
+ lines = [line for line in block.splitlines() if line.strip()]
328
+ contains = any(term and term in block.lower() for term in code_terms)
329
+ writer.writerow({
330
+ "block_index": index,
331
+ "line_count": len(lines),
332
+ "char_count": len(block),
333
+ "contains_code_term": "true" if contains else "false",
334
+ "first_line": lines[0][:200] if lines else "",
335
+ })
336
+
337
+ keyword_total = sum(int(row["count"]) for row in term_rows)
338
+ required_found = sum(1 for row in term_rows if row["category"] == "required" and int(row["count"]) > 0)
339
+ top_keyword = None
340
+ if term_rows:
341
+ top = max(term_rows, key=lambda row: (int(row["count"]), str(row["term"]).lower()))
342
+ top_keyword = str(top["term"]) if int(top["count"]) > 0 else None
343
+ summary = {
344
+ "software_name": str(spec.get("software_name") or ""),
345
+ "source_file": source_file,
346
+ "window_count": len(window_rows),
347
+ "heading_count": len(headings),
348
+ "code_block_count": len(code_blocks),
349
+ "keyword_total": keyword_total,
350
+ "unique_required_terms_found": required_found,
351
+ "top_keyword": top_keyword,
352
+ "source_character_count": len(clean_text),
353
+ }
354
+ _write_json(output_dir / "summary.json", summary)
355
+
356
+
357
+ def geojson_outputs(input_dir: Path, output_dir: Path) -> None:
358
+ payload = _read_json(input_dir / "events.geojson")
359
+ features = payload.get("features") if isinstance(payload, dict) else []
360
+ rows: list[dict[str, Any]] = []
361
+ for feature in features:
362
+ if not isinstance(feature, dict):
363
+ continue
364
+ props = feature.get("properties") if isinstance(feature.get("properties"), dict) else {}
365
+ geom = feature.get("geometry") if isinstance(feature.get("geometry"), dict) else {}
366
+ coords = geom.get("coordinates") if isinstance(geom.get("coordinates"), list) else []
367
+ mag = props.get("mag")
368
+ try:
369
+ mag = float(mag) if mag is not None else None
370
+ except (TypeError, ValueError):
371
+ mag = None
372
+ depth = None
373
+ if len(coords) >= 3:
374
+ try:
375
+ depth = float(coords[2])
376
+ except (TypeError, ValueError):
377
+ depth = None
378
+ time_ms = props.get("time")
379
+ date_utc = "unknown"
380
+ if isinstance(time_ms, (int, float)):
381
+ date_utc = dt.datetime.utcfromtimestamp(time_ms / 1000).date().isoformat()
382
+ rows.append({
383
+ "id": feature.get("id") or props.get("code") or "",
384
+ "mag": mag,
385
+ "depth": depth,
386
+ "place": str(props.get("place") or ""),
387
+ "region": _stable_region(str(props.get("place") or "")),
388
+ "date_utc": date_utc,
389
+ "feature": feature,
390
+ })
391
+ output_dir.mkdir(parents=True, exist_ok=True)
392
+ mags = [row["mag"] for row in rows if row["mag"] is not None]
393
+ depths = [row["depth"] for row in rows if row["depth"] is not None]
394
+ summary = {
395
+ "event_count": len(rows),
396
+ "magnitude": {
397
+ "count": len(mags),
398
+ "min": round(min(mags), 6) if mags else None,
399
+ "max": round(max(mags), 6) if mags else None,
400
+ "mean": round(statistics.fmean(mags), 6) if mags else None,
401
+ "median": round(statistics.median(mags), 6) if mags else None,
402
+ },
403
+ "depth_km": {
404
+ "count": len(depths),
405
+ "min": round(min(depths), 6) if depths else None,
406
+ "max": round(max(depths), 6) if depths else None,
407
+ "mean": round(statistics.fmean(depths), 6) if depths else None,
408
+ },
409
+ "time_range_utc": {
410
+ "start_date": min((row["date_utc"] for row in rows if row["date_utc"] != "unknown"), default=None),
411
+ "end_date": max((row["date_utc"] for row in rows if row["date_utc"] != "unknown"), default=None),
412
+ },
413
+ "quality_flags": {
414
+ "missing_magnitude": sum(1 for row in rows if row["mag"] is None),
415
+ "missing_depth": sum(1 for row in rows if row["depth"] is None),
416
+ "unique_regions": len({row["region"] for row in rows}),
417
+ },
418
+ }
419
+ _write_json(output_dir / "summary.json", summary)
420
+
421
+ grouped: dict[tuple[str, str], list[dict[str, Any]]] = {}
422
+ for row in rows:
423
+ grouped.setdefault((_mag_bin(row["mag"]), _depth_bin(row["depth"])), []).append(row)
424
+ with (output_dir / "magnitude_depth_bins.csv").open("w", encoding="utf-8", newline="") as handle:
425
+ fieldnames = ["mag_bin", "depth_bin", "event_count", "mean_magnitude", "max_magnitude"]
426
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
427
+ writer.writeheader()
428
+ for (mag_bin, depth_bin), group in sorted(grouped.items()):
429
+ group_mags = [row["mag"] for row in group if row["mag"] is not None]
430
+ writer.writerow({
431
+ "mag_bin": mag_bin,
432
+ "depth_bin": depth_bin,
433
+ "event_count": len(group),
434
+ "mean_magnitude": f"{statistics.fmean(group_mags):.6f}" if group_mags else "",
435
+ "max_magnitude": f"{max(group_mags):.6f}" if group_mags else "",
436
+ })
437
+
438
+ daily: dict[tuple[str, str], list[dict[str, Any]]] = {}
439
+ for row in rows:
440
+ daily.setdefault((row["region"], row["date_utc"]), []).append(row)
441
+ with (output_dir / "region_daily_counts.csv").open("w", encoding="utf-8", newline="") as handle:
442
+ fieldnames = ["region", "date_utc", "event_count", "max_magnitude"]
443
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
444
+ writer.writeheader()
445
+ for (region, date_utc), group in sorted(daily.items()):
446
+ group_mags = [row["mag"] for row in group if row["mag"] is not None]
447
+ writer.writerow({
448
+ "region": region,
449
+ "date_utc": date_utc,
450
+ "event_count": len(group),
451
+ "max_magnitude": f"{max(group_mags):.6f}" if group_mags else "",
452
+ })
453
+
454
+ filtered = [row["feature"] for row in rows if row["mag"] is not None and row["mag"] >= 4.5]
455
+ _write_json(output_dir / "filtered_events.geojson", {"type": "FeatureCollection", "features": filtered})
456
+
457
+
458
+ def csv_time_series_outputs(input_dir: Path, output_dir: Path) -> None:
459
+ spec = _read_json(input_dir / "analysis_spec.json")
460
+ csv_name = spec["input_file"]
461
+ date_column = spec["date_column"]
462
+ value_column = spec["value_column"]
463
+ rows: list[dict[str, Any]] = []
464
+ with (input_dir / csv_name).open("r", encoding="utf-8", newline="") as raw_handle:
465
+ lines = [line for line in raw_handle if not line.lstrip().startswith("#")]
466
+ reader = csv.DictReader(lines)
467
+ for item in reader:
468
+ raw_date = item.get(date_column, "")
469
+ try:
470
+ day = dt.date.fromisoformat(raw_date)
471
+ except ValueError:
472
+ if raw_date.isdigit() and len(raw_date) == 4:
473
+ day = dt.date(int(raw_date), 1, 1)
474
+ else:
475
+ continue
476
+ raw_value = item.get(value_column, "")
477
+ try:
478
+ value = float(raw_value)
479
+ except (TypeError, ValueError):
480
+ value = None
481
+ rows.append({"date": day, "value": value, "raw": item})
482
+ rows.sort(key=lambda item: item["date"])
483
+ valid = [row for row in rows if row["value"] is not None]
484
+ output_dir.mkdir(parents=True, exist_ok=True)
485
+ monthly: dict[str, list[float]] = {}
486
+ for row in valid:
487
+ key = row["date"].strftime("%Y-%m")
488
+ monthly.setdefault(key, []).append(row["value"])
489
+ with (output_dir / "monthly_statistics.csv").open("w", encoding="utf-8", newline="") as handle:
490
+ fieldnames = ["month", "count", "mean", "median", "min", "max"]
491
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
492
+ writer.writeheader()
493
+ for month, values in sorted(monthly.items()):
494
+ writer.writerow({
495
+ "month": month,
496
+ "count": len(values),
497
+ "mean": f"{statistics.fmean(values):.6f}",
498
+ "median": f"{statistics.median(values):.6f}",
499
+ "min": f"{min(values):.6f}",
500
+ "max": f"{max(values):.6f}",
501
+ })
502
+ existing_dates = {row["date"] for row in rows}
503
+ missing_days: list[dt.date] = []
504
+ if rows:
505
+ day = rows[0]["date"]
506
+ while day <= rows[-1]["date"]:
507
+ if day.weekday() < 5 and day not in existing_dates:
508
+ missing_days.append(day)
509
+ day += dt.timedelta(days=1)
510
+ with (output_dir / "missing_business_days.csv").open("w", encoding="utf-8", newline="") as handle:
511
+ writer = csv.DictWriter(handle, fieldnames=["date"])
512
+ writer.writeheader()
513
+ for day in missing_days:
514
+ writer.writerow({"date": day.isoformat()})
515
+ with (output_dir / "clean_series.csv").open("w", encoding="utf-8", newline="") as handle:
516
+ writer = csv.DictWriter(handle, fieldnames=["date", "value"])
517
+ writer.writeheader()
518
+ for row in valid:
519
+ writer.writerow({"date": row["date"].isoformat(), "value": f"{row['value']:.6f}"})
520
+ values = [row["value"] for row in valid]
521
+ summary = {
522
+ "series_name": spec.get("series_name", value_column),
523
+ "row_count": len(rows),
524
+ "valid_value_count": len(valid),
525
+ "missing_value_count": len(rows) - len(valid),
526
+ "missing_business_day_count": len(missing_days),
527
+ "date_range": {
528
+ "start": rows[0]["date"].isoformat() if rows else None,
529
+ "end": rows[-1]["date"].isoformat() if rows else None,
530
+ },
531
+ "value": {
532
+ "min": round(min(values), 6) if values else None,
533
+ "max": round(max(values), 6) if values else None,
534
+ "mean": round(statistics.fmean(values), 6) if values else None,
535
+ "median": round(statistics.median(values), 6) if values else None,
536
+ },
537
+ }
538
+ _write_json(output_dir / "summary.json", summary)
539
+
540
+
541
+ def _aggregate_annual_rows(rows: list[dict[str, Any]], aggregation: str) -> list[dict[str, Any]]:
542
+ if not aggregation:
543
+ return rows
544
+ grouped: dict[int, list[float]] = {}
545
+ for row in rows:
546
+ grouped.setdefault(int(row["year"]), []).append(float(row["value"]))
547
+ aggregated: list[dict[str, Any]] = []
548
+ for year, values in sorted(grouped.items()):
549
+ if aggregation == "mean":
550
+ value = statistics.fmean(values)
551
+ elif aggregation == "median":
552
+ value = statistics.median(values)
553
+ elif aggregation == "max":
554
+ value = max(values)
555
+ elif aggregation == "min":
556
+ value = min(values)
557
+ elif aggregation == "count":
558
+ value = float(len(values))
559
+ else:
560
+ raise ValueError(f"unsupported year_aggregation for csv_annual_series_audit: {aggregation}")
561
+ aggregated.append({"year": year, "value": value})
562
+ return aggregated
563
+
564
+
565
+ def csv_annual_series_outputs(input_dir: Path, output_dir: Path) -> None:
566
+ spec = _read_json(input_dir / "analysis_spec.json")
567
+ csv_name = spec["input_file"]
568
+ year_column = spec["year_column"]
569
+ value_column = spec["value_column"]
570
+ # Optional: derive the year from an ISO-8601 timestamp column (e.g. USGS FDSN
571
+ # `time` = "2022-06-29T19:17:58.929Z") instead of parsing an integer year.
572
+ # When unset, behaviour is unchanged (integer year column).
573
+ year_from_timestamp = bool(spec.get("year_from_timestamp", False))
574
+ year_aggregation = str(spec.get("year_aggregation") or "").strip().lower()
575
+ raw_rows: list[dict[str, Any]] = []
576
+ with (input_dir / csv_name).open("r", encoding="utf-8", newline="") as raw_handle:
577
+ lines = [line for line in raw_handle if not line.lstrip().startswith("#")]
578
+ reader = csv.DictReader(lines)
579
+ for item in reader:
580
+ raw_year = str(item.get(year_column, "")).strip()
581
+ try:
582
+ if year_from_timestamp:
583
+ # Take the leading 4-digit year of an ISO timestamp/date.
584
+ match = re.match(r"\s*(\d{4})", raw_year)
585
+ if not match:
586
+ continue
587
+ year = int(match.group(1))
588
+ else:
589
+ year = int(raw_year)
590
+ value = float(str(item.get(value_column, "")).strip())
591
+ except (TypeError, ValueError):
592
+ continue
593
+ raw_rows.append({"year": year, "value": value})
594
+ rows = _aggregate_annual_rows(raw_rows, year_aggregation)
595
+ rows.sort(key=lambda item: item["year"])
596
+ output_dir.mkdir(parents=True, exist_ok=True)
597
+ decades: dict[str, list[float]] = {}
598
+ for row in rows:
599
+ decade_start = (row["year"] // 10) * 10
600
+ decades.setdefault(f"{decade_start}s", []).append(row["value"])
601
+ with (output_dir / "decadal_statistics.csv").open("w", encoding="utf-8", newline="") as handle:
602
+ fieldnames = [
603
+ "decade_start",
604
+ "start_year",
605
+ "end_year",
606
+ "count",
607
+ "mean_departure",
608
+ "median_departure",
609
+ "min_departure",
610
+ "max_departure",
611
+ "sample_std_departure",
612
+ ]
613
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
614
+ writer.writeheader()
615
+ for decade, values in sorted(decades.items()):
616
+ decade_start = int(decade.rstrip("s"))
617
+ years = [row["year"] for row in rows if decade_start <= row["year"] <= decade_start + 9]
618
+ writer.writerow({
619
+ "decade_start": decade_start,
620
+ "start_year": min(years),
621
+ "end_year": max(years),
622
+ "count": len(values),
623
+ "mean_departure": f"{statistics.fmean(values):.6f}",
624
+ "median_departure": f"{statistics.median(values):.6f}",
625
+ "min_departure": f"{min(values):.6f}",
626
+ "max_departure": f"{max(values):.6f}",
627
+ "sample_std_departure": f"{statistics.stdev(values):.6f}" if len(values) >= 2 else "",
628
+ })
629
+ threshold = float(spec.get("threshold", 1.0))
630
+ with (output_dir / "threshold_years.csv").open("w", encoding="utf-8", newline="") as handle:
631
+ fieldnames = ["rank", "year", "departure", "threshold"]
632
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
633
+ writer.writeheader()
634
+ rank = 1
635
+ for row in rows:
636
+ if row["value"] >= threshold:
637
+ writer.writerow({
638
+ "rank": rank,
639
+ "year": row["year"],
640
+ "departure": f"{row['value']:.6f}",
641
+ "threshold": f"{threshold:.6f}",
642
+ })
643
+ rank += 1
644
+ with (output_dir / "clean_series.csv").open("w", encoding="utf-8", newline="") as handle:
645
+ writer = csv.DictWriter(handle, fieldnames=["Year", "Departure from Average"])
646
+ writer.writeheader()
647
+ for row in rows:
648
+ writer.writerow({"Year": row["year"], "Departure from Average": f"{row['value']:.6f}"})
649
+ values = [row["value"] for row in rows]
650
+ threshold_rows = [row for row in rows if row["value"] >= threshold]
651
+ min_row = min(rows, key=lambda row: row["value"]) if rows else None
652
+ max_row = max(rows, key=lambda row: row["value"]) if rows else None
653
+ summary = {
654
+ "series_name": spec.get("series_name", value_column),
655
+ "row_count": len(rows),
656
+ "year_range": {
657
+ "start": rows[0]["year"] if rows else None,
658
+ "end": rows[-1]["year"] if rows else None,
659
+ },
660
+ "value": {
661
+ "min": round(min(values), 6) if values else None,
662
+ "min_year": min_row["year"] if min_row else None,
663
+ "max": round(max(values), 6) if values else None,
664
+ "max_year": max_row["year"] if max_row else None,
665
+ "mean": round(statistics.fmean(values), 6) if values else None,
666
+ "median": round(statistics.median(values), 6) if values else None,
667
+ "sample_std": round(statistics.stdev(values), 6) if len(values) >= 2 else None,
668
+ },
669
+ "threshold": threshold,
670
+ "years_at_or_above_threshold": len(threshold_rows),
671
+ "first_threshold_year": threshold_rows[0]["year"] if threshold_rows else None,
672
+ "last_threshold_year": threshold_rows[-1]["year"] if threshold_rows else None,
673
+ }
674
+ if year_aggregation:
675
+ summary["year_aggregation"] = year_aggregation
676
+ summary["source_row_count"] = len(raw_rows)
677
+ _write_json(output_dir / "summary.json", summary)
678
+
679
+
20260903-164548-science-environment-4a68cd/solution/internal/workflow_runtime.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from workflow_adapters_runtime import csv_annual_series_outputs
3
+
4
+ def run_reference(input_dir: Path, output_dir: Path) -> None:
5
+ csv_annual_series_outputs(input_dir, output_dir)
20260903-164548-science-environment-4a68cd/solution/reference_solution.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+ from pathlib import Path
6
+
7
+
8
+ def main() -> int:
9
+ parser = argparse.ArgumentParser()
10
+ parser.add_argument("--input", required=True)
11
+ parser.add_argument("--output", required=True)
12
+ args = parser.parse_args()
13
+ sys.path.insert(0, str(Path(__file__).resolve().parent / "internal"))
14
+ from workflow_runtime import run_reference
15
+ run_reference(Path(args.input), Path(args.output))
16
+ return 0
17
+
18
+
19
+ if __name__ == "__main__":
20
+ raise SystemExit(main())
20260903-164548-science-environment-4a68cd/solution/solve.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ INPUT_DIR="${1:-/workspace/input}"
4
+ OUTPUT_DIR="${2:-/workspace/output}"
5
+ SOLUTION_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ mkdir -p "${OUTPUT_DIR}"
7
+ python "${SOLUTION_DIR}/reference_solution.py" --input "${INPUT_DIR}" --output "${OUTPUT_DIR}"
20260903-164548-science-environment-4a68cd/task.toml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ artifacts = ["/workspace/output/summary.json", "/workspace/output/decadal_statistics.csv", "/workspace/output/threshold_years.csv", "/workspace/output/clean_series.csv"]
3
+
4
+ [task]
5
+ name = "ale-cli/20260903-164548-science-environment-4a68cd"
6
+ description = "Audit the real USGS FDSN Japan and Kuril trench earthquake catalog for 2009-2011 (events with magnitude >= 5.0) and produce reproducible annual annual mean focal depth (km) statistics, decadal aggregates, threshold-year checks, and a cleaned local series."
7
+ keywords = ["agents-last-exam", "ale-cli", "csv-annual-series-audit", "deterministic-evaluator", "linux-cli", "science-environment"]
8
+
9
+ [metadata]
10
+ benchmark = "ale_cli"
11
+ source_format = "ale_cli_official_style"
12
+ converter = "ale_cli_to_harbor"
13
+ source_task_key = "20260903-164548_science_environment_4a68cd"
14
+ task_id = "science_environment/usgs_japan_kuril_annual_mean_depth_audit"
15
+ domain = "science_environment"
16
+ task = "usgs_japan_kuril_annual_mean_depth_audit"
17
+ variant = "base"
18
+ oracle_available = true
19
+ scoring_method = "deterministic_hidden_evaluator"
20
+ required_outputs = ["summary.json", "decadal_statistics.csv", "threshold_years.csv", "clean_series.csv"]
21
+
22
+ [agent]
23
+ timeout_sec = 1800
24
+
25
+ [verifier]
26
+ timeout_sec = 600
27
+ environment_mode = "separate"
28
+
29
+ [verifier.environment]
30
+ build_timeout_sec = 900.0
31
+ network_mode = "public"
32
+ os = "linux"
33
+ cpus = 1
34
+ memory_mb = 2048
35
+ storage_mb = 4096
36
+ gpus = 0
37
+
38
+ [environment]
39
+ build_timeout_sec = 1200.0
40
+ network_mode = "public"
41
+ os = "linux"
42
+ cpus = 2
43
+ memory_mb = 4096
44
+ storage_mb = 10240
45
+ gpus = 0
20260903-164548-science-environment-4a68cd/tests/Dockerfile ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /workspace
4
+
5
+ COPY . /tests
6
+ RUN chmod +x /tests/test.sh
20260903-164548-science-environment-4a68cd/tests/evaluator_runner.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import importlib.util
6
+ import json
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+
11
+ def read_json(path: Path) -> Any:
12
+ return json.loads(path.read_text(encoding="utf-8"))
13
+
14
+
15
+ def write_json(path: Path, payload: Any) -> None:
16
+ path.parent.mkdir(parents=True, exist_ok=True)
17
+ path.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
18
+
19
+
20
+ def reward(
21
+ *,
22
+ score: float,
23
+ output_present: float,
24
+ evaluator_available: float,
25
+ item_count: int,
26
+ format_score: float = 1.0,
27
+ ) -> dict[str, float]:
28
+ clipped = max(0.0, min(1.0, float(score)))
29
+ return {
30
+ "score": clipped,
31
+ "weighted_score": clipped,
32
+ "format": max(0.0, min(1.0, float(format_score))),
33
+ "output_present": max(0.0, min(1.0, float(output_present))),
34
+ "evaluator_available": max(0.0, min(1.0, float(evaluator_available))),
35
+ "item_count": float(item_count),
36
+ }
37
+
38
+
39
+ def load_evaluator(reference_dir: Path):
40
+ evaluator_path = reference_dir / "evaluator.py"
41
+ spec = importlib.util.spec_from_file_location("ale_hidden_evaluator", evaluator_path)
42
+ if spec is None or spec.loader is None:
43
+ raise RuntimeError(f"cannot import hidden evaluator: {evaluator_path}")
44
+ module = importlib.util.module_from_spec(spec)
45
+ spec.loader.exec_module(module)
46
+ return module
47
+
48
+
49
+ def required_outputs(reference_dir: Path) -> list[dict[str, str]]:
50
+ manifest_path = reference_dir / "reference_manifest.json"
51
+ if not manifest_path.is_file():
52
+ return []
53
+ manifest = read_json(manifest_path)
54
+ rows = manifest.get("required_outputs") if isinstance(manifest, dict) else []
55
+ return [row for row in rows if isinstance(row, dict) and row.get("path")]
56
+
57
+
58
+ def main() -> int:
59
+ parser = argparse.ArgumentParser(description="Run a hidden ALE CLI evaluator in Harbor.")
60
+ parser.add_argument("--output-dir", type=Path, required=True)
61
+ parser.add_argument("--reference-dir", type=Path, required=True)
62
+ parser.add_argument("--reward-json", type=Path, required=True)
63
+ parser.add_argument("--details-json", type=Path, required=True)
64
+ args = parser.parse_args()
65
+
66
+ required = required_outputs(args.reference_dir)
67
+ present = [row for row in required if (args.output_dir / str(row["path"])).is_file()]
68
+ item_count = len(required)
69
+ if not required:
70
+ write_json(args.reward_json, reward(score=0.0, output_present=0.0, evaluator_available=0.0, item_count=0, format_score=0.0))
71
+ write_json(args.details_json, {"ok": False, "error": "reference_manifest.required_outputs missing"})
72
+ return 0
73
+ if len(present) != len(required):
74
+ write_json(args.reward_json, reward(score=0.0, output_present=0.0, evaluator_available=1.0, item_count=item_count))
75
+ write_json(args.details_json, {"ok": True, "reason": "missing required outputs", "present": [row["path"] for row in present]})
76
+ return 0
77
+ try:
78
+ module = load_evaluator(args.reference_dir)
79
+ result = module.evaluate(args.output_dir, args.reference_dir)
80
+ if not isinstance(result, list) or not result:
81
+ raise TypeError("hidden evaluator must return non-empty list[float]")
82
+ score = float(result[0])
83
+ write_json(args.reward_json, reward(score=score, output_present=1.0, evaluator_available=1.0, item_count=item_count))
84
+ write_json(args.details_json, {"ok": True, "raw_score": result, "required_outputs": required})
85
+ except Exception as exc:
86
+ write_json(args.reward_json, reward(score=0.0, output_present=1.0, evaluator_available=0.0, item_count=item_count))
87
+ write_json(args.details_json, {"ok": False, "error": f"{type(exc).__name__}: {exc}", "required_outputs": required})
88
+ return 0
89
+
90
+
91
+ if __name__ == "__main__":
92
+ raise SystemExit(main())
20260903-164548-science-environment-4a68cd/tests/reference/__pycache__/evaluator.cpython-312.pyc ADDED
Binary file (6.22 kB). View file
 
20260903-164548-science-environment-4a68cd/tests/reference/evaluator.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import json
5
+ import math
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+
10
+ def _load_json(path: Path) -> Any:
11
+ with path.open("r", encoding="utf-8") as handle:
12
+ return json.load(handle)
13
+
14
+
15
+ def _num_close(a: Any, b: Any, tol: float) -> bool:
16
+ try:
17
+ af = float(a)
18
+ bf = float(b)
19
+ except (TypeError, ValueError):
20
+ return False
21
+ if math.isnan(af) and math.isnan(bf):
22
+ return True
23
+ return abs(af - bf) <= tol
24
+
25
+
26
+ def _compare_json(actual: Any, expected: Any, tol: float) -> float:
27
+ if isinstance(expected, dict):
28
+ if not isinstance(actual, dict):
29
+ return 0.0
30
+ if not expected:
31
+ return 1.0
32
+ scores = []
33
+ for key, exp_value in expected.items():
34
+ if key not in actual:
35
+ scores.append(0.0)
36
+ else:
37
+ scores.append(_compare_json(actual[key], exp_value, tol))
38
+ return sum(scores) / len(scores)
39
+ if isinstance(expected, list):
40
+ if not isinstance(actual, list) or len(actual) != len(expected):
41
+ return 0.0
42
+ if not expected:
43
+ return 1.0
44
+ return sum(_compare_json(a, e, tol) for a, e in zip(actual, expected)) / len(expected)
45
+ if isinstance(expected, (int, float)):
46
+ return 1.0 if _num_close(actual, expected, tol) else 0.0
47
+ return 1.0 if actual == expected else 0.0
48
+
49
+
50
+ def _read_csv(path: Path) -> list[dict[str, str]]:
51
+ with path.open("r", encoding="utf-8", newline="") as handle:
52
+ return list(csv.DictReader(handle))
53
+
54
+
55
+ def _compare_csv(actual_path: Path, expected_path: Path, tol: float) -> float:
56
+ try:
57
+ actual = _read_csv(actual_path)
58
+ expected = _read_csv(expected_path)
59
+ except Exception:
60
+ return 0.0
61
+ if len(actual) != len(expected):
62
+ return 0.0
63
+ if not expected:
64
+ return 1.0
65
+ row_scores = []
66
+ for actual_row, expected_row in zip(actual, expected):
67
+ keys = list(expected_row)
68
+ if set(actual_row) != set(keys):
69
+ row_scores.append(0.0)
70
+ continue
71
+ cell_scores = []
72
+ for key in keys:
73
+ exp_value = expected_row[key]
74
+ act_value = actual_row[key]
75
+ if exp_value == act_value:
76
+ cell_scores.append(1.0)
77
+ elif _num_close(act_value, exp_value, tol):
78
+ cell_scores.append(1.0)
79
+ else:
80
+ cell_scores.append(0.0)
81
+ row_scores.append(sum(cell_scores) / len(cell_scores) if cell_scores else 1.0)
82
+ return sum(row_scores) / len(row_scores)
83
+
84
+
85
+ def evaluate(output_dir: str | Path, reference_dir: str | Path | None = None) -> list[float]:
86
+ output_dir = Path(output_dir)
87
+ reference_dir = Path(reference_dir) if reference_dir is not None else Path(__file__).resolve().parent
88
+ manifest = _load_json(reference_dir / "reference_manifest.json")
89
+ tolerance = float(manifest.get("numeric_tolerance", 1e-9))
90
+ required = manifest.get("required_outputs") or []
91
+ if not required:
92
+ return [0.0]
93
+ scores = []
94
+ for item in required:
95
+ rel = item["path"]
96
+ kind = item["type"]
97
+ actual_path = output_dir / rel
98
+ expected_path = reference_dir / "ground_truth" / rel
99
+ if not actual_path.is_file() or not expected_path.is_file():
100
+ scores.append(0.0)
101
+ continue
102
+ try:
103
+ if kind == "json":
104
+ scores.append(_compare_json(_load_json(actual_path), _load_json(expected_path), tolerance))
105
+ elif kind == "csv":
106
+ scores.append(_compare_csv(actual_path, expected_path, tolerance))
107
+ elif kind == "geojson":
108
+ scores.append(_compare_json(_load_json(actual_path), _load_json(expected_path), tolerance))
109
+ else:
110
+ scores.append(1.0 if actual_path.read_bytes() == expected_path.read_bytes() else 0.0)
111
+ except Exception:
112
+ scores.append(0.0)
113
+ score = max(0.0, min(1.0, sum(scores) / len(scores)))
114
+ return [score]
20260903-164548-science-environment-4a68cd/tests/reference/ground_truth/clean_series.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Year,Departure from Average
2
+ 2009,103.958427
3
+ 2010,51.923125
4
+ 2011,36.779408
20260903-164548-science-environment-4a68cd/tests/reference/ground_truth/decadal_statistics.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ decade_start,start_year,end_year,count,mean_departure,median_departure,min_departure,max_departure,sample_std_departure
2
+ 2000,2009,2009,1,103.958427,103.958427,103.958427,103.958427,
3
+ 2010,2010,2011,2,44.351267,44.351267,36.779408,51.923125,10.708225
20260903-164548-science-environment-4a68cd/tests/reference/ground_truth/summary.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "series_name": "USGS FDSN Japan and Kuril trench 2009-2011 earthquake annual mean focal depth (km) (min mag 5.0)",
3
+ "row_count": 3,
4
+ "year_range": {
5
+ "start": 2009,
6
+ "end": 2011
7
+ },
8
+ "value": {
9
+ "min": 36.779408,
10
+ "min_year": 2011,
11
+ "max": 103.958427,
12
+ "max_year": 2009,
13
+ "mean": 64.22032,
14
+ "median": 51.923125,
15
+ "sample_std": 35.237351
16
+ },
17
+ "threshold": 70.0,
18
+ "years_at_or_above_threshold": 1,
19
+ "first_threshold_year": 2009,
20
+ "last_threshold_year": 2009,
21
+ "year_aggregation": "mean",
22
+ "source_row_count": 1128
23
+ }
20260903-164548-science-environment-4a68cd/tests/reference/ground_truth/threshold_years.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ rank,year,departure,threshold
2
+ 1,2009,103.958427,70.000000
20260903-164548-science-environment-4a68cd/tests/reference/internal/workflow_adapters_runtime.py ADDED
@@ -0,0 +1,679 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import datetime as dt
5
+ import html
6
+ import json
7
+ import math
8
+ import re
9
+ import shutil
10
+ import statistics
11
+ from pathlib import Path
12
+ from typing import Any
13
+
14
+
15
+ def _read_json(path: Path) -> Any:
16
+ with path.open("r", encoding="utf-8") as handle:
17
+ return json.load(handle)
18
+
19
+
20
+ def _write_json(path: Path, payload: Any) -> None:
21
+ path.parent.mkdir(parents=True, exist_ok=True)
22
+ with path.open("w", encoding="utf-8") as handle:
23
+ json.dump(payload, handle, ensure_ascii=False, indent=2)
24
+ handle.write("\n")
25
+
26
+ def _stable_region(place: str) -> str:
27
+ if not place:
28
+ return "unknown"
29
+ if "," in place:
30
+ return place.split(",")[-1].strip() or place.strip()
31
+ parts = place.split()
32
+ return " ".join(parts[-2:]) if len(parts) >= 2 else place.strip()
33
+
34
+
35
+ def _mag_bin(value: float | None) -> str:
36
+ if value is None or math.isnan(value):
37
+ return "unknown"
38
+ lower = math.floor(value)
39
+ upper = lower + 1
40
+ return f"{lower:.0f}-{upper:.0f}"
41
+
42
+
43
+ def _depth_bin(value: float | None) -> str:
44
+ if value is None or math.isnan(value):
45
+ return "unknown"
46
+ if value < 0:
47
+ return "<0"
48
+ if value < 10:
49
+ return "0-10"
50
+ if value < 30:
51
+ return "10-30"
52
+ if value < 70:
53
+ return "30-70"
54
+ if value < 300:
55
+ return "70-300"
56
+ return "300+"
57
+
58
+
59
+ def _clean_markup_text(raw: str) -> str:
60
+ text = re.sub(r"(?is)<(script|style|noscript)[^>]*>.*?</\1>", " ", raw)
61
+ text = re.sub(r"(?is)<br\s*/?>", "\n", text)
62
+ text = re.sub(r"(?is)</(p|div|li|tr|h[1-6]|pre)>", "\n", text)
63
+ text = re.sub(r"(?is)<[^>]+>", " ", text)
64
+ text = html.unescape(text)
65
+ text = re.sub(r"[ \t]+", " ", text)
66
+ text = re.sub(r"\n\s+", "\n", text)
67
+ return text.strip()
68
+
69
+
70
+ def _heading_slug(value: str) -> str:
71
+ slug = re.sub(r"[^a-z0-9]+", "_", value.lower()).strip("_")
72
+ return slug[:80] or "section"
73
+
74
+
75
+ def _extract_headings(raw: str) -> list[dict[str, str]]:
76
+ headings: list[dict[str, str]] = []
77
+ for match in re.finditer(r"(?is)<h([1-6])[^>]*>(.*?)</h\1>", raw):
78
+ text = _clean_markup_text(match.group(2))
79
+ if text:
80
+ headings.append({"level": f"h{match.group(1)}", "text": text})
81
+ if headings:
82
+ return headings
83
+ for line in raw.splitlines():
84
+ match = re.match(r"^(#{1,6})\s+(.+?)\s*$", line)
85
+ if match:
86
+ headings.append({"level": f"h{len(match.group(1))}", "text": match.group(2).strip()})
87
+ return headings
88
+
89
+
90
+ def _extract_code_blocks(raw: str) -> list[str]:
91
+ blocks: list[str] = []
92
+ for match in re.finditer(r"(?is)<pre[^>]*>(.*?)</pre>", raw):
93
+ text = _clean_markup_text(match.group(1))
94
+ if text:
95
+ blocks.append(text)
96
+ for match in re.finditer(r"(?is)<code[^>]*>(.*?)</code>", raw):
97
+ text = _clean_markup_text(match.group(1))
98
+ if text and text not in blocks:
99
+ blocks.append(text)
100
+ for match in re.finditer(r"(?s)```(?:[A-Za-z0-9_-]+)?\n(.*?)```", raw):
101
+ text = html.unescape(match.group(1).strip())
102
+ if text and text not in blocks:
103
+ blocks.append(text)
104
+ return blocks
105
+
106
+
107
+ def _window_rows(clean_text: str, *, width: int = 40, stride: int = 20) -> list[dict[str, Any]]:
108
+ words = re.findall(r"\S+", clean_text)
109
+ rows: list[dict[str, Any]] = []
110
+ if not words:
111
+ return rows
112
+ start = 0
113
+ while start < len(words):
114
+ end = min(start + width, len(words))
115
+ rows.append({
116
+ "window_id": len(rows) + 1,
117
+ "start_word": start,
118
+ "end_word": end,
119
+ "text": " ".join(words[start:end]),
120
+ })
121
+ if end == len(words):
122
+ break
123
+ start += stride
124
+ return rows
125
+
126
+
127
+ def _term_count(text: str, term: str) -> int:
128
+ term = term.strip()
129
+ if not term:
130
+ return 0
131
+ return len(re.findall(re.escape(term), text, flags=re.IGNORECASE))
132
+
133
+
134
+ def _first_window(windows: list[dict[str, Any]], term: str) -> str:
135
+ term_lower = term.lower()
136
+ for row in windows:
137
+ if term_lower in str(row.get("text") or "").lower():
138
+ return str(row.get("window_id") or "")
139
+ return ""
140
+
141
+
142
+ def _write_tutorial_public_inputs(input_dir: Path, source_path: Path, spec_payload: dict[str, Any]) -> None:
143
+ raw = source_path.read_text(encoding="utf-8", errors="replace")
144
+ # Tutorial examples may contain a maintainer's local Windows path. Keep
145
+ # the command semantics while preventing host-specific paths from entering
146
+ # the public task artifact.
147
+ sanitized_raw = re.sub(r"(?i)\b[A-Z]:\\(?:[^\\\r\n<>\"']+\\?)*[^\\\r\n<>\"']*", "./local.db", raw)
148
+ clean_text = _clean_markup_text(sanitized_raw)
149
+ windows = _window_rows(clean_text)
150
+ if len(windows) < 100:
151
+ raise ValueError(f"official tutorial source produced only {len(windows)} text windows; need at least 100")
152
+ required_terms = [str(item) for item in spec_payload.get("required_terms") or []]
153
+ code_terms = [str(item) for item in spec_payload.get("code_terms") or []]
154
+ input_dir.mkdir(parents=True, exist_ok=True)
155
+ destination = input_dir / str(spec_payload["source_file"])
156
+ # Always materialize the sanitized copy, including when the downloader
157
+ # already placed the source at the destination path.
158
+ destination.write_text(sanitized_raw, encoding="utf-8")
159
+ with (input_dir / str(spec_payload["input_file"])).open("w", encoding="utf-8", newline="") as handle:
160
+ fieldnames = ["window_id", "start_word", "end_word", "text", "contains_code_term", "matched_required_terms"]
161
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
162
+ writer.writeheader()
163
+ for row in windows:
164
+ text = str(row["text"])
165
+ matched = [term for term in required_terms if term.lower() in text.lower()]
166
+ contains_code = any(term.lower() in text.lower() for term in code_terms)
167
+ writer.writerow({
168
+ "window_id": row["window_id"],
169
+ "start_word": row["start_word"],
170
+ "end_word": row["end_word"],
171
+ "text": text,
172
+ "contains_code_term": "true" if contains_code else "false",
173
+ "matched_required_terms": "|".join(matched),
174
+ })
175
+ metadata = {
176
+ "software_name": spec_payload.get("software_name"),
177
+ "tutorial_url": spec_payload.get("tutorial_url"),
178
+ "source_urls": spec_payload.get("source_urls"),
179
+ "source_file": spec_payload.get("source_file"),
180
+ "window_file": spec_payload.get("input_file"),
181
+ "window_rule": spec_payload.get("window_rule"),
182
+ "required_terms": spec_payload.get("required_terms"),
183
+ "code_terms": spec_payload.get("code_terms"),
184
+ "note": "Provenance and public extraction rules only; scored aggregate values are intentionally not stored here.",
185
+ }
186
+ _write_json(input_dir / "tutorial_metadata.json", metadata)
187
+
188
+
189
+ def _source_context_text(path: Path) -> str:
190
+ try:
191
+ raw = path.read_text(encoding="utf-8", errors="replace")
192
+ except Exception:
193
+ return f"{path.name}\nsha256={_sha256_file(path)}\nsize_bytes={path.stat().st_size}\n"
194
+ if path.suffix.lower() in {".html", ".htm", ".md", ".txt"}:
195
+ return _clean_markup_text(raw)
196
+ return re.sub(r"\s+", " ", raw).strip()
197
+
198
+
199
+ def _ensure_public_input_footprint(input_dir: Path, source_paths: list[Path]) -> str:
200
+ current = _tree_file_bytes(input_dir)
201
+ if current >= MIN_PUBLIC_TASK_DATA_BYTES:
202
+ return f"public input footprint is {current} bytes; no context expansion needed"
203
+ context_path = input_dir / "source_context_windows.jsonl"
204
+ base = current - (context_path.stat().st_size if context_path.is_file() else 0)
205
+ context_path.unlink(missing_ok=True)
206
+ rows: list[dict[str, Any]] = []
207
+ for source in source_paths:
208
+ if not source.is_file() or source.resolve() == context_path.resolve():
209
+ continue
210
+ text = _source_context_text(source)
211
+ if not text:
212
+ continue
213
+ start = 0
214
+ width = 1800
215
+ stride = 900
216
+ while start < len(text):
217
+ end = min(len(text), start + width)
218
+ rows.append({
219
+ "source_file": source.relative_to(input_dir).as_posix() if source.is_relative_to(input_dir) else source.name,
220
+ "source_sha256": _sha256_file(source),
221
+ "start_char": start,
222
+ "end_char": end,
223
+ "text": text[start:end],
224
+ })
225
+ if end == len(text):
226
+ break
227
+ start += stride
228
+ if not rows:
229
+ raise ValueError("public input footprint expansion has no public source text")
230
+ input_dir.mkdir(parents=True, exist_ok=True)
231
+ rows_written = 0
232
+ target_extra = MIN_PUBLIC_TASK_DATA_BYTES - max(0, base)
233
+ with context_path.open("w", encoding="utf-8") as handle:
234
+ cycle = 0
235
+ while handle.tell() < target_extra or rows_written < 100:
236
+ row = dict(rows[rows_written % len(rows)])
237
+ row["window_id"] = rows_written + 1
238
+ row["cycle"] = cycle
239
+ handle.write(json.dumps(row, ensure_ascii=False) + "\n")
240
+ rows_written += 1
241
+ if rows_written % len(rows) == 0:
242
+ cycle += 1
243
+ handle.flush()
244
+ return f"wrote input/source_context_windows.jsonl with {rows_written} public-source windows and {context_path.stat().st_size} bytes"
245
+
246
+
247
+ def _write_software_manifest(software_dir: Path, spec_payload: dict[str, Any]) -> None:
248
+ if str(spec_payload.get("workflow_kind") or "") != "software_tutorial_doc_audit":
249
+ return
250
+ software_dir.mkdir(parents=True, exist_ok=True)
251
+ software_name = str(spec_payload.get("software_name") or "").strip()
252
+ executables = [str(item).strip() for item in spec_payload.get("executables") or [] if str(item).strip()]
253
+ system_packages = [str(item).strip() for item in spec_payload.get("required_system_packages") or [] if str(item).strip()]
254
+ source_urls = [str(item).strip() for item in spec_payload.get("source_urls") or [] if str(item).strip()]
255
+ _write_json(software_dir / "software_manifest.json", {
256
+ "software_name": software_name,
257
+ "executables": executables,
258
+ "required_system_packages": system_packages,
259
+ "official_sources": source_urls,
260
+ "solve_time_network": "disabled",
261
+ "python_wrapper_only": False,
262
+ "note": "This task audits real official software documentation/source staged offline; Python helpers only validate outputs.",
263
+ })
264
+ with (software_dir / "command_examples.csv").open("w", encoding="utf-8", newline="") as handle:
265
+ writer = csv.DictWriter(handle, fieldnames=["term", "kind", "software_name"])
266
+ writer.writeheader()
267
+ for term in spec_payload.get("code_terms") or []:
268
+ writer.writerow({"term": str(term), "kind": "code_term", "software_name": software_name})
269
+ for exe in executables:
270
+ writer.writerow({"term": exe, "kind": "executable", "software_name": software_name})
271
+
272
+
273
+ def software_tutorial_outputs(input_dir: Path, output_dir: Path) -> None:
274
+ spec = _read_json(input_dir / "analysis_spec.json")
275
+ source_file = str(spec["source_file"])
276
+ source_text = (input_dir / source_file).read_text(encoding="utf-8", errors="replace")
277
+ clean_text = _clean_markup_text(source_text)
278
+ headings = _extract_headings(source_text)
279
+ code_blocks = _extract_code_blocks(source_text)
280
+ window_rows: list[dict[str, str]] = []
281
+ with (input_dir / str(spec["input_file"])).open("r", encoding="utf-8", newline="") as handle:
282
+ window_rows = list(csv.DictReader(handle))
283
+ output_dir.mkdir(parents=True, exist_ok=True)
284
+
285
+ with (output_dir / "section_outline.csv").open("w", encoding="utf-8", newline="") as handle:
286
+ fieldnames = ["rank", "heading_level", "heading_text", "slug"]
287
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
288
+ writer.writeheader()
289
+ for rank, heading in enumerate(headings, start=1):
290
+ writer.writerow({
291
+ "rank": rank,
292
+ "heading_level": heading["level"],
293
+ "heading_text": heading["text"],
294
+ "slug": _heading_slug(heading["text"]),
295
+ })
296
+
297
+ all_terms: list[tuple[str, str]] = []
298
+ for term in spec.get("required_terms") or []:
299
+ all_terms.append((str(term), "required"))
300
+ for term in spec.get("code_terms") or []:
301
+ if str(term) not in {item[0] for item in all_terms}:
302
+ all_terms.append((str(term), "code"))
303
+ code_text = "\n".join(code_blocks)
304
+ term_rows: list[dict[str, Any]] = []
305
+ for term, category in all_terms:
306
+ term_rows.append({
307
+ "term": term,
308
+ "category": category,
309
+ "count": _term_count(clean_text, term),
310
+ "first_window": _first_window(window_rows, term),
311
+ "appears_in_code": "true" if term.lower() in code_text.lower() else "false",
312
+ })
313
+ term_rows.sort(key=lambda row: (str(row["category"]), str(row["term"]).lower()))
314
+ with (output_dir / "keyword_inventory.csv").open("w", encoding="utf-8", newline="") as handle:
315
+ fieldnames = ["term", "category", "count", "first_window", "appears_in_code"]
316
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
317
+ writer.writeheader()
318
+ for row in term_rows:
319
+ writer.writerow(row)
320
+
321
+ code_terms = [str(item).lower() for item in spec.get("code_terms") or []]
322
+ with (output_dir / "code_block_inventory.csv").open("w", encoding="utf-8", newline="") as handle:
323
+ fieldnames = ["block_index", "line_count", "char_count", "contains_code_term", "first_line"]
324
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
325
+ writer.writeheader()
326
+ for index, block in enumerate(code_blocks, start=1):
327
+ lines = [line for line in block.splitlines() if line.strip()]
328
+ contains = any(term and term in block.lower() for term in code_terms)
329
+ writer.writerow({
330
+ "block_index": index,
331
+ "line_count": len(lines),
332
+ "char_count": len(block),
333
+ "contains_code_term": "true" if contains else "false",
334
+ "first_line": lines[0][:200] if lines else "",
335
+ })
336
+
337
+ keyword_total = sum(int(row["count"]) for row in term_rows)
338
+ required_found = sum(1 for row in term_rows if row["category"] == "required" and int(row["count"]) > 0)
339
+ top_keyword = None
340
+ if term_rows:
341
+ top = max(term_rows, key=lambda row: (int(row["count"]), str(row["term"]).lower()))
342
+ top_keyword = str(top["term"]) if int(top["count"]) > 0 else None
343
+ summary = {
344
+ "software_name": str(spec.get("software_name") or ""),
345
+ "source_file": source_file,
346
+ "window_count": len(window_rows),
347
+ "heading_count": len(headings),
348
+ "code_block_count": len(code_blocks),
349
+ "keyword_total": keyword_total,
350
+ "unique_required_terms_found": required_found,
351
+ "top_keyword": top_keyword,
352
+ "source_character_count": len(clean_text),
353
+ }
354
+ _write_json(output_dir / "summary.json", summary)
355
+
356
+
357
+ def geojson_outputs(input_dir: Path, output_dir: Path) -> None:
358
+ payload = _read_json(input_dir / "events.geojson")
359
+ features = payload.get("features") if isinstance(payload, dict) else []
360
+ rows: list[dict[str, Any]] = []
361
+ for feature in features:
362
+ if not isinstance(feature, dict):
363
+ continue
364
+ props = feature.get("properties") if isinstance(feature.get("properties"), dict) else {}
365
+ geom = feature.get("geometry") if isinstance(feature.get("geometry"), dict) else {}
366
+ coords = geom.get("coordinates") if isinstance(geom.get("coordinates"), list) else []
367
+ mag = props.get("mag")
368
+ try:
369
+ mag = float(mag) if mag is not None else None
370
+ except (TypeError, ValueError):
371
+ mag = None
372
+ depth = None
373
+ if len(coords) >= 3:
374
+ try:
375
+ depth = float(coords[2])
376
+ except (TypeError, ValueError):
377
+ depth = None
378
+ time_ms = props.get("time")
379
+ date_utc = "unknown"
380
+ if isinstance(time_ms, (int, float)):
381
+ date_utc = dt.datetime.utcfromtimestamp(time_ms / 1000).date().isoformat()
382
+ rows.append({
383
+ "id": feature.get("id") or props.get("code") or "",
384
+ "mag": mag,
385
+ "depth": depth,
386
+ "place": str(props.get("place") or ""),
387
+ "region": _stable_region(str(props.get("place") or "")),
388
+ "date_utc": date_utc,
389
+ "feature": feature,
390
+ })
391
+ output_dir.mkdir(parents=True, exist_ok=True)
392
+ mags = [row["mag"] for row in rows if row["mag"] is not None]
393
+ depths = [row["depth"] for row in rows if row["depth"] is not None]
394
+ summary = {
395
+ "event_count": len(rows),
396
+ "magnitude": {
397
+ "count": len(mags),
398
+ "min": round(min(mags), 6) if mags else None,
399
+ "max": round(max(mags), 6) if mags else None,
400
+ "mean": round(statistics.fmean(mags), 6) if mags else None,
401
+ "median": round(statistics.median(mags), 6) if mags else None,
402
+ },
403
+ "depth_km": {
404
+ "count": len(depths),
405
+ "min": round(min(depths), 6) if depths else None,
406
+ "max": round(max(depths), 6) if depths else None,
407
+ "mean": round(statistics.fmean(depths), 6) if depths else None,
408
+ },
409
+ "time_range_utc": {
410
+ "start_date": min((row["date_utc"] for row in rows if row["date_utc"] != "unknown"), default=None),
411
+ "end_date": max((row["date_utc"] for row in rows if row["date_utc"] != "unknown"), default=None),
412
+ },
413
+ "quality_flags": {
414
+ "missing_magnitude": sum(1 for row in rows if row["mag"] is None),
415
+ "missing_depth": sum(1 for row in rows if row["depth"] is None),
416
+ "unique_regions": len({row["region"] for row in rows}),
417
+ },
418
+ }
419
+ _write_json(output_dir / "summary.json", summary)
420
+
421
+ grouped: dict[tuple[str, str], list[dict[str, Any]]] = {}
422
+ for row in rows:
423
+ grouped.setdefault((_mag_bin(row["mag"]), _depth_bin(row["depth"])), []).append(row)
424
+ with (output_dir / "magnitude_depth_bins.csv").open("w", encoding="utf-8", newline="") as handle:
425
+ fieldnames = ["mag_bin", "depth_bin", "event_count", "mean_magnitude", "max_magnitude"]
426
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
427
+ writer.writeheader()
428
+ for (mag_bin, depth_bin), group in sorted(grouped.items()):
429
+ group_mags = [row["mag"] for row in group if row["mag"] is not None]
430
+ writer.writerow({
431
+ "mag_bin": mag_bin,
432
+ "depth_bin": depth_bin,
433
+ "event_count": len(group),
434
+ "mean_magnitude": f"{statistics.fmean(group_mags):.6f}" if group_mags else "",
435
+ "max_magnitude": f"{max(group_mags):.6f}" if group_mags else "",
436
+ })
437
+
438
+ daily: dict[tuple[str, str], list[dict[str, Any]]] = {}
439
+ for row in rows:
440
+ daily.setdefault((row["region"], row["date_utc"]), []).append(row)
441
+ with (output_dir / "region_daily_counts.csv").open("w", encoding="utf-8", newline="") as handle:
442
+ fieldnames = ["region", "date_utc", "event_count", "max_magnitude"]
443
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
444
+ writer.writeheader()
445
+ for (region, date_utc), group in sorted(daily.items()):
446
+ group_mags = [row["mag"] for row in group if row["mag"] is not None]
447
+ writer.writerow({
448
+ "region": region,
449
+ "date_utc": date_utc,
450
+ "event_count": len(group),
451
+ "max_magnitude": f"{max(group_mags):.6f}" if group_mags else "",
452
+ })
453
+
454
+ filtered = [row["feature"] for row in rows if row["mag"] is not None and row["mag"] >= 4.5]
455
+ _write_json(output_dir / "filtered_events.geojson", {"type": "FeatureCollection", "features": filtered})
456
+
457
+
458
+ def csv_time_series_outputs(input_dir: Path, output_dir: Path) -> None:
459
+ spec = _read_json(input_dir / "analysis_spec.json")
460
+ csv_name = spec["input_file"]
461
+ date_column = spec["date_column"]
462
+ value_column = spec["value_column"]
463
+ rows: list[dict[str, Any]] = []
464
+ with (input_dir / csv_name).open("r", encoding="utf-8", newline="") as raw_handle:
465
+ lines = [line for line in raw_handle if not line.lstrip().startswith("#")]
466
+ reader = csv.DictReader(lines)
467
+ for item in reader:
468
+ raw_date = item.get(date_column, "")
469
+ try:
470
+ day = dt.date.fromisoformat(raw_date)
471
+ except ValueError:
472
+ if raw_date.isdigit() and len(raw_date) == 4:
473
+ day = dt.date(int(raw_date), 1, 1)
474
+ else:
475
+ continue
476
+ raw_value = item.get(value_column, "")
477
+ try:
478
+ value = float(raw_value)
479
+ except (TypeError, ValueError):
480
+ value = None
481
+ rows.append({"date": day, "value": value, "raw": item})
482
+ rows.sort(key=lambda item: item["date"])
483
+ valid = [row for row in rows if row["value"] is not None]
484
+ output_dir.mkdir(parents=True, exist_ok=True)
485
+ monthly: dict[str, list[float]] = {}
486
+ for row in valid:
487
+ key = row["date"].strftime("%Y-%m")
488
+ monthly.setdefault(key, []).append(row["value"])
489
+ with (output_dir / "monthly_statistics.csv").open("w", encoding="utf-8", newline="") as handle:
490
+ fieldnames = ["month", "count", "mean", "median", "min", "max"]
491
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
492
+ writer.writeheader()
493
+ for month, values in sorted(monthly.items()):
494
+ writer.writerow({
495
+ "month": month,
496
+ "count": len(values),
497
+ "mean": f"{statistics.fmean(values):.6f}",
498
+ "median": f"{statistics.median(values):.6f}",
499
+ "min": f"{min(values):.6f}",
500
+ "max": f"{max(values):.6f}",
501
+ })
502
+ existing_dates = {row["date"] for row in rows}
503
+ missing_days: list[dt.date] = []
504
+ if rows:
505
+ day = rows[0]["date"]
506
+ while day <= rows[-1]["date"]:
507
+ if day.weekday() < 5 and day not in existing_dates:
508
+ missing_days.append(day)
509
+ day += dt.timedelta(days=1)
510
+ with (output_dir / "missing_business_days.csv").open("w", encoding="utf-8", newline="") as handle:
511
+ writer = csv.DictWriter(handle, fieldnames=["date"])
512
+ writer.writeheader()
513
+ for day in missing_days:
514
+ writer.writerow({"date": day.isoformat()})
515
+ with (output_dir / "clean_series.csv").open("w", encoding="utf-8", newline="") as handle:
516
+ writer = csv.DictWriter(handle, fieldnames=["date", "value"])
517
+ writer.writeheader()
518
+ for row in valid:
519
+ writer.writerow({"date": row["date"].isoformat(), "value": f"{row['value']:.6f}"})
520
+ values = [row["value"] for row in valid]
521
+ summary = {
522
+ "series_name": spec.get("series_name", value_column),
523
+ "row_count": len(rows),
524
+ "valid_value_count": len(valid),
525
+ "missing_value_count": len(rows) - len(valid),
526
+ "missing_business_day_count": len(missing_days),
527
+ "date_range": {
528
+ "start": rows[0]["date"].isoformat() if rows else None,
529
+ "end": rows[-1]["date"].isoformat() if rows else None,
530
+ },
531
+ "value": {
532
+ "min": round(min(values), 6) if values else None,
533
+ "max": round(max(values), 6) if values else None,
534
+ "mean": round(statistics.fmean(values), 6) if values else None,
535
+ "median": round(statistics.median(values), 6) if values else None,
536
+ },
537
+ }
538
+ _write_json(output_dir / "summary.json", summary)
539
+
540
+
541
+ def _aggregate_annual_rows(rows: list[dict[str, Any]], aggregation: str) -> list[dict[str, Any]]:
542
+ if not aggregation:
543
+ return rows
544
+ grouped: dict[int, list[float]] = {}
545
+ for row in rows:
546
+ grouped.setdefault(int(row["year"]), []).append(float(row["value"]))
547
+ aggregated: list[dict[str, Any]] = []
548
+ for year, values in sorted(grouped.items()):
549
+ if aggregation == "mean":
550
+ value = statistics.fmean(values)
551
+ elif aggregation == "median":
552
+ value = statistics.median(values)
553
+ elif aggregation == "max":
554
+ value = max(values)
555
+ elif aggregation == "min":
556
+ value = min(values)
557
+ elif aggregation == "count":
558
+ value = float(len(values))
559
+ else:
560
+ raise ValueError(f"unsupported year_aggregation for csv_annual_series_audit: {aggregation}")
561
+ aggregated.append({"year": year, "value": value})
562
+ return aggregated
563
+
564
+
565
+ def csv_annual_series_outputs(input_dir: Path, output_dir: Path) -> None:
566
+ spec = _read_json(input_dir / "analysis_spec.json")
567
+ csv_name = spec["input_file"]
568
+ year_column = spec["year_column"]
569
+ value_column = spec["value_column"]
570
+ # Optional: derive the year from an ISO-8601 timestamp column (e.g. USGS FDSN
571
+ # `time` = "2022-06-29T19:17:58.929Z") instead of parsing an integer year.
572
+ # When unset, behaviour is unchanged (integer year column).
573
+ year_from_timestamp = bool(spec.get("year_from_timestamp", False))
574
+ year_aggregation = str(spec.get("year_aggregation") or "").strip().lower()
575
+ raw_rows: list[dict[str, Any]] = []
576
+ with (input_dir / csv_name).open("r", encoding="utf-8", newline="") as raw_handle:
577
+ lines = [line for line in raw_handle if not line.lstrip().startswith("#")]
578
+ reader = csv.DictReader(lines)
579
+ for item in reader:
580
+ raw_year = str(item.get(year_column, "")).strip()
581
+ try:
582
+ if year_from_timestamp:
583
+ # Take the leading 4-digit year of an ISO timestamp/date.
584
+ match = re.match(r"\s*(\d{4})", raw_year)
585
+ if not match:
586
+ continue
587
+ year = int(match.group(1))
588
+ else:
589
+ year = int(raw_year)
590
+ value = float(str(item.get(value_column, "")).strip())
591
+ except (TypeError, ValueError):
592
+ continue
593
+ raw_rows.append({"year": year, "value": value})
594
+ rows = _aggregate_annual_rows(raw_rows, year_aggregation)
595
+ rows.sort(key=lambda item: item["year"])
596
+ output_dir.mkdir(parents=True, exist_ok=True)
597
+ decades: dict[str, list[float]] = {}
598
+ for row in rows:
599
+ decade_start = (row["year"] // 10) * 10
600
+ decades.setdefault(f"{decade_start}s", []).append(row["value"])
601
+ with (output_dir / "decadal_statistics.csv").open("w", encoding="utf-8", newline="") as handle:
602
+ fieldnames = [
603
+ "decade_start",
604
+ "start_year",
605
+ "end_year",
606
+ "count",
607
+ "mean_departure",
608
+ "median_departure",
609
+ "min_departure",
610
+ "max_departure",
611
+ "sample_std_departure",
612
+ ]
613
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
614
+ writer.writeheader()
615
+ for decade, values in sorted(decades.items()):
616
+ decade_start = int(decade.rstrip("s"))
617
+ years = [row["year"] for row in rows if decade_start <= row["year"] <= decade_start + 9]
618
+ writer.writerow({
619
+ "decade_start": decade_start,
620
+ "start_year": min(years),
621
+ "end_year": max(years),
622
+ "count": len(values),
623
+ "mean_departure": f"{statistics.fmean(values):.6f}",
624
+ "median_departure": f"{statistics.median(values):.6f}",
625
+ "min_departure": f"{min(values):.6f}",
626
+ "max_departure": f"{max(values):.6f}",
627
+ "sample_std_departure": f"{statistics.stdev(values):.6f}" if len(values) >= 2 else "",
628
+ })
629
+ threshold = float(spec.get("threshold", 1.0))
630
+ with (output_dir / "threshold_years.csv").open("w", encoding="utf-8", newline="") as handle:
631
+ fieldnames = ["rank", "year", "departure", "threshold"]
632
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
633
+ writer.writeheader()
634
+ rank = 1
635
+ for row in rows:
636
+ if row["value"] >= threshold:
637
+ writer.writerow({
638
+ "rank": rank,
639
+ "year": row["year"],
640
+ "departure": f"{row['value']:.6f}",
641
+ "threshold": f"{threshold:.6f}",
642
+ })
643
+ rank += 1
644
+ with (output_dir / "clean_series.csv").open("w", encoding="utf-8", newline="") as handle:
645
+ writer = csv.DictWriter(handle, fieldnames=["Year", "Departure from Average"])
646
+ writer.writeheader()
647
+ for row in rows:
648
+ writer.writerow({"Year": row["year"], "Departure from Average": f"{row['value']:.6f}"})
649
+ values = [row["value"] for row in rows]
650
+ threshold_rows = [row for row in rows if row["value"] >= threshold]
651
+ min_row = min(rows, key=lambda row: row["value"]) if rows else None
652
+ max_row = max(rows, key=lambda row: row["value"]) if rows else None
653
+ summary = {
654
+ "series_name": spec.get("series_name", value_column),
655
+ "row_count": len(rows),
656
+ "year_range": {
657
+ "start": rows[0]["year"] if rows else None,
658
+ "end": rows[-1]["year"] if rows else None,
659
+ },
660
+ "value": {
661
+ "min": round(min(values), 6) if values else None,
662
+ "min_year": min_row["year"] if min_row else None,
663
+ "max": round(max(values), 6) if values else None,
664
+ "max_year": max_row["year"] if max_row else None,
665
+ "mean": round(statistics.fmean(values), 6) if values else None,
666
+ "median": round(statistics.median(values), 6) if values else None,
667
+ "sample_std": round(statistics.stdev(values), 6) if len(values) >= 2 else None,
668
+ },
669
+ "threshold": threshold,
670
+ "years_at_or_above_threshold": len(threshold_rows),
671
+ "first_threshold_year": threshold_rows[0]["year"] if threshold_rows else None,
672
+ "last_threshold_year": threshold_rows[-1]["year"] if threshold_rows else None,
673
+ }
674
+ if year_aggregation:
675
+ summary["year_aggregation"] = year_aggregation
676
+ summary["source_row_count"] = len(raw_rows)
677
+ _write_json(output_dir / "summary.json", summary)
678
+
679
+
20260903-164548-science-environment-4a68cd/tests/reference/internal/workflow_runtime.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from workflow_adapters_runtime import csv_annual_series_outputs
3
+
4
+ def run_reference(input_dir: Path, output_dir: Path) -> None:
5
+ csv_annual_series_outputs(input_dir, output_dir)
20260903-164548-science-environment-4a68cd/tests/reference/reference_manifest.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "workflow_kind": "csv_annual_series_audit",
3
+ "task_id": "usgs_fdsn_eq_japan_kuril_2009_2011_m5_depth_mean",
4
+ "domain": "science_environment",
5
+ "task": "usgs_japan_kuril_annual_mean_depth_audit",
6
+ "variant": "base",
7
+ "created_from": "standard reference workflow",
8
+ "required_outputs": [
9
+ {
10
+ "path": "summary.json",
11
+ "type": "json"
12
+ },
13
+ {
14
+ "path": "decadal_statistics.csv",
15
+ "type": "csv"
16
+ },
17
+ {
18
+ "path": "threshold_years.csv",
19
+ "type": "csv"
20
+ },
21
+ {
22
+ "path": "clean_series.csv",
23
+ "type": "csv"
24
+ }
25
+ ],
26
+ "numeric_tolerance": 1e-09,
27
+ "source_prior_sha256": "cd6afb5c04f7bbc8f5026b12dcff2a1a6c9e95eaab2b6a2dea7eb0c5b42e11e2",
28
+ "gold_output_hashes": {
29
+ "summary.json": "e7ca77bfff83cf98fa36d24b412d37be1549f0bce64350318b14928b5ec70e13",
30
+ "decadal_statistics.csv": "2f019b06e65a9e4a323a48bd5187f6a0e4001269691e467208460bbe8dd7083d",
31
+ "threshold_years.csv": "088d8468e732e14cbd15227a7ddf9b2b85252165b1a9908b6e0210fb283a1c1f",
32
+ "clean_series.csv": "f749ba5e5fa10366a759b1c1847ecd61cd12bd755652b4adf36500238be6dff2"
33
+ }
34
+ }
20260903-164548-science-environment-4a68cd/tests/reference/reference_solution.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+ from pathlib import Path
6
+
7
+
8
+ def main() -> int:
9
+ parser = argparse.ArgumentParser()
10
+ parser.add_argument("--input", required=True)
11
+ parser.add_argument("--output", required=True)
12
+ args = parser.parse_args()
13
+ sys.path.insert(0, str(Path(__file__).resolve().parent / "internal"))
14
+ from workflow_runtime import run_reference
15
+ run_reference(Path(args.input), Path(args.output))
16
+ return 0
17
+
18
+
19
+ if __name__ == "__main__":
20
+ raise SystemExit(main())
20260903-164548-science-environment-4a68cd/tests/test.sh ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -u
3
+
4
+ TESTS_DIR="${HARBOR_TESTS_DIR:-/tests}"
5
+ WORKSPACE_DIR="${HARBOR_WORKSPACE_DIR:-/workspace}"
6
+ LOGS_DIR="${HARBOR_LOGS_DIR:-/logs/verifier}"
7
+
8
+ mkdir -p "${LOGS_DIR}" "${WORKSPACE_DIR}/output"
9
+
10
+ python "${TESTS_DIR}/evaluator_runner.py" \
11
+ --output-dir "${WORKSPACE_DIR}/output" \
12
+ --reference-dir "${TESTS_DIR}/reference" \
13
+ --reward-json "${LOGS_DIR}/reward.json" \
14
+ --details-json "${LOGS_DIR}/ale_evaluator_details.json"
15
+
16
+ if [ ! -f "${LOGS_DIR}/reward.json" ]; then
17
+ echo '{"score":0.0,"format":0.0,"output_present":0.0,"evaluator_available":0.0,"item_count":0.0}' > "${LOGS_DIR}/reward.json"
18
+ fi
19
+
20
+ python - <<'PY' "${LOGS_DIR}/reward.json" "${LOGS_DIR}/reward.txt"
21
+ import json
22
+ import sys
23
+ from pathlib import Path
24
+ reward = json.loads(Path(sys.argv[1]).read_text(encoding="utf-8"))
25
+ score = float(reward.get("score", 0.0))
26
+ Path(sys.argv[2]).write_text(f"{score}\n", encoding="utf-8")
27
+ PY
28
+
29
+ exit 0
20260903-164548-science-environment-8102f0/.DS_Store ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:95a6f6f40b40cd3adb2c4aff247fc495d5d34688cca69f181c1a4f8dc0bd5c52
3
+ size 6148
20260903-164548-science-environment-8102f0/environment/Dockerfile ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /workspace
4
+
5
+ COPY public_data/input /workspace/input
6
+ COPY public_data/software /workspace/software
7
+ COPY public_data/task_card.json /workspace/task_card.json
8
+ COPY public_data/main.py /workspace/main.py
9
+ COPY public_data/README.md /workspace/README.md
10
+
11
+ RUN mkdir -p /workspace/output /workspace/report /logs/agent /logs/artifacts \
12
+ && chmod -R 777 /workspace/output /workspace/report /logs
20260903-164548-science-environment-8102f0/environment/public_data/README.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Public Task Inputs
2
+
3
+ Files in this directory are copied into the workspace:
4
+
5
+ - `input/` -> `/workspace/input/`
6
+ - `software/` -> `/workspace/software/`
7
+ - `task_card.json` -> `/workspace/task_card.json`
8
+ - `main.py` -> `/workspace/main.py`
9
+
10
+ Hidden reference data and evaluator files are not present in the agent workspace.
11
+ Final deliverables must be written under `/workspace/output/`.
20260903-164548-science-environment-8102f0/environment/public_data/input/README.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ This directory contains the public staged input for this task.
2
+ input/analysis_spec.json is the authoritative public contract for input columns, grouping/filtering rules, required output files, and output schemas.
3
+ Primary data file: input/usgs_fdsn_alaska_aleutians_1974_1978_m4p5.csv.
4
+ Workflow kind: csv_annual_series_audit.
5
+ Required output files: output/summary.json, output/decadal_statistics.csv, output/threshold_years.csv, output/clean_series.csv.
6
+ Solve the task from the staged local files only; do not fetch fresh remote data during solve time.
20260903-164548-science-environment-8102f0/environment/public_data/input/analysis_spec.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "input_file": "usgs_fdsn_alaska_aleutians_1974_1978_m4p5.csv",
3
+ "workflow_kind": "csv_annual_series_audit",
4
+ "year_column": "time",
5
+ "value_column": "depth",
6
+ "series_name": "USGS FDSN Alaska and Aleutians 1974-1978 earthquake annual mean focal depth (km) (min mag 4.5)",
7
+ "threshold": 70.0,
8
+ "year_from_timestamp": true,
9
+ "comment_prefix": "#",
10
+ "required_outputs": [
11
+ {
12
+ "path": "summary.json",
13
+ "type": "json"
14
+ },
15
+ {
16
+ "path": "decadal_statistics.csv",
17
+ "type": "csv"
18
+ },
19
+ {
20
+ "path": "threshold_years.csv",
21
+ "type": "csv"
22
+ },
23
+ {
24
+ "path": "clean_series.csv",
25
+ "type": "csv"
26
+ }
27
+ ],
28
+ "output_schemas": {
29
+ "summary.json": {
30
+ "series_name": "string",
31
+ "row_count": "integer valid annual rows",
32
+ "year_range": {
33
+ "start": "integer|null",
34
+ "end": "integer|null"
35
+ },
36
+ "value": {
37
+ "min": "number|null",
38
+ "min_year": "integer|null",
39
+ "max": "number|null",
40
+ "max_year": "integer|null",
41
+ "mean": "number|null",
42
+ "median": "number|null",
43
+ "sample_std": "number|null"
44
+ },
45
+ "threshold": "number",
46
+ "years_at_or_above_threshold": "integer",
47
+ "first_threshold_year": "integer|null",
48
+ "last_threshold_year": "integer|null",
49
+ "year_aggregation": "string annual aggregation applied to raw rows",
50
+ "source_row_count": "integer raw rows before annual aggregation"
51
+ },
52
+ "decadal_statistics.csv": [
53
+ "decade_start",
54
+ "start_year",
55
+ "end_year",
56
+ "count",
57
+ "mean_departure",
58
+ "median_departure",
59
+ "min_departure",
60
+ "max_departure",
61
+ "sample_std_departure"
62
+ ],
63
+ "threshold_years.csv": [
64
+ "rank",
65
+ "year",
66
+ "departure",
67
+ "threshold"
68
+ ],
69
+ "clean_series.csv": [
70
+ "Year",
71
+ "Departure from Average"
72
+ ]
73
+ },
74
+ "notes": "First group raw CSV rows by year and aggregate the value column with mean; then compute reproducible annual-series audit outputs. Do not fetch new data.",
75
+ "year_aggregation": "mean"
76
+ }
20260903-164548-science-environment-8102f0/environment/public_data/input/source_context_windows.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
20260903-164548-science-environment-8102f0/environment/public_data/input/usgs_fdsn_alaska_aleutians_1974_1978_m4p5.csv ADDED
@@ -0,0 +1,538 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ time,latitude,longitude,depth,mag,magType,nst,gap,dmin,rms,net,id,updated,place,type,horizontalError,depthError,magError,magNst,status,locationSource,magSource
2
+ 1974-01-05T14:00:56.800Z,52.165,-171.415,41,5.4,mb,,,,,us,usp00004tn,2022-04-27T18:30:27.540Z,"190 km E of Atka, Alaska",earthquake,,,,,reviewed,us,us
3
+ 1974-01-07T08:27:03.500Z,59.807,-153.722,128,4.9,mb,,,,,us,usp00004us,2014-11-06T23:21:22.305Z,"21 km E of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
4
+ 1974-01-10T00:02:29.900Z,53.056,-174.444,207,4.5,mb,,,,,us,usp00004vp,2014-11-06T23:21:22.341Z,"97 km N of Atka, Alaska",earthquake,,,,,reviewed,us,us
5
+ 1974-01-19T08:53:39.100Z,52.936,-167.977,59,5,mb,,,,,us,usp00004yx,2014-11-06T23:21:22.454Z,"59 km E of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
6
+ 1974-01-22T10:43:04.200Z,60.128,-153.336,152,4.6,mb,,,,,us,usp0000504,2014-11-06T23:21:22.498Z,"55 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
7
+ 1974-01-24T18:43:26.800Z,61.588,-147.626,40,4.8,mb,,,,,us,usp000050z,2022-04-27T18:32:15.967Z,"24 km S of Glacier View, Alaska",earthquake,,,,,reviewed,us,us
8
+ 1974-01-26T03:11:20.900Z,52.295,-171.397,54,5.3,mb,,,,,us,usp000051j,2014-11-06T23:21:22.550Z,"186 km WSW of Nikolski, AK",earthquake,,,,,reviewed,us,us
9
+ 1974-01-31T19:55:26.200Z,52.357,-168.74,36,5.6,mb,,,,,us,usp000053d,2025-12-19T19:24:59.601Z,"65 km S of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
10
+ 1974-01-31T20:15:54.600Z,52.245,-168.778,44,4.8,mb,,,,,us,usp000053e,2014-11-06T23:21:22.618Z,"77 km S of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
11
+ 1974-02-02T15:55:28.300Z,61.602,-147.603,48,5.1,mb,,,,,us,usp0000556,2025-12-19T19:31:50.506Z,"23 km S of Glacier View, Alaska",earthquake,,,,,reviewed,us,us
12
+ 1974-02-05T02:25:22.000Z,62.703,-148.854,75,5,mb,,,,,us,usp0000567,2014-11-06T23:21:22.710Z,"70 km ENE of Chase, Alaska",earthquake,,,,,reviewed,us,us
13
+ 1974-02-06T04:04:07.200Z,53.799,-164.672,2,6.5,ms,,,,,us,usp000056v,2025-12-19T19:31:57.968Z,"81 km ESE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
14
+ 1974-02-10T21:25:11.700Z,50.815,-172.68,33,4.5,mb,,,,,us,usp0000591,2014-11-06T23:21:22.801Z,"186 km SE of Atka, Alaska",earthquake,,,,,reviewed,us,us
15
+ 1974-02-10T22:05:46.200Z,59.131,-152.503,61,4.6,mb,,,,,us,usp0000592,2014-11-06T23:21:22.803Z,"41 km SW of Nanwalek, Alaska",earthquake,,,,,reviewed,us,us
16
+ 1974-02-15T06:06:28.500Z,63.144,-150.763,126,4.5,mb,,,,,us,usp00005a8,2014-11-06T23:21:22.855Z,"65 km SE of Denali National Park, Alaska",earthquake,,,,,reviewed,us,us
17
+ 1974-02-17T21:19:53.100Z,53.648,-163.54,33,4.7,mb,,,,,us,usp00005b8,2014-11-06T23:21:22.887Z,"134 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
18
+ 1974-02-24T14:56:54.000Z,53.412,-169.1,98,4.5,mb,,,,,us,usp00005d4,2014-11-06T23:21:22.985Z,"55 km NNW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
19
+ 1974-02-28T14:59:47.300Z,51.415,-179.338,56,4.8,mb,,,,,us,usp00005ew,2014-11-06T23:21:23.103Z,"193 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
20
+ 1974-02-28T19:19:21.900Z,53.01,-166.664,33,5,mb,,,,,us,usp00005f0,2014-11-06T23:21:23.149Z,"96 km S of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
21
+ 1974-03-10T00:12:40.400Z,50.533,-175.111,28,4.7,mb,,,,,us,usp00005jp,2014-11-06T23:21:23.283Z,"183 km SE of Adak, Alaska",earthquake,,,,,reviewed,us,us
22
+ 1974-03-10T10:00:14.100Z,63.16,-150.503,117,4.5,mb,,,,,us,usp00005jx,2014-11-06T23:21:23.289Z,"74 km SE of Denali National Park, Alaska",earthquake,,,,,reviewed,us,us
23
+ 1974-03-14T08:29:35.100Z,51.712,-167.067,33,4.5,mb,,,,,us,usp00005m9,2014-11-06T23:21:23.330Z,"183 km SE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
24
+ 1974-03-22T05:45:19.000Z,53.698,-163.433,33,4.9,mb,,,,,us,usp00005pr,2014-11-06T23:21:23.407Z,"128 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
25
+ 1974-03-22T07:04:06.200Z,53.622,-163.372,33,5.1,mb,,,,,us,usp00005ps,2014-11-06T23:21:23.408Z,"137 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
26
+ 1974-03-27T16:28:47.300Z,50.109,-179.657,37,5.6,mb,,,,,us,usp00005s7,2022-04-27T18:27:42.935Z,"289 km SW of Adak, Alaska",earthquake,,,,,reviewed,us,us
27
+ 1974-03-29T21:50:35.300Z,57.585,-153.922,44,5.7,mb,,,,,us,usp00005sx,2025-12-19T19:31:36.010Z,"6 km NE of Larsen Bay, Alaska",earthquake,,,,,reviewed,us,us
28
+ 1974-04-06T01:53:47.300Z,55.102,-160.44,27,5.7,mb,,,,,us,usp00005vv,2025-12-19T19:30:39.685Z,"26 km S of Sand Point, Alaska",earthquake,,,,,reviewed,us,us
29
+ 1974-04-06T03:56:01.800Z,55.12,-160.443,40,6,mb,,,,,us,usp00005w2,2025-12-19T19:30:40.931Z,"24 km S of Sand Point, Alaska",earthquake,,,,,reviewed,us,us
30
+ 1974-04-06T05:12:26.400Z,57.8,-153.499,53,4.6,mb,,,,,us,usp00005w3,2014-11-06T23:21:23.620Z,"37 km WSW of Port Lions, Alaska",earthquake,,,,,reviewed,us,us
31
+ 1974-04-10T01:28:15.900Z,52.515,-168.74,15,4.6,mb,,,,,us,usp00005xd,2014-11-06T23:21:23.665Z,"47 km S of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
32
+ 1974-04-11T06:53:04.700Z,52.016,-170.529,33,4.5,mb,,,,,us,usp00005xs,2014-11-06T23:21:23.676Z,"152 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
33
+ 1974-04-14T15:43:10.600Z,64.2,-173.998,33,4.5,mb,,,,,us,usp00005z3,2014-11-06T23:21:23.734Z,"44 km SW of Provideniya, Russia",earthquake,,,,,reviewed,us,us
34
+ 1974-04-17T00:39:40.600Z,51.739,-173.488,46,4.9,mb,,,,,us,usp00005zs,2014-11-06T23:21:23.757Z,"70 km SE of Atka, Alaska",earthquake,,,,,reviewed,us,us
35
+ 1974-04-20T08:22:21.300Z,52.974,-167.375,42,5.9,ms,,,,,us,usp0000617,2014-11-06T23:21:23.869Z,"99 km E of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
36
+ 1974-04-22T02:29:40.100Z,51.985,-176.057,70,4.9,mb,,,,,us,usp0000620,2014-11-06T23:21:23.894Z,"41 km ENE of Adak, Alaska",earthquake,,,,,reviewed,us,us
37
+ 1974-04-22T04:31:00.500Z,52.558,-169.551,32,4.5,mb,,,,,us,usp0000624,2014-11-06T23:21:23.898Z,"62 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
38
+ 1974-04-26T01:07:08.700Z,51.755,-176.746,64,4.7,mb,,,,,us,usp000063j,2014-11-06T23:21:23.943Z,"15 km SSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
39
+ 1974-04-30T19:47:39.800Z,51.098,-172.727,12,4.8,mb,,,,,us,usp000065f,2014-11-06T23:21:24.007Z,"159 km SE of Atka, Alaska",earthquake,,,,,reviewed,us,us
40
+ 1974-05-04T08:02:00.200Z,56.295,-153.268,10,4.6,mb,,,,,us,usp0000671,2014-11-06T23:21:24.060Z,"91 km SE of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
41
+ 1974-05-08T04:27:13.100Z,63.669,-150.727,11,4.6,mb,,,,,us,usp000068t,2014-11-06T23:21:24.117Z,"51 km ENE of Denali National Park, Alaska",earthquake,,,,,reviewed,us,us
42
+ 1974-05-11T19:10:47.800Z,56.498,-153.076,27,4.9,mb,,,,,us,usp00006aa,2014-11-06T23:21:24.167Z,"79 km S of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
43
+ 1974-05-13T05:10:49.800Z,55.868,-158.514,41,4.9,mb,,,,,us,usp00006b6,2014-11-06T23:21:24.194Z,"39 km E of Perryville, Alaska",earthquake,,,,,reviewed,us,us
44
+ 1974-05-14T14:07:35.700Z,54.304,-164.104,27,4.8,mb,,,,,us,usp00006br,2014-11-06T23:21:24.213Z,"75 km SW of False Pass, Alaska",earthquake,,,,,reviewed,us,us
45
+ 1974-05-15T13:04:04.100Z,52.408,-168.817,44,5,mb,,,,,us,usp00006cm,2014-11-06T23:21:24.242Z,"59 km S of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
46
+ 1974-05-23T05:16:54.200Z,50.201,-179.539,35,4.8,mb,,,,,us,usp00006f8,2014-11-06T23:21:24.330Z,"275 km SW of Adak, Alaska",earthquake,,,,,reviewed,us,us
47
+ 1974-05-24T22:30:02.000Z,58.112,-156.832,126,4.5,mb,,,,,us,usp00006fy,2014-11-06T23:21:24.354Z,"34 km ESE of Egegik, Alaska",earthquake,,,,,reviewed,us,us
48
+ 1974-05-27T14:01:43.500Z,60.328,-146.016,21,5.7,ms,,,,,us,usp00006hr,2025-12-19T19:30:30.913Z,"27 km SSW of Cordova, Alaska",earthquake,,,,,reviewed,us,us
49
+ 1974-05-31T03:13:10.700Z,53.602,-163.819,33,4.8,mb,,,,,us,usp00006k1,2026-01-07T19:03:30.134Z,"141 km ESE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
50
+ 1974-06-07T17:50:08.800Z,50.925,-170.626,33,5,mb,,,,,us,usp00006p3,2014-11-06T23:21:24.587Z,"254 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
51
+ 1974-06-10T14:34:22.300Z,54.765,-161.649,11,4.8,mb,,,,,us,usp00006q9,2014-11-06T23:21:24.627Z,"54 km SE of King Cove, Alaska",earthquake,,,,,reviewed,us,us
52
+ 1974-06-11T20:20:44.900Z,51.918,-173.532,58,4.8,mb,,,,,us,usp00006qq,2014-11-06T23:21:24.642Z,"55 km SE of Atka, Alaska",earthquake,,,,,reviewed,us,us
53
+ 1974-06-12T16:46:34.300Z,52.441,-170.202,46,5.2,mb,,,,,us,usp00006r0,2014-11-06T23:21:24.652Z,"106 km WSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
54
+ 1974-06-19T11:35:11.700Z,53.823,-163.433,33,4.7,mb,,,,,us,usp00006t3,2014-11-06T23:21:24.787Z,"114 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
55
+ 1974-06-22T20:35:37.000Z,51.245,-178.237,49,4.5,mb,,,,,us,usp00006up,2014-11-06T23:21:24.847Z,"131 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
56
+ 1974-06-23T05:14:53.800Z,52.537,-169.025,42,5,mb,,,,,us,usp00006uy,2014-11-06T23:21:24.869Z,"46 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
57
+ 1974-06-24T21:20:22.100Z,63.167,-149.881,75,5.5,mb,,,,,us,usp00006vk,2014-11-06T23:21:24.890Z,"52 km WSW of Cantwell, Alaska",earthquake,,,,,reviewed,us,us
58
+ 1974-07-13T12:44:50.700Z,61.492,-145.007,55,4.7,mb,,,,,us,usp0000742,2014-11-06T23:21:25.186Z,"20 km SSE of Tonsina, Alaska",earthquake,,,,,reviewed,us,us
59
+ 1974-07-17T10:42:42.300Z,51.662,-173.509,45,5,mb,,,,,us,usp000076r,2014-11-06T23:21:25.280Z,"76 km SE of Atka, Alaska",earthquake,,,,,reviewed,us,us
60
+ 1974-07-20T00:48:03.900Z,51.593,-173.547,45,4.9,mb,,,,,us,usp000077w,2014-11-06T23:21:25.319Z,"80 km SSE of Atka, Alaska",earthquake,,,,,reviewed,us,us
61
+ 1974-07-26T20:37:17.800Z,51.06,-170.455,33,4.9,mb,,,,,us,usp00007av,2025-12-19T19:28:52.010Z,"235 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
62
+ 1974-07-29T11:37:44.000Z,59.709,-152.729,84,4.5,mb,,,,,us,usp00007cf,2014-11-06T23:21:25.483Z,"51 km W of Anchor Point, Alaska",earthquake,,,,,reviewed,us,us
63
+ 1974-08-01T05:06:19.500Z,56.723,-152.096,24,4.6,mb,,,,,us,usp00007e1,2014-11-06T23:21:25.570Z,"90 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
64
+ 1974-08-01T05:07:59.000Z,56.516,-152.315,10,6.1,ms,,,,,us,usp00007e2,2025-12-19T19:27:36.291Z,"97 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
65
+ 1974-08-01T05:55:38.200Z,56.67,-152.105,33,6.3,ms,,,,,us,usp00007e3,2025-12-19T19:27:37.119Z,"94 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
66
+ 1974-08-01T06:07:17.000Z,56.592,-152.392,15,4.6,mb,,,,,us,usp00007e4,2014-11-06T23:21:25.571Z,"87 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
67
+ 1974-08-01T06:17:02.300Z,56.645,-152.071,19,4.5,mb,,,,,us,usp00007e6,2014-11-06T23:21:25.601Z,"97 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
68
+ 1974-08-01T07:59:56.900Z,56.632,-152.265,33,6,ms,,,,,us,usp00007ee,2022-04-27T18:09:38.028Z,"89 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
69
+ 1974-08-05T00:54:07.700Z,52.34,-173.363,66,5.1,mb,,,,,us,usp00007ga,2014-11-06T23:21:25.668Z,"59 km ENE of Atka, Alaska",earthquake,,,,,reviewed,us,us
70
+ 1974-08-06T02:37:42.300Z,60.247,-153.324,136,5,mb,,,,,us,usp00007gf,2014-11-06T23:21:25.673Z,"55 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
71
+ 1974-08-06T12:59:55.600Z,56.554,-152.469,16,4.7,ms,,,,,us,usp00007gh,2014-11-06T23:21:25.675Z,"88 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
72
+ 1974-08-06T18:05:25.300Z,56.722,-152.411,33,4.6,mb,,,,,us,usp00007gm,2014-11-06T23:21:25.678Z,"76 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
73
+ 1974-08-07T08:21:01.800Z,56.783,-152.303,32,4.6,mb,,,,,us,usp00007gu,2014-11-06T23:21:25.685Z,"76 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
74
+ 1974-08-07T08:23:36.800Z,56.649,-152.31,33,5.3,ms,,,,,us,usp00007gv,2025-12-19T19:27:43.055Z,"86 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
75
+ 1974-08-07T15:30:29.500Z,56.745,-152.389,33,4.6,mb,,,,,us,usp00007gz,2014-11-06T23:21:25.691Z,"75 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
76
+ 1974-08-07T15:59:38.500Z,56.795,-152.112,33,4.5,mb,,,,,us,usp00007h0,2014-11-06T23:21:25.692Z,"85 km ESE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
77
+ 1974-08-13T03:46:20.300Z,51.525,-178.112,52,5.8,mb,,,,,us,usp00007km,2025-12-19T19:28:00.031Z,"109 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
78
+ 1974-08-14T05:34:54.400Z,51.561,-178.145,56,5.7,mb,,,,,us,usp00007m4,2025-12-19T19:28:03.149Z,"110 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
79
+ 1974-08-16T09:41:31.700Z,51.498,-177.828,46,5.8,ms,,,,,us,usp00007nb,2025-12-19T19:28:07.516Z,"92 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
80
+ 1974-08-24T10:41:11.200Z,52.407,-168.273,41,5.7,mb,,,,,us,usp00007rr,2025-12-19T19:28:20.416Z,"71 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
81
+ 1974-08-24T22:18:55.400Z,52.297,-168.314,37,5.3,mb,,,,,us,usp00007s4,2022-04-27T18:13:14.544Z,"80 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
82
+ 1974-08-25T09:22:32.500Z,52.719,-166.91,33,4.5,mb,,,,,us,usp00007sh,2014-11-06T23:21:25.973Z,"130 km S of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
83
+ 1974-08-28T18:43:25.700Z,59.506,-144.453,4,4.9,mb,,,,,us,usp00007u4,2025-12-19T19:28:27.346Z,"136 km SSE of Cordova, Alaska",earthquake,,,,,reviewed,us,us
84
+ 1974-09-14T08:56:55.200Z,59.985,-151.34,100,4.6,mb,,,,,us,usp000081f,2014-11-06T23:21:26.306Z,"19 km ESE of Ninilchik, Alaska",earthquake,,,,,reviewed,us,us
85
+ 1974-09-17T02:01:23.200Z,56.724,-151.655,17,5.1,ms,,,,,us,usp0000825,2026-01-07T19:01:36.091Z,"105 km SSE of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
86
+ 1974-09-26T11:29:23.300Z,54.298,-164.752,31,4.9,mb,,,,,us,usp000085q,2014-11-06T23:21:26.545Z,"69 km ENE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
87
+ 1974-10-12T12:33:24.900Z,56.145,-153.72,10,4.8,ms,,,,,us,usp00008cq,2014-11-06T23:21:26.808Z,"93 km SSE of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
88
+ 1974-10-18T14:02:33.800Z,53.632,-163.8,42,4.7,mb,,,,,us,usp00008fa,2014-11-06T23:21:26.901Z,"138 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
89
+ 1974-10-25T07:39:49.300Z,56.423,-153.535,32,4.5,mb,,,,,us,usp00008jm,2014-11-06T23:21:27.018Z,"70 km SSE of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
90
+ 1974-10-28T04:22:56.600Z,57.436,-156.713,14,4.7,mb,,,,,us,usp00008ke,2014-11-06T23:21:27.048Z,"41 km ESE of Ugashik, Alaska",earthquake,,,,,reviewed,us,us
91
+ 1974-10-31T17:59:48.600Z,52.77,-167.011,36,4.9,mb,,,,,us,usp00008mp,2014-11-06T23:21:27.086Z,"126 km E of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
92
+ 1974-11-11T05:17:51.000Z,51.631,-178.11,68,5.8,mb,,,,,us,usp00008rg,2025-12-19T19:25:26.008Z,"105 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
93
+ 1974-11-14T04:48:54.700Z,58.797,-154.62,37,5.6,ms,,,,,us,usp00008sb,2025-12-19T19:25:33.709Z,"72 km S of Kokhanok, Alaska",earthquake,,,,,reviewed,us,us
94
+ 1974-11-15T03:01:31.600Z,58.74,-154.644,42,4.8,mb,,,,,us,usp00008t3,2014-11-06T23:21:27.422Z,"Alaska Peninsula",earthquake,,,,,reviewed,us,us
95
+ 1974-11-20T00:09:15.000Z,53.6,-165.253,57,5,mb,,,,,us,usp00008us,2014-11-06T23:21:27.482Z,"68 km SSE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
96
+ 1974-11-20T05:34:05.600Z,58.595,-154.61,17,4.6,mb,,,,,us,usp00008uw,2014-11-06T23:21:27.486Z,"94 km S of Kokhanok, Alaska",earthquake,,,,,reviewed,us,us
97
+ 1974-11-22T18:04:02.100Z,60.273,-153.298,158,4.6,mb,,,,,us,usp00008vu,2014-11-06T23:21:27.518Z,"56 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
98
+ 1974-11-26T14:29:43.400Z,50.671,-129.641,33,4.5,mb,,,,,us,usp00008x1,2014-11-06T23:21:27.562Z,"180 km W of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
99
+ 1974-11-28T05:28:48.200Z,51.873,-175.266,63,5.2,mb,,,,,us,usp00008xk,2014-11-06T23:21:27.580Z,"81 km WSW of Atka, Alaska",earthquake,,,,,reviewed,us,us
100
+ 1974-11-28T16:31:58.300Z,53.621,-163.703,32,5.3,mb,,,,,us,usp00008xs,2014-11-06T23:21:27.587Z,"138 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
101
+ 1974-12-04T20:14:19.400Z,51.902,-170.863,39,4.5,mb,,,,,us,usp0000905,2014-11-06T23:21:27.672Z,"178 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
102
+ 1974-12-07T07:34:11.000Z,51.857,-170.795,33,5.8,ms,,,,,us,usp0000916,2025-12-19T19:23:48.058Z,"178 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
103
+ 1974-12-22T05:32:12.300Z,51.44,-178.517,55,4.6,mb,,,,,us,usp0000972,2014-11-06T23:21:27.940Z,"138 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
104
+ 1974-12-28T00:11:53.700Z,54.192,-162.772,44,4.6,mb,,,,,us,usp0000997,2014-11-06T23:21:28.028Z,"84 km SSE of False Pass, Alaska",earthquake,,,,,reviewed,us,us
105
+ 1974-12-29T18:25:00.700Z,61.597,-150.511,67,5.6,mb,,,,,us,usp00009a2,2022-04-27T18:00:16.473Z,"5 km N of Susitna, Alaska",earthquake,,,,,reviewed,us,us
106
+ 1974-12-30T03:33:16.600Z,61.982,-149.686,62,5.1,mb,,,,,us,usp00009a6,2014-11-06T23:21:28.063Z,"21 km SSE of Susitna North, Alaska",earthquake,,,,,reviewed,us,us
107
+ 1974-12-31T04:37:31.200Z,52.531,-179.26,228,5.1,mb,,,,,us,usp00009aq,2014-11-06T23:21:28.151Z,"193 km WNW of Adak, Alaska",earthquake,,,,,reviewed,us,us
108
+ 1975-01-01T03:55:12.000Z,61.909,-149.738,66,5.9,mb,,,,,us,usp00009bd,2025-12-19T19:23:22.353Z,"23 km NE of Willow, Alaska",earthquake,,,,,reviewed,us,us
109
+ 1975-01-06T23:12:17.800Z,54.303,-165.78,102,5.1,mb,,,,,us,usp00009du,2014-11-06T23:21:28.278Z,"18 km N of Akutan, Alaska",earthquake,,,,,reviewed,us,us
110
+ 1975-01-08T17:38:19.100Z,52.396,-175.552,114,5.1,mb,,,,,us,usp00009eg,2014-11-06T23:21:28.302Z,"94 km NE of Adak, Alaska",earthquake,,,,,reviewed,us,us
111
+ 1975-01-10T20:40:39.600Z,51.585,-178.455,63,4.9,mb,,,,,us,usp00009fg,2014-11-06T23:21:28.341Z,"129 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
112
+ 1975-01-12T22:01:25.700Z,59.591,-149.161,46,4.7,mb,,,,,us,usp00009g8,2014-11-06T23:21:28.371Z,"55 km SSE of Lowell Point, Alaska",earthquake,,,,,reviewed,us,us
113
+ 1975-01-13T00:31:55.600Z,61.434,-150.494,66,4.8,mb,,,,,us,usp00009g9,2014-11-06T23:21:28.372Z,"12 km S of Susitna, Alaska",earthquake,,,,,reviewed,us,us
114
+ 1975-01-13T09:19:10.300Z,52.22,-171.142,42,5.7,mb,,,,,us,usp00009gg,2025-12-19T20:33:47.451Z,"174 km WSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
115
+ 1975-01-13T19:29:16.200Z,51.282,-178.155,46,4.9,mb,,,,,us,usp00009gj,2014-11-06T23:21:28.382Z,"124 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
116
+ 1975-01-15T02:23:17.500Z,51.118,-179.187,57,4.6,mb,,,,,us,usp00009h5,2014-11-06T23:21:28.410Z,"196 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
117
+ 1975-01-21T06:41:05.100Z,52.51,-168.612,33,4.6,mb,,,,,us,usp00009k6,2014-11-06T23:21:28.486Z,"50 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
118
+ 1975-01-21T21:47:49.400Z,55.773,-158.013,35,4.9,mb,,,,,us,usp00009kf,2014-11-06T23:21:28.496Z,"62 km SSE of Chignik, Alaska",earthquake,,,,,reviewed,us,us
119
+ 1975-01-24T22:43:00.200Z,51.813,-175.307,56,4.6,mb,,,,,us,usp00009ne,2014-11-06T23:21:28.572Z,"87 km WSW of Atka, Alaska",earthquake,,,,,reviewed,us,us
120
+ 1975-01-25T17:04:33.900Z,51.071,-170.983,33,4.9,mb,,,,,us,usp00009nz,2014-11-06T23:21:28.593Z,"253 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
121
+ 1975-01-27T21:33:32.200Z,52.488,-176.188,150,4.9,mb,,,,,us,usp00009q4,2014-11-06T23:21:28.637Z,"74 km NNE of Adak, Alaska",earthquake,,,,,reviewed,us,us
122
+ 1975-01-29T16:16:58.700Z,50.077,-129.345,33,4.5,mb,,,,,us,usp00009qr,2014-11-06T23:21:28.658Z,"170 km WSW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
123
+ 1975-02-01T05:52:22.200Z,53.489,-163.295,18,4.6,mb,,,,,us,usp00009re,2014-11-06T23:21:28.683Z,"152 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
124
+ 1975-02-08T23:48:25.500Z,52.615,-169.177,33,4.5,mb,,,,,us,usp00009uq,2014-11-06T23:21:28.789Z,"41 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
125
+ 1975-02-11T14:30:38.600Z,54.451,-160.997,21,4.6,mb,,,,,us,usp00009wa,2014-11-06T23:21:28.841Z,"103 km SSW of Sand Point, Alaska",earthquake,,,,,reviewed,us,us
126
+ 1975-02-15T20:05:09.700Z,52.276,-169.983,33,4.8,mb,,,,,us,usp00009xp,2014-11-06T23:21:28.885Z,"105 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
127
+ 1975-02-22T08:36:07.400Z,51.377,-179.419,48,6.5,ms,,,,,us,usp00009zr,2025-12-19T20:33:35.484Z,"200 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
128
+ 1975-02-22T19:58:10.000Z,51.4,-179.505,46,4.8,mb,,,,,us,usp0000a00,2014-11-06T23:21:28.975Z,"205 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
129
+ 1975-02-22T22:47:45.800Z,51.324,-179.337,62,5.1,mb,,,,,us,usp0000a06,2014-11-06T23:21:28.980Z,"197 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
130
+ 1975-02-23T01:16:14.400Z,51.347,-179.417,55,5,mb,,,,,us,usp0000a07,2014-11-06T23:21:28.981Z,"201 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
131
+ 1975-02-23T05:09:43.300Z,51.272,-179.273,50,5,mb,,,,,us,usp0000a0b,2014-11-06T23:21:28.984Z,"194 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
132
+ 1975-02-24T20:20:08.200Z,51.411,-179.227,59,4.7,mb,,,,,us,usp0000a0x,2014-11-06T23:21:29.013Z,"186 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
133
+ 1975-03-12T10:43:33.100Z,51.534,-177.751,54,5.4,mb,,,,,us,usp0000a6y,2014-11-06T23:21:29.321Z,"85 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
134
+ 1975-03-17T17:39:29.200Z,51.845,-175.286,48,5,mb,,,,,us,usp0000a9b,2014-11-06T23:21:29.399Z,"84 km WSW of Atka, Alaska",earthquake,,,,,reviewed,us,us
135
+ 1975-03-17T20:51:17.700Z,57.253,-153.722,65,4.5,mb,,,,,us,usp0000a9f,2014-11-06T23:21:29.404Z,"25 km WNW of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
136
+ 1975-03-20T03:23:33.500Z,50.356,-175.999,27,4.9,mb,,,,,us,usp0000aah,2014-11-06T23:21:29.440Z,"174 km SSE of Adak, Alaska",earthquake,,,,,reviewed,us,us
137
+ 1975-03-20T03:27:21.600Z,50.175,-176.264,33,4.7,mb,,,,,us,usp0000aaj,2014-11-06T23:21:29.441Z,"190 km S of Adak, Alaska",earthquake,,,,,reviewed,us,us
138
+ 1975-03-20T07:11:35.700Z,51.26,-179.625,53,4.9,mb,,,,,us,usp0000aam,2014-11-06T23:21:29.443Z,"218 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
139
+ 1975-03-20T07:30:38.800Z,51.323,-179.556,57,5.4,mb,,,,,us,usp0000aan,2025-12-19T20:32:36.385Z,"211 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
140
+ 1975-04-02T14:43:21.900Z,51.619,-178.289,62,4.9,mb,,,,,us,usp0000af7,2014-11-06T23:21:29.597Z,"117 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
141
+ 1975-04-08T20:32:24.900Z,51.899,-166.207,33,5.4,mb,,,,,us,usp0000ahx,2022-04-27T17:46:41.869Z,"214 km ESE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
142
+ 1975-04-11T10:47:15.300Z,54.097,-163.248,20,5.5,mb,,,,,us,usp0000ak1,2025-12-19T20:08:02.448Z,"84 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
143
+ 1975-04-19T19:17:52.500Z,54.195,-163.191,49,4.7,mb,,,,,us,usp0000apr,2014-11-06T23:21:29.850Z,"74 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
144
+ 1975-05-01T18:47:56.000Z,52.709,-167.033,17,5.1,mb,,,,,us,usp0000avg,2025-12-19T20:30:18.584Z,"125 km ESE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
145
+ 1975-05-01T19:01:40.700Z,53.289,-167.419,33,4.8,mb,,,,,us,usp0000avh,2014-11-06T23:21:30.124Z,"87 km SW of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
146
+ 1975-05-01T19:21:02.800Z,52.875,-167.006,8,4.5,mb,,,,,us,usp0000avk,2014-11-06T23:21:30.125Z,"115 km SSW of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
147
+ 1975-05-02T14:09:03.200Z,51.901,-168.153,33,4.9,mb,,,,,us,usp0000avy,2014-11-06T23:21:30.138Z,"125 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
148
+ 1975-05-06T21:34:29.900Z,54.02,-163.434,49,4.6,mb,,,,,us,usp0000axy,2014-11-06T23:21:30.211Z,"92 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
149
+ 1975-05-08T00:59:56.000Z,56.509,-152.871,33,4.7,mb,,,,,us,usp0000ayj,2014-11-06T23:21:30.231Z,"81 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
150
+ 1975-05-08T10:26:55.000Z,50.302,-179.806,33,4.8,mb,,,,,us,usp0000ayp,2014-11-06T23:21:30.235Z,"282 km SW of Adak, Alaska",earthquake,,,,,reviewed,us,us
151
+ 1975-05-16T07:57:47.500Z,54.089,-163.093,9,5.4,mb,,,,,us,usp0000b22,2025-12-19T20:30:37.938Z,"87 km SSE of False Pass, Alaska",earthquake,,,,,reviewed,us,us
152
+ 1975-05-18T15:42:59.100Z,63.17,-150.263,106,5.4,mb,,,,,us,usp0000b2m,2022-04-27T17:44:45.511Z,"70 km WSW of Cantwell, Alaska",earthquake,,,,,reviewed,us,us
153
+ 1975-05-21T06:34:54.900Z,60.182,-147.575,35,4.8,mb,,,,,us,usp0000b3x,2014-11-06T23:21:30.390Z,"27 km ENE of Chenega, Alaska",earthquake,,,,,reviewed,us,us
154
+ 1975-05-21T22:57:03.800Z,59.559,-154.112,100,4.6,mb,,,,,us,usp0000b49,2014-11-06T23:21:30.397Z,"21 km E of Pope-Vannoy Landing, Alaska",earthquake,,,,,reviewed,us,us
155
+ 1975-05-23T15:12:33.200Z,51.343,-131.236,33,5.6,ms,,,,,us,usp0000b4z,2014-11-06T23:21:30.411Z,"Haida Gwaii Region, Canada",earthquake,,,,,reviewed,us,us
156
+ 1975-05-25T15:47:30.400Z,57.501,-150.117,33,4.8,ms,,,,,us,usp0000b66,2014-11-06T23:21:30.437Z,"130 km E of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
157
+ 1975-05-25T19:04:34.400Z,57.375,-150.119,33,5.6,mb,,,,,us,usp0000b67,2025-12-19T20:30:57.242Z,"132 km ESE of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
158
+ 1975-05-26T00:02:22.600Z,57.465,-150.229,1,4.5,mb,,,,,us,usp0000b6c,2014-11-06T23:21:30.441Z,"124 km E of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
159
+ 1975-05-31T23:35:21.800Z,58.242,-155.88,129,4.6,mb,,,,,us,usp0000b8p,2014-11-06T23:21:30.490Z,"67 km SE of King Salmon, Alaska",earthquake,,,,,reviewed,us,us
160
+ 1975-06-04T20:35:56.800Z,51.938,-179.579,75,4.5,mb,,,,,us,usp0000baw,2014-11-06T23:21:30.537Z,"202 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
161
+ 1975-06-14T20:50:25.700Z,71.912,-132.94,33,5.3,mb,,,,,us,usp0000bjs,2022-04-27T17:42:35.819Z,"Beaufort Sea",earthquake,,,,,reviewed,us,us
162
+ 1975-06-18T08:30:37.800Z,56.495,-152.435,13,4.8,mb,,,,,us,usp0000bn1,2014-11-06T23:21:30.930Z,"95 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
163
+ 1975-06-18T19:15:41.400Z,56.868,-151.853,30,4.5,mb,,,,,us,usp0000bnc,2014-11-06T23:21:30.936Z,"86 km SSE of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
164
+ 1975-06-25T05:44:06.800Z,64.852,-133.506,33,5.1,mb,,,,,us,usp0000bs2,2014-11-06T23:21:31.017Z,"295 km SSE of Fort McPherson, Canada",earthquake,,,,,reviewed,us,us
165
+ 1975-06-26T07:59:27.200Z,52.366,-168.73,37,5.1,mb,,,,,us,usp0000bsj,2014-11-06T23:21:31.027Z,"64 km S of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
166
+ 1975-06-26T11:54:37.900Z,55.722,-154.245,1,4.5,mb,,,,,us,usp0000bsr,2014-11-06T23:21:31.031Z,"136 km S of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
167
+ 1975-07-08T20:57:22.700Z,51.546,-178.286,57,5,mb,,,,,us,usp0000by3,2014-11-06T23:21:31.143Z,"119 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
168
+ 1975-07-25T10:40:25.000Z,55.055,-160.377,17,5.8,mb,,,,,us,usp0000c5y,2025-12-19T20:28:52.297Z,"32 km SSE of Sand Point, Alaska",earthquake,,,,,reviewed,us,us
169
+ 1975-08-01T07:04:33.000Z,61.919,-150.763,79,4.6,mb,,,,,us,usp0000c8t,2014-11-06T23:21:31.535Z,"34 km ESE of Skwentna, Alaska",earthquake,,,,,reviewed,us,us
170
+ 1975-08-02T10:18:17.900Z,53.387,-161.485,33,6.2,mb,,,,,us,usp0000c9r,2025-12-19T20:27:24.154Z,"194 km SSE of King Cove, Alaska",earthquake,,,,,reviewed,us,us
171
+ 1975-08-02T15:01:35.300Z,56.632,-152.198,33,4.9,mb,,,,,us,usp0000c9w,2014-11-06T23:21:31.556Z,"92 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
172
+ 1975-08-08T11:44:38.800Z,68.958,-145.147,33,4.5,mb,,,,,us,usp0000ccw,2014-11-06T23:21:31.617Z,"94 km N of Arctic Village, Alaska",earthquake,,,,,reviewed,us,us
173
+ 1975-08-12T23:20:27.000Z,53.307,-170.745,167,4.5,mb,,,,,us,usp0000cew,2014-11-06T23:21:31.657Z,"132 km WNW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
174
+ 1975-08-18T14:56:42.100Z,57.364,-150.204,25,5.2,mb,,,,,us,usp0000ch1,2025-12-19T20:27:48.860Z,"127 km ESE of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
175
+ 1975-08-20T01:35:20.900Z,51.96,-166.077,33,4.6,mb,,,,,us,usp0000chj,2014-11-06T23:21:31.717Z,"south of the Aleutian Islands",earthquake,,,,,reviewed,us,us
176
+ 1975-08-20T02:06:01.800Z,51.526,-130.619,33,4.5,mb,,,,,us,usp0000chk,2014-11-06T23:21:31.717Z,"268 km WNW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
177
+ 1975-08-21T22:19:21.100Z,60.356,-151.194,67,4.9,mb,,,,,us,usp0000cjb,2014-11-06T23:21:31.733Z,"4 km ENE of Kasilof, Alaska",earthquake,,,,,reviewed,us,us
178
+ 1975-08-22T15:50:14.300Z,60.119,-153.443,160,4.7,mb,,,,,us,usp0000cjj,2014-11-06T23:21:31.738Z,"49 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
179
+ 1975-08-23T06:40:27.300Z,59.013,-154.264,167,4.5,mb,,,,,us,usp0000cjw,2014-11-06T23:21:31.744Z,"55 km SSE of Kokhanok, Alaska",earthquake,,,,,reviewed,us,us
180
+ 1975-08-31T12:02:10.000Z,57.254,-151.063,12,5.1,mb,,,,,us,usp0000cnn,2014-11-06T23:21:31.797Z,"83 km ESE of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
181
+ 1975-09-06T18:04:59.500Z,56.628,-152.3,33,5.1,mb,,,,,us,usp0000cqq,2014-11-06T23:21:31.880Z,"88 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
182
+ 1975-09-06T20:35:02.000Z,56.515,-152.279,33,4.8,mb,,,,,us,usp0000cqr,2014-11-06T23:21:31.880Z,"98 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
183
+ 1975-09-17T13:18:14.200Z,63.422,-149.827,133,4.6,mb,,,,,us,usp0000cug,2014-11-06T23:21:32.048Z,"43 km W of Cantwell, Alaska",earthquake,,,,,reviewed,us,us
184
+ 1975-09-30T08:28:12.200Z,51.709,-179.449,33,4.6,mb,,,,,us,usp0000d0b,2014-11-06T23:21:32.168Z,"195 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
185
+ 1975-10-16T13:12:06.800Z,60.203,-153.177,99,5.3,mb,,,,,us,usp0000d5b,2014-11-06T23:21:32.267Z,"63 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
186
+ 1975-10-17T19:39:12.500Z,57.446,-149.008,33,5.7,mb,,,,,us,usp0000d5y,2025-12-19T20:07:47.776Z,"197 km E of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
187
+ 1975-10-21T01:16:28.700Z,61.313,-147.371,33,4.6,mb,,,,,us,usp0000d79,2014-11-06T23:21:32.305Z,"57 km SSE of Glacier View, Alaska",earthquake,,,,,reviewed,us,us
188
+ 1975-10-28T06:40:59.000Z,61.424,-152.418,132,4.5,mb,,,,,us,usp0000dap,2014-11-06T23:21:32.378Z,"78 km WNW of Beluga, Alaska",earthquake,,,,,reviewed,us,us
189
+ 1975-10-30T12:31:44.200Z,51.072,-179.424,52,4.6,mb,,,,,us,usp0000dbg,2014-11-06T23:21:32.393Z,"213 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
190
+ 1975-10-30T12:36:11.500Z,51.36,-179.345,50,5,ms,,,,,us,usp0000dbh,2014-11-06T23:21:32.394Z,"196 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
191
+ 1975-11-01T00:48:23.400Z,53.655,-163.366,25,5.7,ms,,,,,us,usp0000dcv,2025-12-19T20:24:56.876Z,"133 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
192
+ 1975-11-02T14:32:20.400Z,59.36,-153.545,112,4.8,mb,,,,,us,usp0000ddr,2014-11-06T23:21:32.477Z,"Southern Alaska",earthquake,,,,,reviewed,us,us
193
+ 1975-11-10T11:02:43.500Z,51.38,-179.149,57,4.5,mb,,,,,us,usp0000dgr,2014-11-06T23:21:32.630Z,"182 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
194
+ 1975-11-13T02:54:01.200Z,54.371,-162.656,33,5.3,mb,,,,,us,usp0000djh,2022-04-27T17:27:27.211Z,"72 km SE of False Pass, Alaska",earthquake,,,,,reviewed,us,us
195
+ 1975-11-22T08:50:09.100Z,51.72,-173.429,54,5.2,mb,,,,,us,usp0000dpb,2022-04-27T17:28:28.467Z,"Andreanof Islands, Aleutian Islands, Alaska",earthquake,,,,,reviewed,us,us
196
+ 1975-11-24T10:35:43.400Z,51.518,-130.507,33,4.8,mb,,,,,us,usp0000dq3,2014-11-06T23:21:32.797Z,"261 km WNW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
197
+ 1975-11-30T05:31:25.700Z,52.297,-176.27,99,4.8,mb,,,,,us,usp0000dsr,2014-11-06T23:21:32.847Z,"53 km NNE of Adak, Alaska",earthquake,,,,,reviewed,us,us
198
+ 1975-11-30T20:30:17.000Z,52.599,-167.184,24,6.3,ms,,,,,us,usp0000dt0,2025-12-19T20:25:35.516Z,"119 km ESE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
199
+ 1975-12-01T02:05:23.400Z,53.304,-167.442,53,4.7,mb,,,,,us,usp0000dt5,2014-11-06T23:21:32.856Z,"87 km SW of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
200
+ 1975-12-05T17:54:39.600Z,54.355,-162.939,45,4.7,mb,,,,,us,usp0000du8,2014-11-06T23:21:32.878Z,"63 km SSE of False Pass, Alaska",earthquake,,,,,reviewed,us,us
201
+ 1975-12-08T21:19:47.800Z,52.764,-166.86,19,4.9,mb,,,,,us,usp0000dv5,2014-11-06T23:21:32.895Z,"125 km S of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
202
+ 1975-12-11T03:40:38.000Z,51.431,-178.13,66,4.5,mb,,,,,us,usp0000dvs,2014-11-06T23:21:32.907Z,"114 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
203
+ 1975-12-11T06:28:35.500Z,50.147,-129.929,33,4.7,mb,,,,,us,usp0000dvu,2025-12-19T20:24:28.967Z,"208 km WSW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
204
+ 1975-12-11T07:03:13.800Z,50.184,-129.847,22,4.8,mb,,,,,us,usp0000dvv,2025-12-19T20:24:29.838Z,"201 km WSW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
205
+ 1975-12-15T22:54:48.100Z,56.196,-157.725,77,4.5,mb,,,,,us,usp0000dxj,2014-11-06T23:21:32.943Z,"43 km ESE of Chignik, Alaska",earthquake,,,,,reviewed,us,us
206
+ 1975-12-24T23:32:39.600Z,52.427,-168.68,33,5,mb,,,,,us,usp0000e1t,2014-11-06T23:21:33.030Z,"58 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
207
+ 1975-12-28T15:06:35.100Z,52.305,-168.3,29,4.6,mb,,,,,us,usp0000e4j,2014-11-06T23:21:33.123Z,"80 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
208
+ 1976-01-01T03:03:54.500Z,50.258,-129.723,33,4.6,mb,,,,,us,usp0000e7k,2014-11-06T23:21:33.328Z,"190 km WSW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
209
+ 1976-01-01T04:11:41.800Z,50.273,-129.823,19,4.9,mb,,,,,us,usp0000e7m,2014-11-06T23:21:33.329Z,"197 km WSW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
210
+ 1976-01-02T03:36:20.400Z,50.388,-129.826,23,5.1,mb,,,,,us,usp0000e8b,2025-12-19T20:23:01.047Z,"195 km W of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
211
+ 1976-01-04T08:44:11.200Z,52.891,-166.758,40,5.2,ms,,,,,us,usp0000e9s,2022-04-27T17:19:37.807Z,"110 km S of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
212
+ 1976-01-04T23:28:56.000Z,58.98,-153.627,29,4.8,mb,,,,,us,usp0000e9v,2014-11-06T23:21:33.391Z,"81 km SE of Pope-Vannoy Landing, Alaska",earthquake,,,,,reviewed,us,us
213
+ 1976-01-08T13:26:44.800Z,57.536,-152.84,55,4.5,mb,,,,,us,usp0000ebu,2014-11-06T23:21:33.433Z,"19 km SSW of Womens Bay, Alaska",earthquake,,,,,reviewed,us,us
214
+ 1976-01-09T07:56:07.000Z,51.401,-178.945,52,4.5,mb,,,,,us,usp0000eca,2014-11-06T23:21:33.443Z,"168 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
215
+ 1976-01-25T18:52:40.900Z,59.89,-141.55,91,4.5,mb,,,,,us,usp0000eqz,2014-11-06T23:21:33.706Z,"109 km WNW of Yakutat, Alaska",earthquake,,,,,reviewed,us,us
216
+ 1976-01-26T01:41:34.600Z,60.132,-153.167,148,4.6,mb,,,,,us,usp0000er9,2014-11-06T23:21:33.713Z,"64 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
217
+ 1976-02-05T09:36:36.500Z,59.985,-149.348,35,5.2,mb,,,,,us,usp0000exx,2022-04-27T17:15:36.791Z,"11 km SSE of Lowell Point, Alaska",earthquake,,,,,reviewed,us,us
218
+ 1976-02-07T10:34:54.300Z,55.327,-160.282,75,4.7,mb,,,,,us,usp0000ez0,2014-11-06T23:21:34.002Z,"13 km E of Sand Point, Alaska",earthquake,,,,,reviewed,us,us
219
+ 1976-02-15T01:56:51.000Z,52.49,-169.751,61,4.5,mb,,,,,us,usp0000f2g,2014-11-06T23:21:34.083Z,"78 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
220
+ 1976-02-18T08:00:58.600Z,51.573,-178.676,39,4.9,mb,,,,,us,usp0000f3q,2022-04-27T17:16:19.437Z,"145 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
221
+ 1976-02-19T04:55:41.900Z,66.366,-135.702,33,5,mb,,,,,us,usp0000f43,2022-04-27T17:16:34.756Z,"124 km SSW of Fort McPherson, Canada",earthquake,,,,,reviewed,us,us
222
+ 1976-02-19T10:28:33.500Z,52.495,-179.521,212,4.9,mb,,,,,us,usp0000f4a,2014-11-06T23:21:34.127Z,"209 km WNW of Adak, Alaska",earthquake,,,,,reviewed,us,us
223
+ 1976-02-19T22:01:27.100Z,53.471,-164.5,33,5,mb,,,,,us,usp0000f4g,2014-11-06T23:21:34.131Z,"111 km SE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
224
+ 1976-02-19T23:19:16.200Z,53.529,-164.736,44,4.7,mb,,,,,us,usp0000f4k,2014-11-06T23:21:34.133Z,"96 km SE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
225
+ 1976-02-22T05:58:27.700Z,52.243,-169.508,44,5.3,mb,,,,,us,usp0000f5p,2022-04-27T17:17:26.591Z,"88 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
226
+ 1976-02-22T07:21:25.800Z,51.726,-176.866,58,5,mb,,,,,us,usp0000f5s,2014-11-06T23:21:34.161Z,"22 km SW of Adak, Alaska",earthquake,,,,,reviewed,us,us
227
+ 1976-02-23T03:08:59.700Z,52.048,-169.478,26,5,mb,,,,,us,usp0000f69,2014-11-06T23:21:34.174Z,"107 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
228
+ 1976-02-23T15:14:16.000Z,51.471,-130.442,16,6,ms,,,,,us,usp0000f6k,2025-12-19T20:22:53.460Z,"254 km WNW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
229
+ 1976-02-23T16:12:26.800Z,51.582,-130.067,33,4.6,mb,,,,,us,usp0000f6n,2014-11-06T23:21:34.182Z,"236 km WNW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
230
+ 1976-02-28T09:43:58.000Z,51.562,-178.541,32,4.8,mb,,,,,us,usp0000f8j,2014-11-06T23:21:34.231Z,"136 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
231
+ 1976-03-06T12:21:56.900Z,58.24,-157.103,155,4.5,mb,,,,,us,usp0000fb3,2014-11-06T23:21:34.285Z,"16 km E of Egegik, Alaska",earthquake,,,,,reviewed,us,us
232
+ 1976-03-08T02:28:47.700Z,51.339,-178.035,54,4.7,mb,,,,,us,usp0000fbt,2014-11-06T23:21:34.299Z,"113 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
233
+ 1976-03-10T06:30:01.500Z,51.143,-179.1,58,4.8,mb,,,,,us,usp0000fcv,2014-11-06T23:21:34.321Z,"189 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
234
+ 1976-03-13T23:10:38.400Z,68.032,-158.222,53,4.5,mb,,,,,us,usp0000feg,2014-11-06T23:21:34.357Z,"106 km N of Ambler, Alaska",earthquake,,,,,reviewed,us,us
235
+ 1976-03-14T06:45:21.400Z,53.043,-174.899,222,4.6,mb,,,,,us,usp0000fen,2014-11-06T23:21:34.360Z,"105 km NNW of Atka, Alaska",earthquake,,,,,reviewed,us,us
236
+ 1976-03-21T17:33:28.000Z,52.801,-166.836,33,4.8,mb,,,,,us,usp0000fjc,2014-11-06T23:21:34.491Z,"121 km S of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
237
+ 1976-03-22T05:09:08.000Z,54.026,-166.14,79,4.8,mb,,,,,us,usp0000fjn,2014-11-06T23:21:34.497Z,"26 km WSW of Akutan, Alaska",earthquake,,,,,reviewed,us,us
238
+ 1976-03-24T15:44:59.900Z,53.274,-169.499,110,4.9,mb,,,,,us,usp0000fkf,2014-11-06T23:21:34.583Z,"56 km NW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
239
+ 1976-03-25T07:49:33.600Z,57.009,-153.705,28,5,mb,,,,,us,usp0000fkz,2014-11-06T23:21:34.594Z,"29 km ENE of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
240
+ 1976-03-28T06:55:15.200Z,52.701,-167.153,36,5.2,mb,,,,,us,usp0000fny,2026-01-07T18:55:19.914Z,"118 km ESE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
241
+ 1976-04-02T22:52:24.900Z,52.175,-169.57,34,4.8,mb,,,,,us,usp0000frb,2014-11-06T23:21:34.714Z,"97 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
242
+ 1976-04-03T00:20:31.600Z,52.346,-169.608,33,4.9,mb,,,,,us,usp0000fre,2014-11-06T23:21:34.716Z,"83 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
243
+ 1976-04-03T00:26:54.000Z,52.15,-169.614,22,5,ms,,,,,us,usp0000frf,2025-12-19T20:21:20.751Z,"101 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
244
+ 1976-04-03T00:56:10.700Z,52.231,-169.531,33,4.6,mb,,,,,us,usp0000frg,2014-11-06T23:21:34.717Z,"90 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
245
+ 1976-04-04T01:30:00.800Z,52.178,-169.492,37,4.5,mb,,,,,us,usp0000frt,2014-11-06T23:21:34.723Z,"94 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
246
+ 1976-04-04T02:31:48.200Z,52.049,-169.549,24,4.5,mb,,,,,us,usp0000fru,2014-11-06T23:21:34.724Z,"109 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
247
+ 1976-04-04T02:36:12.200Z,52.263,-169.538,15,4.8,mb,,,,,us,usp0000frv,2014-11-06T23:21:34.724Z,"88 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
248
+ 1976-04-06T14:33:11.400Z,51.437,-179.128,64,4.7,mb,,,,,us,usp0000fsn,2014-11-06T23:21:34.740Z,"179 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
249
+ 1976-04-12T04:41:51.400Z,52.405,-170.189,38,5.2,mb,,,,,us,usp0000fur,2014-11-06T23:21:34.785Z,"107 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
250
+ 1976-04-20T07:59:53.800Z,53.534,-165.465,46,5.5,ms,,,,,us,usp0000fz2,2014-11-06T23:21:34.879Z,"69 km SSE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
251
+ 1976-04-20T14:27:20.600Z,60.408,-140.649,33,4.8,mb,,,,,us,usp0000fz9,2022-04-27T17:12:14.679Z,"108 km NNW of Yakutat, Alaska",earthquake,,,,,reviewed,us,us
252
+ 1976-05-03T17:47:29.500Z,58.913,-154.395,142,4.7,mb,,,,,us,usp0000g4r,2014-11-06T23:21:34.996Z,"62 km SSE of Kokhanok, Alaska",earthquake,,,,,reviewed,us,us
253
+ 1976-05-09T00:09:50.700Z,59.858,-153.069,38,4.7,mb,,,,,us,usp0000g7t,2014-11-06T23:21:35.069Z,"58 km E of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
254
+ 1976-05-13T07:11:44.000Z,53.114,-132.099,26,4.8,mb,,,,,us,usp0000gar,2014-11-06T23:21:35.255Z,"177 km SW of Prince Rupert, Canada",earthquake,,,,,reviewed,us,us
255
+ 1976-05-21T11:15:24.500Z,51.72,-173.541,45,4.9,mb,,,,,us,usp0000gf3,2014-11-06T23:21:35.358Z,"69 km SE of Atka, Alaska",earthquake,,,,,reviewed,us,us
256
+ 1976-05-26T17:38:22.200Z,57.966,-153.3,33,4.5,mb,,,,,us,usp0000gj8,2014-11-06T23:21:35.426Z,"25 km WSW of Aleneva, Alaska",earthquake,,,,,reviewed,us,us
257
+ 1976-05-27T05:55:52.500Z,54.131,-163.717,15,4.8,mb,,,,,us,usp0000gjh,2014-11-06T23:21:35.430Z,"82 km SSW of False Pass, Alaska",earthquake,,,,,reviewed,us,us
258
+ 1976-06-06T17:44:09.100Z,51.497,-178.03,54,5.2,mb,,,,,us,usp0000grr,2014-11-06T23:21:35.567Z,"105 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
259
+ 1976-06-08T11:31:35.900Z,53.91,-163.457,49,4.5,mb,,,,,us,usp0000gsn,2014-11-06T23:21:35.588Z,"105 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
260
+ 1976-06-09T10:20:54.800Z,51.653,-176.502,64,4.5,mb,,,,,us,usp0000gt4,2014-11-06T23:21:35.599Z,"26 km SSE of Adak, Alaska",earthquake,,,,,reviewed,us,us
261
+ 1976-06-10T08:57:59.600Z,51.518,-176.539,58,4.5,mb,,,,,us,usp0000gtp,2014-11-06T23:21:35.611Z,"40 km S of Adak, Alaska",earthquake,,,,,reviewed,us,us
262
+ 1976-06-14T17:11:56.500Z,51.849,-171.477,48,4.5,mb,,,,,us,usp0000gvq,2014-11-06T23:21:35.653Z,"190 km ESE of Atka, Alaska",earthquake,,,,,reviewed,us,us
263
+ 1976-06-14T18:01:34.100Z,51.751,-171.307,10,5.1,ms,,,,,us,usp0000gvr,2025-12-19T20:19:46.592Z,"204 km ESE of Atka, Alaska",earthquake,,,,,reviewed,us,us
264
+ 1976-06-17T02:44:58.900Z,57.431,-154.331,50,5.2,mb,,,,,us,usp0000gxb,2014-11-06T23:21:35.699Z,"17 km SSE of Karluk, Alaska",earthquake,,,,,reviewed,us,us
265
+ 1976-06-24T13:36:59.200Z,61.965,-150.895,73,4.8,mb,,,,,us,usp0000h19,2014-11-06T23:21:35.868Z,"26 km E of Skwentna, Alaska",earthquake,,,,,reviewed,us,us
266
+ 1976-07-02T16:28:38.500Z,60.634,-140.97,27,4.7,mb,,,,,us,usp0000h5p,2014-11-06T23:21:36.060Z,"138 km SE of McCarthy, Alaska",earthquake,,,,,reviewed,us,us
267
+ 1976-07-05T18:25:17.700Z,51.295,-179.142,61,4.6,mb,,,,,us,usp0000h6s,2014-11-06T23:21:36.087Z,"185 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
268
+ 1976-07-05T18:28:28.000Z,51.33,-179.156,54,5.2,mb,,,,,us,usp0000h6t,2014-11-06T23:21:36.087Z,"184 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
269
+ 1976-07-11T02:00:11.100Z,63.301,-150.803,133,4.5,mb,,,,,us,usp0000h8y,2014-11-06T23:21:36.141Z,"53 km ESE of Denali National Park, Alaska",earthquake,,,,,reviewed,us,us
270
+ 1976-07-12T01:59:15.300Z,62.858,-150.682,128,4.6,mb,,,,,us,usp0000h9y,2014-11-06T23:21:36.167Z,"40 km N of Petersville, Alaska",earthquake,,,,,reviewed,us,us
271
+ 1976-07-14T07:48:26.500Z,53.953,-162.78,33,4.7,mb,,,,,us,usp0000hbh,2014-11-06T23:21:36.207Z,"108 km SSE of False Pass, Alaska",earthquake,,,,,reviewed,us,us
272
+ 1976-07-20T11:17:09.900Z,55.62,-156.904,33,4.9,mb,,,,,us,usp0000het,2014-11-06T23:21:36.293Z,"120 km SE of Chignik, Alaska",earthquake,,,,,reviewed,us,us
273
+ 1976-07-22T14:30:17.700Z,51.485,-177.857,58,4.9,mb,,,,,us,usp0000hfj,2014-11-06T23:21:36.311Z,"95 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
274
+ 1976-08-11T20:43:45.500Z,51.699,-175.422,33,4.6,mb,,,,,us,usp0000ht7,2014-11-06T23:21:36.660Z,"85 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
275
+ 1976-08-16T05:11:38.900Z,51.497,-178.375,65,5.1,mb,,,,,us,usp0000hv4,2014-11-06T23:21:36.719Z,"127 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
276
+ 1976-08-16T10:11:33.300Z,51.488,-178.045,55,4.8,mb,,,,,us,usp0000hv5,2014-11-06T23:21:36.720Z,"106 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
277
+ 1976-08-22T02:01:47.400Z,60.22,-153.304,144,5.5,mb,,,,,us,usp0000hzy,2025-12-19T20:18:27.863Z,"56 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
278
+ 1976-08-28T02:30:09.200Z,52.597,-175.343,145,5.1,mb,,,,,us,usp0000j2n,2014-11-06T23:21:36.919Z,"89 km WNW of Atka, Alaska",earthquake,,,,,reviewed,us,us
279
+ 1976-08-28T17:29:30.700Z,51.22,-177.78,39,5,mb,,,,,us,usp0000j2z,2014-11-06T23:21:36.928Z,"107 km SW of Adak, Alaska",earthquake,,,,,reviewed,us,us
280
+ 1976-09-01T02:17:25.100Z,51.977,-176.171,116,4.5,mb,,,,,us,usp0000j53,2014-11-06T23:21:36.977Z,"33 km ENE of Adak, Alaska",earthquake,,,,,reviewed,us,us
281
+ 1976-09-04T23:23:46.000Z,62.931,-150.653,123,5.4,mb,,,,,us,usp0000j7f,2014-11-06T23:21:37.041Z,"48 km N of Petersville, Alaska",earthquake,,,,,reviewed,us,us
282
+ 1976-09-10T14:56:35.400Z,52.614,-170.65,33,4.6,mb,,,,,us,usp0000jaw,2025-12-19T20:17:01.300Z,"Fox Islands, Aleutian Islands, Alaska",earthquake,,,,,reviewed,us,us
283
+ 1976-09-11T02:40:25.800Z,51.883,-179.819,100,4.9,mb,,,,,us,usp0000jb5,2014-11-06T23:21:37.137Z,"219 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
284
+ 1976-09-21T03:01:04.600Z,57.843,-152.122,33,4.9,mb,,,,,us,usp0000jhp,2014-11-06T23:21:37.425Z,"17 km ENE of Kodiak, Alaska",earthquake,,,,,reviewed,us,us
285
+ 1976-09-22T02:30:25.700Z,51.723,-175.953,43,5.1,ms,,,,,us,usp0000jj5,2025-12-19T20:17:36.421Z,"49 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
286
+ 1976-10-18T00:36:31.600Z,63.29,-150.737,126,4.9,mb,,,,,us,usp0000jx9,2014-11-06T23:21:37.759Z,"56 km ESE of Denali National Park, Alaska",earthquake,,,,,reviewed,us,us
287
+ 1976-10-20T11:41:32.100Z,56.224,-153.18,22,5,mb,,,,,us,usp0000jyq,2014-11-06T23:21:37.793Z,"100 km SE of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
288
+ 1976-10-21T14:54:35.600Z,52.229,-169.39,36,5.4,mb,,,,,us,usp0000jze,2022-04-27T16:51:00.308Z,"86 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
289
+ 1976-10-21T15:13:18.700Z,52.333,-169.366,33,4.8,mb,,,,,us,usp0000jzg,2014-11-06T23:21:37.811Z,"75 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
290
+ 1976-10-22T18:35:25.900Z,56.143,-153.274,26,5.5,mb,,,,,us,usp0000jzy,2025-12-19T20:16:29.864Z,"105 km SSE of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
291
+ 1976-10-23T08:25:32.300Z,55.05,-165.973,194,4.6,mb,,,,,us,usp0000k09,2014-11-06T23:21:37.831Z,"102 km N of Akutan, Alaska",earthquake,,,,,reviewed,us,us
292
+ 1976-10-24T08:36:12.700Z,58.127,-153.282,59,5,mb,,,,,us,usp0000k0w,2014-11-06T23:21:37.846Z,"23 km WNW of Aleneva, Alaska",earthquake,,,,,reviewed,us,us
293
+ 1976-10-24T17:19:53.700Z,62.647,-149.139,75,4.9,mb,,,,,us,usp0000k13,2014-11-06T23:21:37.851Z,"54 km ENE of Chase, Alaska",earthquake,,,,,reviewed,us,us
294
+ 1976-10-25T11:10:45.300Z,56.196,-153.438,33,4.8,mb,,,,,us,usp0000k1j,2014-11-06T23:21:37.862Z,"94 km SSE of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
295
+ 1976-10-25T11:24:07.200Z,57.171,-166.224,33,4.5,mb,,,,,us,usp0000k1k,2014-11-06T23:21:37.862Z,"212 km ENE of Saint George, Alaska",earthquake,,,,,reviewed,us,us
296
+ 1976-10-28T15:29:20.800Z,52.982,-167.813,50,4.9,mb,,,,,us,usp0000k36,2014-11-06T23:21:37.900Z,"70 km E of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
297
+ 1976-10-31T23:13:45.600Z,59.827,-153.168,131,4.6,mb,,,,,us,usp0000k4x,2014-11-06T23:21:37.979Z,"52 km E of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
298
+ 1976-11-06T00:08:16.400Z,60.05,-153.517,119,4.9,mb,,,,,us,usp0000k73,2014-11-06T23:21:38.025Z,"44 km NE of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
299
+ 1976-11-09T20:17:19.400Z,50.589,-129.761,33,4.6,mb,,,,,us,usp0000k90,2014-11-06T23:21:38.163Z,"189 km W of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
300
+ 1976-11-12T06:40:39.000Z,71.785,-137.505,33,4.9,mb,,,,,us,usp0000k9v,2014-11-06T23:21:38.190Z,"289 km NE of Kaktovik, Alaska",earthquake,,,,,reviewed,us,us
301
+ 1976-11-30T06:22:35.300Z,59.916,-153.356,127,4.7,mb,,,,,us,usp0000kjh,2014-11-06T23:21:38.432Z,"44 km ENE of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
302
+ 1976-12-26T14:47:38.100Z,55.239,-159.475,40,5.1,mb,,,,,us,usp0000ky8,2014-11-06T23:21:38.999Z,"65 km E of Sand Point, Alaska",earthquake,,,,,reviewed,us,us
303
+ 1977-01-03T01:34:34.200Z,51.429,-179.085,33,4.8,mb,,,,,us,usp0000m1q,2014-11-06T23:21:39.208Z,"176 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
304
+ 1977-01-06T16:02:07.600Z,51.479,-175.478,38,5.3,ms,,,,,us,usp0000m33,2025-12-19T20:07:10.296Z,"91 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
305
+ 1977-01-13T22:05:59.300Z,59.433,-142.228,33,4.5,ml,,,,,us,usp0000m5t,2014-11-06T23:21:39.321Z,"142 km W of Yakutat, Alaska",earthquake,,,,,reviewed,us,pmr
306
+ 1977-01-17T09:42:25.600Z,53.867,-158.212,22,5.1,mb,,,,,us,usp0000m7d,2014-11-06T23:21:39.365Z,"220 km SE of Sand Point, Alaska",earthquake,,,,,reviewed,us,us
307
+ 1977-01-20T15:45:21.600Z,57.645,-138.022,36,4.5,mb,,,,,us,usp0000m99,2014-11-06T23:21:39.417Z,"112 km WSW of Pelican, Alaska",earthquake,,,,,reviewed,us,us
308
+ 1977-01-27T00:51:05.600Z,66.79,-135.433,33,4.7,mb,,,,,us,usp0000mc7,2014-11-06T23:21:39.525Z,"76 km SSW of Fort McPherson, Canada",earthquake,,,,,reviewed,us,us
309
+ 1977-02-20T07:02:20.400Z,57.041,-153.883,51,4.7,mb,,,,,us,usp0000mn9,2014-11-06T23:21:39.926Z,"Kodiak Island region, Alaska",earthquake,,,,,reviewed,us,us
310
+ 1977-02-21T20:02:06.000Z,55.913,-161.894,167,5,mb,,,,,us,usp0000mnt,2014-11-06T23:21:39.938Z,"44 km WSW of Nelson Lagoon, Alaska",earthquake,,,,,reviewed,us,us
311
+ 1977-02-25T03:20:36.500Z,58.702,-151.999,81,4.8,mb,,,,,us,usp0000mqm,2014-11-06T23:21:39.986Z,"72 km S of Port Graham, Alaska",earthquake,,,,,reviewed,us,us
312
+ 1977-03-09T06:06:30.400Z,52.755,-167.793,33,4.7,mb,,,,,us,usp0000mv1,2014-11-06T23:21:40.105Z,"74 km ESE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
313
+ 1977-03-16T06:22:17.700Z,55.489,-157.044,18,5.1,mb,,,,,us,usp0000mxt,2014-11-06T23:21:40.178Z,"123 km SE of Chignik, Alaska",earthquake,,,,,reviewed,us,us
314
+ 1977-03-16T15:46:30.600Z,50.804,-129.556,33,4.5,mb,,,,,us,usp0000my1,2014-11-06T23:21:40.185Z,"176 km W of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
315
+ 1977-03-25T13:39:45.200Z,60.843,-148.137,55,4.6,mb,,,,,us,usp0000n41,2014-11-06T23:21:40.462Z,"30 km ENE of Whittier, Alaska",earthquake,,,,,reviewed,us,us
316
+ 1977-03-26T04:36:14.700Z,52.295,-168.257,38,6,ms,,,,,us,usp0000n4d,2025-12-19T20:14:00.297Z,"82 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
317
+ 1977-03-26T14:09:28.400Z,53.019,-168.311,47,4.7,mb,,,,,us,usp0000n4p,2014-11-06T23:21:40.503Z,"38 km ENE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
318
+ 1977-03-26T16:29:36.300Z,52.125,-167.946,29,4.5,mb,,,,,us,usp0000n4u,2014-11-06T23:21:40.507Z,"109 km SE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
319
+ 1977-03-28T03:37:54.400Z,58.123,-156.769,61,4.5,mb,,,,,us,usp0000n5g,2014-11-06T23:21:40.525Z,"37 km ESE of Egegik, Alaska",earthquake,,,,,reviewed,us,us
320
+ 1977-04-02T01:36:41.200Z,52.817,-161.605,33,4.6,mb,,,,,us,usp0000n7w,2014-11-06T23:21:40.625Z,"254 km S of King Cove, Alaska",earthquake,,,,,reviewed,us,us
321
+ 1977-04-03T18:45:45.900Z,50.669,-129.858,4,4.7,mb,,,,,us,usp0000n8e,2014-11-06T23:21:40.639Z,"196 km W of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
322
+ 1977-04-11T19:23:10.800Z,51.106,-179.922,59,4.6,mb,,,,,us,usp0000nbv,2014-11-06T23:21:40.826Z,"243 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
323
+ 1977-04-13T18:20:43.300Z,51.699,-179.613,46,5.1,mb,,,,,us,usp0000nd9,2014-11-06T23:21:40.863Z,"206 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
324
+ 1977-04-16T04:02:17.100Z,52.018,-170.468,15,4.9,mb,,,,,us,usp0000ne5,2014-11-06T23:21:41.035Z,"149 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
325
+ 1977-04-20T00:19:13.500Z,51.118,-179.034,33,4.7,mb,,,,,us,usp0000nfu,2014-11-06T23:21:41.182Z,"186 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
326
+ 1977-04-20T12:11:49.100Z,59.451,-150.606,33,4.8,mb,,,,,us,usp0000ng3,2014-11-06T23:21:41.190Z,"38 km ESE of Halibut Cove, Alaska",earthquake,,,,,reviewed,us,us
327
+ 1977-04-20T15:02:51.600Z,62.848,-151.046,114,4.5,mb,,,,,us,usp0000ng4,2014-11-06T23:21:41.191Z,"41 km NNW of Petersville, Alaska",earthquake,,,,,reviewed,us,us
328
+ 1977-04-24T03:29:13.700Z,52.379,-169.073,59,4.5,mb,,,,,us,usp0000nkv,2014-11-06T23:21:41.408Z,"63 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
329
+ 1977-04-29T08:15:11.800Z,59.418,-145.004,8,4.7,mb,,,,,us,usp0000np5,2025-12-19T20:13:28.053Z,"132 km SSE of Cordova, Alaska",earthquake,,,,,reviewed,us,us
330
+ 1977-04-30T16:43:55.300Z,51.697,-173.421,38,4.6,mb,,,,,us,usp0000npw,2014-11-06T23:21:41.612Z,"77 km SE of Atka, Alaska",earthquake,,,,,reviewed,us,us
331
+ 1977-04-30T21:49:40.700Z,51.646,-173.431,42,4.8,ms,,,,,us,usp0000nq2,2014-11-06T23:21:41.616Z,"80 km SE of Atka, Alaska",earthquake,,,,,reviewed,us,us
332
+ 1977-05-07T04:09:32.100Z,61.647,-152.039,130,4.5,mb,,,,,us,usp0000nsg,2014-11-06T23:21:41.699Z,"51 km SW of Skwentna, Alaska",earthquake,,,,,reviewed,us,us
333
+ 1977-05-07T22:18:42.400Z,51.685,-173.231,33,4.8,mb,,,,,us,usp0000nsu,2014-11-06T23:21:41.708Z,"87 km SE of Atka, Alaska",earthquake,,,,,reviewed,us,us
334
+ 1977-05-15T15:50:47.100Z,52.446,-168.025,33,5.3,mb,,,,,us,usp0000nwh,2025-12-19T20:12:15.102Z,"78 km SE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
335
+ 1977-05-23T13:59:47.000Z,57.018,-153.231,33,4.6,mb,,,,,us,usp0000p06,2014-11-06T23:21:42.067Z,"21 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
336
+ 1977-05-30T15:16:01.600Z,52.428,-169.707,33,6,ms,,,,,us,usp0000p3a,2025-12-19T20:12:47.627Z,"80 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
337
+ 1977-06-07T03:51:46.700Z,51.659,-179.125,56,4.5,mb,,,,,us,usp0000p6p,2014-11-06T23:21:42.274Z,"173 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
338
+ 1977-06-10T04:45:08.800Z,59.754,-153.463,131,4.5,mb,,,,,us,usp0000p7y,2014-11-06T23:21:42.310Z,"36 km E of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
339
+ 1977-06-13T15:12:50.000Z,57.29,-155.073,53,4.6,mb,,,,,us,usp0000p9h,2014-11-06T23:21:42.382Z,"48 km SW of Karluk, Alaska",earthquake,,,,,reviewed,us,us
340
+ 1977-06-15T09:18:25.400Z,56.299,-153.277,33,4.6,mb,,,,,us,usp0000pa9,2014-11-06T23:21:42.436Z,"90 km SE of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
341
+ 1977-06-16T01:24:54.300Z,60.018,-153.588,176,4.7,mb,,,,,us,usp0000pam,2014-11-06T23:21:42.446Z,"38 km NE of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
342
+ 1977-06-29T08:47:15.600Z,51.774,-176.216,60,5,mb,,,,,us,usp0000phu,2014-11-06T23:21:42.779Z,"30 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
343
+ 1977-07-03T12:55:41.400Z,52.523,-167.479,33,5,mb,,,,,us,usp0000pkf,2026-01-07T19:27:44.096Z,"104 km ESE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
344
+ 1977-07-03T17:29:49.300Z,52.616,-167.475,33,4.7,mb,,,,,us,usp0000pkj,2014-11-06T23:21:42.836Z,"100 km ESE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
345
+ 1977-07-07T15:58:24.800Z,52.304,-170.889,52,5,mb,,,,,us,usp0000pmu,2014-11-06T23:21:42.878Z,"154 km WSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
346
+ 1977-07-08T11:45:27.600Z,52.131,-171.316,43,4.7,mb,,,,,us,usp0000pn1,2014-11-06T23:21:42.885Z,"189 km WSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
347
+ 1977-07-08T19:59:39.900Z,61.168,-150.855,72,4.7,mb,,,,,us,usp0000pn4,2014-11-06T23:21:42.887Z,"12 km ENE of Beluga, Alaska",earthquake,,,,,reviewed,us,us
348
+ 1977-07-11T15:57:17.200Z,64.561,-147.266,14,4.5,mb,,,,,us,usp0000ppf,2014-11-06T23:21:42.926Z,"15 km SW of Eielson Air Force Base, Alaska",earthquake,,,,,reviewed,us,us
349
+ 1977-07-14T10:47:13.500Z,55.539,-155.598,33,4.7,mb,,,,,us,usp0000pqq,2014-11-06T23:21:42.962Z,"179 km SSW of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
350
+ 1977-07-20T10:36:05.800Z,51.594,-179.454,33,4.7,mb,,,,,us,usp0000pt7,2014-11-06T23:21:43.037Z,"197 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
351
+ 1977-07-20T13:24:25.900Z,54.612,-161.599,53,5.3,mb,,,,,us,usp0000pt9,2022-04-27T16:19:34.198Z,"68 km SE of King Cove, Alaska",earthquake,,,,,reviewed,us,us
352
+ 1977-07-23T13:44:54.600Z,54.316,-162.414,27,5.1,mb,,,,,us,usp0000pus,2014-11-06T23:21:43.085Z,"83 km S of King Cove, Alaska",earthquake,,,,,reviewed,us,us
353
+ 1977-08-07T23:26:53.500Z,52.347,-176.318,125,5.3,mb,,,,,us,usp0000q0s,2014-11-06T23:21:43.391Z,"56 km NNE of Adak, Alaska",earthquake,,,,,reviewed,us,us
354
+ 1977-08-10T09:35:58.700Z,56.636,-152.728,33,5,mb,,,,,us,usp0000q1p,2014-11-06T23:21:43.449Z,"72 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
355
+ 1977-08-15T00:24:33.200Z,51.591,-176.378,63,4.5,mb,,,,,us,usp0000q3k,2014-11-06T23:21:43.511Z,"36 km SSE of Adak, Alaska",earthquake,,,,,reviewed,us,us
356
+ 1977-08-17T16:48:31.300Z,51.867,-175.342,57,5.4,mb,,,,,us,usp0000q57,2022-04-27T16:14:25.463Z,"86 km WSW of Atka, Alaska",earthquake,,,,,reviewed,us,us
357
+ 1977-08-27T03:51:50.400Z,56.945,-151.718,33,4.7,mb,,,,,us,usp0000qbj,2014-11-06T23:21:43.771Z,"81 km SSE of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
358
+ 1977-08-29T20:59:59.200Z,51.563,-173.968,25,5.4,mb,,,,,us,usp0000qd1,2025-12-19T20:09:38.756Z,"72 km SSE of Atka, Alaska",earthquake,,,,,reviewed,us,us
359
+ 1977-08-29T22:03:37.800Z,51.668,-174.023,37,4.6,mb,,,,,us,usp0000qd2,2014-11-06T23:21:43.820Z,"60 km SSE of Atka, Alaska",earthquake,,,,,reviewed,us,us
360
+ 1977-08-29T22:08:53.600Z,51.665,-173.942,30,4.8,mb,,,,,us,usp0000qd3,2014-11-06T23:21:43.820Z,"61 km SSE of Atka, Alaska",earthquake,,,,,reviewed,us,us
361
+ 1977-08-30T02:07:58.700Z,51.718,-174.038,42,4.6,mb,,,,,us,usp0000qd5,2014-11-06T23:21:43.822Z,"54 km SSE of Atka, Alaska",earthquake,,,,,reviewed,us,us
362
+ 1977-08-30T06:50:39.900Z,63.161,-151.109,130,5,mb,,,,,us,usp0000qd7,2014-11-06T23:21:43.824Z,"52 km SE of Denali National Park, Alaska",earthquake,,,,,reviewed,us,us
363
+ 1977-08-30T15:12:27.600Z,51.382,-173.785,33,5.4,mb,,,,,us,usp0000qdh,2025-12-19T20:09:41.170Z,"95 km SSE of Atka, Alaska",earthquake,,,,,reviewed,us,us
364
+ 1977-08-30T20:45:01.700Z,56.632,-152.529,20,4.9,mb,,,,,us,usp0000qdn,2014-11-06T23:21:43.837Z,"79 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
365
+ 1977-08-31T08:58:27.100Z,51.499,-173.853,43,4.8,mb,,,,,us,usp0000qe2,2014-11-06T23:21:43.850Z,"81 km SSE of Atka, Alaska",earthquake,,,,,reviewed,us,us
366
+ 1977-09-09T15:58:56.400Z,62.187,-149.527,59,4.6,mb,,,,,us,usp0000qjn,2014-11-06T23:21:44.042Z,"17 km E of Susitna North, Alaska",earthquake,,,,,reviewed,us,us
367
+ 1977-09-17T16:28:54.200Z,50.446,-173.412,33,4.8,mb,,,,,us,usp0000qpt,2014-11-06T23:21:44.241Z,"202 km SSE of Atka, Alaska",earthquake,,,,,reviewed,us,us
368
+ 1977-09-17T18:26:29.900Z,61.033,-152.915,150,4.8,mb,,,,,us,usp0000qpv,2014-11-06T23:21:44.243Z,"96 km W of Tyonek, Alaska",earthquake,,,,,reviewed,us,us
369
+ 1977-09-19T08:07:37.300Z,59.91,-152.845,116,4.8,mb,,,,,us,usp0000qqk,2014-11-06T23:21:44.263Z,"58 km WNW of Anchor Point, Alaska",earthquake,,,,,reviewed,us,us
370
+ 1977-09-19T22:18:24.000Z,60.193,-152.53,104,4.5,mb,,,,,us,usp0000qqu,2014-11-06T23:21:44.269Z,"50 km WNW of Ninilchik, Alaska",earthquake,,,,,reviewed,us,us
371
+ 1977-09-21T10:35:26.600Z,51.371,-178.359,30,4.9,mb,,,,,us,usp0000qrj,2014-11-06T23:21:44.291Z,"131 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
372
+ 1977-09-21T14:49:54.600Z,56.658,-152.443,20,4.8,mb,,,,,us,usp0000qrn,2014-11-06T23:21:44.295Z,"80 km SE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
373
+ 1977-10-11T05:03:11.600Z,51.137,-176.837,33,4.7,mb,,,,,us,usp0000qzu,2014-11-06T23:21:44.567Z,"83 km S of Adak, Alaska",earthquake,,,,,reviewed,us,us
374
+ 1977-10-13T00:08:14.700Z,51.303,-178.582,28,5.3,ms,,,,,us,usp0000r0t,2014-11-06T23:21:44.603Z,"149 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
375
+ 1977-10-16T04:25:40.000Z,59.881,-152.546,82,4.6,mb,,,,,us,usp0000r27,2014-11-06T23:21:44.648Z,"41 km WNW of Anchor Point, Alaska",earthquake,,,,,reviewed,us,us
376
+ 1977-10-16T16:29:04.500Z,59.051,-153.062,87,4.7,mb,,,,,us,usp0000r2g,2014-11-06T23:21:44.656Z,"73 km WSW of Nanwalek, Alaska",earthquake,,,,,reviewed,us,us
377
+ 1977-10-18T07:03:53.500Z,54.804,-154.634,33,4.9,mb,,,,,us,usp0000r3c,2014-11-06T23:21:44.697Z,"240 km S of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
378
+ 1977-10-19T02:16:02.600Z,62.883,-150.559,102,5,mb,,,,,us,usp0000r3u,2014-11-06T23:21:44.711Z,"44 km NNE of Petersville, Alaska",earthquake,,,,,reviewed,us,us
379
+ 1977-10-21T19:09:47.200Z,52.347,-171.44,67,5.3,mb,,,,,us,usp0000r5v,2022-04-27T16:10:54.053Z,"186 km WSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
380
+ 1977-10-24T07:09:41.200Z,56.528,-161.715,198,4.7,mb,,,,,us,usp0000r6y,2014-11-06T23:21:44.896Z,"66 km NNW of Nelson Lagoon, Alaska",earthquake,,,,,reviewed,us,us
381
+ 1977-10-31T23:03:20.700Z,53.115,-169.068,97,4.5,mb,,,,,us,usp0000ray,2014-11-06T23:21:45.033Z,"23 km NW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
382
+ 1977-11-04T09:52:55.700Z,51.659,-175.952,33,6.7,ms,,,,,us,usp0000rc6,2025-12-19T20:05:32.451Z,"52 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
383
+ 1977-11-04T10:02:03.700Z,51.528,-175.502,33,5.2,mb,,,,,us,usp0000rc7,2014-11-06T23:21:45.074Z,"87 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
384
+ 1977-11-04T11:04:14.900Z,51.386,-175.354,33,4.7,mb,,,,,us,usp0000rc8,2014-11-06T23:21:45.075Z,"103 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
385
+ 1977-11-04T18:07:31.300Z,51.429,-175.558,33,5.4,ms,,,,,us,usp0000rcg,2025-12-19T20:05:33.783Z,"89 km SE of Adak, Alaska",earthquake,,,,,reviewed,us,us
386
+ 1977-11-05T14:44:03.300Z,51.544,-175.546,33,5.6,ms,,,,,us,usp0000rcy,2025-12-19T20:05:36.277Z,"83 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
387
+ 1977-11-06T07:34:25.400Z,51.259,-179.812,33,5,mb,,,,,us,usp0000rd4,2014-11-06T23:21:45.102Z,"230 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
388
+ 1977-11-06T15:25:40.800Z,51.267,-175.392,33,4.8,mb,,,,,us,usp0000rd9,2014-11-06T23:21:45.107Z,"109 km SE of Adak, Alaska",earthquake,,,,,reviewed,us,us
389
+ 1977-11-06T18:42:14.300Z,51.216,-178.343,33,4.6,mb,,,,,us,usp0000rdd,2014-11-06T23:21:45.110Z,"139 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
390
+ 1977-11-07T05:32:44.900Z,57.319,-151.934,45,4.5,mb,,,,,us,usp0000rdh,2014-11-06T23:21:45.114Z,"38 km SSE of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
391
+ 1977-11-14T19:29:01.800Z,52.477,-170.686,69,4.9,mb,,,,,us,usp0000rgy,2014-11-06T23:21:45.226Z,"133 km WSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
392
+ 1977-11-15T04:57:14.000Z,54.948,-160.031,39,5.1,mb,,,,,us,usp0000rh4,2014-11-06T23:21:45.231Z,"52 km SE of Sand Point, Alaska",earthquake,,,,,reviewed,us,us
393
+ 1977-11-19T22:03:48.300Z,51.494,-174.32,47,4.7,mb,,,,,us,usp0000rma,2014-11-06T23:21:45.332Z,"78 km S of Atka, Alaska",earthquake,,,,,reviewed,us,us
394
+ 1977-11-20T18:53:57.800Z,62.429,-150.661,79,4.9,mb,,,,,us,usp0000rmp,2014-11-06T23:21:45.342Z,"Central Alaska",earthquake,,,,,reviewed,us,us
395
+ 1977-11-23T05:33:18.000Z,56.613,-152.754,33,4.7,mb,,,,,us,usp0000rnx,2014-11-06T23:21:45.381Z,"73 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
396
+ 1977-11-23T16:55:20.400Z,52.195,-171.546,53,5.5,ms,,,,,us,usp0000rps,2025-12-19T20:06:00.505Z,"181 km E of Atka, Alaska",earthquake,,,,,reviewed,us,us
397
+ 1977-11-25T23:37:13.200Z,51.859,-179.989,88,5,mb,,,,,us,usp0000rsd,2014-11-06T23:21:45.485Z,"231 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
398
+ 1977-11-27T10:46:43.800Z,51.343,-166.338,33,5,mb,,,,,us,usp0000rtm,2014-11-06T23:21:45.547Z,"247 km SE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
399
+ 1977-11-27T15:05:06.800Z,58.558,-155.383,116,4.9,mb,,,,,us,usp0000rtr,2025-12-19T20:06:06.658Z,"75 km ESE of King Salmon, Alaska",earthquake,,,,,reviewed,us,us
400
+ 1977-11-28T13:06:37.800Z,53.026,-174.998,232,4.6,mb,,,,,us,usp0000rux,2014-11-06T23:21:45.637Z,"106 km NNW of Atka, Alaska",earthquake,,,,,reviewed,us,us
401
+ 1977-12-08T01:58:05.800Z,59.446,-151.36,65,4.7,mb,,,,,us,usp0000rze,2014-11-06T23:21:45.873Z,"16 km ESE of Seldovia Village, Alaska",earthquake,,,,,reviewed,us,us
402
+ 1977-12-16T21:49:21.700Z,59.766,-153.453,118,4.9,mb,,,,,us,usp0000s3v,2014-11-06T23:21:45.993Z,"36 km E of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
403
+ 1977-12-17T11:32:24.400Z,52.23,-170.097,44,5.1,ms,,,,,us,usp0000s42,2022-04-27T16:01:48.635Z,"115 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
404
+ 1977-12-17T17:27:27.500Z,52.21,-170.025,40,5.5,ms,,,,,us,usp0000s4a,2025-12-19T20:05:03.301Z,"113 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
405
+ 1977-12-18T00:58:11.700Z,57.611,-151.258,29,4.7,mb,,,,,us,usp0000s4h,2014-11-06T23:21:46.013Z,"61 km E of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
406
+ 1977-12-19T10:52:38.900Z,51.194,-176.437,53,5.1,mb,,,,,us,usp0000s50,2025-12-19T20:05:06.928Z,"76 km S of Adak, Alaska",earthquake,,,,,reviewed,us,us
407
+ 1977-12-19T20:31:22.700Z,51.343,-176.374,54,4.6,mb,,,,,us,usp0000s56,2014-11-06T23:21:46.029Z,"61 km SSE of Adak, Alaska",earthquake,,,,,reviewed,us,us
408
+ 1977-12-27T15:09:51.000Z,60.391,-153.7,175,5.1,mb,,,,,us,usp0000s8n,2025-12-19T20:05:26.213Z,"40 km ENE of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
409
+ 1977-12-28T18:49:55.900Z,51.364,-173.296,33,4.5,mb,,,,,us,usp0000s94,2014-11-06T23:21:46.151Z,"111 km SSE of Atka, Alaska",earthquake,,,,,reviewed,us,us
410
+ 1977-12-30T09:02:44.100Z,52.148,-169.586,38,5,mb,,,,,us,usp0000s9v,2014-11-06T23:21:46.173Z,"100 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
411
+ 1977-12-30T14:56:16.200Z,51.935,-172.85,33,4.8,mb,,,,,us,usp0000s9y,2014-11-06T23:21:46.176Z,"97 km ESE of Atka, Alaska",earthquake,,,,,reviewed,us,us
412
+ 1978-01-02T20:57:38.200Z,51.103,-178.146,33,5.1,mb,,,,,us,usp0000sbb,2014-11-06T23:21:46.221Z,"135 km SW of Adak, Alaska",earthquake,,,,,reviewed,us,us
413
+ 1978-01-05T21:00:13.200Z,56.024,-154.275,33,4.9,mb,,,,,us,usp0000scg,2014-11-06T23:21:46.262Z,"102 km S of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
414
+ 1978-01-06T07:08:43.800Z,51.775,-176.01,63,5.3,mb,,,,,us,usp0000scp,2022-04-27T15:57:28.949Z,"44 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
415
+ 1978-01-06T21:59:01.100Z,60.909,-149.382,45,4.6,mb,,,,,us,usp0000scv,2014-11-06T23:21:46.273Z,"3 km NE of Sunrise, Alaska",earthquake,,,,,reviewed,us,us
416
+ 1978-01-08T22:13:57.100Z,57.115,-153.406,26,4.8,mb,,,,,us,usp0000sdp,2014-11-06T23:21:46.297Z,"11 km SSW of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
417
+ 1978-01-13T08:25:31.600Z,52.748,-132.08,33,5,mb,,,,,us,usp0000sft,2014-11-06T23:21:46.384Z,"209 km SSW of Prince Rupert, Canada",earthquake,,,,,reviewed,us,us
418
+ 1978-01-14T20:30:38.700Z,54.17,-164.086,40,4.8,mb,,,,,us,usp0000sh2,2014-11-06T23:21:46.539Z,"87 km SSW of False Pass, Alaska",earthquake,,,,,reviewed,us,us
419
+ 1978-01-15T21:08:58.700Z,59.159,-144.391,33,4.7,mb,,,,,us,usp0000sht,2014-11-06T23:21:46.562Z,"172 km SSE of Cordova, Alaska",earthquake,,,,,reviewed,us,us
420
+ 1978-01-18T04:51:51.100Z,52.176,-170.347,33,4.6,mb,,,,,us,usp0000sk9,2014-11-06T23:21:46.608Z,"131 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
421
+ 1978-01-25T21:43:03.600Z,52.126,-169.808,21,5,mb,,,,,us,usp0000spv,2014-11-06T23:21:46.723Z,"110 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
422
+ 1978-01-26T03:10:55.800Z,54.562,-155.725,33,4.7,mb,,,,,us,usp0000sq1,2014-11-06T23:21:46.729Z,"256 km SE of Chignik, Alaska",earthquake,,,,,reviewed,us,us
423
+ 1978-01-27T18:52:59.200Z,60.374,-151.123,70,4.7,mb,,,,,us,usp0000sqk,2014-11-06T23:21:46.748Z,"9 km ENE of Kasilof, Alaska",earthquake,,,,,reviewed,us,us
424
+ 1978-01-28T18:53:06.800Z,60.071,-151.328,77,4.5,mb,,,,,us,usp0000sr4,2014-11-06T23:21:46.763Z,"18 km SSE of Clam Gulch, Alaska",earthquake,,,,,reviewed,us,us
425
+ 1978-02-12T08:56:38.900Z,59.448,-152.622,72,5.4,mb,,,,,us,usp0000sxz,2022-04-27T15:55:39.396Z,"41 km WNW of Nanwalek, Alaska",earthquake,,,,,reviewed,us,us
426
+ 1978-02-13T01:16:54.300Z,59.863,-153.757,131,4.9,mb,,,,,us,usp0000sy8,2014-11-06T23:21:47.001Z,"21 km ENE of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
427
+ 1978-02-16T14:52:42.000Z,59.435,-145.629,52,4.7,ms,,,,,us,usp0000t02,2014-11-06T23:21:47.085Z,"123 km S of Cordova, Alaska",earthquake,,,,,reviewed,us,us
428
+ 1978-02-16T18:33:42.300Z,52.38,-166.751,33,4.6,mb,,,,,us,usp0000t05,2014-11-06T23:21:47.088Z,"155 km ESE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
429
+ 1978-03-02T14:41:40.700Z,56.388,-158.282,88,4.9,mb,,,,,us,usp0000t6x,2014-11-06T23:21:47.434Z,"12 km NE of Chignik, Alaska",earthquake,,,,,reviewed,us,us
430
+ 1978-03-03T18:48:36.700Z,56.319,-152.801,35,4.5,mb,,,,,us,usp0000t7f,2014-11-06T23:21:47.450Z,"103 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
431
+ 1978-03-04T10:23:01.400Z,56.256,-152.723,20,4.6,mb,,,,,us,usp0000t7r,2014-11-06T23:21:47.459Z,"111 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
432
+ 1978-03-05T00:33:26.800Z,59.962,-153.498,155,4.5,mb,,,,,us,usp0000t7w,2014-11-06T23:21:47.463Z,"39 km ENE of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
433
+ 1978-03-06T18:40:23.600Z,51.761,-175.808,65,4.7,mb,,,,,us,usp0000t8t,2014-11-06T23:21:47.492Z,"58 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
434
+ 1978-03-14T02:30:23.600Z,51.967,-179.115,102,5.1,mb,,,,,us,usp0000tcv,2014-11-06T23:21:47.621Z,"170 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
435
+ 1978-03-15T15:01:51.400Z,52.26,-168.436,20,4.7,mb,,,,,us,usp0000tdn,2014-11-06T23:21:47.646Z,"80 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
436
+ 1978-03-16T02:00:50.400Z,52.267,-168.593,38,5.1,mb,,,,,us,usp0000tdy,2014-11-06T23:21:47.656Z,"76 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
437
+ 1978-03-16T02:09:38.400Z,52.295,-168.622,49,5.5,mb,,,,,us,usp0000tdz,2022-04-27T15:50:06.669Z,"73 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
438
+ 1978-03-16T02:31:10.500Z,52.433,-168.586,51,4.6,mb,,,,,us,usp0000te0,2014-11-06T23:21:47.659Z,"59 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
439
+ 1978-03-16T03:29:59.600Z,52.314,-168.581,33,5,mb,,,,,us,usp0000te2,2014-11-06T23:21:47.661Z,"72 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
440
+ 1978-03-20T03:59:05.000Z,60.182,-153.608,153,4.9,mb,,,,,us,usp0000tg0,2014-11-06T23:21:47.721Z,"39 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
441
+ 1978-03-22T15:45:20.300Z,64.879,-160.482,33,4.7,mb,,,,,us,usp0000thr,2014-11-06T23:21:47.775Z,"32 km E of Koyuk, Alaska",earthquake,,,,,reviewed,us,us
442
+ 1978-03-23T07:23:13.400Z,52.01,-169.465,23,5.8,ms,,,,,us,usp0000tk3,2022-04-27T15:51:29.749Z,"111 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
443
+ 1978-03-24T05:22:09.900Z,52.218,-169.518,33,4.7,mb,,,,,us,usp0000tmd,2014-11-06T23:21:47.870Z,"91 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
444
+ 1978-03-31T00:19:06.200Z,60.329,-152.521,128,4.5,mb,,,,,us,usp0000tux,2014-11-06T23:21:48.240Z,"56 km WNW of Ninilchik, Alaska",earthquake,,,,,reviewed,us,us
445
+ 1978-03-31T00:38:13.400Z,61.766,-151.409,90,5.1,mb,,,,,us,usp0000tuy,2025-12-19T20:03:17.493Z,"25 km S of Skwentna, Alaska",earthquake,,,,,reviewed,us,us
446
+ 1978-04-09T17:12:59.900Z,60.689,-151.839,101,4.5,mb,,,,,us,usp0000u04,2014-11-06T23:21:48.410Z,"29 km WNW of Salamatof, Alaska",earthquake,,,,,reviewed,us,us
447
+ 1978-04-11T05:12:55.100Z,53.535,-163.731,33,5.6,ms,,,,,us,usp0000u0v,2025-12-19T20:02:21.693Z,"148 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
448
+ 1978-04-12T03:42:03.500Z,56.423,-152.691,14,6.6,ms,,,,,us,usp0000u1x,2025-12-19T20:02:23.250Z,"94 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
449
+ 1978-04-12T03:48:55.600Z,56.738,-153.637,23,5.2,mb,,,,,us,usp0000u1y,2014-11-06T23:21:48.469Z,"39 km SE of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
450
+ 1978-04-12T04:16:05.700Z,56.496,-152.528,33,4.7,mb,,,,,us,usp0000u1z,2014-11-06T23:21:48.470Z,"91 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
451
+ 1978-04-12T04:20:40.000Z,57.691,-152.622,87,4.6,mb,,,,,us,usp0000u20,2014-11-06T23:21:48.471Z,"2 km ENE of Womens Bay, Alaska",earthquake,,,,,reviewed,us,us
452
+ 1978-04-12T04:26:56.500Z,56.627,-152.63,16,4.7,mb,,,,,us,usp0000u21,2014-11-06T23:21:48.472Z,"76 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
453
+ 1978-04-12T04:47:16.600Z,56.352,-152.559,15,4.6,mb,,,,,us,usp0000u22,2014-11-06T23:21:48.473Z,"105 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
454
+ 1978-04-12T05:22:28.900Z,56.463,-152.579,24,5.1,mb,,,,,us,usp0000u23,2022-04-27T15:46:38.356Z,"93 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
455
+ 1978-04-12T08:56:19.200Z,56.374,-152.543,19,4.6,mb,,,,,us,usp0000u24,2014-11-06T23:21:48.475Z,"103 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
456
+ 1978-04-12T09:33:38.200Z,56.576,-152.841,27,5.1,mb,,,,,us,usp0000u25,2014-11-06T23:21:48.475Z,"75 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
457
+ 1978-04-13T13:59:58.600Z,56.167,-152.173,33,4.5,mb,,,,,us,usp0000u2w,2014-11-06T23:21:48.500Z,"134 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
458
+ 1978-04-16T09:50:52.200Z,56.663,-152.757,24,4.9,mb,,,,,us,usp0000u4p,2014-11-06T23:21:48.565Z,"68 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
459
+ 1978-04-17T05:49:51.100Z,54.147,-163.962,33,4.8,mb,,,,,us,usp0000u51,2014-11-06T23:21:48.580Z,"86 km SSW of False Pass, Alaska",earthquake,,,,,reviewed,us,us
460
+ 1978-04-18T02:18:08.300Z,56.374,-152.845,33,4.5,mb,,,,,us,usp0000u55,2014-11-06T23:21:48.584Z,"96 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
461
+ 1978-04-19T01:49:03.500Z,60.135,-153.54,158,4.6,mb,,,,,us,usp0000u5t,2014-11-06T23:21:48.607Z,"43 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
462
+ 1978-04-22T13:24:04.800Z,56.483,-152.824,33,4.7,mb,,,,,us,usp0000u7f,2014-11-06T23:21:48.675Z,"Kodiak Island region, Alaska",earthquake,,,,,reviewed,us,us
463
+ 1978-04-24T04:28:47.000Z,51.645,-176.091,53,5.2,mb,,,,,us,usp0000u88,2022-04-27T15:46:53.410Z,"45 km SE of Adak, Alaska",earthquake,,,,,reviewed,us,us
464
+ 1978-04-25T07:36:06.200Z,60.053,-153.461,171,4.5,mb,,,,,us,usp0000u8x,2014-11-06T23:21:48.726Z,"46 km NE of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
465
+ 1978-04-27T01:41:17.300Z,56.573,-152.723,33,4.7,mb,,,,,us,usp0000u9w,2014-11-06T23:21:48.755Z,"78 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
466
+ 1978-05-05T05:32:47.400Z,63.302,-150.971,134,5.2,mb,,,,,us,usp0000udc,2014-11-06T23:21:48.885Z,"46 km SE of Denali National Park, Alaska",earthquake,,,,,reviewed,us,us
467
+ 1978-05-11T00:23:37.600Z,51.667,-176.1,59,5.9,ms,,,,,us,usp0000ug3,2025-12-19T20:01:21.877Z,"43 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
468
+ 1978-05-12T12:16:03.900Z,62.25,-149.398,67,5.1,mb,,,,,us,usp0000uh1,2025-12-19T20:01:25.610Z,"25 km ENE of Susitna North, Alaska",earthquake,,,,,reviewed,us,us
469
+ 1978-05-12T16:00:37.300Z,53.924,-164.137,33,4.9,mb,,,,,us,usp0000uh5,2014-11-06T23:21:49.101Z,"109 km ESE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
470
+ 1978-05-21T14:55:32.800Z,56.356,-152.582,33,4.7,mb,,,,,us,usp0000una,2014-11-06T23:21:49.241Z,"104 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
471
+ 1978-05-22T13:05:47.100Z,51.783,-176.882,62,4.7,mb,,,,,us,usp0000unt,2014-11-06T23:21:49.259Z,"19 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
472
+ 1978-05-24T06:16:55.400Z,51.232,-179.213,25,6.7,ms,,,,,us,usp0000uq0,2025-12-19T20:01:54.321Z,"192 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
473
+ 1978-05-24T06:33:17.600Z,51.144,-179.074,33,5,mb,,,,,us,usp0000uq1,2014-11-06T23:21:49.301Z,"187 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
474
+ 1978-05-24T06:47:25.100Z,51.461,-179.445,33,4.5,mb,,,,,us,usp0000uq2,2014-11-06T23:21:49.302Z,"199 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
475
+ 1978-05-24T07:19:10.900Z,51.151,-179.379,33,4.5,mb,,,,,us,usp0000uq3,2014-11-06T23:21:49.302Z,"206 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
476
+ 1978-05-24T07:20:54.400Z,51.267,-179.268,33,4.9,mb,,,,,us,usp0000uq4,2014-11-06T23:21:49.304Z,"194 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
477
+ 1978-05-24T07:49:30.600Z,51.306,-179.157,33,4.5,mb,,,,,us,usp0000uq7,2014-11-06T23:21:49.307Z,"185 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
478
+ 1978-05-24T09:23:56.700Z,51.202,-179.183,33,4.8,mb,,,,,us,usp0000uqd,2014-11-06T23:21:49.312Z,"191 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
479
+ 1978-05-24T09:53:03.400Z,51.128,-179.199,33,5.4,ms,,,,,us,usp0000uqh,2025-12-19T20:01:55.542Z,"196 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
480
+ 1978-05-24T18:54:29.800Z,51.452,-179.416,33,4.8,mb,,,,,us,usp0000uqs,2014-11-06T23:21:49.322Z,"198 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
481
+ 1978-05-24T23:49:37.300Z,51.238,-179.296,33,4.5,mb,,,,,us,usp0000uqv,2014-11-06T23:21:49.326Z,"197 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
482
+ 1978-05-26T20:01:57.800Z,51.166,-130.429,17,4.9,mb,,,,,us,usp0000us7,2014-11-06T23:21:49.369Z,"243 km WNW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
483
+ 1978-06-02T20:41:43.700Z,50.259,-127.688,21,5.2,ms,,,,,us,usp0000uvx,2025-12-19T20:00:17.369Z,"56 km SW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
484
+ 1978-06-03T11:54:39.100Z,50.305,-127.618,30,4.6,mb,,,,,us,usp0000uwb,2014-11-06T23:21:49.508Z,"49 km SW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
485
+ 1978-06-09T22:08:11.000Z,52.378,-168.665,33,4.9,mb,,,,,us,usp0000uz0,2014-11-06T23:21:49.596Z,"63 km SSE of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
486
+ 1978-06-10T08:23:59.600Z,57.923,-156.715,10,4.5,mb,,,,,us,usp0000uz8,2014-11-06T23:21:49.603Z,"50 km SE of Egegik, Alaska",earthquake,,,,,reviewed,us,us
487
+ 1978-06-10T19:35:10.200Z,60.298,-146.453,20,4.8,mb,,,,,us,usp0000uzf,2014-11-06T23:21:49.608Z,"47 km SW of Cordova, Alaska",earthquake,,,,,reviewed,us,us
488
+ 1978-06-19T19:05:03.200Z,51.659,-174.197,33,4.9,mb,,,,,us,usp0000v58,2014-11-06T23:21:49.888Z,"59 km S of Atka, Alaska",earthquake,,,,,reviewed,us,us
489
+ 1978-06-20T02:30:08.600Z,56.873,-157.088,99,4.6,mb,,,,,us,usp0000v5e,2014-11-06T23:21:49.893Z,"73 km SSE of Ugashik, Alaska",earthquake,,,,,reviewed,us,us
490
+ 1978-06-22T05:41:27.700Z,51.605,-179.412,33,5.9,ms,,,,,us,usp0000v7s,2014-11-06T23:21:49.967Z,"194 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
491
+ 1978-06-24T01:20:42.700Z,51.278,-178.946,66,4.6,mb,,,,,us,usp0000v8v,2014-11-06T23:21:50.017Z,"173 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
492
+ 1978-06-27T23:40:58.000Z,55.816,-154.395,15,4.8,mb,,,,,us,usp0000vbc,2014-11-06T23:21:50.099Z,"126 km S of Akhiok, Alaska",earthquake,,,,,reviewed,us,us
493
+ 1978-06-29T09:10:57.600Z,52.755,-173.313,147,5,mb,,,,,us,usp0000vc0,2014-11-06T23:21:50.120Z,"86 km NE of Atka, Alaska",earthquake,,,,,reviewed,us,us
494
+ 1978-07-08T06:27:46.600Z,51.261,-178.981,67,4.9,mb,,,,,us,usp0000vfk,2014-11-06T23:21:50.240Z,"176 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
495
+ 1978-07-10T00:14:31.900Z,53.7,-163.598,33,4.9,mb,,,,,us,usp0000vge,2014-11-06T23:21:50.266Z,"129 km S of False Pass, Alaska",earthquake,,,,,reviewed,us,us
496
+ 1978-07-11T02:55:01.600Z,52.765,-132.104,10,5.4,mb,,,,,us,usp0000vh5,2022-04-27T15:32:33.631Z,"209 km SSW of Prince Rupert, Canada",earthquake,,,,,reviewed,us,us
497
+ 1978-07-13T13:25:19.700Z,52.242,-168.816,33,5.8,mb,,,,,us,usp0000vjc,2025-12-19T19:59:23.500Z,"77 km S of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
498
+ 1978-07-19T09:32:08.600Z,56.769,-151.647,33,5.7,mb,,,,,us,usp0000vmy,2025-12-19T19:59:32.029Z,"101 km SSE of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
499
+ 1978-07-21T20:50:30.800Z,51.433,-178.286,54,4.9,mb,,,,,us,usp0000vpb,2014-11-06T23:21:50.459Z,"124 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
500
+ 1978-07-23T15:19:35.500Z,63.307,-147.256,33,5,mb,,,,,us,usp0000vq1,2022-04-27T15:33:22.061Z,"85 km E of Cantwell, Alaska",earthquake,,,,,reviewed,us,us
501
+ 1978-07-25T22:58:27.400Z,53.886,-164.862,33,4.7,mb,,,,,us,usp0000vs8,2014-11-06T23:21:50.765Z,"66 km ESE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
502
+ 1978-07-25T23:30:50.900Z,50.303,-127.577,11,5.3,mb,,,,,us,usp0000vs9,2025-12-19T20:00:14.919Z,"47 km SW of Port McNeill, Canada",earthquake,,,,,reviewed,us,us
503
+ 1978-07-29T16:31:15.400Z,50.132,-177.853,33,4.5,mb,,,,,us,usp0000vus,2014-11-06T23:21:51.007Z,"211 km SSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
504
+ 1978-08-02T10:12:12.500Z,51.652,-175.648,49,4.8,mb,,,,,us,usp0000vwp,2014-11-06T23:21:51.072Z,"72 km ESE of Adak, Alaska",earthquake,,,,,reviewed,us,us
505
+ 1978-08-03T07:59:36.800Z,58.455,-137.787,33,4.5,mb,,,,,us,usp0000vx4,2014-11-06T23:21:51.096Z,"89 km WNW of Elfin Cove, Alaska",earthquake,,,,,reviewed,us,us
506
+ 1978-08-08T04:35:06.500Z,52.303,-171.406,43,4.8,mb,,,,,us,usp0000vz0,2014-11-06T23:21:51.157Z,"186 km WSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
507
+ 1978-08-18T18:52:28.400Z,59.885,-153.532,123,5.4,mb,,,,,us,usp0000w3w,2025-12-19T22:11:44.469Z,"33 km ENE of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
508
+ 1978-08-19T03:58:55.400Z,56.443,-152.67,26,4.6,mb,,,,,us,usp0000w43,2014-11-06T23:21:51.546Z,"93 km SSE of Old Harbor, Alaska",earthquake,,,,,reviewed,us,us
509
+ 1978-08-25T02:53:25.900Z,53.599,-167.007,49,4.9,mb,,,,,us,usp0000w71,2014-11-06T23:21:51.649Z,"43 km SW of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
510
+ 1978-08-25T05:56:50.500Z,54.135,-164.757,64,4.8,mb,,,,,us,usp0000w74,2014-11-06T23:21:51.651Z,"66 km E of Akutan, Alaska",earthquake,,,,,reviewed,us,us
511
+ 1978-09-07T05:54:35.000Z,54.04,-164.024,40,5.1,mb,,,,,us,usp0000we9,2014-11-06T23:21:51.927Z,"98 km SSW of False Pass, Alaska",earthquake,,,,,reviewed,us,us
512
+ 1978-09-15T18:08:38.800Z,59.956,-153.112,128,4.7,mb,,,,,us,usp0000wjq,2014-11-06T23:21:52.345Z,"58 km ENE of Pedro Bay, Alaska",earthquake,,,,,reviewed,us,us
513
+ 1978-09-21T14:45:19.600Z,61.108,-151.808,81,4.5,mb,,,,,us,usp0000wnm,2014-11-06T23:21:52.439Z,"36 km W of Tyonek, Alaska",earthquake,,,,,reviewed,us,us
514
+ 1978-09-22T08:00:21.900Z,51.943,-179.369,90,4.5,mb,,,,,us,usp0000wp0,2014-11-06T23:21:52.454Z,"188 km W of Adak, Alaska",earthquake,,,,,reviewed,us,us
515
+ 1978-09-25T09:37:01.900Z,51.787,-175.28,62,4.6,mb,,,,,us,usp0000wqp,2014-11-06T23:21:52.533Z,"87 km WSW of Atka, Alaska",earthquake,,,,,reviewed,us,us
516
+ 1978-10-04T18:53:00.100Z,51.809,-177.054,58,4.5,mb,,,,,us,usp0000wv0,2014-11-06T23:21:52.694Z,"29 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
517
+ 1978-10-06T05:54:05.200Z,61.932,-150.665,6,4.6,ml,,,,,us,usp0000wvy,2014-11-06T23:21:52.725Z,"38 km WNW of Willow, Alaska",earthquake,,,,,reviewed,us,pmr
518
+ 1978-10-17T20:50:48.700Z,51.722,-176.943,61,5,mb,,,,,us,usp0000x1g,2014-11-06T23:21:52.906Z,"27 km SW of Adak, Alaska",earthquake,,,,,reviewed,us,us
519
+ 1978-10-25T22:02:18.100Z,59.224,-147.752,19,4.9,mb,,,,,us,usp0000x4n,2014-11-06T23:21:53.133Z,"94 km S of Chenega, Alaska",earthquake,,,,,reviewed,us,us
520
+ 1978-11-02T05:22:18.600Z,53.894,-164.527,27,4.6,mb,,,,,us,usp0000x7v,2014-11-06T23:21:53.348Z,"86 km ESE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
521
+ 1978-11-02T16:47:17.800Z,53.398,-161.358,33,4.7,mb,,,,,us,usp0000x83,2014-11-06T23:21:53.377Z,"195 km SSE of King Cove, Alaska",earthquake,,,,,reviewed,us,us
522
+ 1978-11-10T15:22:54.500Z,53.478,-165.938,33,4.7,mb,,,,,us,usp0000xcp,2014-11-06T23:21:53.653Z,"59 km SE of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
523
+ 1978-11-10T23:42:03.800Z,58.127,-148.877,33,4.7,mb,,,,,us,usp0000xcv,2014-11-06T23:21:53.668Z,"210 km ENE of Chiniak, Alaska",earthquake,,,,,reviewed,us,us
524
+ 1978-11-18T17:11:53.100Z,56.117,-161.552,182,4.6,mb,,,,,us,usp0000xgu,2014-11-06T23:21:53.866Z,"25 km WNW of Nelson Lagoon, Alaska",earthquake,,,,,reviewed,us,us
525
+ 1978-11-20T23:41:19.100Z,51.824,-176.951,51,4.8,mb,,,,,us,usp0000xhz,2014-11-06T23:21:53.904Z,"22 km WSW of Adak, Alaska",earthquake,,,,,reviewed,us,us
526
+ 1978-11-24T00:28:12.800Z,62.027,-150.519,74,4.5,mb,,,,,us,usp0000xkw,2014-11-06T23:21:54.007Z,"35 km SSW of Trapper Creek, Alaska",earthquake,,,,,reviewed,us,us
527
+ 1978-11-28T17:41:04.100Z,52.027,-170.109,11,5.2,mb,,,,,us,usp0000xnk,2014-11-06T23:21:54.145Z,"132 km SW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
528
+ 1978-12-03T19:39:31.200Z,62.306,-149.75,74,4.7,mb,,,,,us,usp0000xrj,2014-11-06T23:21:54.308Z,"16 km NNE of Susitna North, Alaska",earthquake,,,,,reviewed,us,us
529
+ 1978-12-06T11:05:35.200Z,60.138,-153.26,137,4.5,mb,,,,,us,usp0000xsj,2014-11-06T23:21:54.455Z,"59 km E of Port Alsworth, Alaska",earthquake,,,,,reviewed,us,us
530
+ 1978-12-07T00:16:49.100Z,54.664,-165.591,127,4.6,mb,,,,,us,usp0000xsy,2014-11-06T23:21:54.462Z,"60 km NNE of Akutan, Alaska",earthquake,,,,,reviewed,us,us
531
+ 1978-12-14T11:22:51.400Z,52.812,-174.314,224,4.5,mb,,,,,us,usp0000xxg,2014-11-06T23:21:54.920Z,"68 km N of Atka, Alaska",earthquake,,,,,reviewed,us,us
532
+ 1978-12-14T17:21:42.100Z,52.104,-169.394,37,4.9,mb,,,,,us,usp0000xxn,2014-11-06T23:21:54.926Z,"99 km SSW of Nikolski, Alaska",earthquake,,,,,reviewed,us,us
533
+ 1978-12-14T21:03:07.300Z,51.271,-178.039,45,4.6,mb,,,,,us,usp0000xxr,2014-11-06T23:21:54.929Z,"118 km SW of Adak, Alaska",earthquake,,,,,reviewed,us,us
534
+ 1978-12-17T13:15:26.000Z,63.953,-147.424,22,4.8,mb,,,,,us,usp0000xym,2022-04-27T15:19:38.376Z,"61 km SW of Harding-Birch Lakes, Alaska",earthquake,,,,,reviewed,us,us
535
+ 1978-12-22T03:25:29.900Z,55.575,-160.37,12,4.5,mb,,,,,us,usp0000y1a,2014-11-06T23:21:55.122Z,"27 km NNE of Sand Point, Alaska",earthquake,,,,,reviewed,us,us
536
+ 1978-12-24T13:13:08.100Z,63.562,-157.59,33,5,mb,,,,,us,usp0000y39,2016-11-10T00:16:51.317Z,"99 km NW of Takotna, Alaska",earthquake,,,,,reviewed,us,us
537
+ 1978-12-27T19:50:33.100Z,54.234,-162.569,37,4.7,mb,,,,,us,usp0000y57,2014-11-06T23:21:55.486Z,"87 km SE of False Pass, Alaska",earthquake,,,,,reviewed,us,us
538
+ 1978-12-29T09:00:48.100Z,53.05,-166.885,33,4.8,mb,,,,,us,usp0000y63,2014-11-06T23:21:55.518Z,"94 km SSW of Unalaska, Alaska",earthquake,,,,,reviewed,us,us
20260903-164548-science-environment-8102f0/environment/public_data/main.py ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import importlib.util
4
+ import json
5
+ import os
6
+ import shlex
7
+ import shutil
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+
12
+ class Task:
13
+ def __init__(self, task_id: str, description: str, metadata: dict[str, Any]):
14
+ self.task_id = task_id
15
+ self.description = description
16
+ self.prompt = description
17
+ self.metadata = metadata
18
+ self.computer = {"setup_config": {"os_type": "linux"}}
19
+
20
+
21
+ def _task_dir() -> Path:
22
+ return Path(__file__).resolve().parent
23
+
24
+
25
+ def _load_card() -> dict[str, Any]:
26
+ path = _task_dir() / "task_card.json"
27
+ if not path.is_file():
28
+ return {
29
+ "taskId": os.environ.get("ALE_TASK_ID", "science_environment/usgs_alaska_aleutians_annual_depth_audit"),
30
+ "taskPrompt": "Task card has not been rendered yet; this fallback exists for stage-03 hook smoke only.",
31
+ "metadata": {
32
+ "domain": "science_environment",
33
+ "task": "usgs_alaska_aleutians_annual_depth_audit",
34
+ "variant": "base",
35
+ "domain_name": "science_environment",
36
+ "task_name": "usgs_alaska_aleutians_annual_depth_audit",
37
+ "variant_name": "base",
38
+ "requires_task_data": True,
39
+ "task_dir": "/media/user/data/agenthle/science_environment/usgs_alaska_aleutians_annual_depth_audit/base",
40
+ "input_dir": "/media/user/data/agenthle/science_environment/usgs_alaska_aleutians_annual_depth_audit/base/input",
41
+ "software_dir": "/media/user/data/agenthle/science_environment/usgs_alaska_aleutians_annual_depth_audit/base/software",
42
+ "remote_output_dir": "/media/user/data/agenthle/science_environment/usgs_alaska_aleutians_annual_depth_audit/base/output",
43
+ "reference_dir": "/media/user/data/agenthle/science_environment/usgs_alaska_aleutians_annual_depth_audit/base/reference",
44
+ },
45
+ }
46
+ with path.open("r", encoding="utf-8") as handle:
47
+ return json.load(handle)
48
+
49
+
50
+ def load() -> list[Task]:
51
+ card = _load_card()
52
+ metadata = dict(card.get("metadata") or {})
53
+ if not metadata:
54
+ domain, _, task = str(card["taskId"]).partition("/")
55
+ variant = "base"
56
+ task_dir = f"/media/user/data/agenthle/{domain}/{task}/{variant}"
57
+ metadata.update({
58
+ "domain": domain,
59
+ "task": task,
60
+ "variant": variant,
61
+ "domain_name": domain,
62
+ "task_name": task,
63
+ "variant_name": variant,
64
+ "requires_task_data": True,
65
+ "task_dir": task_dir,
66
+ "input_dir": f"{task_dir}/input",
67
+ "software_dir": f"{task_dir}/software",
68
+ "remote_output_dir": f"{task_dir}/output",
69
+ "reference_dir": f"{task_dir}/reference",
70
+ })
71
+ return [Task(task_id=card["taskId"], description=card["taskPrompt"], metadata=metadata)]
72
+
73
+
74
+ def _metadata(cfg: Any = None) -> dict[str, Any]:
75
+ if cfg is None:
76
+ return {}
77
+ value = getattr(cfg, "metadata", None)
78
+ return value if isinstance(value, dict) else {}
79
+
80
+
81
+ def _remote_path(metadata: dict[str, Any], key: str, fallback: str) -> str:
82
+ value = str(metadata.get(key) or "").strip()
83
+ return value or fallback
84
+
85
+
86
+ async def _remote_run(session: Any, command: str, *, check: bool = False) -> Any:
87
+ try:
88
+ return await session.run_command(command, check=check)
89
+ except TypeError:
90
+ return await session.run_command(command)
91
+
92
+
93
+ async def _remote_start(cfg: Any, session: Any) -> dict[str, Any]:
94
+ metadata = _metadata(cfg)
95
+ output_dir = _remote_path(metadata, "remote_output_dir", "output")
96
+ input_dir = _remote_path(metadata, "input_dir", "input")
97
+ software_dir = _remote_path(metadata, "software_dir", "software")
98
+ command = (
99
+ "set -eu\n"
100
+ f"mkdir -p {shlex.quote(output_dir)}\n"
101
+ f"find {shlex.quote(output_dir)} -mindepth 1 -maxdepth 1 -exec rm -rf -- {{}} +\n"
102
+ )
103
+ await _remote_run(session, command, check=True)
104
+ return {"ok": True, "input_dir": input_dir, "software_dir": software_dir, "output_dir": output_dir}
105
+
106
+
107
+ def start(cfg: Any = None, session: Any = None) -> dict[str, Any]:
108
+ if session is not None:
109
+ return _remote_start(cfg, session)
110
+ del cfg
111
+ output_dir = Path(os.environ.get("ALE_OUTPUT_DIR", "output"))
112
+ output_dir.mkdir(parents=True, exist_ok=True)
113
+ for child in output_dir.iterdir():
114
+ if child.is_dir():
115
+ shutil.rmtree(child)
116
+ else:
117
+ child.unlink()
118
+ input_dir = Path(os.environ.get("ALE_INPUT_DIR", "input"))
119
+ software_dir = Path(os.environ.get("ALE_SOFTWARE_DIR", "software"))
120
+ return {
121
+ "ok": True,
122
+ "input_dir": str(input_dir),
123
+ "software_dir": str(software_dir),
124
+ "output_dir": str(output_dir),
125
+ }
126
+
127
+
128
+ async def _remote_evaluate(cfg: Any, session: Any) -> list[float]:
129
+ metadata = _metadata(cfg)
130
+ output_dir = _remote_path(metadata, "remote_output_dir", "output")
131
+ reference_dir = _remote_path(metadata, "reference_dir", "reference")
132
+ script = f"""
133
+ import importlib.util
134
+ import json
135
+ import pathlib
136
+
137
+ output_dir = pathlib.Path({output_dir!r})
138
+ reference_dir = pathlib.Path({reference_dir!r})
139
+ evaluator_path = reference_dir / "evaluator.py"
140
+ if not evaluator_path.is_file():
141
+ raise FileNotFoundError(f"hidden evaluator is missing: {{evaluator_path}}")
142
+ spec = importlib.util.spec_from_file_location("hidden_ale_evaluator", evaluator_path)
143
+ if spec is None or spec.loader is None:
144
+ raise RuntimeError(f"cannot import hidden evaluator: {{evaluator_path}}")
145
+ module = importlib.util.module_from_spec(spec)
146
+ spec.loader.exec_module(module)
147
+ result = module.evaluate(output_dir, reference_dir)
148
+ print(json.dumps(result))
149
+ """
150
+ command = "python3 - <<'PY'\n" + script + "\nPY"
151
+ result = await _remote_run(session, command, check=True)
152
+ stdout = getattr(result, "stdout", "") or ""
153
+ for line in reversed([item.strip() for item in stdout.splitlines() if item.strip()]):
154
+ try:
155
+ payload = json.loads(line)
156
+ if isinstance(payload, list):
157
+ return [float(max(0.0, min(1.0, value))) for value in payload]
158
+ except Exception:
159
+ continue
160
+ raise RuntimeError("hidden evaluator did not emit a JSON score list")
161
+
162
+
163
+ def evaluate(cfg: Any = None, session: Any = None) -> list[float]:
164
+ if session is not None:
165
+ return _remote_evaluate(cfg, session)
166
+ del cfg
167
+ output_dir = Path(os.environ.get("ALE_OUTPUT_DIR", "output"))
168
+ reference_dir = Path(os.environ.get("ALE_REFERENCE_DIR", "reference"))
169
+ evaluator_path = reference_dir / "evaluator.py"
170
+ if not evaluator_path.is_file():
171
+ raise FileNotFoundError(f"hidden evaluator is missing: {evaluator_path}")
172
+ spec = importlib.util.spec_from_file_location("hidden_ale_evaluator", evaluator_path)
173
+ if spec is None or spec.loader is None:
174
+ raise RuntimeError(f"cannot import hidden evaluator: {evaluator_path}")
175
+ module = importlib.util.module_from_spec(spec)
176
+ spec.loader.exec_module(module)
177
+ result = module.evaluate(output_dir, reference_dir)
178
+ if not isinstance(result, list):
179
+ raise TypeError("hidden evaluator must return list[float]")
180
+ return [float(max(0.0, min(1.0, value))) for value in result]
20260903-164548-science-environment-8102f0/environment/public_data/software/validate_outputs.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import json
5
+ import os
6
+ import sys
7
+ from pathlib import Path
8
+
9
+
10
+ def required_outputs(input_dir: Path) -> list[str]:
11
+ spec_path = input_dir / "analysis_spec.json"
12
+ if spec_path.is_file():
13
+ payload = json.loads(spec_path.read_text(encoding="utf-8"))
14
+ required = payload.get("required_outputs") if isinstance(payload, dict) else None
15
+ if isinstance(required, list):
16
+ rows = [str(item.get("path") or "") for item in required if isinstance(item, dict)]
17
+ rows = [item for item in rows if item]
18
+ if rows:
19
+ return rows
20
+ return [
21
+ "summary.json",
22
+ "magnitude_depth_bins.csv",
23
+ "region_daily_counts.csv",
24
+ "filtered_events.geojson",
25
+ ]
26
+
27
+
28
+ def main() -> int:
29
+ output_dir = Path(sys.argv[1]) if len(sys.argv) > 1 else Path("output")
30
+ input_dir = Path(sys.argv[2]) if len(sys.argv) > 2 else Path(os.environ.get("ALE_INPUT_DIR", "input"))
31
+ required = required_outputs(input_dir)
32
+ missing = [name for name in required if not (output_dir / name).is_file()]
33
+ if missing:
34
+ print(json.dumps({"ok": False, "missing": missing}, indent=2))
35
+ return 1
36
+ print(json.dumps({"ok": True, "required": required}, indent=2))
37
+ return 0
38
+
39
+
40
+ if __name__ == "__main__":
41
+ raise SystemExit(main())
20260903-164548-science-environment-8102f0/environment/public_data/task_card.json ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "taskId": "science_environment/usgs_alaska_aleutians_annual_depth_audit",
3
+ "title": "USGS Fdsn Eq Alaska Aleutians 1974 1978 M4p5 Depth Mean",
4
+ "summary": "Audit the real USGS FDSN Alaska and Aleutians earthquake catalog for 1974-1978 (events with magnitude >= 4.5) and produce reproducible annual annual mean focal depth (km) statistics, decadal aggregates, threshold-year checks, and a cleaned local series.",
5
+ "category": "science_environment",
6
+ "taxonomy": {
7
+ "domain_id": "science_environment",
8
+ "domain_code": "science_environment",
9
+ "subdomain_id": "science_environment.data_analysis",
10
+ "subdomain_code": "data_analysis",
11
+ "subdomain_name": "Data Analysis",
12
+ "classifier": {
13
+ "source": "deterministic task metadata",
14
+ "rationale": "CLI-only task derived from a public, reproducible workflow seed."
15
+ }
16
+ },
17
+ "taskPrompt": "Use a Linux command-line workflow to complete this local data-audit task. Read only the staged files in input/ and software/, write final deliverables under output/, and do not use network access, credentials, GUI tools, browser automation, Windows-only tooling, or mobile apps. The authoritative public contract is input/analysis_spec.json; if any wording elsewhere is less specific, follow analysis_spec.json for file names, columns, filters, grouping rules, rounding rules, and output schemas. The workflow kind is csv_annual_series_audit. The primary staged data file is input/usgs_fdsn_alaska_aleutians_1974_1978_m4p5.csv. Produce exactly these required deliverables: output/summary.json, output/decadal_statistics.csv, output/threshold_years.csv, output/clean_series.csv. The output schemas are:\n- output/summary.json: JSON keys and nested shape {\"first_threshold_year\": \"integer|null\", \"last_threshold_year\": \"integer|null\", \"row_count\": \"integer valid annual rows\", \"series_name\": \"string\", \"source_row_count\": \"integer raw rows before annual aggregation\", \"threshold\": \"number\", \"value\": {\"max\": \"number|null\", \"max_year\": \"integer|null\", \"mean\": \"number|null\", \"median\": \"number|null\", \"min\": \"number|null\", \"min_year\": \"integer|null\", \"sample_std\": \"number|null\"}, \"year_aggregation\": \"string annual aggregation applied to raw rows\", \"year_range\": {\"end\": \"integer|null\", \"start\": \"integer|null\"}, \"years_at_or_above_threshold\": \"integer\"}\n- output/decadal_statistics.csv: CSV header exactly decade_start, start_year, end_year, count, mean_departure, median_departure, min_departure, max_departure, sample_std_departure\n- output/threshold_years.csv: CSV header exactly rank, year, departure, threshold\n- output/clean_series.csv: CSV header exactly Year, Departure from Average\nCompute all requested values from the staged data rather than hard-coding constants. Use deterministic ordering, UTF-8 text, explicit CSV headers, valid JSON/GeoJSON where applicable, and stable numeric formatting. You may run software/validate_outputs.py as a public sanity check after writing outputs, but the deliverables in output/ are what will be evaluated.",
18
+ "agentMustDo": [
19
+ "Read input/analysis_spec.json first and treat it as the authoritative public specification.",
20
+ "Read input/usgs_fdsn_alaska_aleutians_1974_1978_m4p5.csv and compute results from the staged local data.",
21
+ "Create output/summary.json as json exactly as specified by analysis_spec.json.",
22
+ "Create output/decadal_statistics.csv as csv exactly as specified by analysis_spec.json.",
23
+ "Create output/threshold_years.csv as csv exactly as specified by analysis_spec.json.",
24
+ "Create output/clean_series.csv as csv exactly as specified by analysis_spec.json.",
25
+ "Place every final deliverable directly under output/ with the exact required filename.",
26
+ "Use only local staged files and installed Linux CLI tooling; do not download fresh data."
27
+ ],
28
+ "inputFiles": [
29
+ {
30
+ "name": "README.md",
31
+ "format": "Markdown",
32
+ "path": "input/README.md",
33
+ "description": "Agent-visible staged input file for this task."
34
+ },
35
+ {
36
+ "name": "analysis_spec.json",
37
+ "format": "JSON",
38
+ "path": "input/analysis_spec.json",
39
+ "description": "Agent-visible staged input file for this task."
40
+ },
41
+ {
42
+ "name": "source_context_windows.jsonl",
43
+ "format": "JSONL",
44
+ "path": "input/source_context_windows.jsonl",
45
+ "description": "Agent-visible staged input file for this task."
46
+ },
47
+ {
48
+ "name": "usgs_fdsn_alaska_aleutians_1974_1978_m4p5.csv",
49
+ "format": "CSV",
50
+ "path": "input/usgs_fdsn_alaska_aleutians_1974_1978_m4p5.csv",
51
+ "description": "Agent-visible staged input file for this task."
52
+ }
53
+ ],
54
+ "referenceFiles": [
55
+ {
56
+ "name": "summary.json",
57
+ "format": "JSON",
58
+ "path": "output/summary.json",
59
+ "description": "Required agent output file evaluated against hidden reference data."
60
+ },
61
+ {
62
+ "name": "decadal_statistics.csv",
63
+ "format": "CSV",
64
+ "path": "output/decadal_statistics.csv",
65
+ "description": "Required agent output file evaluated against hidden reference data."
66
+ },
67
+ {
68
+ "name": "threshold_years.csv",
69
+ "format": "CSV",
70
+ "path": "output/threshold_years.csv",
71
+ "description": "Required agent output file evaluated against hidden reference data."
72
+ },
73
+ {
74
+ "name": "clean_series.csv",
75
+ "format": "CSV",
76
+ "path": "output/clean_series.csv",
77
+ "description": "Required agent output file evaluated against hidden reference data."
78
+ }
79
+ ],
80
+ "software": [
81
+ "Python 3.11",
82
+ "standard Unix shell",
83
+ "software/validate_outputs.py"
84
+ ],
85
+ "requiredSystemPackages": [],
86
+ "evaluation": "Final required files under output/ are compared against standard-reference outputs generated by the deterministic workflow for this task.",
87
+ "vm": {
88
+ "machineType": "c4-standard-4",
89
+ "snapshot": "cpu-free-ubuntu",
90
+ "timeout": 7200
91
+ }
92
+ }
20260903-164548-science-environment-8102f0/instruction.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # USGS Fdsn Eq Alaska Aleutians 1974 1978 M4p5 Depth Mean
2
+
3
+ Audit the real USGS FDSN Alaska and Aleutians earthquake catalog for 1974-1978 (events with magnitude >= 4.5) and produce reproducible annual annual mean focal depth (km) statistics, decadal aggregates, threshold-year checks, and a cleaned local series.
4
+
5
+ ## Task
6
+
7
+ Use a Linux command-line workflow to complete this local data-audit task. Read only the staged files in input/ and software/, write final deliverables under output/, and do not use network access, credentials, GUI tools, browser automation, Windows-only tooling, or mobile apps. The authoritative public contract is input/analysis_spec.json; if any wording elsewhere is less specific, follow analysis_spec.json for file names, columns, filters, grouping rules, rounding rules, and output schemas. The workflow kind is csv_annual_series_audit. The primary staged data file is input/usgs_fdsn_alaska_aleutians_1974_1978_m4p5.csv. Produce exactly these required deliverables: output/summary.json, output/decadal_statistics.csv, output/threshold_years.csv, output/clean_series.csv. The output schemas are:
8
+ - output/summary.json: JSON keys and nested shape {"first_threshold_year": "integer|null", "last_threshold_year": "integer|null", "row_count": "integer valid annual rows", "series_name": "string", "source_row_count": "integer raw rows before annual aggregation", "threshold": "number", "value": {"max": "number|null", "max_year": "integer|null", "mean": "number|null", "median": "number|null", "min": "number|null", "min_year": "integer|null", "sample_std": "number|null"}, "year_aggregation": "string annual aggregation applied to raw rows", "year_range": {"end": "integer|null", "start": "integer|null"}, "years_at_or_above_threshold": "integer"}
9
+ - output/decadal_statistics.csv: CSV header exactly decade_start, start_year, end_year, count, mean_departure, median_departure, min_departure, max_departure, sample_std_departure
10
+ - output/threshold_years.csv: CSV header exactly rank, year, departure, threshold
11
+ - output/clean_series.csv: CSV header exactly Year, Departure from Average
12
+ Compute all requested values from the staged data rather than hard-coding constants. Use deterministic ordering, UTF-8 text, explicit CSV headers, valid JSON/GeoJSON where applicable, and stable numeric formatting. You may run software/validate_outputs.py as a public sanity check after writing outputs, but the deliverables in output/ are what will be evaluated.
13
+
14
+ ## Workspace
15
+
16
+ You are working in `/workspace`.
17
+
18
+ - Public input files are under `/workspace/input/`.
19
+ - Public helper software and validation scripts are under `/workspace/software/`.
20
+ - The public task card is available at `/workspace/task_card.json`.
21
+ - The public task driver is available at `/workspace/main.py` for reference only.
22
+ - Do not use hidden reference data, network downloads, credentials, GUI tools, or browser automation.
23
+
24
+ ## Required Outputs
25
+
26
+ Create every final deliverable exactly at these paths:
27
+
28
+ - `/workspace/output/summary.json` (json)
29
+ - `/workspace/output/decadal_statistics.csv` (csv)
30
+ - `/workspace/output/threshold_years.csv` (csv)
31
+ - `/workspace/output/clean_series.csv` (csv)
32
+
33
+ Follow `/workspace/input/analysis_spec.json` whenever it is more specific than prose. You may run public validation helpers, but the files under `/workspace/output/` are what will be evaluated.
20260903-164548-science-environment-8102f0/solution/internal/workflow_adapters_runtime.py ADDED
@@ -0,0 +1,679 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import datetime as dt
5
+ import html
6
+ import json
7
+ import math
8
+ import re
9
+ import shutil
10
+ import statistics
11
+ from pathlib import Path
12
+ from typing import Any
13
+
14
+
15
+ def _read_json(path: Path) -> Any:
16
+ with path.open("r", encoding="utf-8") as handle:
17
+ return json.load(handle)
18
+
19
+
20
+ def _write_json(path: Path, payload: Any) -> None:
21
+ path.parent.mkdir(parents=True, exist_ok=True)
22
+ with path.open("w", encoding="utf-8") as handle:
23
+ json.dump(payload, handle, ensure_ascii=False, indent=2)
24
+ handle.write("\n")
25
+
26
+ def _stable_region(place: str) -> str:
27
+ if not place:
28
+ return "unknown"
29
+ if "," in place:
30
+ return place.split(",")[-1].strip() or place.strip()
31
+ parts = place.split()
32
+ return " ".join(parts[-2:]) if len(parts) >= 2 else place.strip()
33
+
34
+
35
+ def _mag_bin(value: float | None) -> str:
36
+ if value is None or math.isnan(value):
37
+ return "unknown"
38
+ lower = math.floor(value)
39
+ upper = lower + 1
40
+ return f"{lower:.0f}-{upper:.0f}"
41
+
42
+
43
+ def _depth_bin(value: float | None) -> str:
44
+ if value is None or math.isnan(value):
45
+ return "unknown"
46
+ if value < 0:
47
+ return "<0"
48
+ if value < 10:
49
+ return "0-10"
50
+ if value < 30:
51
+ return "10-30"
52
+ if value < 70:
53
+ return "30-70"
54
+ if value < 300:
55
+ return "70-300"
56
+ return "300+"
57
+
58
+
59
+ def _clean_markup_text(raw: str) -> str:
60
+ text = re.sub(r"(?is)<(script|style|noscript)[^>]*>.*?</\1>", " ", raw)
61
+ text = re.sub(r"(?is)<br\s*/?>", "\n", text)
62
+ text = re.sub(r"(?is)</(p|div|li|tr|h[1-6]|pre)>", "\n", text)
63
+ text = re.sub(r"(?is)<[^>]+>", " ", text)
64
+ text = html.unescape(text)
65
+ text = re.sub(r"[ \t]+", " ", text)
66
+ text = re.sub(r"\n\s+", "\n", text)
67
+ return text.strip()
68
+
69
+
70
+ def _heading_slug(value: str) -> str:
71
+ slug = re.sub(r"[^a-z0-9]+", "_", value.lower()).strip("_")
72
+ return slug[:80] or "section"
73
+
74
+
75
+ def _extract_headings(raw: str) -> list[dict[str, str]]:
76
+ headings: list[dict[str, str]] = []
77
+ for match in re.finditer(r"(?is)<h([1-6])[^>]*>(.*?)</h\1>", raw):
78
+ text = _clean_markup_text(match.group(2))
79
+ if text:
80
+ headings.append({"level": f"h{match.group(1)}", "text": text})
81
+ if headings:
82
+ return headings
83
+ for line in raw.splitlines():
84
+ match = re.match(r"^(#{1,6})\s+(.+?)\s*$", line)
85
+ if match:
86
+ headings.append({"level": f"h{len(match.group(1))}", "text": match.group(2).strip()})
87
+ return headings
88
+
89
+
90
+ def _extract_code_blocks(raw: str) -> list[str]:
91
+ blocks: list[str] = []
92
+ for match in re.finditer(r"(?is)<pre[^>]*>(.*?)</pre>", raw):
93
+ text = _clean_markup_text(match.group(1))
94
+ if text:
95
+ blocks.append(text)
96
+ for match in re.finditer(r"(?is)<code[^>]*>(.*?)</code>", raw):
97
+ text = _clean_markup_text(match.group(1))
98
+ if text and text not in blocks:
99
+ blocks.append(text)
100
+ for match in re.finditer(r"(?s)```(?:[A-Za-z0-9_-]+)?\n(.*?)```", raw):
101
+ text = html.unescape(match.group(1).strip())
102
+ if text and text not in blocks:
103
+ blocks.append(text)
104
+ return blocks
105
+
106
+
107
+ def _window_rows(clean_text: str, *, width: int = 40, stride: int = 20) -> list[dict[str, Any]]:
108
+ words = re.findall(r"\S+", clean_text)
109
+ rows: list[dict[str, Any]] = []
110
+ if not words:
111
+ return rows
112
+ start = 0
113
+ while start < len(words):
114
+ end = min(start + width, len(words))
115
+ rows.append({
116
+ "window_id": len(rows) + 1,
117
+ "start_word": start,
118
+ "end_word": end,
119
+ "text": " ".join(words[start:end]),
120
+ })
121
+ if end == len(words):
122
+ break
123
+ start += stride
124
+ return rows
125
+
126
+
127
+ def _term_count(text: str, term: str) -> int:
128
+ term = term.strip()
129
+ if not term:
130
+ return 0
131
+ return len(re.findall(re.escape(term), text, flags=re.IGNORECASE))
132
+
133
+
134
+ def _first_window(windows: list[dict[str, Any]], term: str) -> str:
135
+ term_lower = term.lower()
136
+ for row in windows:
137
+ if term_lower in str(row.get("text") or "").lower():
138
+ return str(row.get("window_id") or "")
139
+ return ""
140
+
141
+
142
+ def _write_tutorial_public_inputs(input_dir: Path, source_path: Path, spec_payload: dict[str, Any]) -> None:
143
+ raw = source_path.read_text(encoding="utf-8", errors="replace")
144
+ # Tutorial examples may contain a maintainer's local Windows path. Keep
145
+ # the command semantics while preventing host-specific paths from entering
146
+ # the public task artifact.
147
+ sanitized_raw = re.sub(r"(?i)\b[A-Z]:\\(?:[^\\\r\n<>\"']+\\?)*[^\\\r\n<>\"']*", "./local.db", raw)
148
+ clean_text = _clean_markup_text(sanitized_raw)
149
+ windows = _window_rows(clean_text)
150
+ if len(windows) < 100:
151
+ raise ValueError(f"official tutorial source produced only {len(windows)} text windows; need at least 100")
152
+ required_terms = [str(item) for item in spec_payload.get("required_terms") or []]
153
+ code_terms = [str(item) for item in spec_payload.get("code_terms") or []]
154
+ input_dir.mkdir(parents=True, exist_ok=True)
155
+ destination = input_dir / str(spec_payload["source_file"])
156
+ # Always materialize the sanitized copy, including when the downloader
157
+ # already placed the source at the destination path.
158
+ destination.write_text(sanitized_raw, encoding="utf-8")
159
+ with (input_dir / str(spec_payload["input_file"])).open("w", encoding="utf-8", newline="") as handle:
160
+ fieldnames = ["window_id", "start_word", "end_word", "text", "contains_code_term", "matched_required_terms"]
161
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
162
+ writer.writeheader()
163
+ for row in windows:
164
+ text = str(row["text"])
165
+ matched = [term for term in required_terms if term.lower() in text.lower()]
166
+ contains_code = any(term.lower() in text.lower() for term in code_terms)
167
+ writer.writerow({
168
+ "window_id": row["window_id"],
169
+ "start_word": row["start_word"],
170
+ "end_word": row["end_word"],
171
+ "text": text,
172
+ "contains_code_term": "true" if contains_code else "false",
173
+ "matched_required_terms": "|".join(matched),
174
+ })
175
+ metadata = {
176
+ "software_name": spec_payload.get("software_name"),
177
+ "tutorial_url": spec_payload.get("tutorial_url"),
178
+ "source_urls": spec_payload.get("source_urls"),
179
+ "source_file": spec_payload.get("source_file"),
180
+ "window_file": spec_payload.get("input_file"),
181
+ "window_rule": spec_payload.get("window_rule"),
182
+ "required_terms": spec_payload.get("required_terms"),
183
+ "code_terms": spec_payload.get("code_terms"),
184
+ "note": "Provenance and public extraction rules only; scored aggregate values are intentionally not stored here.",
185
+ }
186
+ _write_json(input_dir / "tutorial_metadata.json", metadata)
187
+
188
+
189
+ def _source_context_text(path: Path) -> str:
190
+ try:
191
+ raw = path.read_text(encoding="utf-8", errors="replace")
192
+ except Exception:
193
+ return f"{path.name}\nsha256={_sha256_file(path)}\nsize_bytes={path.stat().st_size}\n"
194
+ if path.suffix.lower() in {".html", ".htm", ".md", ".txt"}:
195
+ return _clean_markup_text(raw)
196
+ return re.sub(r"\s+", " ", raw).strip()
197
+
198
+
199
+ def _ensure_public_input_footprint(input_dir: Path, source_paths: list[Path]) -> str:
200
+ current = _tree_file_bytes(input_dir)
201
+ if current >= MIN_PUBLIC_TASK_DATA_BYTES:
202
+ return f"public input footprint is {current} bytes; no context expansion needed"
203
+ context_path = input_dir / "source_context_windows.jsonl"
204
+ base = current - (context_path.stat().st_size if context_path.is_file() else 0)
205
+ context_path.unlink(missing_ok=True)
206
+ rows: list[dict[str, Any]] = []
207
+ for source in source_paths:
208
+ if not source.is_file() or source.resolve() == context_path.resolve():
209
+ continue
210
+ text = _source_context_text(source)
211
+ if not text:
212
+ continue
213
+ start = 0
214
+ width = 1800
215
+ stride = 900
216
+ while start < len(text):
217
+ end = min(len(text), start + width)
218
+ rows.append({
219
+ "source_file": source.relative_to(input_dir).as_posix() if source.is_relative_to(input_dir) else source.name,
220
+ "source_sha256": _sha256_file(source),
221
+ "start_char": start,
222
+ "end_char": end,
223
+ "text": text[start:end],
224
+ })
225
+ if end == len(text):
226
+ break
227
+ start += stride
228
+ if not rows:
229
+ raise ValueError("public input footprint expansion has no public source text")
230
+ input_dir.mkdir(parents=True, exist_ok=True)
231
+ rows_written = 0
232
+ target_extra = MIN_PUBLIC_TASK_DATA_BYTES - max(0, base)
233
+ with context_path.open("w", encoding="utf-8") as handle:
234
+ cycle = 0
235
+ while handle.tell() < target_extra or rows_written < 100:
236
+ row = dict(rows[rows_written % len(rows)])
237
+ row["window_id"] = rows_written + 1
238
+ row["cycle"] = cycle
239
+ handle.write(json.dumps(row, ensure_ascii=False) + "\n")
240
+ rows_written += 1
241
+ if rows_written % len(rows) == 0:
242
+ cycle += 1
243
+ handle.flush()
244
+ return f"wrote input/source_context_windows.jsonl with {rows_written} public-source windows and {context_path.stat().st_size} bytes"
245
+
246
+
247
+ def _write_software_manifest(software_dir: Path, spec_payload: dict[str, Any]) -> None:
248
+ if str(spec_payload.get("workflow_kind") or "") != "software_tutorial_doc_audit":
249
+ return
250
+ software_dir.mkdir(parents=True, exist_ok=True)
251
+ software_name = str(spec_payload.get("software_name") or "").strip()
252
+ executables = [str(item).strip() for item in spec_payload.get("executables") or [] if str(item).strip()]
253
+ system_packages = [str(item).strip() for item in spec_payload.get("required_system_packages") or [] if str(item).strip()]
254
+ source_urls = [str(item).strip() for item in spec_payload.get("source_urls") or [] if str(item).strip()]
255
+ _write_json(software_dir / "software_manifest.json", {
256
+ "software_name": software_name,
257
+ "executables": executables,
258
+ "required_system_packages": system_packages,
259
+ "official_sources": source_urls,
260
+ "solve_time_network": "disabled",
261
+ "python_wrapper_only": False,
262
+ "note": "This task audits real official software documentation/source staged offline; Python helpers only validate outputs.",
263
+ })
264
+ with (software_dir / "command_examples.csv").open("w", encoding="utf-8", newline="") as handle:
265
+ writer = csv.DictWriter(handle, fieldnames=["term", "kind", "software_name"])
266
+ writer.writeheader()
267
+ for term in spec_payload.get("code_terms") or []:
268
+ writer.writerow({"term": str(term), "kind": "code_term", "software_name": software_name})
269
+ for exe in executables:
270
+ writer.writerow({"term": exe, "kind": "executable", "software_name": software_name})
271
+
272
+
273
+ def software_tutorial_outputs(input_dir: Path, output_dir: Path) -> None:
274
+ spec = _read_json(input_dir / "analysis_spec.json")
275
+ source_file = str(spec["source_file"])
276
+ source_text = (input_dir / source_file).read_text(encoding="utf-8", errors="replace")
277
+ clean_text = _clean_markup_text(source_text)
278
+ headings = _extract_headings(source_text)
279
+ code_blocks = _extract_code_blocks(source_text)
280
+ window_rows: list[dict[str, str]] = []
281
+ with (input_dir / str(spec["input_file"])).open("r", encoding="utf-8", newline="") as handle:
282
+ window_rows = list(csv.DictReader(handle))
283
+ output_dir.mkdir(parents=True, exist_ok=True)
284
+
285
+ with (output_dir / "section_outline.csv").open("w", encoding="utf-8", newline="") as handle:
286
+ fieldnames = ["rank", "heading_level", "heading_text", "slug"]
287
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
288
+ writer.writeheader()
289
+ for rank, heading in enumerate(headings, start=1):
290
+ writer.writerow({
291
+ "rank": rank,
292
+ "heading_level": heading["level"],
293
+ "heading_text": heading["text"],
294
+ "slug": _heading_slug(heading["text"]),
295
+ })
296
+
297
+ all_terms: list[tuple[str, str]] = []
298
+ for term in spec.get("required_terms") or []:
299
+ all_terms.append((str(term), "required"))
300
+ for term in spec.get("code_terms") or []:
301
+ if str(term) not in {item[0] for item in all_terms}:
302
+ all_terms.append((str(term), "code"))
303
+ code_text = "\n".join(code_blocks)
304
+ term_rows: list[dict[str, Any]] = []
305
+ for term, category in all_terms:
306
+ term_rows.append({
307
+ "term": term,
308
+ "category": category,
309
+ "count": _term_count(clean_text, term),
310
+ "first_window": _first_window(window_rows, term),
311
+ "appears_in_code": "true" if term.lower() in code_text.lower() else "false",
312
+ })
313
+ term_rows.sort(key=lambda row: (str(row["category"]), str(row["term"]).lower()))
314
+ with (output_dir / "keyword_inventory.csv").open("w", encoding="utf-8", newline="") as handle:
315
+ fieldnames = ["term", "category", "count", "first_window", "appears_in_code"]
316
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
317
+ writer.writeheader()
318
+ for row in term_rows:
319
+ writer.writerow(row)
320
+
321
+ code_terms = [str(item).lower() for item in spec.get("code_terms") or []]
322
+ with (output_dir / "code_block_inventory.csv").open("w", encoding="utf-8", newline="") as handle:
323
+ fieldnames = ["block_index", "line_count", "char_count", "contains_code_term", "first_line"]
324
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
325
+ writer.writeheader()
326
+ for index, block in enumerate(code_blocks, start=1):
327
+ lines = [line for line in block.splitlines() if line.strip()]
328
+ contains = any(term and term in block.lower() for term in code_terms)
329
+ writer.writerow({
330
+ "block_index": index,
331
+ "line_count": len(lines),
332
+ "char_count": len(block),
333
+ "contains_code_term": "true" if contains else "false",
334
+ "first_line": lines[0][:200] if lines else "",
335
+ })
336
+
337
+ keyword_total = sum(int(row["count"]) for row in term_rows)
338
+ required_found = sum(1 for row in term_rows if row["category"] == "required" and int(row["count"]) > 0)
339
+ top_keyword = None
340
+ if term_rows:
341
+ top = max(term_rows, key=lambda row: (int(row["count"]), str(row["term"]).lower()))
342
+ top_keyword = str(top["term"]) if int(top["count"]) > 0 else None
343
+ summary = {
344
+ "software_name": str(spec.get("software_name") or ""),
345
+ "source_file": source_file,
346
+ "window_count": len(window_rows),
347
+ "heading_count": len(headings),
348
+ "code_block_count": len(code_blocks),
349
+ "keyword_total": keyword_total,
350
+ "unique_required_terms_found": required_found,
351
+ "top_keyword": top_keyword,
352
+ "source_character_count": len(clean_text),
353
+ }
354
+ _write_json(output_dir / "summary.json", summary)
355
+
356
+
357
+ def geojson_outputs(input_dir: Path, output_dir: Path) -> None:
358
+ payload = _read_json(input_dir / "events.geojson")
359
+ features = payload.get("features") if isinstance(payload, dict) else []
360
+ rows: list[dict[str, Any]] = []
361
+ for feature in features:
362
+ if not isinstance(feature, dict):
363
+ continue
364
+ props = feature.get("properties") if isinstance(feature.get("properties"), dict) else {}
365
+ geom = feature.get("geometry") if isinstance(feature.get("geometry"), dict) else {}
366
+ coords = geom.get("coordinates") if isinstance(geom.get("coordinates"), list) else []
367
+ mag = props.get("mag")
368
+ try:
369
+ mag = float(mag) if mag is not None else None
370
+ except (TypeError, ValueError):
371
+ mag = None
372
+ depth = None
373
+ if len(coords) >= 3:
374
+ try:
375
+ depth = float(coords[2])
376
+ except (TypeError, ValueError):
377
+ depth = None
378
+ time_ms = props.get("time")
379
+ date_utc = "unknown"
380
+ if isinstance(time_ms, (int, float)):
381
+ date_utc = dt.datetime.utcfromtimestamp(time_ms / 1000).date().isoformat()
382
+ rows.append({
383
+ "id": feature.get("id") or props.get("code") or "",
384
+ "mag": mag,
385
+ "depth": depth,
386
+ "place": str(props.get("place") or ""),
387
+ "region": _stable_region(str(props.get("place") or "")),
388
+ "date_utc": date_utc,
389
+ "feature": feature,
390
+ })
391
+ output_dir.mkdir(parents=True, exist_ok=True)
392
+ mags = [row["mag"] for row in rows if row["mag"] is not None]
393
+ depths = [row["depth"] for row in rows if row["depth"] is not None]
394
+ summary = {
395
+ "event_count": len(rows),
396
+ "magnitude": {
397
+ "count": len(mags),
398
+ "min": round(min(mags), 6) if mags else None,
399
+ "max": round(max(mags), 6) if mags else None,
400
+ "mean": round(statistics.fmean(mags), 6) if mags else None,
401
+ "median": round(statistics.median(mags), 6) if mags else None,
402
+ },
403
+ "depth_km": {
404
+ "count": len(depths),
405
+ "min": round(min(depths), 6) if depths else None,
406
+ "max": round(max(depths), 6) if depths else None,
407
+ "mean": round(statistics.fmean(depths), 6) if depths else None,
408
+ },
409
+ "time_range_utc": {
410
+ "start_date": min((row["date_utc"] for row in rows if row["date_utc"] != "unknown"), default=None),
411
+ "end_date": max((row["date_utc"] for row in rows if row["date_utc"] != "unknown"), default=None),
412
+ },
413
+ "quality_flags": {
414
+ "missing_magnitude": sum(1 for row in rows if row["mag"] is None),
415
+ "missing_depth": sum(1 for row in rows if row["depth"] is None),
416
+ "unique_regions": len({row["region"] for row in rows}),
417
+ },
418
+ }
419
+ _write_json(output_dir / "summary.json", summary)
420
+
421
+ grouped: dict[tuple[str, str], list[dict[str, Any]]] = {}
422
+ for row in rows:
423
+ grouped.setdefault((_mag_bin(row["mag"]), _depth_bin(row["depth"])), []).append(row)
424
+ with (output_dir / "magnitude_depth_bins.csv").open("w", encoding="utf-8", newline="") as handle:
425
+ fieldnames = ["mag_bin", "depth_bin", "event_count", "mean_magnitude", "max_magnitude"]
426
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
427
+ writer.writeheader()
428
+ for (mag_bin, depth_bin), group in sorted(grouped.items()):
429
+ group_mags = [row["mag"] for row in group if row["mag"] is not None]
430
+ writer.writerow({
431
+ "mag_bin": mag_bin,
432
+ "depth_bin": depth_bin,
433
+ "event_count": len(group),
434
+ "mean_magnitude": f"{statistics.fmean(group_mags):.6f}" if group_mags else "",
435
+ "max_magnitude": f"{max(group_mags):.6f}" if group_mags else "",
436
+ })
437
+
438
+ daily: dict[tuple[str, str], list[dict[str, Any]]] = {}
439
+ for row in rows:
440
+ daily.setdefault((row["region"], row["date_utc"]), []).append(row)
441
+ with (output_dir / "region_daily_counts.csv").open("w", encoding="utf-8", newline="") as handle:
442
+ fieldnames = ["region", "date_utc", "event_count", "max_magnitude"]
443
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
444
+ writer.writeheader()
445
+ for (region, date_utc), group in sorted(daily.items()):
446
+ group_mags = [row["mag"] for row in group if row["mag"] is not None]
447
+ writer.writerow({
448
+ "region": region,
449
+ "date_utc": date_utc,
450
+ "event_count": len(group),
451
+ "max_magnitude": f"{max(group_mags):.6f}" if group_mags else "",
452
+ })
453
+
454
+ filtered = [row["feature"] for row in rows if row["mag"] is not None and row["mag"] >= 4.5]
455
+ _write_json(output_dir / "filtered_events.geojson", {"type": "FeatureCollection", "features": filtered})
456
+
457
+
458
+ def csv_time_series_outputs(input_dir: Path, output_dir: Path) -> None:
459
+ spec = _read_json(input_dir / "analysis_spec.json")
460
+ csv_name = spec["input_file"]
461
+ date_column = spec["date_column"]
462
+ value_column = spec["value_column"]
463
+ rows: list[dict[str, Any]] = []
464
+ with (input_dir / csv_name).open("r", encoding="utf-8", newline="") as raw_handle:
465
+ lines = [line for line in raw_handle if not line.lstrip().startswith("#")]
466
+ reader = csv.DictReader(lines)
467
+ for item in reader:
468
+ raw_date = item.get(date_column, "")
469
+ try:
470
+ day = dt.date.fromisoformat(raw_date)
471
+ except ValueError:
472
+ if raw_date.isdigit() and len(raw_date) == 4:
473
+ day = dt.date(int(raw_date), 1, 1)
474
+ else:
475
+ continue
476
+ raw_value = item.get(value_column, "")
477
+ try:
478
+ value = float(raw_value)
479
+ except (TypeError, ValueError):
480
+ value = None
481
+ rows.append({"date": day, "value": value, "raw": item})
482
+ rows.sort(key=lambda item: item["date"])
483
+ valid = [row for row in rows if row["value"] is not None]
484
+ output_dir.mkdir(parents=True, exist_ok=True)
485
+ monthly: dict[str, list[float]] = {}
486
+ for row in valid:
487
+ key = row["date"].strftime("%Y-%m")
488
+ monthly.setdefault(key, []).append(row["value"])
489
+ with (output_dir / "monthly_statistics.csv").open("w", encoding="utf-8", newline="") as handle:
490
+ fieldnames = ["month", "count", "mean", "median", "min", "max"]
491
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
492
+ writer.writeheader()
493
+ for month, values in sorted(monthly.items()):
494
+ writer.writerow({
495
+ "month": month,
496
+ "count": len(values),
497
+ "mean": f"{statistics.fmean(values):.6f}",
498
+ "median": f"{statistics.median(values):.6f}",
499
+ "min": f"{min(values):.6f}",
500
+ "max": f"{max(values):.6f}",
501
+ })
502
+ existing_dates = {row["date"] for row in rows}
503
+ missing_days: list[dt.date] = []
504
+ if rows:
505
+ day = rows[0]["date"]
506
+ while day <= rows[-1]["date"]:
507
+ if day.weekday() < 5 and day not in existing_dates:
508
+ missing_days.append(day)
509
+ day += dt.timedelta(days=1)
510
+ with (output_dir / "missing_business_days.csv").open("w", encoding="utf-8", newline="") as handle:
511
+ writer = csv.DictWriter(handle, fieldnames=["date"])
512
+ writer.writeheader()
513
+ for day in missing_days:
514
+ writer.writerow({"date": day.isoformat()})
515
+ with (output_dir / "clean_series.csv").open("w", encoding="utf-8", newline="") as handle:
516
+ writer = csv.DictWriter(handle, fieldnames=["date", "value"])
517
+ writer.writeheader()
518
+ for row in valid:
519
+ writer.writerow({"date": row["date"].isoformat(), "value": f"{row['value']:.6f}"})
520
+ values = [row["value"] for row in valid]
521
+ summary = {
522
+ "series_name": spec.get("series_name", value_column),
523
+ "row_count": len(rows),
524
+ "valid_value_count": len(valid),
525
+ "missing_value_count": len(rows) - len(valid),
526
+ "missing_business_day_count": len(missing_days),
527
+ "date_range": {
528
+ "start": rows[0]["date"].isoformat() if rows else None,
529
+ "end": rows[-1]["date"].isoformat() if rows else None,
530
+ },
531
+ "value": {
532
+ "min": round(min(values), 6) if values else None,
533
+ "max": round(max(values), 6) if values else None,
534
+ "mean": round(statistics.fmean(values), 6) if values else None,
535
+ "median": round(statistics.median(values), 6) if values else None,
536
+ },
537
+ }
538
+ _write_json(output_dir / "summary.json", summary)
539
+
540
+
541
+ def _aggregate_annual_rows(rows: list[dict[str, Any]], aggregation: str) -> list[dict[str, Any]]:
542
+ if not aggregation:
543
+ return rows
544
+ grouped: dict[int, list[float]] = {}
545
+ for row in rows:
546
+ grouped.setdefault(int(row["year"]), []).append(float(row["value"]))
547
+ aggregated: list[dict[str, Any]] = []
548
+ for year, values in sorted(grouped.items()):
549
+ if aggregation == "mean":
550
+ value = statistics.fmean(values)
551
+ elif aggregation == "median":
552
+ value = statistics.median(values)
553
+ elif aggregation == "max":
554
+ value = max(values)
555
+ elif aggregation == "min":
556
+ value = min(values)
557
+ elif aggregation == "count":
558
+ value = float(len(values))
559
+ else:
560
+ raise ValueError(f"unsupported year_aggregation for csv_annual_series_audit: {aggregation}")
561
+ aggregated.append({"year": year, "value": value})
562
+ return aggregated
563
+
564
+
565
+ def csv_annual_series_outputs(input_dir: Path, output_dir: Path) -> None:
566
+ spec = _read_json(input_dir / "analysis_spec.json")
567
+ csv_name = spec["input_file"]
568
+ year_column = spec["year_column"]
569
+ value_column = spec["value_column"]
570
+ # Optional: derive the year from an ISO-8601 timestamp column (e.g. USGS FDSN
571
+ # `time` = "2022-06-29T19:17:58.929Z") instead of parsing an integer year.
572
+ # When unset, behaviour is unchanged (integer year column).
573
+ year_from_timestamp = bool(spec.get("year_from_timestamp", False))
574
+ year_aggregation = str(spec.get("year_aggregation") or "").strip().lower()
575
+ raw_rows: list[dict[str, Any]] = []
576
+ with (input_dir / csv_name).open("r", encoding="utf-8", newline="") as raw_handle:
577
+ lines = [line for line in raw_handle if not line.lstrip().startswith("#")]
578
+ reader = csv.DictReader(lines)
579
+ for item in reader:
580
+ raw_year = str(item.get(year_column, "")).strip()
581
+ try:
582
+ if year_from_timestamp:
583
+ # Take the leading 4-digit year of an ISO timestamp/date.
584
+ match = re.match(r"\s*(\d{4})", raw_year)
585
+ if not match:
586
+ continue
587
+ year = int(match.group(1))
588
+ else:
589
+ year = int(raw_year)
590
+ value = float(str(item.get(value_column, "")).strip())
591
+ except (TypeError, ValueError):
592
+ continue
593
+ raw_rows.append({"year": year, "value": value})
594
+ rows = _aggregate_annual_rows(raw_rows, year_aggregation)
595
+ rows.sort(key=lambda item: item["year"])
596
+ output_dir.mkdir(parents=True, exist_ok=True)
597
+ decades: dict[str, list[float]] = {}
598
+ for row in rows:
599
+ decade_start = (row["year"] // 10) * 10
600
+ decades.setdefault(f"{decade_start}s", []).append(row["value"])
601
+ with (output_dir / "decadal_statistics.csv").open("w", encoding="utf-8", newline="") as handle:
602
+ fieldnames = [
603
+ "decade_start",
604
+ "start_year",
605
+ "end_year",
606
+ "count",
607
+ "mean_departure",
608
+ "median_departure",
609
+ "min_departure",
610
+ "max_departure",
611
+ "sample_std_departure",
612
+ ]
613
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
614
+ writer.writeheader()
615
+ for decade, values in sorted(decades.items()):
616
+ decade_start = int(decade.rstrip("s"))
617
+ years = [row["year"] for row in rows if decade_start <= row["year"] <= decade_start + 9]
618
+ writer.writerow({
619
+ "decade_start": decade_start,
620
+ "start_year": min(years),
621
+ "end_year": max(years),
622
+ "count": len(values),
623
+ "mean_departure": f"{statistics.fmean(values):.6f}",
624
+ "median_departure": f"{statistics.median(values):.6f}",
625
+ "min_departure": f"{min(values):.6f}",
626
+ "max_departure": f"{max(values):.6f}",
627
+ "sample_std_departure": f"{statistics.stdev(values):.6f}" if len(values) >= 2 else "",
628
+ })
629
+ threshold = float(spec.get("threshold", 1.0))
630
+ with (output_dir / "threshold_years.csv").open("w", encoding="utf-8", newline="") as handle:
631
+ fieldnames = ["rank", "year", "departure", "threshold"]
632
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
633
+ writer.writeheader()
634
+ rank = 1
635
+ for row in rows:
636
+ if row["value"] >= threshold:
637
+ writer.writerow({
638
+ "rank": rank,
639
+ "year": row["year"],
640
+ "departure": f"{row['value']:.6f}",
641
+ "threshold": f"{threshold:.6f}",
642
+ })
643
+ rank += 1
644
+ with (output_dir / "clean_series.csv").open("w", encoding="utf-8", newline="") as handle:
645
+ writer = csv.DictWriter(handle, fieldnames=["Year", "Departure from Average"])
646
+ writer.writeheader()
647
+ for row in rows:
648
+ writer.writerow({"Year": row["year"], "Departure from Average": f"{row['value']:.6f}"})
649
+ values = [row["value"] for row in rows]
650
+ threshold_rows = [row for row in rows if row["value"] >= threshold]
651
+ min_row = min(rows, key=lambda row: row["value"]) if rows else None
652
+ max_row = max(rows, key=lambda row: row["value"]) if rows else None
653
+ summary = {
654
+ "series_name": spec.get("series_name", value_column),
655
+ "row_count": len(rows),
656
+ "year_range": {
657
+ "start": rows[0]["year"] if rows else None,
658
+ "end": rows[-1]["year"] if rows else None,
659
+ },
660
+ "value": {
661
+ "min": round(min(values), 6) if values else None,
662
+ "min_year": min_row["year"] if min_row else None,
663
+ "max": round(max(values), 6) if values else None,
664
+ "max_year": max_row["year"] if max_row else None,
665
+ "mean": round(statistics.fmean(values), 6) if values else None,
666
+ "median": round(statistics.median(values), 6) if values else None,
667
+ "sample_std": round(statistics.stdev(values), 6) if len(values) >= 2 else None,
668
+ },
669
+ "threshold": threshold,
670
+ "years_at_or_above_threshold": len(threshold_rows),
671
+ "first_threshold_year": threshold_rows[0]["year"] if threshold_rows else None,
672
+ "last_threshold_year": threshold_rows[-1]["year"] if threshold_rows else None,
673
+ }
674
+ if year_aggregation:
675
+ summary["year_aggregation"] = year_aggregation
676
+ summary["source_row_count"] = len(raw_rows)
677
+ _write_json(output_dir / "summary.json", summary)
678
+
679
+
20260903-164548-science-environment-8102f0/solution/internal/workflow_runtime.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from workflow_adapters_runtime import csv_annual_series_outputs
3
+
4
+ def run_reference(input_dir: Path, output_dir: Path) -> None:
5
+ csv_annual_series_outputs(input_dir, output_dir)
20260903-164548-science-environment-8102f0/solution/reference_solution.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+ from pathlib import Path
6
+
7
+
8
+ def main() -> int:
9
+ parser = argparse.ArgumentParser()
10
+ parser.add_argument("--input", required=True)
11
+ parser.add_argument("--output", required=True)
12
+ args = parser.parse_args()
13
+ sys.path.insert(0, str(Path(__file__).resolve().parent / "internal"))
14
+ from workflow_runtime import run_reference
15
+ run_reference(Path(args.input), Path(args.output))
16
+ return 0
17
+
18
+
19
+ if __name__ == "__main__":
20
+ raise SystemExit(main())
20260903-164548-science-environment-8102f0/solution/solve.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ INPUT_DIR="${1:-/workspace/input}"
4
+ OUTPUT_DIR="${2:-/workspace/output}"
5
+ SOLUTION_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ mkdir -p "${OUTPUT_DIR}"
7
+ python "${SOLUTION_DIR}/reference_solution.py" --input "${INPUT_DIR}" --output "${OUTPUT_DIR}"
20260903-164548-science-environment-8102f0/task.toml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ artifacts = ["/workspace/output/summary.json", "/workspace/output/decadal_statistics.csv", "/workspace/output/threshold_years.csv", "/workspace/output/clean_series.csv"]
3
+
4
+ [task]
5
+ name = "ale-cli/20260903-164548-science-environment-8102f0"
6
+ description = "Audit the real USGS FDSN Alaska and Aleutians earthquake catalog for 1974-1978 (events with magnitude >= 4.5) and produce reproducible annual annual mean focal depth (km) statistics, decadal aggregates, threshold-year checks, and a cleaned local series."
7
+ keywords = ["agents-last-exam", "ale-cli", "csv-annual-series-audit", "deterministic-evaluator", "linux-cli", "science-environment"]
8
+
9
+ [metadata]
10
+ benchmark = "ale_cli"
11
+ source_format = "ale_cli_official_style"
12
+ converter = "ale_cli_to_harbor"
13
+ source_task_key = "20260903-164548_science_environment_8102f0"
14
+ task_id = "science_environment/usgs_alaska_aleutians_annual_depth_audit"
15
+ domain = "science_environment"
16
+ task = "usgs_alaska_aleutians_annual_depth_audit"
17
+ variant = "base"
18
+ oracle_available = true
19
+ scoring_method = "deterministic_hidden_evaluator"
20
+ required_outputs = ["summary.json", "decadal_statistics.csv", "threshold_years.csv", "clean_series.csv"]
21
+
22
+ [agent]
23
+ timeout_sec = 1800
24
+
25
+ [verifier]
26
+ timeout_sec = 600
27
+ environment_mode = "separate"
28
+
29
+ [verifier.environment]
30
+ build_timeout_sec = 900.0
31
+ network_mode = "public"
32
+ os = "linux"
33
+ cpus = 1
34
+ memory_mb = 2048
35
+ storage_mb = 4096
36
+ gpus = 0
37
+
38
+ [environment]
39
+ build_timeout_sec = 1200.0
40
+ network_mode = "public"
41
+ os = "linux"
42
+ cpus = 2
43
+ memory_mb = 4096
44
+ storage_mb = 10240
45
+ gpus = 0
20260903-164548-science-environment-8102f0/tests/Dockerfile ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /workspace
4
+
5
+ COPY . /tests
6
+ RUN chmod +x /tests/test.sh
20260903-164548-science-environment-8102f0/tests/evaluator_runner.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import importlib.util
6
+ import json
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+
11
+ def read_json(path: Path) -> Any:
12
+ return json.loads(path.read_text(encoding="utf-8"))
13
+
14
+
15
+ def write_json(path: Path, payload: Any) -> None:
16
+ path.parent.mkdir(parents=True, exist_ok=True)
17
+ path.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
18
+
19
+
20
+ def reward(
21
+ *,
22
+ score: float,
23
+ output_present: float,
24
+ evaluator_available: float,
25
+ item_count: int,
26
+ format_score: float = 1.0,
27
+ ) -> dict[str, float]:
28
+ clipped = max(0.0, min(1.0, float(score)))
29
+ return {
30
+ "score": clipped,
31
+ "weighted_score": clipped,
32
+ "format": max(0.0, min(1.0, float(format_score))),
33
+ "output_present": max(0.0, min(1.0, float(output_present))),
34
+ "evaluator_available": max(0.0, min(1.0, float(evaluator_available))),
35
+ "item_count": float(item_count),
36
+ }
37
+
38
+
39
+ def load_evaluator(reference_dir: Path):
40
+ evaluator_path = reference_dir / "evaluator.py"
41
+ spec = importlib.util.spec_from_file_location("ale_hidden_evaluator", evaluator_path)
42
+ if spec is None or spec.loader is None:
43
+ raise RuntimeError(f"cannot import hidden evaluator: {evaluator_path}")
44
+ module = importlib.util.module_from_spec(spec)
45
+ spec.loader.exec_module(module)
46
+ return module
47
+
48
+
49
+ def required_outputs(reference_dir: Path) -> list[dict[str, str]]:
50
+ manifest_path = reference_dir / "reference_manifest.json"
51
+ if not manifest_path.is_file():
52
+ return []
53
+ manifest = read_json(manifest_path)
54
+ rows = manifest.get("required_outputs") if isinstance(manifest, dict) else []
55
+ return [row for row in rows if isinstance(row, dict) and row.get("path")]
56
+
57
+
58
+ def main() -> int:
59
+ parser = argparse.ArgumentParser(description="Run a hidden ALE CLI evaluator in Harbor.")
60
+ parser.add_argument("--output-dir", type=Path, required=True)
61
+ parser.add_argument("--reference-dir", type=Path, required=True)
62
+ parser.add_argument("--reward-json", type=Path, required=True)
63
+ parser.add_argument("--details-json", type=Path, required=True)
64
+ args = parser.parse_args()
65
+
66
+ required = required_outputs(args.reference_dir)
67
+ present = [row for row in required if (args.output_dir / str(row["path"])).is_file()]
68
+ item_count = len(required)
69
+ if not required:
70
+ write_json(args.reward_json, reward(score=0.0, output_present=0.0, evaluator_available=0.0, item_count=0, format_score=0.0))
71
+ write_json(args.details_json, {"ok": False, "error": "reference_manifest.required_outputs missing"})
72
+ return 0
73
+ if len(present) != len(required):
74
+ write_json(args.reward_json, reward(score=0.0, output_present=0.0, evaluator_available=1.0, item_count=item_count))
75
+ write_json(args.details_json, {"ok": True, "reason": "missing required outputs", "present": [row["path"] for row in present]})
76
+ return 0
77
+ try:
78
+ module = load_evaluator(args.reference_dir)
79
+ result = module.evaluate(args.output_dir, args.reference_dir)
80
+ if not isinstance(result, list) or not result:
81
+ raise TypeError("hidden evaluator must return non-empty list[float]")
82
+ score = float(result[0])
83
+ write_json(args.reward_json, reward(score=score, output_present=1.0, evaluator_available=1.0, item_count=item_count))
84
+ write_json(args.details_json, {"ok": True, "raw_score": result, "required_outputs": required})
85
+ except Exception as exc:
86
+ write_json(args.reward_json, reward(score=0.0, output_present=1.0, evaluator_available=0.0, item_count=item_count))
87
+ write_json(args.details_json, {"ok": False, "error": f"{type(exc).__name__}: {exc}", "required_outputs": required})
88
+ return 0
89
+
90
+
91
+ if __name__ == "__main__":
92
+ raise SystemExit(main())
20260903-164548-science-environment-8102f0/tests/reference/__pycache__/evaluator.cpython-312.pyc ADDED
Binary file (6.22 kB). View file
 
20260903-164548-science-environment-8102f0/tests/reference/evaluator.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import json
5
+ import math
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+
10
+ def _load_json(path: Path) -> Any:
11
+ with path.open("r", encoding="utf-8") as handle:
12
+ return json.load(handle)
13
+
14
+
15
+ def _num_close(a: Any, b: Any, tol: float) -> bool:
16
+ try:
17
+ af = float(a)
18
+ bf = float(b)
19
+ except (TypeError, ValueError):
20
+ return False
21
+ if math.isnan(af) and math.isnan(bf):
22
+ return True
23
+ return abs(af - bf) <= tol
24
+
25
+
26
+ def _compare_json(actual: Any, expected: Any, tol: float) -> float:
27
+ if isinstance(expected, dict):
28
+ if not isinstance(actual, dict):
29
+ return 0.0
30
+ if not expected:
31
+ return 1.0
32
+ scores = []
33
+ for key, exp_value in expected.items():
34
+ if key not in actual:
35
+ scores.append(0.0)
36
+ else:
37
+ scores.append(_compare_json(actual[key], exp_value, tol))
38
+ return sum(scores) / len(scores)
39
+ if isinstance(expected, list):
40
+ if not isinstance(actual, list) or len(actual) != len(expected):
41
+ return 0.0
42
+ if not expected:
43
+ return 1.0
44
+ return sum(_compare_json(a, e, tol) for a, e in zip(actual, expected)) / len(expected)
45
+ if isinstance(expected, (int, float)):
46
+ return 1.0 if _num_close(actual, expected, tol) else 0.0
47
+ return 1.0 if actual == expected else 0.0
48
+
49
+
50
+ def _read_csv(path: Path) -> list[dict[str, str]]:
51
+ with path.open("r", encoding="utf-8", newline="") as handle:
52
+ return list(csv.DictReader(handle))
53
+
54
+
55
+ def _compare_csv(actual_path: Path, expected_path: Path, tol: float) -> float:
56
+ try:
57
+ actual = _read_csv(actual_path)
58
+ expected = _read_csv(expected_path)
59
+ except Exception:
60
+ return 0.0
61
+ if len(actual) != len(expected):
62
+ return 0.0
63
+ if not expected:
64
+ return 1.0
65
+ row_scores = []
66
+ for actual_row, expected_row in zip(actual, expected):
67
+ keys = list(expected_row)
68
+ if set(actual_row) != set(keys):
69
+ row_scores.append(0.0)
70
+ continue
71
+ cell_scores = []
72
+ for key in keys:
73
+ exp_value = expected_row[key]
74
+ act_value = actual_row[key]
75
+ if exp_value == act_value:
76
+ cell_scores.append(1.0)
77
+ elif _num_close(act_value, exp_value, tol):
78
+ cell_scores.append(1.0)
79
+ else:
80
+ cell_scores.append(0.0)
81
+ row_scores.append(sum(cell_scores) / len(cell_scores) if cell_scores else 1.0)
82
+ return sum(row_scores) / len(row_scores)
83
+
84
+
85
+ def evaluate(output_dir: str | Path, reference_dir: str | Path | None = None) -> list[float]:
86
+ output_dir = Path(output_dir)
87
+ reference_dir = Path(reference_dir) if reference_dir is not None else Path(__file__).resolve().parent
88
+ manifest = _load_json(reference_dir / "reference_manifest.json")
89
+ tolerance = float(manifest.get("numeric_tolerance", 1e-9))
90
+ required = manifest.get("required_outputs") or []
91
+ if not required:
92
+ return [0.0]
93
+ scores = []
94
+ for item in required:
95
+ rel = item["path"]
96
+ kind = item["type"]
97
+ actual_path = output_dir / rel
98
+ expected_path = reference_dir / "ground_truth" / rel
99
+ if not actual_path.is_file() or not expected_path.is_file():
100
+ scores.append(0.0)
101
+ continue
102
+ try:
103
+ if kind == "json":
104
+ scores.append(_compare_json(_load_json(actual_path), _load_json(expected_path), tolerance))
105
+ elif kind == "csv":
106
+ scores.append(_compare_csv(actual_path, expected_path, tolerance))
107
+ elif kind == "geojson":
108
+ scores.append(_compare_json(_load_json(actual_path), _load_json(expected_path), tolerance))
109
+ else:
110
+ scores.append(1.0 if actual_path.read_bytes() == expected_path.read_bytes() else 0.0)
111
+ except Exception:
112
+ scores.append(0.0)
113
+ score = max(0.0, min(1.0, sum(scores) / len(scores)))
114
+ return [score]
20260903-164548-science-environment-8102f0/tests/reference/ground_truth/clean_series.csv ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Year,Departure from Average
2
+ 1974,49.094340
3
+ 1975,51.360000
4
+ 1976,60.726316
5
+ 1977,56.385321
6
+ 1978,52.267717
20260903-164548-science-environment-8102f0/tests/reference/ground_truth/decadal_statistics.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ decade_start,start_year,end_year,count,mean_departure,median_departure,min_departure,max_departure,sample_std_departure
2
+ 1970,1974,1978,5,53.966739,52.267717,49.094340,60.726316,4.608781
20260903-164548-science-environment-8102f0/tests/reference/ground_truth/summary.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "series_name": "USGS FDSN Alaska and Aleutians 1974-1978 earthquake annual mean focal depth (km) (min mag 4.5)",
3
+ "row_count": 5,
4
+ "year_range": {
5
+ "start": 1974,
6
+ "end": 1978
7
+ },
8
+ "value": {
9
+ "min": 49.09434,
10
+ "min_year": 1974,
11
+ "max": 60.726316,
12
+ "max_year": 1976,
13
+ "mean": 53.966739,
14
+ "median": 52.267717,
15
+ "sample_std": 4.608781
16
+ },
17
+ "threshold": 70.0,
18
+ "years_at_or_above_threshold": 0,
19
+ "first_threshold_year": null,
20
+ "last_threshold_year": null,
21
+ "year_aggregation": "mean",
22
+ "source_row_count": 537
23
+ }
20260903-164548-science-environment-8102f0/tests/reference/ground_truth/threshold_years.csv ADDED
@@ -0,0 +1 @@
 
 
1
+ rank,year,departure,threshold
20260903-164548-science-environment-8102f0/tests/reference/internal/workflow_adapters_runtime.py ADDED
@@ -0,0 +1,679 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ import datetime as dt
5
+ import html
6
+ import json
7
+ import math
8
+ import re
9
+ import shutil
10
+ import statistics
11
+ from pathlib import Path
12
+ from typing import Any
13
+
14
+
15
+ def _read_json(path: Path) -> Any:
16
+ with path.open("r", encoding="utf-8") as handle:
17
+ return json.load(handle)
18
+
19
+
20
+ def _write_json(path: Path, payload: Any) -> None:
21
+ path.parent.mkdir(parents=True, exist_ok=True)
22
+ with path.open("w", encoding="utf-8") as handle:
23
+ json.dump(payload, handle, ensure_ascii=False, indent=2)
24
+ handle.write("\n")
25
+
26
+ def _stable_region(place: str) -> str:
27
+ if not place:
28
+ return "unknown"
29
+ if "," in place:
30
+ return place.split(",")[-1].strip() or place.strip()
31
+ parts = place.split()
32
+ return " ".join(parts[-2:]) if len(parts) >= 2 else place.strip()
33
+
34
+
35
+ def _mag_bin(value: float | None) -> str:
36
+ if value is None or math.isnan(value):
37
+ return "unknown"
38
+ lower = math.floor(value)
39
+ upper = lower + 1
40
+ return f"{lower:.0f}-{upper:.0f}"
41
+
42
+
43
+ def _depth_bin(value: float | None) -> str:
44
+ if value is None or math.isnan(value):
45
+ return "unknown"
46
+ if value < 0:
47
+ return "<0"
48
+ if value < 10:
49
+ return "0-10"
50
+ if value < 30:
51
+ return "10-30"
52
+ if value < 70:
53
+ return "30-70"
54
+ if value < 300:
55
+ return "70-300"
56
+ return "300+"
57
+
58
+
59
+ def _clean_markup_text(raw: str) -> str:
60
+ text = re.sub(r"(?is)<(script|style|noscript)[^>]*>.*?</\1>", " ", raw)
61
+ text = re.sub(r"(?is)<br\s*/?>", "\n", text)
62
+ text = re.sub(r"(?is)</(p|div|li|tr|h[1-6]|pre)>", "\n", text)
63
+ text = re.sub(r"(?is)<[^>]+>", " ", text)
64
+ text = html.unescape(text)
65
+ text = re.sub(r"[ \t]+", " ", text)
66
+ text = re.sub(r"\n\s+", "\n", text)
67
+ return text.strip()
68
+
69
+
70
+ def _heading_slug(value: str) -> str:
71
+ slug = re.sub(r"[^a-z0-9]+", "_", value.lower()).strip("_")
72
+ return slug[:80] or "section"
73
+
74
+
75
+ def _extract_headings(raw: str) -> list[dict[str, str]]:
76
+ headings: list[dict[str, str]] = []
77
+ for match in re.finditer(r"(?is)<h([1-6])[^>]*>(.*?)</h\1>", raw):
78
+ text = _clean_markup_text(match.group(2))
79
+ if text:
80
+ headings.append({"level": f"h{match.group(1)}", "text": text})
81
+ if headings:
82
+ return headings
83
+ for line in raw.splitlines():
84
+ match = re.match(r"^(#{1,6})\s+(.+?)\s*$", line)
85
+ if match:
86
+ headings.append({"level": f"h{len(match.group(1))}", "text": match.group(2).strip()})
87
+ return headings
88
+
89
+
90
+ def _extract_code_blocks(raw: str) -> list[str]:
91
+ blocks: list[str] = []
92
+ for match in re.finditer(r"(?is)<pre[^>]*>(.*?)</pre>", raw):
93
+ text = _clean_markup_text(match.group(1))
94
+ if text:
95
+ blocks.append(text)
96
+ for match in re.finditer(r"(?is)<code[^>]*>(.*?)</code>", raw):
97
+ text = _clean_markup_text(match.group(1))
98
+ if text and text not in blocks:
99
+ blocks.append(text)
100
+ for match in re.finditer(r"(?s)```(?:[A-Za-z0-9_-]+)?\n(.*?)```", raw):
101
+ text = html.unescape(match.group(1).strip())
102
+ if text and text not in blocks:
103
+ blocks.append(text)
104
+ return blocks
105
+
106
+
107
+ def _window_rows(clean_text: str, *, width: int = 40, stride: int = 20) -> list[dict[str, Any]]:
108
+ words = re.findall(r"\S+", clean_text)
109
+ rows: list[dict[str, Any]] = []
110
+ if not words:
111
+ return rows
112
+ start = 0
113
+ while start < len(words):
114
+ end = min(start + width, len(words))
115
+ rows.append({
116
+ "window_id": len(rows) + 1,
117
+ "start_word": start,
118
+ "end_word": end,
119
+ "text": " ".join(words[start:end]),
120
+ })
121
+ if end == len(words):
122
+ break
123
+ start += stride
124
+ return rows
125
+
126
+
127
+ def _term_count(text: str, term: str) -> int:
128
+ term = term.strip()
129
+ if not term:
130
+ return 0
131
+ return len(re.findall(re.escape(term), text, flags=re.IGNORECASE))
132
+
133
+
134
+ def _first_window(windows: list[dict[str, Any]], term: str) -> str:
135
+ term_lower = term.lower()
136
+ for row in windows:
137
+ if term_lower in str(row.get("text") or "").lower():
138
+ return str(row.get("window_id") or "")
139
+ return ""
140
+
141
+
142
+ def _write_tutorial_public_inputs(input_dir: Path, source_path: Path, spec_payload: dict[str, Any]) -> None:
143
+ raw = source_path.read_text(encoding="utf-8", errors="replace")
144
+ # Tutorial examples may contain a maintainer's local Windows path. Keep
145
+ # the command semantics while preventing host-specific paths from entering
146
+ # the public task artifact.
147
+ sanitized_raw = re.sub(r"(?i)\b[A-Z]:\\(?:[^\\\r\n<>\"']+\\?)*[^\\\r\n<>\"']*", "./local.db", raw)
148
+ clean_text = _clean_markup_text(sanitized_raw)
149
+ windows = _window_rows(clean_text)
150
+ if len(windows) < 100:
151
+ raise ValueError(f"official tutorial source produced only {len(windows)} text windows; need at least 100")
152
+ required_terms = [str(item) for item in spec_payload.get("required_terms") or []]
153
+ code_terms = [str(item) for item in spec_payload.get("code_terms") or []]
154
+ input_dir.mkdir(parents=True, exist_ok=True)
155
+ destination = input_dir / str(spec_payload["source_file"])
156
+ # Always materialize the sanitized copy, including when the downloader
157
+ # already placed the source at the destination path.
158
+ destination.write_text(sanitized_raw, encoding="utf-8")
159
+ with (input_dir / str(spec_payload["input_file"])).open("w", encoding="utf-8", newline="") as handle:
160
+ fieldnames = ["window_id", "start_word", "end_word", "text", "contains_code_term", "matched_required_terms"]
161
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
162
+ writer.writeheader()
163
+ for row in windows:
164
+ text = str(row["text"])
165
+ matched = [term for term in required_terms if term.lower() in text.lower()]
166
+ contains_code = any(term.lower() in text.lower() for term in code_terms)
167
+ writer.writerow({
168
+ "window_id": row["window_id"],
169
+ "start_word": row["start_word"],
170
+ "end_word": row["end_word"],
171
+ "text": text,
172
+ "contains_code_term": "true" if contains_code else "false",
173
+ "matched_required_terms": "|".join(matched),
174
+ })
175
+ metadata = {
176
+ "software_name": spec_payload.get("software_name"),
177
+ "tutorial_url": spec_payload.get("tutorial_url"),
178
+ "source_urls": spec_payload.get("source_urls"),
179
+ "source_file": spec_payload.get("source_file"),
180
+ "window_file": spec_payload.get("input_file"),
181
+ "window_rule": spec_payload.get("window_rule"),
182
+ "required_terms": spec_payload.get("required_terms"),
183
+ "code_terms": spec_payload.get("code_terms"),
184
+ "note": "Provenance and public extraction rules only; scored aggregate values are intentionally not stored here.",
185
+ }
186
+ _write_json(input_dir / "tutorial_metadata.json", metadata)
187
+
188
+
189
+ def _source_context_text(path: Path) -> str:
190
+ try:
191
+ raw = path.read_text(encoding="utf-8", errors="replace")
192
+ except Exception:
193
+ return f"{path.name}\nsha256={_sha256_file(path)}\nsize_bytes={path.stat().st_size}\n"
194
+ if path.suffix.lower() in {".html", ".htm", ".md", ".txt"}:
195
+ return _clean_markup_text(raw)
196
+ return re.sub(r"\s+", " ", raw).strip()
197
+
198
+
199
+ def _ensure_public_input_footprint(input_dir: Path, source_paths: list[Path]) -> str:
200
+ current = _tree_file_bytes(input_dir)
201
+ if current >= MIN_PUBLIC_TASK_DATA_BYTES:
202
+ return f"public input footprint is {current} bytes; no context expansion needed"
203
+ context_path = input_dir / "source_context_windows.jsonl"
204
+ base = current - (context_path.stat().st_size if context_path.is_file() else 0)
205
+ context_path.unlink(missing_ok=True)
206
+ rows: list[dict[str, Any]] = []
207
+ for source in source_paths:
208
+ if not source.is_file() or source.resolve() == context_path.resolve():
209
+ continue
210
+ text = _source_context_text(source)
211
+ if not text:
212
+ continue
213
+ start = 0
214
+ width = 1800
215
+ stride = 900
216
+ while start < len(text):
217
+ end = min(len(text), start + width)
218
+ rows.append({
219
+ "source_file": source.relative_to(input_dir).as_posix() if source.is_relative_to(input_dir) else source.name,
220
+ "source_sha256": _sha256_file(source),
221
+ "start_char": start,
222
+ "end_char": end,
223
+ "text": text[start:end],
224
+ })
225
+ if end == len(text):
226
+ break
227
+ start += stride
228
+ if not rows:
229
+ raise ValueError("public input footprint expansion has no public source text")
230
+ input_dir.mkdir(parents=True, exist_ok=True)
231
+ rows_written = 0
232
+ target_extra = MIN_PUBLIC_TASK_DATA_BYTES - max(0, base)
233
+ with context_path.open("w", encoding="utf-8") as handle:
234
+ cycle = 0
235
+ while handle.tell() < target_extra or rows_written < 100:
236
+ row = dict(rows[rows_written % len(rows)])
237
+ row["window_id"] = rows_written + 1
238
+ row["cycle"] = cycle
239
+ handle.write(json.dumps(row, ensure_ascii=False) + "\n")
240
+ rows_written += 1
241
+ if rows_written % len(rows) == 0:
242
+ cycle += 1
243
+ handle.flush()
244
+ return f"wrote input/source_context_windows.jsonl with {rows_written} public-source windows and {context_path.stat().st_size} bytes"
245
+
246
+
247
+ def _write_software_manifest(software_dir: Path, spec_payload: dict[str, Any]) -> None:
248
+ if str(spec_payload.get("workflow_kind") or "") != "software_tutorial_doc_audit":
249
+ return
250
+ software_dir.mkdir(parents=True, exist_ok=True)
251
+ software_name = str(spec_payload.get("software_name") or "").strip()
252
+ executables = [str(item).strip() for item in spec_payload.get("executables") or [] if str(item).strip()]
253
+ system_packages = [str(item).strip() for item in spec_payload.get("required_system_packages") or [] if str(item).strip()]
254
+ source_urls = [str(item).strip() for item in spec_payload.get("source_urls") or [] if str(item).strip()]
255
+ _write_json(software_dir / "software_manifest.json", {
256
+ "software_name": software_name,
257
+ "executables": executables,
258
+ "required_system_packages": system_packages,
259
+ "official_sources": source_urls,
260
+ "solve_time_network": "disabled",
261
+ "python_wrapper_only": False,
262
+ "note": "This task audits real official software documentation/source staged offline; Python helpers only validate outputs.",
263
+ })
264
+ with (software_dir / "command_examples.csv").open("w", encoding="utf-8", newline="") as handle:
265
+ writer = csv.DictWriter(handle, fieldnames=["term", "kind", "software_name"])
266
+ writer.writeheader()
267
+ for term in spec_payload.get("code_terms") or []:
268
+ writer.writerow({"term": str(term), "kind": "code_term", "software_name": software_name})
269
+ for exe in executables:
270
+ writer.writerow({"term": exe, "kind": "executable", "software_name": software_name})
271
+
272
+
273
+ def software_tutorial_outputs(input_dir: Path, output_dir: Path) -> None:
274
+ spec = _read_json(input_dir / "analysis_spec.json")
275
+ source_file = str(spec["source_file"])
276
+ source_text = (input_dir / source_file).read_text(encoding="utf-8", errors="replace")
277
+ clean_text = _clean_markup_text(source_text)
278
+ headings = _extract_headings(source_text)
279
+ code_blocks = _extract_code_blocks(source_text)
280
+ window_rows: list[dict[str, str]] = []
281
+ with (input_dir / str(spec["input_file"])).open("r", encoding="utf-8", newline="") as handle:
282
+ window_rows = list(csv.DictReader(handle))
283
+ output_dir.mkdir(parents=True, exist_ok=True)
284
+
285
+ with (output_dir / "section_outline.csv").open("w", encoding="utf-8", newline="") as handle:
286
+ fieldnames = ["rank", "heading_level", "heading_text", "slug"]
287
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
288
+ writer.writeheader()
289
+ for rank, heading in enumerate(headings, start=1):
290
+ writer.writerow({
291
+ "rank": rank,
292
+ "heading_level": heading["level"],
293
+ "heading_text": heading["text"],
294
+ "slug": _heading_slug(heading["text"]),
295
+ })
296
+
297
+ all_terms: list[tuple[str, str]] = []
298
+ for term in spec.get("required_terms") or []:
299
+ all_terms.append((str(term), "required"))
300
+ for term in spec.get("code_terms") or []:
301
+ if str(term) not in {item[0] for item in all_terms}:
302
+ all_terms.append((str(term), "code"))
303
+ code_text = "\n".join(code_blocks)
304
+ term_rows: list[dict[str, Any]] = []
305
+ for term, category in all_terms:
306
+ term_rows.append({
307
+ "term": term,
308
+ "category": category,
309
+ "count": _term_count(clean_text, term),
310
+ "first_window": _first_window(window_rows, term),
311
+ "appears_in_code": "true" if term.lower() in code_text.lower() else "false",
312
+ })
313
+ term_rows.sort(key=lambda row: (str(row["category"]), str(row["term"]).lower()))
314
+ with (output_dir / "keyword_inventory.csv").open("w", encoding="utf-8", newline="") as handle:
315
+ fieldnames = ["term", "category", "count", "first_window", "appears_in_code"]
316
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
317
+ writer.writeheader()
318
+ for row in term_rows:
319
+ writer.writerow(row)
320
+
321
+ code_terms = [str(item).lower() for item in spec.get("code_terms") or []]
322
+ with (output_dir / "code_block_inventory.csv").open("w", encoding="utf-8", newline="") as handle:
323
+ fieldnames = ["block_index", "line_count", "char_count", "contains_code_term", "first_line"]
324
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
325
+ writer.writeheader()
326
+ for index, block in enumerate(code_blocks, start=1):
327
+ lines = [line for line in block.splitlines() if line.strip()]
328
+ contains = any(term and term in block.lower() for term in code_terms)
329
+ writer.writerow({
330
+ "block_index": index,
331
+ "line_count": len(lines),
332
+ "char_count": len(block),
333
+ "contains_code_term": "true" if contains else "false",
334
+ "first_line": lines[0][:200] if lines else "",
335
+ })
336
+
337
+ keyword_total = sum(int(row["count"]) for row in term_rows)
338
+ required_found = sum(1 for row in term_rows if row["category"] == "required" and int(row["count"]) > 0)
339
+ top_keyword = None
340
+ if term_rows:
341
+ top = max(term_rows, key=lambda row: (int(row["count"]), str(row["term"]).lower()))
342
+ top_keyword = str(top["term"]) if int(top["count"]) > 0 else None
343
+ summary = {
344
+ "software_name": str(spec.get("software_name") or ""),
345
+ "source_file": source_file,
346
+ "window_count": len(window_rows),
347
+ "heading_count": len(headings),
348
+ "code_block_count": len(code_blocks),
349
+ "keyword_total": keyword_total,
350
+ "unique_required_terms_found": required_found,
351
+ "top_keyword": top_keyword,
352
+ "source_character_count": len(clean_text),
353
+ }
354
+ _write_json(output_dir / "summary.json", summary)
355
+
356
+
357
+ def geojson_outputs(input_dir: Path, output_dir: Path) -> None:
358
+ payload = _read_json(input_dir / "events.geojson")
359
+ features = payload.get("features") if isinstance(payload, dict) else []
360
+ rows: list[dict[str, Any]] = []
361
+ for feature in features:
362
+ if not isinstance(feature, dict):
363
+ continue
364
+ props = feature.get("properties") if isinstance(feature.get("properties"), dict) else {}
365
+ geom = feature.get("geometry") if isinstance(feature.get("geometry"), dict) else {}
366
+ coords = geom.get("coordinates") if isinstance(geom.get("coordinates"), list) else []
367
+ mag = props.get("mag")
368
+ try:
369
+ mag = float(mag) if mag is not None else None
370
+ except (TypeError, ValueError):
371
+ mag = None
372
+ depth = None
373
+ if len(coords) >= 3:
374
+ try:
375
+ depth = float(coords[2])
376
+ except (TypeError, ValueError):
377
+ depth = None
378
+ time_ms = props.get("time")
379
+ date_utc = "unknown"
380
+ if isinstance(time_ms, (int, float)):
381
+ date_utc = dt.datetime.utcfromtimestamp(time_ms / 1000).date().isoformat()
382
+ rows.append({
383
+ "id": feature.get("id") or props.get("code") or "",
384
+ "mag": mag,
385
+ "depth": depth,
386
+ "place": str(props.get("place") or ""),
387
+ "region": _stable_region(str(props.get("place") or "")),
388
+ "date_utc": date_utc,
389
+ "feature": feature,
390
+ })
391
+ output_dir.mkdir(parents=True, exist_ok=True)
392
+ mags = [row["mag"] for row in rows if row["mag"] is not None]
393
+ depths = [row["depth"] for row in rows if row["depth"] is not None]
394
+ summary = {
395
+ "event_count": len(rows),
396
+ "magnitude": {
397
+ "count": len(mags),
398
+ "min": round(min(mags), 6) if mags else None,
399
+ "max": round(max(mags), 6) if mags else None,
400
+ "mean": round(statistics.fmean(mags), 6) if mags else None,
401
+ "median": round(statistics.median(mags), 6) if mags else None,
402
+ },
403
+ "depth_km": {
404
+ "count": len(depths),
405
+ "min": round(min(depths), 6) if depths else None,
406
+ "max": round(max(depths), 6) if depths else None,
407
+ "mean": round(statistics.fmean(depths), 6) if depths else None,
408
+ },
409
+ "time_range_utc": {
410
+ "start_date": min((row["date_utc"] for row in rows if row["date_utc"] != "unknown"), default=None),
411
+ "end_date": max((row["date_utc"] for row in rows if row["date_utc"] != "unknown"), default=None),
412
+ },
413
+ "quality_flags": {
414
+ "missing_magnitude": sum(1 for row in rows if row["mag"] is None),
415
+ "missing_depth": sum(1 for row in rows if row["depth"] is None),
416
+ "unique_regions": len({row["region"] for row in rows}),
417
+ },
418
+ }
419
+ _write_json(output_dir / "summary.json", summary)
420
+
421
+ grouped: dict[tuple[str, str], list[dict[str, Any]]] = {}
422
+ for row in rows:
423
+ grouped.setdefault((_mag_bin(row["mag"]), _depth_bin(row["depth"])), []).append(row)
424
+ with (output_dir / "magnitude_depth_bins.csv").open("w", encoding="utf-8", newline="") as handle:
425
+ fieldnames = ["mag_bin", "depth_bin", "event_count", "mean_magnitude", "max_magnitude"]
426
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
427
+ writer.writeheader()
428
+ for (mag_bin, depth_bin), group in sorted(grouped.items()):
429
+ group_mags = [row["mag"] for row in group if row["mag"] is not None]
430
+ writer.writerow({
431
+ "mag_bin": mag_bin,
432
+ "depth_bin": depth_bin,
433
+ "event_count": len(group),
434
+ "mean_magnitude": f"{statistics.fmean(group_mags):.6f}" if group_mags else "",
435
+ "max_magnitude": f"{max(group_mags):.6f}" if group_mags else "",
436
+ })
437
+
438
+ daily: dict[tuple[str, str], list[dict[str, Any]]] = {}
439
+ for row in rows:
440
+ daily.setdefault((row["region"], row["date_utc"]), []).append(row)
441
+ with (output_dir / "region_daily_counts.csv").open("w", encoding="utf-8", newline="") as handle:
442
+ fieldnames = ["region", "date_utc", "event_count", "max_magnitude"]
443
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
444
+ writer.writeheader()
445
+ for (region, date_utc), group in sorted(daily.items()):
446
+ group_mags = [row["mag"] for row in group if row["mag"] is not None]
447
+ writer.writerow({
448
+ "region": region,
449
+ "date_utc": date_utc,
450
+ "event_count": len(group),
451
+ "max_magnitude": f"{max(group_mags):.6f}" if group_mags else "",
452
+ })
453
+
454
+ filtered = [row["feature"] for row in rows if row["mag"] is not None and row["mag"] >= 4.5]
455
+ _write_json(output_dir / "filtered_events.geojson", {"type": "FeatureCollection", "features": filtered})
456
+
457
+
458
+ def csv_time_series_outputs(input_dir: Path, output_dir: Path) -> None:
459
+ spec = _read_json(input_dir / "analysis_spec.json")
460
+ csv_name = spec["input_file"]
461
+ date_column = spec["date_column"]
462
+ value_column = spec["value_column"]
463
+ rows: list[dict[str, Any]] = []
464
+ with (input_dir / csv_name).open("r", encoding="utf-8", newline="") as raw_handle:
465
+ lines = [line for line in raw_handle if not line.lstrip().startswith("#")]
466
+ reader = csv.DictReader(lines)
467
+ for item in reader:
468
+ raw_date = item.get(date_column, "")
469
+ try:
470
+ day = dt.date.fromisoformat(raw_date)
471
+ except ValueError:
472
+ if raw_date.isdigit() and len(raw_date) == 4:
473
+ day = dt.date(int(raw_date), 1, 1)
474
+ else:
475
+ continue
476
+ raw_value = item.get(value_column, "")
477
+ try:
478
+ value = float(raw_value)
479
+ except (TypeError, ValueError):
480
+ value = None
481
+ rows.append({"date": day, "value": value, "raw": item})
482
+ rows.sort(key=lambda item: item["date"])
483
+ valid = [row for row in rows if row["value"] is not None]
484
+ output_dir.mkdir(parents=True, exist_ok=True)
485
+ monthly: dict[str, list[float]] = {}
486
+ for row in valid:
487
+ key = row["date"].strftime("%Y-%m")
488
+ monthly.setdefault(key, []).append(row["value"])
489
+ with (output_dir / "monthly_statistics.csv").open("w", encoding="utf-8", newline="") as handle:
490
+ fieldnames = ["month", "count", "mean", "median", "min", "max"]
491
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
492
+ writer.writeheader()
493
+ for month, values in sorted(monthly.items()):
494
+ writer.writerow({
495
+ "month": month,
496
+ "count": len(values),
497
+ "mean": f"{statistics.fmean(values):.6f}",
498
+ "median": f"{statistics.median(values):.6f}",
499
+ "min": f"{min(values):.6f}",
500
+ "max": f"{max(values):.6f}",
501
+ })
502
+ existing_dates = {row["date"] for row in rows}
503
+ missing_days: list[dt.date] = []
504
+ if rows:
505
+ day = rows[0]["date"]
506
+ while day <= rows[-1]["date"]:
507
+ if day.weekday() < 5 and day not in existing_dates:
508
+ missing_days.append(day)
509
+ day += dt.timedelta(days=1)
510
+ with (output_dir / "missing_business_days.csv").open("w", encoding="utf-8", newline="") as handle:
511
+ writer = csv.DictWriter(handle, fieldnames=["date"])
512
+ writer.writeheader()
513
+ for day in missing_days:
514
+ writer.writerow({"date": day.isoformat()})
515
+ with (output_dir / "clean_series.csv").open("w", encoding="utf-8", newline="") as handle:
516
+ writer = csv.DictWriter(handle, fieldnames=["date", "value"])
517
+ writer.writeheader()
518
+ for row in valid:
519
+ writer.writerow({"date": row["date"].isoformat(), "value": f"{row['value']:.6f}"})
520
+ values = [row["value"] for row in valid]
521
+ summary = {
522
+ "series_name": spec.get("series_name", value_column),
523
+ "row_count": len(rows),
524
+ "valid_value_count": len(valid),
525
+ "missing_value_count": len(rows) - len(valid),
526
+ "missing_business_day_count": len(missing_days),
527
+ "date_range": {
528
+ "start": rows[0]["date"].isoformat() if rows else None,
529
+ "end": rows[-1]["date"].isoformat() if rows else None,
530
+ },
531
+ "value": {
532
+ "min": round(min(values), 6) if values else None,
533
+ "max": round(max(values), 6) if values else None,
534
+ "mean": round(statistics.fmean(values), 6) if values else None,
535
+ "median": round(statistics.median(values), 6) if values else None,
536
+ },
537
+ }
538
+ _write_json(output_dir / "summary.json", summary)
539
+
540
+
541
+ def _aggregate_annual_rows(rows: list[dict[str, Any]], aggregation: str) -> list[dict[str, Any]]:
542
+ if not aggregation:
543
+ return rows
544
+ grouped: dict[int, list[float]] = {}
545
+ for row in rows:
546
+ grouped.setdefault(int(row["year"]), []).append(float(row["value"]))
547
+ aggregated: list[dict[str, Any]] = []
548
+ for year, values in sorted(grouped.items()):
549
+ if aggregation == "mean":
550
+ value = statistics.fmean(values)
551
+ elif aggregation == "median":
552
+ value = statistics.median(values)
553
+ elif aggregation == "max":
554
+ value = max(values)
555
+ elif aggregation == "min":
556
+ value = min(values)
557
+ elif aggregation == "count":
558
+ value = float(len(values))
559
+ else:
560
+ raise ValueError(f"unsupported year_aggregation for csv_annual_series_audit: {aggregation}")
561
+ aggregated.append({"year": year, "value": value})
562
+ return aggregated
563
+
564
+
565
+ def csv_annual_series_outputs(input_dir: Path, output_dir: Path) -> None:
566
+ spec = _read_json(input_dir / "analysis_spec.json")
567
+ csv_name = spec["input_file"]
568
+ year_column = spec["year_column"]
569
+ value_column = spec["value_column"]
570
+ # Optional: derive the year from an ISO-8601 timestamp column (e.g. USGS FDSN
571
+ # `time` = "2022-06-29T19:17:58.929Z") instead of parsing an integer year.
572
+ # When unset, behaviour is unchanged (integer year column).
573
+ year_from_timestamp = bool(spec.get("year_from_timestamp", False))
574
+ year_aggregation = str(spec.get("year_aggregation") or "").strip().lower()
575
+ raw_rows: list[dict[str, Any]] = []
576
+ with (input_dir / csv_name).open("r", encoding="utf-8", newline="") as raw_handle:
577
+ lines = [line for line in raw_handle if not line.lstrip().startswith("#")]
578
+ reader = csv.DictReader(lines)
579
+ for item in reader:
580
+ raw_year = str(item.get(year_column, "")).strip()
581
+ try:
582
+ if year_from_timestamp:
583
+ # Take the leading 4-digit year of an ISO timestamp/date.
584
+ match = re.match(r"\s*(\d{4})", raw_year)
585
+ if not match:
586
+ continue
587
+ year = int(match.group(1))
588
+ else:
589
+ year = int(raw_year)
590
+ value = float(str(item.get(value_column, "")).strip())
591
+ except (TypeError, ValueError):
592
+ continue
593
+ raw_rows.append({"year": year, "value": value})
594
+ rows = _aggregate_annual_rows(raw_rows, year_aggregation)
595
+ rows.sort(key=lambda item: item["year"])
596
+ output_dir.mkdir(parents=True, exist_ok=True)
597
+ decades: dict[str, list[float]] = {}
598
+ for row in rows:
599
+ decade_start = (row["year"] // 10) * 10
600
+ decades.setdefault(f"{decade_start}s", []).append(row["value"])
601
+ with (output_dir / "decadal_statistics.csv").open("w", encoding="utf-8", newline="") as handle:
602
+ fieldnames = [
603
+ "decade_start",
604
+ "start_year",
605
+ "end_year",
606
+ "count",
607
+ "mean_departure",
608
+ "median_departure",
609
+ "min_departure",
610
+ "max_departure",
611
+ "sample_std_departure",
612
+ ]
613
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
614
+ writer.writeheader()
615
+ for decade, values in sorted(decades.items()):
616
+ decade_start = int(decade.rstrip("s"))
617
+ years = [row["year"] for row in rows if decade_start <= row["year"] <= decade_start + 9]
618
+ writer.writerow({
619
+ "decade_start": decade_start,
620
+ "start_year": min(years),
621
+ "end_year": max(years),
622
+ "count": len(values),
623
+ "mean_departure": f"{statistics.fmean(values):.6f}",
624
+ "median_departure": f"{statistics.median(values):.6f}",
625
+ "min_departure": f"{min(values):.6f}",
626
+ "max_departure": f"{max(values):.6f}",
627
+ "sample_std_departure": f"{statistics.stdev(values):.6f}" if len(values) >= 2 else "",
628
+ })
629
+ threshold = float(spec.get("threshold", 1.0))
630
+ with (output_dir / "threshold_years.csv").open("w", encoding="utf-8", newline="") as handle:
631
+ fieldnames = ["rank", "year", "departure", "threshold"]
632
+ writer = csv.DictWriter(handle, fieldnames=fieldnames)
633
+ writer.writeheader()
634
+ rank = 1
635
+ for row in rows:
636
+ if row["value"] >= threshold:
637
+ writer.writerow({
638
+ "rank": rank,
639
+ "year": row["year"],
640
+ "departure": f"{row['value']:.6f}",
641
+ "threshold": f"{threshold:.6f}",
642
+ })
643
+ rank += 1
644
+ with (output_dir / "clean_series.csv").open("w", encoding="utf-8", newline="") as handle:
645
+ writer = csv.DictWriter(handle, fieldnames=["Year", "Departure from Average"])
646
+ writer.writeheader()
647
+ for row in rows:
648
+ writer.writerow({"Year": row["year"], "Departure from Average": f"{row['value']:.6f}"})
649
+ values = [row["value"] for row in rows]
650
+ threshold_rows = [row for row in rows if row["value"] >= threshold]
651
+ min_row = min(rows, key=lambda row: row["value"]) if rows else None
652
+ max_row = max(rows, key=lambda row: row["value"]) if rows else None
653
+ summary = {
654
+ "series_name": spec.get("series_name", value_column),
655
+ "row_count": len(rows),
656
+ "year_range": {
657
+ "start": rows[0]["year"] if rows else None,
658
+ "end": rows[-1]["year"] if rows else None,
659
+ },
660
+ "value": {
661
+ "min": round(min(values), 6) if values else None,
662
+ "min_year": min_row["year"] if min_row else None,
663
+ "max": round(max(values), 6) if values else None,
664
+ "max_year": max_row["year"] if max_row else None,
665
+ "mean": round(statistics.fmean(values), 6) if values else None,
666
+ "median": round(statistics.median(values), 6) if values else None,
667
+ "sample_std": round(statistics.stdev(values), 6) if len(values) >= 2 else None,
668
+ },
669
+ "threshold": threshold,
670
+ "years_at_or_above_threshold": len(threshold_rows),
671
+ "first_threshold_year": threshold_rows[0]["year"] if threshold_rows else None,
672
+ "last_threshold_year": threshold_rows[-1]["year"] if threshold_rows else None,
673
+ }
674
+ if year_aggregation:
675
+ summary["year_aggregation"] = year_aggregation
676
+ summary["source_row_count"] = len(raw_rows)
677
+ _write_json(output_dir / "summary.json", summary)
678
+
679
+
20260903-164548-science-environment-8102f0/tests/reference/internal/workflow_runtime.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from workflow_adapters_runtime import csv_annual_series_outputs
3
+
4
+ def run_reference(input_dir: Path, output_dir: Path) -> None:
5
+ csv_annual_series_outputs(input_dir, output_dir)
20260903-164548-science-environment-8102f0/tests/reference/reference_manifest.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "workflow_kind": "csv_annual_series_audit",
3
+ "task_id": "usgs_fdsn_eq_alaska_aleutians_1974_1978_m4p5_depth_mean",
4
+ "domain": "science_environment",
5
+ "task": "usgs_alaska_aleutians_annual_depth_audit",
6
+ "variant": "base",
7
+ "created_from": "standard reference workflow",
8
+ "required_outputs": [
9
+ {
10
+ "path": "summary.json",
11
+ "type": "json"
12
+ },
13
+ {
14
+ "path": "decadal_statistics.csv",
15
+ "type": "csv"
16
+ },
17
+ {
18
+ "path": "threshold_years.csv",
19
+ "type": "csv"
20
+ },
21
+ {
22
+ "path": "clean_series.csv",
23
+ "type": "csv"
24
+ }
25
+ ],
26
+ "numeric_tolerance": 1e-09,
27
+ "source_prior_sha256": "f8a440c2016be171dc653df3b6c4f252f415c61f93233b57ebdbdaf3d51c3b20",
28
+ "gold_output_hashes": {
29
+ "summary.json": "7e43c917247e1ff4e65dff64610c709f8d6f5aa58833f6189a479146d8d39855",
30
+ "decadal_statistics.csv": "42ebc4deb326958811aab306def1ec45dae3cd10e074521d3541e6eb50a5f671",
31
+ "threshold_years.csv": "ad468e2115fb271d13f6f7c49bc604804dbda48dff5f622dd3cc8a36320a8f8e",
32
+ "clean_series.csv": "96c59625d19b660bfa9b8a2b751b36facbd891d4de571b8a93e1e4198d780923"
33
+ }
34
+ }