turambar928 commited on
Commit
1ebf9e7
·
verified ·
1 Parent(s): aa99056

Upload folder using huggingface_hub (part 4)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. 20260905-231035-science-environment-8cb4fa/tests/reference/internal/workflow_adapters_runtime.py +679 -0
  2. 20260905-231035-science-environment-8cb4fa/tests/reference/internal/workflow_runtime.py +5 -0
  3. 20260905-231035-science-environment-8cb4fa/tests/reference/reference_manifest.json +34 -0
  4. 20260905-231035-science-environment-8cb4fa/tests/reference/reference_solution.py +20 -0
  5. 20260905-231035-science-environment-8cb4fa/tests/test.sh +29 -0
  6. 20260905-231105-science-environment-dbcba6/.DS_Store +0 -0
  7. 20260905-231105-science-environment-dbcba6/environment/Dockerfile +12 -0
  8. 20260905-231105-science-environment-dbcba6/environment/public_data/README.md +11 -0
  9. 20260905-231105-science-environment-dbcba6/environment/public_data/input/README.md +6 -0
  10. 20260905-231105-science-environment-dbcba6/environment/public_data/input/analysis_spec.json +76 -0
  11. 20260905-231105-science-environment-dbcba6/environment/public_data/input/source_context_windows.jsonl +0 -0
  12. 20260905-231105-science-environment-dbcba6/environment/public_data/input/usgs_fdsn_japan_kuril_1996_1996_m4p5.csv +443 -0
  13. 20260905-231105-science-environment-dbcba6/environment/public_data/main.py +180 -0
  14. 20260905-231105-science-environment-dbcba6/environment/public_data/software/validate_outputs.py +41 -0
  15. 20260905-231105-science-environment-dbcba6/environment/public_data/task_card.json +92 -0
  16. 20260905-231105-science-environment-dbcba6/instruction.md +33 -0
  17. 20260905-231105-science-environment-dbcba6/solution/internal/workflow_adapters_runtime.py +679 -0
  18. 20260905-231105-science-environment-dbcba6/solution/internal/workflow_runtime.py +5 -0
  19. 20260905-231105-science-environment-dbcba6/solution/reference_solution.py +20 -0
  20. 20260905-231105-science-environment-dbcba6/solution/solve.sh +7 -0
  21. 20260905-231105-science-environment-dbcba6/task.toml +45 -0
  22. 20260905-231105-science-environment-dbcba6/tests/Dockerfile +6 -0
  23. 20260905-231105-science-environment-dbcba6/tests/evaluator_runner.py +92 -0
  24. 20260905-231105-science-environment-dbcba6/tests/reference/__pycache__/evaluator.cpython-312.pyc +0 -0
  25. 20260905-231105-science-environment-dbcba6/tests/reference/evaluator.py +114 -0
  26. 20260905-231105-science-environment-dbcba6/tests/reference/ground_truth/clean_series.csv +2 -0
  27. 20260905-231105-science-environment-dbcba6/tests/reference/ground_truth/decadal_statistics.csv +2 -0
  28. 20260905-231105-science-environment-dbcba6/tests/reference/ground_truth/summary.json +23 -0
  29. 20260905-231105-science-environment-dbcba6/tests/reference/ground_truth/threshold_years.csv +2 -0
  30. 20260905-231105-science-environment-dbcba6/tests/reference/internal/workflow_adapters_runtime.py +679 -0
  31. 20260905-231105-science-environment-dbcba6/tests/reference/internal/workflow_runtime.py +5 -0
  32. 20260905-231105-science-environment-dbcba6/tests/reference/reference_manifest.json +34 -0
  33. 20260905-231105-science-environment-dbcba6/tests/reference/reference_solution.py +20 -0
  34. 20260905-231105-science-environment-dbcba6/tests/test.sh +29 -0
  35. 20260905-231124-science-environment-25f2d6/.DS_Store +3 -0
  36. 20260905-231124-science-environment-25f2d6/environment/Dockerfile +12 -0
  37. 20260905-231124-science-environment-25f2d6/environment/public_data/README.md +11 -0
  38. 20260905-231124-science-environment-25f2d6/environment/public_data/input/README.md +6 -0
  39. 20260905-231124-science-environment-25f2d6/environment/public_data/input/analysis_spec.json +76 -0
  40. 20260905-231124-science-environment-25f2d6/environment/public_data/input/source_context_windows.jsonl +0 -0
  41. 20260905-231124-science-environment-25f2d6/environment/public_data/input/usgs_fdsn_global_1992_1993_m4p5.csv +0 -0
  42. 20260905-231124-science-environment-25f2d6/environment/public_data/main.py +180 -0
  43. 20260905-231124-science-environment-25f2d6/environment/public_data/software/validate_outputs.py +41 -0
  44. 20260905-231124-science-environment-25f2d6/environment/public_data/task_card.json +92 -0
  45. 20260905-231124-science-environment-25f2d6/instruction.md +33 -0
  46. 20260905-231124-science-environment-25f2d6/solution/internal/workflow_adapters_runtime.py +679 -0
  47. 20260905-231124-science-environment-25f2d6/solution/internal/workflow_runtime.py +5 -0
  48. 20260905-231124-science-environment-25f2d6/solution/reference_solution.py +20 -0
  49. 20260905-231124-science-environment-25f2d6/solution/solve.sh +7 -0
  50. 20260905-231124-science-environment-25f2d6/task.toml +45 -0
20260905-231035-science-environment-8cb4fa/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
+
20260905-231035-science-environment-8cb4fa/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)
20260905-231035-science-environment-8cb4fa/tests/reference/reference_manifest.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "workflow_kind": "csv_annual_series_audit",
3
+ "task_id": "usgs_fdsn_eq_himalaya_1975_1975_m4p5_mag_max",
4
+ "domain": "science_environment",
5
+ "task": "usgs_himalaya_1975_annual_maximum_magnitude_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": "7c428ff1fdc559e0953a0136ce3a7ee4c19ea2c4e5e4c9aeca4518d7d1ac43e0",
28
+ "gold_output_hashes": {
29
+ "summary.json": "7eac7a84b7b09b9e11cc8fb5c88fc1e9009491dee66e78cdabe8c6ca6323aea6",
30
+ "decadal_statistics.csv": "0cd6e9e4540d5d45fecdb94534e7c2dee82ee4784d7b9d0946fa5e6a444d2bfe",
31
+ "threshold_years.csv": "3c246d327c8916202a9b7e098f782bc753aafca2e09f7194ac2d7dd478b6a347",
32
+ "clean_series.csv": "4c9c7bddc05c9f381f3fd88dc95ce848dd681f0df7be4e55734b93647a6095be"
33
+ }
34
+ }
20260905-231035-science-environment-8cb4fa/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())
20260905-231035-science-environment-8cb4fa/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
20260905-231105-science-environment-dbcba6/.DS_Store ADDED
Binary file (6.15 kB). View file
 
20260905-231105-science-environment-dbcba6/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
20260905-231105-science-environment-dbcba6/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/`.
20260905-231105-science-environment-dbcba6/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_japan_kuril_1996_1996_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.
20260905-231105-science-environment-dbcba6/environment/public_data/input/analysis_spec.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "input_file": "usgs_fdsn_japan_kuril_1996_1996_m4p5.csv",
3
+ "workflow_kind": "csv_annual_series_audit",
4
+ "year_column": "time",
5
+ "value_column": "mag",
6
+ "series_name": "USGS FDSN Japan and Kuril trench 1996-1996 earthquake annual maximum magnitude (min mag 4.5)",
7
+ "threshold": 6.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 max; then compute reproducible annual-series audit outputs. Do not fetch new data.",
75
+ "year_aggregation": "max"
76
+ }
20260905-231105-science-environment-dbcba6/environment/public_data/input/source_context_windows.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
20260905-231105-science-environment-dbcba6/environment/public_data/input/usgs_fdsn_japan_kuril_1996_1996_m4p5.csv ADDED
@@ -0,0 +1,443 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ time,latitude,longitude,depth,mag,magType,nst,gap,dmin,rms,net,id,updated,place,type,horizontalError,depthError,magError,magNst,status,locationSource,magSource
2
+ 1996-01-02T10:55:11.460Z,42.415,142.307,87.1,4.6,mb,,,,1.1,us,usp0007a5v,2014-11-07T00:59:35.810Z,"10 km NNW of Shizunai-furukawach?, Japan",earthquake,,7.1,,47,reviewed,us,us
3
+ 1996-01-02T21:32:58.590Z,44.452,149.661,33,4.8,mb,,,,1,us,usp0007a73,2014-11-07T00:59:35.979Z,"165 km ESE of Kuril’sk, Russia",earthquake,,,,49,reviewed,us,us
4
+ 1996-01-02T22:05:29.050Z,46.07,151.712,33,4.6,mb,,,,0.8,us,usp0007a75,2014-11-07T00:59:36.016Z,"Kuril Islands",earthquake,,,,16,reviewed,us,us
5
+ 1996-01-02T22:08:36.010Z,44.376,149.729,33,4.6,mb,,,,1.1,us,usp0007a76,2014-11-07T00:59:36.020Z,"174 km ESE of Kuril’sk, Russia",earthquake,,,,33,reviewed,us,us
6
+ 1996-01-04T19:50:21.790Z,44.45,149.294,33,5.2,mw,,,,1,us,usp0007ac4,2025-12-19T23:27:16.822Z,"141 km SE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
7
+ 1996-01-04T20:12:53.610Z,42.116,142.49,33,4.7,mb,,,,1,us,usp0007ac6,2014-11-07T00:59:36.735Z,"26 km SSE of Shizunai-furukawach?, Japan",earthquake,,,,68,reviewed,us,us
8
+ 1996-01-05T15:37:45.630Z,44.65,149.997,33,4.5,ms,,,,1.2,us,usp0007ads,2014-11-07T00:59:36.892Z,"179 km ESE of Kuril’sk, Russia",earthquake,,,,3,reviewed,us,us
9
+ 1996-01-06T05:27:55.610Z,27.174,130.014,33,4.8,mb,,,,1.1,us,usp0007af3,2014-11-07T00:59:37.036Z,"142 km SSE of Naze, Japan",earthquake,,,,52,reviewed,us,us
10
+ 1996-01-06T09:26:25.050Z,27.12,129.99,33,4.5,mb,,,,1.1,us,usp0007afk,2014-11-07T00:59:37.080Z,"146 km SSE of Naze, Japan",earthquake,,,,20,reviewed,us,us
11
+ 1996-01-06T10:43:16.200Z,27.198,130.013,33,5.1,mw,,,,1.2,us,usp0007afu,2025-12-19T23:27:17.912Z,"139 km SSE of Naze, Japan",earthquake,,,,,reviewed,us,hrv
12
+ 1996-01-06T10:52:16.300Z,27.187,130.044,33,4.9,mb,,,,1.2,us,usp0007afv,2014-11-07T00:59:37.116Z,"141 km SSE of Naze, Japan",earthquake,,,,45,reviewed,us,us
13
+ 1996-01-06T15:28:03.910Z,45.354,151.018,33,5.5,mw,,,,0.9,us,usp0007ag5,2025-12-19T23:27:19.049Z,"246 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
14
+ 1996-01-06T15:39:23.660Z,45.306,151.095,33,5.2,mb,,,,0.9,us,usp0007ag6,2014-11-07T00:59:37.185Z,"252 km E of Kuril’sk, Russia",earthquake,,,,94,reviewed,us,us
15
+ 1996-01-06T19:16:25.610Z,39.809,143.265,33,4.8,mb,,,,1,us,usp0007agm,2014-11-07T00:59:37.244Z,"114 km E of Miyako, Japan",earthquake,,,,53,reviewed,us,us
16
+ 1996-01-07T23:07:43.730Z,29.362,130.599,32.5,5.1,ms,,,,1.2,us,usp0007akv,2014-11-07T00:59:37.697Z,"96 km S of Koshima, Japan",earthquake,,6.8,,6,reviewed,us,us
17
+ 1996-01-08T09:08:58.600Z,44.105,148.488,33,4.7,mb,,,,1.2,us,usp0007amu,2014-11-07T00:59:37.817Z,"133 km SSE of Kuril’sk, Russia",earthquake,,,,51,reviewed,us,us
18
+ 1996-01-08T13:59:45.830Z,45.381,150.191,33,5.5,mw,,,,0.8,us,usp0007anm,2025-12-19T23:27:22.436Z,"182 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
19
+ 1996-01-08T19:35:10.940Z,45.292,150.998,33,4.8,mb,,,,1.1,us,usp0007ap5,2014-11-07T00:59:38.064Z,"245 km E of Kuril’sk, Russia",earthquake,,,,52,reviewed,us,us
20
+ 1996-01-08T22:25:20.790Z,28.07,130.183,47.1,4.6,mb,,,,0.9,us,usp0007apc,2014-11-07T00:59:38.085Z,"76 km ESE of Naze, Japan",earthquake,,9.1,,4,reviewed,us,us
21
+ 1996-01-11T07:19:12.770Z,45.072,150.04,33,5.3,mw,,,,0.8,us,usp0007avn,2025-12-19T23:27:23.600Z,"170 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
22
+ 1996-01-11T15:17:05.880Z,43.953,147.925,33,4.6,mb,,,,1,us,usp0007aw4,2014-11-07T00:59:39.261Z,"98 km E of Shikotan, Russia",earthquake,,,,41,reviewed,us,us
23
+ 1996-01-12T04:41:34.210Z,48.286,152.996,119.4,5.4,mw,,,,0.9,us,usp0007ax5,2025-12-19T22:39:43.236Z,"Kuril Islands",earthquake,,6.4,,,reviewed,us,hrv
24
+ 1996-01-12T18:41:16.070Z,43.734,147.349,33,4.5,mb,,,,1.1,us,usp0007aya,2014-11-07T00:59:39.586Z,"51 km E of Shikotan, Russia",earthquake,,,,29,reviewed,us,us
25
+ 1996-01-13T12:38:07.490Z,43.326,147.046,33,4.6,mb,,,,1,us,usp0007b04,2014-11-07T00:59:39.920Z,"58 km SSE of Shikotan, Russia",earthquake,,,,33,reviewed,us,us
26
+ 1996-01-13T12:54:07.170Z,44.335,149.709,33,4.9,mb,,,,1.1,us,usp0007b07,2014-11-07T00:59:39.928Z,"175 km SE of Kuril’sk, Russia",earthquake,,,,75,reviewed,us,us
27
+ 1996-01-14T03:06:10.010Z,36.663,137.326,33,4.7,mb,,,,1.2,us,usp0007b1b,2014-11-07T00:59:40.092Z,"5 km SW of Kamiichi, Japan",earthquake,,,,4,reviewed,us,us
28
+ 1996-01-14T06:28:24.390Z,44.594,149.024,63.7,5.4,mb,,,,0.9,us,usp0007b1m,2022-04-29T20:06:23.056Z,"114 km SE of Kuril’sk, Russia",earthquake,,,,141,reviewed,us,us
29
+ 1996-01-16T10:50:25.950Z,32.963,140.142,100,4.5,mb,,,,0.5,us,usp0007b63,2014-11-07T00:59:41.056Z,"220 km SSE of Shimoda, Japan",earthquake,,,,7,reviewed,us,us
30
+ 1996-01-19T02:05:00.200Z,44.316,149.522,33,4.8,mb,,,,0.9,us,usp0007bbd,2014-11-07T00:59:41.694Z,"164 km SE of Kuril’sk, Russia",earthquake,,,,71,reviewed,us,us
31
+ 1996-01-19T02:09:34.100Z,42.952,148.356,33,4.6,mb,,,,1.2,us,usp0007bbf,2014-11-07T00:59:41.708Z,"162 km SE of Shikotan, Russia",earthquake,,,,2,reviewed,us,us
32
+ 1996-01-22T00:10:25.990Z,44.556,148.097,47.3,5.1,mw,,,,0.8,us,usp0007bgg,2025-12-19T23:27:25.705Z,"76 km SSE of Kuril’sk, Russia",earthquake,,5.3,,,reviewed,us,hrv
33
+ 1996-01-22T10:41:46.600Z,45.247,150.765,33,4.6,mb,,,,0.9,us,usp0007bhb,2014-11-07T00:59:42.558Z,"226 km E of Kuril’sk, Russia",earthquake,,,,34,reviewed,us,us
34
+ 1996-01-22T13:14:59.890Z,40.094,142.323,63,5.4,mw,,,,1,us,usp0007bhp,2022-04-29T20:06:54.720Z,"59 km NNE of Miyako, Japan",earthquake,,,,,reviewed,us,hrv
35
+ 1996-01-22T14:04:12.370Z,40.131,142.346,59.5,4.6,mb,,,,1,us,usp0007bhr,2014-11-07T00:59:42.604Z,"63 km NNE of Miyako, Japan",earthquake,,6,,51,reviewed,us,us
36
+ 1996-01-25T18:08:38.670Z,44.43,149.374,47.3,4.7,mb,,,,1,us,usp0007bqa,2014-11-07T00:59:43.264Z,"147 km SE of Kuril’sk, Russia",earthquake,,,,59,reviewed,us,us
37
+ 1996-01-26T05:25:17.760Z,43.455,147.156,62.9,4.5,mb,,,,1,us,usp0007brc,2014-11-07T00:59:43.590Z,"51 km SE of Shikotan, Russia",earthquake,,17.6,,29,reviewed,us,us
38
+ 1996-01-27T21:48:56.410Z,44.564,149.404,33,4.8,mb,,,,1,us,usp0007bux,2014-11-07T00:59:44.161Z,"141 km ESE of Kuril’sk, Russia",earthquake,,,,82,reviewed,us,us
39
+ 1996-01-28T02:23:27.710Z,46.155,153.028,33,4.5,mb,,,,1,us,usp0007bv6,2014-11-07T00:59:44.222Z,"Kuril Islands",earthquake,,,,51,reviewed,us,us
40
+ 1996-01-29T07:42:56.070Z,40.429,141.424,126.6,4.7,mb,,,,0.9,us,usp0007bxq,2014-11-07T00:59:44.440Z,"10 km SW of Hachinohe, Japan",earthquake,,4.5,,59,reviewed,us,us
41
+ 1996-01-29T08:42:19.710Z,40.746,142.57,50.7,4.6,mb,,,,1,us,usp0007bxs,2014-11-07T00:59:44.453Z,"94 km ENE of Hachinohe, Japan",earthquake,,,,40,reviewed,us,us
42
+ 1996-01-29T13:49:22.350Z,45.61,151.765,33,4.8,mb,,,,1.1,us,usp0007byh,2014-11-07T00:59:44.558Z,"Kuril Islands",earthquake,,,,57,reviewed,us,us
43
+ 1996-01-30T02:28:42.690Z,47.119,151.902,132.6,5.4,mw,,,,0.8,us,usp0007bz9,2025-12-19T22:39:44.358Z,"Kuril Islands",earthquake,,5,,,reviewed,us,hrv
44
+ 1996-01-30T21:14:55.730Z,36.13,135.35,361,5.2,mw,,,,0.8,us,usp0007c0p,2025-12-19T23:27:30.201Z,"67 km NNE of Miyazu, Japan",earthquake,,2.2,,,reviewed,us,hrv
45
+ 1996-01-31T19:21:24.970Z,44.531,149.372,18.2,5.6,mw,,,,1,us,usp0007c27,2022-04-29T20:07:33.841Z,"141 km ESE of Kuril’sk, Russia",earthquake,,9.5,,,reviewed,us,hrv
46
+ 1996-01-31T20:30:42.370Z,44.468,149.37,20.6,6,mw,,,,0.9,us,usp0007c29,2022-04-29T20:07:34.954Z,"145 km SE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
47
+ 1996-01-31T20:36:03.630Z,44.312,149.377,29.8,5,mb,,,,1.2,us,usp0007c2a,2014-11-07T00:59:45.385Z,"156 km SE of Kuril’sk, Russia",earthquake,,,,44,reviewed,us,us
48
+ 1996-01-31T21:33:47.210Z,44.466,149.387,50.7,4.5,mb,,,,0.9,us,usp0007c2f,2014-11-07T00:59:45.400Z,"146 km SE of Kuril’sk, Russia",earthquake,,,,48,reviewed,us,us
49
+ 1996-02-01T02:22:46.410Z,44.517,149.407,33,4.5,mb,,,,1,us,usp0007c2v,2014-11-07T00:59:47.152Z,"144 km ESE of Kuril’sk, Russia",earthquake,,,,23,reviewed,us,us
50
+ 1996-02-01T07:18:04.230Z,44.853,146.273,170,6.2,mwb,,,,0.9,us,usp0007c3b,2022-04-29T20:07:36.118Z,"93 km NNE of Otrada, Russia",earthquake,,,,,reviewed,us,us
51
+ 1996-02-01T14:29:00.440Z,32.233,140.683,51.1,4.8,mb,,,,1,us,usp0007c3r,2014-11-07T00:59:48.205Z,"Izu Islands, Japan region",earthquake,,7.8,,44,reviewed,us,us
52
+ 1996-02-02T00:41:13.820Z,32.676,137.517,373.7,4.7,mb,,,,0.9,us,usp0007c4m,2014-11-07T00:59:48.583Z,"184 km SE of Shing?, Japan",earthquake,,,,94,reviewed,us,us
53
+ 1996-02-03T20:19:37.760Z,44.557,149.364,33,4.7,mb,,,,1,us,usp0007c97,2014-11-07T00:59:50.179Z,"139 km ESE of Kuril’sk, Russia",earthquake,,,,70,reviewed,us,us
54
+ 1996-02-03T21:13:27.970Z,44.433,149.41,33,4.8,mb,,,,0.9,us,usp0007c9c,2014-11-07T00:59:50.279Z,"149 km SE of Kuril’sk, Russia",earthquake,,,,60,reviewed,us,us
55
+ 1996-02-04T11:57:19.620Z,44.975,149.621,33,5.4,mw,,,,0.9,us,usp0007cak,2025-12-19T23:27:36.859Z,"140 km ESE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
56
+ 1996-02-04T15:52:50.330Z,31.7,131.866,42.3,4.5,ms,,,,1.2,us,usp0007cb2,2014-11-07T00:59:50.551Z,"48 km ENE of Nichinan, Japan",earthquake,,,,1,reviewed,us,us
57
+ 1996-02-04T18:49:21.310Z,43.443,147.98,42,4.8,mb,,,,1.1,us,usp0007cbd,2014-11-07T00:59:50.637Z,"Kuril Islands",earthquake,,,,60,reviewed,us,us
58
+ 1996-02-05T06:59:22.290Z,44.383,149.54,33,4.5,mb,,,,1.1,us,usp0007ccg,2014-11-07T00:59:50.810Z,"161 km SE of Kuril’sk, Russia",earthquake,,,,26,reviewed,us,us
59
+ 1996-02-05T10:25:17.980Z,28.685,142.553,33,4.8,mb,,,,1,us,usp0007cct,2014-11-07T00:59:50.849Z,"Bonin Islands, Japan region",earthquake,,,,44,reviewed,us,us
60
+ 1996-02-05T16:19:53.220Z,43.486,147.967,33,4.8,mb,,,,1.1,us,usp0007cda,2014-11-07T00:59:50.911Z,"106 km ESE of Shikotan, Russia",earthquake,,,,52,reviewed,us,us
61
+ 1996-02-06T08:47:10.840Z,44.19,151.077,33,4.6,mb,,,,1.2,us,usp0007cen,2014-11-07T00:59:51.164Z,"278 km ESE of Kuril’sk, Russia",earthquake,,,,34,reviewed,us,us
62
+ 1996-02-06T20:14:27.470Z,43.416,146.816,62.7,4.9,mb,,,,0.9,us,usp0007cfm,2014-11-07T00:59:51.298Z,"43 km S of Shikotan, Russia",earthquake,,,,74,reviewed,us,us
63
+ 1996-02-07T01:33:18.740Z,35.921,136.574,41.8,5.1,mw,,,,1.1,us,usp0007cg1,2022-04-29T20:08:13.817Z,"10 km SE of Ono, Japan",earthquake,,,,,reviewed,us,hrv
64
+ 1996-02-07T21:36:46.300Z,45.324,149.892,42.6,7.2,mw,,,,1.1,us,usp0007chh,2022-04-29T20:08:38.502Z,"158 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
65
+ 1996-02-07T22:53:40.050Z,44.12,149.479,33,6,ms,,,,1.1,us,usp0007chp,2022-04-29T20:08:39.556Z,"176 km SE of Kuril’sk, Russia",earthquake,,,,3,reviewed,us,us
66
+ 1996-02-09T12:52:55.130Z,45.105,150.119,33,4.7,mb,,,,0.9,us,usp0007cna,2014-11-07T00:59:52.008Z,"176 km E of Kuril’sk, Russia",earthquake,,,,57,reviewed,us,us
67
+ 1996-02-11T06:58:57.640Z,42.792,145.368,33,4.7,mb,,,,0.9,us,usp0007cqz,2014-11-07T00:59:52.297Z,"61 km SSW of Nemuro, Japan",earthquake,,,,37,reviewed,us,us
68
+ 1996-02-11T09:28:49.770Z,45.355,150.529,33,5.1,mw,,,,0.8,us,usp0007cr3,2025-12-19T23:27:43.517Z,"208 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
69
+ 1996-02-11T18:11:19.040Z,44.456,149.665,33,4.7,mb,,,,1.1,us,usp0007crw,2014-11-07T00:59:52.410Z,"165 km ESE of Kuril’sk, Russia",earthquake,,,,40,reviewed,us,us
70
+ 1996-02-11T18:35:39.090Z,44.35,149.721,33,4.8,mb,,,,1,us,usp0007crz,2014-11-07T00:59:52.423Z,"175 km SE of Kuril’sk, Russia",earthquake,,,,56,reviewed,us,us
71
+ 1996-02-12T02:58:53.740Z,45.249,150.303,33,5.3,mw,,,,0.8,us,usp0007csu,2025-12-19T23:27:45.765Z,"190 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
72
+ 1996-02-13T05:53:45.820Z,45.067,150.602,43.5,4.5,mb,,,,1,us,usp0007cuj,2014-11-07T00:59:53.215Z,"Kuril Islands",earthquake,,,,38,reviewed,us,us
73
+ 1996-02-14T11:39:06.840Z,45.263,150.845,33,4.7,mb,,,,0.8,us,usp0007cwt,2014-11-07T00:59:53.448Z,"232 km E of Kuril’sk, Russia",earthquake,,,,63,reviewed,us,us
74
+ 1996-02-14T19:00:36.870Z,41.765,141.958,33,4.6,mb,,,,1.1,us,usp0007cx7,2014-11-07T00:59:53.490Z,"71 km SSW of Shizunai-furukawach?, Japan",earthquake,,,,59,reviewed,us,us
75
+ 1996-02-14T20:31:07.060Z,45.46,150.374,36.5,5.8,mwb,,,,0.9,us,usp0007cxf,2022-04-29T20:08:56.135Z,"197 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,us
76
+ 1996-02-14T21:26:56.300Z,29.246,140.446,141.3,5.7,mw,,,,1,us,usp0007cxh,2022-04-29T20:08:57.740Z,"Izu Islands, Japan region",earthquake,,,,,reviewed,us,hrv
77
+ 1996-02-15T03:02:33.380Z,45.289,150.768,33,4.5,mb,,,,0.9,us,usp0007cy4,2014-11-07T00:59:53.729Z,"226 km E of Kuril’sk, Russia",earthquake,,,,47,reviewed,us,us
78
+ 1996-02-16T15:22:58.830Z,37.353,142.38,40.8,6.7,mw,,,,1.1,us,usp0007d0t,2022-04-29T20:09:12.348Z,"123 km E of Namie, Japan",earthquake,,,,,reviewed,us,hrv
79
+ 1996-02-16T19:21:59.430Z,47.427,152.192,133.4,4.6,mb,,,,1,us,usp0007d13,2014-11-07T00:59:54.124Z,"Kuril Islands",earthquake,,7.7,,77,reviewed,us,us
80
+ 1996-02-16T21:38:16.910Z,45.442,150.461,33,4.6,mb,,,,0.7,us,usp0007d18,2014-11-07T00:59:54.147Z,"203 km E of Kuril’sk, Russia",earthquake,,,,53,reviewed,us,us
81
+ 1996-02-16T22:43:52.350Z,41.707,142.079,33,4.6,mb,,,,1.2,us,usp0007d1c,2014-11-07T00:59:54.170Z,"73 km SSW of Shizunai-furukawach?, Japan",earthquake,,,,56,reviewed,us,us
82
+ 1996-02-17T02:06:17.900Z,26.964,141.021,100,4.5,mb,,,,1.1,us,usp0007d1j,2014-11-07T00:59:54.216Z,"Bonin Islands, Japan region",earthquake,,,,34,reviewed,us,us
83
+ 1996-02-17T14:35:21.590Z,40.933,141.25,33,4.5,mb,,,,1.2,us,usp0007d5j,2014-11-07T00:59:54.681Z,"29 km NNW of Misawa, Japan",earthquake,,,,7,reviewed,us,us
84
+ 1996-02-17T21:24:57.040Z,29.301,129.239,33,5,mb,,,,1.3,us,usp0007d7j,2014-11-07T00:59:54.889Z,"106 km NNW of Naze, Japan",earthquake,,,,48,reviewed,us,us
85
+ 1996-02-19T12:14:18.080Z,40.367,142.371,33,5.3,mw,,,,1.1,us,usp0007dfs,2025-12-19T23:27:48.083Z,"75 km ESE of Hachinohe, Japan",earthquake,,,,,reviewed,us,hrv
86
+ 1996-02-22T14:59:08.980Z,45.263,148.542,124.2,6.3,mwb,,,,0.9,us,usp0007dq2,2022-04-29T20:11:44.432Z,"52 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,us
87
+ 1996-02-24T20:33:32.670Z,29.312,142.347,41.5,5.2,mw,,,,1,us,usp0007duf,2025-12-19T23:27:51.419Z,"Izu Islands, Japan region",earthquake,,,,,reviewed,us,hrv
88
+ 1996-02-25T09:29:38.370Z,29.983,131.329,33.4,4.5,mb,,,,0.9,us,usp0007dw6,2014-11-07T00:59:58.434Z,"79 km SE of Koseda, Japan",earthquake,,5.2,,23,reviewed,us,us
89
+ 1996-02-25T23:15:30.730Z,44.696,149.438,26.6,4.7,mb,,,,1,us,usp0007dxu,2014-11-07T00:59:58.679Z,"136 km ESE of Kuril’sk, Russia",earthquake,,,,52,reviewed,us,us
90
+ 1996-02-26T00:22:29.250Z,44.503,149.245,33,4.5,mb,,,,0.7,us,usp0007dxx,2014-11-07T00:59:58.697Z,"134 km SE of Kuril’sk, Russia",earthquake,,,,41,reviewed,us,us
91
+ 1996-02-28T01:52:55.150Z,44.617,149.445,33,4.9,mb,,,,0.9,us,usp0007e2h,2014-11-07T00:59:59.273Z,"141 km ESE of Kuril’sk, Russia",earthquake,,,,87,reviewed,us,us
92
+ 1996-02-28T21:19:28.930Z,47.155,154.109,33,4.5,mb,,,,1.1,us,usp0007e46,2014-11-07T00:59:59.543Z,"Kuril Islands",earthquake,,,,25,reviewed,us,us
93
+ 1996-02-29T01:45:03.810Z,33.158,140.758,57.6,4.7,mb,,,,1,us,usp0007e4m,2014-11-07T00:59:59.578Z,"218 km SSE of Tateyama, Japan",earthquake,,,,37,reviewed,us,us
94
+ 1996-02-29T09:01:13.820Z,42.651,143.008,116.2,4.9,mb,,,,0.9,us,usp0007e5a,2014-11-07T00:59:59.637Z,"33 km SSW of Obihiro, Japan",earthquake,,,,93,reviewed,us,us
95
+ 1996-03-02T06:20:31.640Z,43.36,148.515,78.6,4.5,mb,,,,1.4,us,usp0007e7z,2014-11-07T01:00:02.355Z,"152 km ESE of Shikotan, Russia",earthquake,,22.4,,20,reviewed,us,us
96
+ 1996-03-04T08:39:17.440Z,36.384,141.712,33,5,mb,,,,1,us,usp0007eas,2014-11-07T01:00:03.451Z,"96 km ESE of Takahagi, Japan",earthquake,,,,72,reviewed,us,us
97
+ 1996-03-06T14:35:28.310Z,35.433,138.987,33,5.6,mwc,,,,1.1,us,usp0007edb,2022-04-29T20:12:54.106Z,"13 km NNE of Gotenba, Japan",earthquake,,,,,reviewed,us,hrv
98
+ 1996-03-07T01:59:11.550Z,29.047,138.503,500,4.5,mb,,,,1,us,usp0007edu,2014-11-07T01:00:04.561Z,"Izu Islands, Japan region",earthquake,,,,55,reviewed,us,us
99
+ 1996-03-07T23:27:44.900Z,28.126,139.893,378.7,4.7,mb,,,,0.8,us,usp0007ef4,2014-11-07T01:00:04.752Z,"Bonin Islands, Japan region",earthquake,,5.3,,62,reviewed,us,us
100
+ 1996-03-09T16:15:36.240Z,43.425,148.009,33,6.1,mwc,,,,1,us,usp0007eh7,2022-04-29T20:13:05.054Z,"111 km ESE of Shikotan, Russia",earthquake,,,,,reviewed,us,hrv
101
+ 1996-03-09T16:17:16.150Z,43.722,147.829,33,5.7,mb,,,,0.9,us,usp0007eh8,2022-04-29T20:13:11.833Z,"89 km E of Shikotan, Russia",earthquake,,,,90,reviewed,us,us
102
+ 1996-03-09T16:40:00.770Z,43.363,147.796,33,4.8,mb,,,,1.1,us,usp0007ehb,2014-11-07T01:00:05.087Z,"99 km ESE of Shikotan, Russia",earthquake,,,,53,reviewed,us,us
103
+ 1996-03-09T16:41:12.070Z,43.366,147.872,33,5,mb,,,,1.2,us,usp0007ehc,2014-11-07T01:00:05.096Z,"104 km ESE of Shikotan, Russia",earthquake,,,,60,reviewed,us,us
104
+ 1996-03-09T16:44:08.570Z,43.512,147.898,33,4.5,mb,,,,1.1,us,usp0007ehd,2014-11-07T01:00:05.106Z,"100 km ESE of Shikotan, Russia",earthquake,,,,14,reviewed,us,us
105
+ 1996-03-09T17:02:43.650Z,43.454,147.92,33,5,mb,,,,0.9,us,usp0007ehf,2014-11-07T01:00:05.112Z,"104 km ESE of Shikotan, Russia",earthquake,,,,63,reviewed,us,us
106
+ 1996-03-09T17:05:30.060Z,43.52,147.897,33,4.7,mb,,,,1,us,usp0007ehh,2014-11-07T01:00:05.128Z,"99 km ESE of Shikotan, Russia",earthquake,,,,28,reviewed,us,us
107
+ 1996-03-09T18:02:11.210Z,43.404,147.818,33,4.8,mb,,,,1.2,us,usp0007ehm,2014-11-07T01:00:05.140Z,"98 km ESE of Shikotan, Russia",earthquake,,,,57,reviewed,us,us
108
+ 1996-03-09T20:22:28.180Z,45.147,150.195,33,4.7,mb,,,,1,us,usp0007ehv,2014-11-07T01:00:05.176Z,"182 km E of Kuril’sk, Russia",earthquake,,,,47,reviewed,us,us
109
+ 1996-03-10T13:39:40.560Z,43.362,147.87,33,4.7,mb,,,,1.1,us,usp0007ek3,2014-11-07T01:00:05.423Z,"104 km ESE of Shikotan, Russia",earthquake,,,,32,reviewed,us,us
110
+ 1996-03-16T16:40:38.880Z,40.161,142.227,33,4.7,mb,,,,1.3,us,usp0007evg,2014-11-07T01:00:06.756Z,"62 km NNE of Miyako, Japan",earthquake,,,,33,reviewed,us,us
111
+ 1996-03-16T22:04:06.240Z,28.983,138.944,477.2,6.7,mwb,,,,0.9,us,usp0007evx,2022-04-29T20:13:37.301Z,"Bonin Islands, Japan region",earthquake,,,,,reviewed,us,us
112
+ 1996-03-18T02:06:16.910Z,35.625,141.108,33,4.9,mb,,,,1,us,usp0007exs,2014-11-07T01:00:07.050Z,"27 km ESE of Hasaki, Japan",earthquake,,,,68,reviewed,us,us
113
+ 1996-03-18T22:05:06.070Z,43.23,147.044,33,5,mb,,,,0.8,us,usp0007eyq,2014-11-07T01:00:07.185Z,"68 km SSE of Shikotan, Russia",earthquake,,,,67,reviewed,us,us
114
+ 1996-03-20T05:22:16.130Z,48.397,154.253,33,4.6,mb,,,,1,us,usp0007f08,2014-11-07T01:00:07.416Z,"287 km SSW of Severo-Kuril’sk, Russia",earthquake,,,,4,reviewed,us,us
115
+ 1996-03-22T22:54:12.710Z,30.443,132.527,19.4,4.7,mb,,,,0.9,us,usp0007f5a,2014-11-07T01:00:08.020Z,"149 km ESE of Nishinoomote, Japan",earthquake,,,,38,reviewed,us,us
116
+ 1996-03-24T14:26:38.760Z,45.082,153.216,33,4.9,mb,,,,1.2,us,usp0007f7h,2014-11-07T01:00:08.311Z,"east of the Kuril Islands",earthquake,,,,48,reviewed,us,us
117
+ 1996-03-25T03:51:47.170Z,44.411,149.673,33,4.8,mb,,,,0.8,us,usp0007f8q,2014-11-07T01:00:08.418Z,"168 km ESE of Kuril’sk, Russia",earthquake,,,,49,reviewed,us,us
118
+ 1996-03-25T20:55:05.170Z,44.407,148.869,58.3,4.5,mb,,,,1,us,usp0007f9u,2014-11-07T01:00:08.555Z,"120 km SE of Kuril’sk, Russia",earthquake,,15,,48,reviewed,us,us
119
+ 1996-03-26T11:48:20.110Z,45.36,150.115,33,5.1,mwc,,,,0.8,us,usp0007faq,2025-12-19T23:28:14.137Z,"176 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
120
+ 1996-03-27T22:48:12.490Z,40.189,142.576,46.7,4.6,mb,,,,1.1,us,usp0007fct,2014-11-07T01:00:08.970Z,"81 km NE of Miyako, Japan",earthquake,,,,21,reviewed,us,us
121
+ 1996-03-28T03:56:48.060Z,45.24,148.981,33,4.7,mb,,,,1,us,usp0007fd4,2014-11-07T01:00:09.034Z,"86 km E of Kuril’sk, Russia",earthquake,,,,21,reviewed,us,us
122
+ 1996-03-28T09:52:49.380Z,43.331,147.009,33,5.6,mwc,,,,0.8,us,usp0007fdc,2022-04-29T20:15:16.405Z,"56 km SSE of Shikotan, Russia",earthquake,,,,,reviewed,us,hrv
123
+ 1996-03-29T02:53:48.470Z,45.211,150.442,33,4.7,mb,,,,0.9,us,usp0007feu,2014-11-07T01:00:09.348Z,"201 km E of Kuril’sk, Russia",earthquake,,,,62,reviewed,us,us
124
+ 1996-03-30T15:03:50.570Z,44.778,150.268,33,4.5,mb,,,,1.2,us,usp0007fh4,2014-11-07T01:00:10.078Z,"194 km ESE of Kuril’sk, Russia",earthquake,,,,25,reviewed,us,us
125
+ 1996-03-30T15:14:13.920Z,43.162,146.456,45.5,5,mb,,,,0.9,us,usp0007fh5,2014-11-07T01:00:10.082Z,"73 km ESE of Nemuro, Japan",earthquake,,,,61,reviewed,us,us
126
+ 1996-03-30T23:16:40.230Z,44.481,149.434,53.1,5.5,mwc,,,,0.9,us,usp0007fhn,2025-12-19T23:28:19.907Z,"148 km SE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
127
+ 1996-03-30T23:22:19.870Z,44.339,149.448,52.1,5.5,mwc,,,,1,us,usp0007fhp,2022-04-29T20:15:57.205Z,"158 km SE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
128
+ 1996-03-30T23:31:10.430Z,44.44,149.292,33,4.8,mb,,,,1,us,usp0007fhr,2014-11-07T01:00:10.215Z,"141 km SE of Kuril’sk, Russia",earthquake,,,,62,reviewed,us,us
129
+ 1996-03-31T21:31:37.260Z,30.468,131.083,43.2,4.6,mb,,,,1,us,usp0007fk4,2014-11-07T01:00:10.472Z,"30 km SSE of Nishinoomote, Japan",earthquake,,,,31,reviewed,us,us
130
+ 1996-04-05T01:09:07.780Z,45.279,150.246,33,4.8,mb,,,,0.8,us,usp0007fsf,2014-11-07T01:00:14.951Z,"185 km E of Kuril’sk, Russia",earthquake,,,,45,reviewed,us,us
131
+ 1996-04-05T20:12:26.240Z,35.48,140.185,71.2,4.5,mb,,,,1,us,usp0007fth,2014-11-07T01:00:15.113Z,"10 km ESE of Ichihara, Japan",earthquake,,4.9,,28,reviewed,us,us
132
+ 1996-04-06T22:04:41.550Z,44.17,149.184,33,5.7,mwc,,,,1,us,usp0007fup,2022-04-29T20:16:19.536Z,"156 km SE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
133
+ 1996-04-06T23:35:06.780Z,44.206,149.146,33,4.8,mb,,,,1.1,us,usp0007fus,2014-11-07T01:00:15.413Z,"151 km SE of Kuril’sk, Russia",earthquake,,,,41,reviewed,us,us
134
+ 1996-04-07T00:07:24.970Z,44.318,149.204,33,5.4,mwc,,,,0.9,us,usp0007fuu,2025-12-19T23:28:25.573Z,"145 km SE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
135
+ 1996-04-07T00:52:56.850Z,44.555,147.981,33,4.7,mb,,,,0.8,us,usp0007fuy,2014-11-07T01:00:15.518Z,"75 km S of Kuril’sk, Russia",earthquake,,,,21,reviewed,us,us
136
+ 1996-04-07T05:58:02.140Z,44.283,149.106,33,5.2,mb,,,,0.9,us,usp0007fv5,2022-04-29T20:16:20.907Z,"143 km SE of Kuril’sk, Russia",earthquake,,,,84,reviewed,us,us
137
+ 1996-04-07T06:02:04.200Z,44.295,149.056,33,5.1,mb,,,,0.9,us,usp0007fv6,2014-11-07T01:00:15.570Z,"139 km SE of Kuril’sk, Russia",earthquake,,,,67,reviewed,us,us
138
+ 1996-04-07T06:09:09.930Z,44.299,149.113,33,5,mb,,,,0.9,us,usp0007fv7,2014-11-07T01:00:15.585Z,"142 km SE of Kuril’sk, Russia",earthquake,,,,72,reviewed,us,us
139
+ 1996-04-07T15:45:41.920Z,27.932,141.784,33,4.6,mb,,,,0.9,us,usp0007fvn,2014-11-07T01:00:15.668Z,"Bonin Islands, Japan region",earthquake,,,,28,reviewed,us,us
140
+ 1996-04-08T00:05:00.840Z,25.82,140.644,397.4,4.6,mb,,,,0.9,us,usp0007fw4,2014-11-07T01:00:15.728Z,"Volcano Islands, Japan region",earthquake,,11.1,,46,reviewed,us,us
141
+ 1996-04-14T21:44:12.680Z,42.118,142.423,59.2,4.8,mb,,,,1,us,usp0007g6j,2014-11-07T01:00:17.060Z,"24 km S of Shizunai-furukawach?, Japan",earthquake,,5.9,,51,reviewed,us,us
142
+ 1996-04-15T09:15:33.190Z,44.134,149.119,33,4.5,mb,,,,1.1,us,usp0007g73,2014-11-07T01:00:17.123Z,"156 km SE of Kuril’sk, Russia",earthquake,,,,25,reviewed,us,us
143
+ 1996-04-17T00:43:08.770Z,28.445,142.711,33,4.5,mb,,,,1.2,us,usp0007g99,2014-11-07T01:00:17.678Z,"Bonin Islands, Japan region",earthquake,,,,28,reviewed,us,us
144
+ 1996-04-18T13:52:01.620Z,48.33,154.458,33,4.5,mb,,,,1,us,usp0007gav,2014-11-07T01:00:17.873Z,"287 km SSW of Severo-Kuril’sk, Russia",earthquake,,,,32,reviewed,us,us
145
+ 1996-04-18T17:08:26.180Z,47.345,154.171,33,5.3,mwc,,,,1,us,usp0007gb2,2025-12-19T23:28:35.691Z,"Kuril Islands",earthquake,,,,,reviewed,us,hrv
146
+ 1996-04-22T06:22:10.030Z,27.783,128.876,33,4.7,mb,,,,1.2,us,usp0007gfd,2014-11-07T01:00:18.566Z,"88 km SW of Naze, Japan",earthquake,,,,32,reviewed,us,us
147
+ 1996-04-22T08:51:45.890Z,44.456,147.844,33,4.6,mb,,,,1.1,us,usp0007gfg,2014-11-07T01:00:18.574Z,"85 km S of Kuril’sk, Russia",earthquake,,,,46,reviewed,us,us
148
+ 1996-04-22T11:27:55.960Z,29.797,129.051,196.9,5.6,mwc,,,,1,us,usp0007gfq,2022-04-29T20:17:53.417Z,"142 km WSW of Kurio, Japan",earthquake,,,,,reviewed,us,hrv
149
+ 1996-04-23T04:08:01.090Z,39.215,141.462,73.2,5.3,mwc,,,,0.9,us,usp0007gga,2025-12-19T23:28:40.261Z,"12 km SSW of T?no, Japan",earthquake,,,,,reviewed,us,hrv
150
+ 1996-04-26T17:03:47.740Z,44.886,150.162,49.8,5.2,mwc,,,,0.9,us,usp0007gmy,2025-12-19T23:28:47.506Z,"183 km ESE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
151
+ 1996-04-28T14:25:56.970Z,43.967,147.107,33,4.6,mb,,,,1.1,us,usp0007gpq,2014-11-07T01:00:19.518Z,"36 km ENE of Shikotan, Russia",earthquake,,,,42,reviewed,us,us
152
+ 1996-04-29T08:40:48.740Z,30.21,130.572,152.1,4.7,mb,,,,0.9,us,usp0007gqd,2014-11-07T01:00:19.582Z,"4 km SE of Koshima, Japan",earthquake,,14,,5,reviewed,us,us
153
+ 1996-04-29T10:35:25.230Z,46.476,153.219,26.7,4.8,mb,,,,0.9,us,usp0007gqg,2014-11-07T01:00:19.589Z,"Kuril Islands",earthquake,,,,53,reviewed,us,us
154
+ 1996-05-02T05:45:12.640Z,31.793,131.629,38.4,5.2,mwc,,,,1.1,us,usp0007gv5,2022-04-29T20:18:49.468Z,"24 km SE of Miyazaki, Japan",earthquake,,4.7,,,reviewed,us,hrv
155
+ 1996-05-02T12:56:12.040Z,34.072,139.253,10,4.6,mb,,,,0.9,us,usp0007gvp,2014-11-07T01:00:23.977Z,"72 km SSE of Shimoda, Japan",earthquake,,,,31,reviewed,us,us
156
+ 1996-05-02T14:19:36.270Z,34.119,139.267,10,4.6,mb,,,,1.1,us,usp0007gvw,2014-11-07T01:00:24.120Z,"68 km SSE of Shimoda, Japan",earthquake,,,,28,reviewed,us,us
157
+ 1996-05-02T15:51:04.340Z,47.844,152.685,124.2,4.7,mb,,,,1,us,usp0007gvz,2014-11-07T01:00:24.143Z,"Kuril Islands",earthquake,,15.1,,52,reviewed,us,us
158
+ 1996-05-03T02:23:07.770Z,27.321,128.385,58.3,5,mwc,,,,1,us,usp0007gwk,2022-04-29T20:18:54.951Z,"87 km NNE of Nago, Japan",earthquake,,5.3,,,reviewed,us,hrv
159
+ 1996-05-03T18:39:37.120Z,43.085,146.835,49.5,5,mwc,,,,0.9,us,usp0007gxt,2025-12-19T23:28:48.671Z,"79 km S of Shikotan, Russia",earthquake,,,,,reviewed,us,hrv
160
+ 1996-05-03T22:06:46.110Z,44.528,149.844,33,4.6,mb,,,,1.1,us,usp0007gxz,2014-11-07T01:00:24.911Z,"173 km ESE of Kuril’sk, Russia",earthquake,,,,32,reviewed,us,us
161
+ 1996-05-06T08:21:31.030Z,43.024,144.152,85.1,4.5,mb,,,,0.9,us,usp0007h0u,2014-11-07T01:00:25.593Z,"18 km WNW of Kushiro, Japan",earthquake,,9,,34,reviewed,us,us
162
+ 1996-05-07T23:20:00.680Z,43.708,147.607,53.9,6.2,mwb,,,,0.8,us,usp0007h34,2022-04-29T20:20:05.564Z,"72 km E of Shikotan, Russia",earthquake,,,,,reviewed,us,us
163
+ 1996-05-10T02:10:30.680Z,36.271,141.807,33,5.2,mwc,,,,0.9,us,usp0007h65,2025-12-19T23:28:50.867Z,"106 km NE of Hasaki, Japan",earthquake,,,,,reviewed,us,hrv
164
+ 1996-05-10T02:11:24.100Z,36.193,141.814,33,4.8,mb,,,,0.8,us,usp0007h66,2014-11-07T01:00:26.370Z,"102 km ENE of Hasaki, Japan",earthquake,,,,21,reviewed,us,us
165
+ 1996-05-10T22:17:36.690Z,36.212,141.844,33,4.6,mb,,,,1,us,usp0007h7h,2014-11-07T01:00:26.529Z,"105 km ENE of Hasaki, Japan",earthquake,,,,31,reviewed,us,us
166
+ 1996-05-11T23:45:43.500Z,44.983,149.008,33,4.5,mb,,,,0.9,us,usp0007h9n,2014-11-07T01:00:26.843Z,"Kuril Islands",earthquake,,,,30,reviewed,us,us
167
+ 1996-05-13T01:55:21.310Z,33.085,140.919,49.1,4.9,mb,,,,0.9,us,usp0007hb2,2014-11-07T01:00:26.984Z,"231 km SSE of Tateyama, Japan",earthquake,,,,63,reviewed,us,us
168
+ 1996-05-13T04:30:42.950Z,44.577,152.193,33,4.5,mb,,,,0.9,us,usp0007hb8,2014-11-07T01:00:27.007Z,"east of the Kuril Islands",earthquake,,,,35,reviewed,us,us
169
+ 1996-05-14T19:08:19.810Z,25.972,128.487,33,4.9,mb,,,,0.9,us,usp0007hdk,2014-11-07T01:00:27.365Z,"73 km ESE of Katsuren-haebaru, Japan",earthquake,,,,31,reviewed,us,us
170
+ 1996-05-14T19:25:45.050Z,25.977,128.608,33,4.5,ms,,,,1.2,us,usp0007hdm,2014-11-07T01:00:27.370Z,"83 km ESE of Katsuren-haebaru, Japan",earthquake,,,,1,reviewed,us,us
171
+ 1996-05-19T21:19:05.860Z,28.799,139.497,382.1,5.3,mwc,,,,0.9,us,usp0007hkc,2025-12-19T23:29:02.320Z,"Bonin Islands, Japan region",earthquake,,,,,reviewed,us,hrv
172
+ 1996-05-20T09:29:56.330Z,49.03,148.427,433.9,4.5,mb,,,,0.8,us,usp0007hkw,2014-11-07T01:00:28.102Z,"northwest of the Kuril Islands",earthquake,,9,,66,reviewed,us,us
173
+ 1996-05-20T16:27:04.890Z,38.224,139.218,39,4.5,mb,,,,0.8,us,usp0007hm2,2014-11-07T01:00:28.125Z,"23 km W of Murakami, Japan",earthquake,,5.5,,32,reviewed,us,us
174
+ 1996-05-21T04:21:19.490Z,44.592,149.691,33,4.7,mb,,,,1.3,us,usp0007hms,2014-11-07T01:00:28.298Z,"159 km ESE of Kuril’sk, Russia",earthquake,,,,12,reviewed,us,us
175
+ 1996-05-23T09:36:31.290Z,38.705,142.098,33.4,4.8,mb,,,,0.9,us,usp0007hq5,2014-11-07T01:00:28.826Z,"52 km SE of ?funato, Japan",earthquake,,,,51,reviewed,us,us
176
+ 1996-05-26T06:08:31.010Z,31.604,138.295,354.8,4.5,mb,,,,0.8,us,usp0007ht9,2014-11-07T01:00:29.160Z,"Izu Islands, Japan region",earthquake,,5.9,,36,reviewed,us,us
177
+ 1996-05-26T14:59:00.220Z,32.638,142.435,33,4.6,mb,,,,0.8,us,usp0007htw,2014-11-07T01:00:29.231Z,"Izu Islands, Japan region",earthquake,,,,30,reviewed,us,us
178
+ 1996-05-28T00:43:15.880Z,49.049,154.994,85.5,4.6,mb,,,,1.1,us,usp0007hvd,2014-11-07T01:00:29.367Z,"198 km SSW of Severo-Kuril’sk, Russia",earthquake,,,,41,reviewed,us,us
179
+ 1996-05-28T01:02:09.900Z,45.358,150.736,33,5.2,mwc,,,,0.9,us,usp0007hvf,2025-12-19T23:29:05.772Z,"224 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
180
+ 1996-05-31T15:46:35.660Z,32.954,140.495,33,4.5,mb,,,,1.2,us,usp0007hzm,2014-11-07T01:00:29.830Z,"232 km SSE of Tateyama, Japan",earthquake,,,,5,reviewed,us,us
181
+ 1996-06-02T09:37:46.480Z,27.424,128.484,41.5,5.8,mwb,,,,1,us,usp0007j1y,2022-04-29T20:20:52.802Z,"102 km NNE of Nago, Japan",earthquake,,,,,reviewed,us,us
182
+ 1996-06-03T19:55:31.800Z,46.787,153.722,33,5.6,mwc,,,,0.9,us,usp0007j49,2022-04-29T20:20:59.748Z,"Kuril Islands",earthquake,,,,,reviewed,us,hrv
183
+ 1996-06-04T00:37:19.090Z,46.858,153.636,33,4.7,mb,,,,0.9,us,usp0007j4k,2014-11-07T01:00:34.037Z,"Kuril Islands",earthquake,,,,56,reviewed,us,us
184
+ 1996-06-05T23:25:16.960Z,30.497,130.962,39.8,4.5,mb,,,,1,us,usp0007j76,2014-11-07T01:00:34.653Z,"26 km S of Nishinoomote, Japan",earthquake,,5,,32,reviewed,us,us
185
+ 1996-06-09T09:24:48.220Z,40.537,143.54,33,4.7,mb,,,,0.8,us,usp0007jbz,2014-11-07T01:00:35.495Z,"168 km NE of Miyako, Japan",earthquake,,,,29,reviewed,us,us
186
+ 1996-06-10T05:26:58.820Z,41.582,142.128,59.7,4.7,mb,,,,1,us,usp0007jdf,2014-11-07T01:00:35.796Z,"82 km ENE of Mutsu, Japan",earthquake,,10.7,,43,reviewed,us,us
187
+ 1996-06-11T09:40:33.200Z,33.556,141.041,33,4.8,mb,,,,0.9,us,usp0007jjw,2014-11-07T01:00:36.909Z,"188 km SSE of Katsuura, Japan",earthquake,,,,7,reviewed,us,us
188
+ 1996-06-11T16:14:58.770Z,35.643,140.635,55.2,4.7,mb,,,,0.9,us,usp0007jkn,2014-11-07T01:00:37.070Z,"8 km S of Asahi, Japan",earthquake,,5.5,,44,reviewed,us,us
189
+ 1996-06-12T20:07:52.680Z,42.635,144.5,74,4.6,mb,,,,1.2,us,usp0007jp3,2014-11-07T01:00:37.468Z,"39 km SSE of Kushiro, Japan",earthquake,,,,15,reviewed,us,us
190
+ 1996-06-13T18:25:20.780Z,44.81,150.325,33,4.6,mb,,,,1.1,us,usp0007jqc,2014-11-07T01:00:37.602Z,"198 km ESE of Kuril’sk, Russia",earthquake,,,,27,reviewed,us,us
191
+ 1996-06-14T06:07:43.880Z,45.183,150.279,33,4.9,mb,,,,0.9,us,usp0007jr1,2014-11-07T01:00:37.679Z,"188 km E of Kuril’sk, Russia",earthquake,,,,72,reviewed,us,us
192
+ 1996-06-14T09:17:36.240Z,44.613,150.278,54.9,5.2,mwc,,,,0.9,us,usp0007jr7,2025-12-19T23:29:21.485Z,"201 km ESE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
193
+ 1996-06-15T04:36:07.410Z,44.661,150.001,33,4.7,mb,,,,1.2,us,usp0007jsm,2014-11-07T01:00:37.929Z,"178 km ESE of Kuril’sk, Russia",earthquake,,,,64,reviewed,us,us
194
+ 1996-06-16T12:59:35.990Z,45.223,148.526,33,5.1,mb,,,,0.9,us,usp0007jv2,2014-11-07T01:00:38.167Z,"50 km E of Kuril’sk, Russia",earthquake,,,,86,reviewed,us,us
195
+ 1996-06-17T17:07:49.930Z,32.357,137.348,402.6,4.9,mb,,,,1.2,us,usp0007jwt,2014-11-07T01:00:38.511Z,"198 km SE of Shing?, Japan",earthquake,,,,80,reviewed,us,us
196
+ 1996-06-19T13:03:03.220Z,43.366,147.783,33,5.6,mwc,,,,1.1,us,usp0007jzd,2022-04-29T20:22:48.387Z,"98 km ESE of Shikotan, Russia",earthquake,,,,,reviewed,us,hrv
197
+ 1996-06-23T05:12:29.820Z,43.115,147.269,52.7,5,mb,,,,0.8,us,usp0007k53,2014-11-07T01:00:39.518Z,"87 km SSE of Shikotan, Russia",earthquake,,,,68,reviewed,us,us
198
+ 1996-06-24T01:56:27.610Z,48.217,154.382,33,4.7,mb,,,,0.8,us,usp0007k6n,2014-11-07T01:00:40.157Z,"Kuril Islands",earthquake,,,,46,reviewed,us,us
199
+ 1996-06-25T21:37:02.680Z,39.971,142.839,44.9,5,mwc,,,,0.9,us,usp0007k9a,2025-12-19T23:29:32.776Z,"84 km ENE of Miyako, Japan",earthquake,,,,,reviewed,us,hrv
200
+ 1996-06-26T03:22:03.140Z,27.727,139.747,468.5,6.3,mwb,,,,0.9,us,usp0007k9q,2022-04-29T20:23:29.295Z,"Bonin Islands, Japan region",earthquake,,,,,reviewed,us,us
201
+ 1996-06-26T03:55:09.480Z,27.668,139.526,470.6,5.5,mwc,,,,1,us,usp0007k9s,2022-04-29T20:23:35.138Z,"Bonin Islands, Japan region",earthquake,,,,,reviewed,us,hrv
202
+ 1996-06-29T23:39:27.740Z,33.674,141.457,11.6,4.7,mb,,,,1.2,us,usp0007kfj,2014-11-07T01:00:41.451Z,"194 km SSE of Katsuura, Japan",earthquake,,5.3,,22,reviewed,us,us
203
+ 1996-07-02T04:44:06.840Z,44.177,147.192,33,4.6,mb,,,,0.8,us,usp0007kkz,2014-11-07T01:00:44.592Z,"56 km NE of Shikotan, Russia",earthquake,,,,27,reviewed,us,us
204
+ 1996-07-03T18:59:26.400Z,40.683,142.57,48.6,5.2,mwc,,,,1,us,usp0007kp8,2025-12-19T23:29:39.631Z,"92 km ENE of Hachinohe, Japan",earthquake,,7.8,,,reviewed,us,hrv
205
+ 1996-07-04T23:26:08.800Z,42.346,139.303,25.2,4.8,mb,,,,0.9,us,usp0007kqt,2014-11-07T01:00:46.035Z,"121 km SW of Iwanai, Japan",earthquake,,,,36,reviewed,us,us
206
+ 1996-07-05T19:06:04.440Z,48.248,155.684,33,4.5,mb,,,,1.1,us,usp0007krs,2014-11-07T01:00:46.385Z,"271 km S of Severo-Kuril’sk, Russia",earthquake,,,,28,reviewed,us,us
207
+ 1996-07-12T08:50:02.420Z,45.475,150.617,33,5.2,mwc,,,,1,us,usp0007kz4,2025-12-19T23:29:46.289Z,"216 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
208
+ 1996-07-16T02:33:03.800Z,46.549,149.874,153.7,4.5,mb,,,,0.8,us,usp0007m3c,2014-11-07T01:00:47.908Z,"213 km NE of Kuril’sk, Russia",earthquake,,12.2,,33,reviewed,us,us
209
+ 1996-07-16T05:39:35.870Z,31.388,133.406,33,4.7,mb,,,,1.1,us,usp0007m3s,2014-11-07T01:00:47.972Z,"182 km SSE of Nakamura, Japan",earthquake,,,,17,reviewed,us,us
210
+ 1996-07-18T09:52:08.100Z,31.019,141.16,49.3,4.6,mb,,,,1.1,us,usp0007m70,2014-11-07T01:00:48.374Z,"Izu Islands, Japan region",earthquake,,,,21,reviewed,us,us
211
+ 1996-07-19T19:19:34.470Z,44.178,149.525,33,4.5,mb,,,,1.1,us,usp0007m8y,2014-11-07T01:00:48.622Z,"175 km SE of Kuril’sk, Russia",earthquake,,,,9,reviewed,us,us
212
+ 1996-07-21T17:53:40.480Z,36.819,141.763,33,4.5,mb,,,,1,us,usp0007mc7,2014-11-07T01:00:49.067Z,"82 km ESE of Iwaki, Japan",earthquake,,,,24,reviewed,us,us
213
+ 1996-07-24T00:50:13.390Z,34.099,137.318,327.6,4.6,mb,,,,1,us,usp0007mh3,2014-11-07T01:00:50.023Z,"61 km SE of Toba, Japan",earthquake,,3,,47,reviewed,us,us
214
+ 1996-07-26T00:43:26.530Z,25.685,128.708,33,4.8,mb,,,,1.1,us,usp0007mma,2014-11-07T01:00:50.386Z,"110 km SE of Katsuren-haebaru, Japan",earthquake,,,,27,reviewed,us,us
215
+ 1996-07-26T22:00:33.020Z,47.627,154.113,33,4.5,mb,,,,1.1,us,usp0007mnb,2014-11-07T01:00:50.507Z,"Kuril Islands",earthquake,,,,16,reviewed,us,us
216
+ 1996-07-31T14:00:55.000Z,46.314,153.063,33,4.7,mb,,,,1.1,us,usp0007mxc,2014-11-07T01:00:51.412Z,"Kuril Islands",earthquake,,,,33,reviewed,us,us
217
+ 1996-08-02T03:35:44.580Z,33.141,137.003,391,4.5,mb,,,,1,us,usp0007n04,2014-11-07T01:00:54.405Z,"115 km SE of Shing?, Japan",earthquake,,3,,41,reviewed,us,us
218
+ 1996-08-04T23:52:28.270Z,40.062,143.54,33,5.2,mb,,,,0.8,us,usp0007n40,2014-11-07T01:00:55.751Z,"144 km ENE of Miyako, Japan",earthquake,,,,76,reviewed,us,us
219
+ 1996-08-05T20:32:06.920Z,29.068,139.524,406.1,4.5,mb,,,,1.1,us,usp0007n5e,2014-11-07T01:00:56.146Z,"Izu Islands, Japan region",earthquake,,4.7,,35,reviewed,us,us
220
+ 1996-08-08T06:11:49.770Z,44.167,146.875,100.3,4.5,mb,,,,1.2,us,usp0007n8e,2014-11-07T01:00:56.892Z,"42 km NNE of Shikotan, Russia",earthquake,,16.3,,36,reviewed,us,us
221
+ 1996-08-08T18:16:06.840Z,35.427,138.934,47.4,4.5,mb,,,,1,us,usp0007n94,2014-11-07T01:00:57.015Z,"12 km N of Gotenba, Japan",earthquake,,4.4,,34,reviewed,us,us
222
+ 1996-08-09T00:20:59.000Z,41.098,144.815,33,4.8,mb,,,,1,us,usp0007n9d,2014-11-07T01:00:57.056Z,"211 km S of Kushiro, Japan",earthquake,,,,41,reviewed,us,us
223
+ 1996-08-09T09:52:46.240Z,27.706,129.94,33,4.5,mb,,,,0.9,us,usp0007na6,2014-11-07T01:00:57.283Z,"85 km SSE of Naze, Japan",earthquake,,,,12,reviewed,us,us
224
+ 1996-08-09T15:34:49.500Z,49.256,155.63,33,5.5,mwc,,,,0.9,us,usp0007nam,2022-04-29T20:27:50.813Z,"161 km SSW of Severo-Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
225
+ 1996-08-09T23:11:41.420Z,44.043,147.047,33,4.5,mb,,,,1.2,us,usp0007nb5,2014-11-07T01:00:57.706Z,"Kuril Islands",earthquake,,,,5,reviewed,us,us
226
+ 1996-08-10T18:12:17.350Z,38.909,140.53,10,6,mwb,,,,0.9,us,usp0007nc7,2022-04-29T20:27:55.624Z,"25 km NE of Shinj?, Japan",earthquake,,,,,reviewed,us,us
227
+ 1996-08-10T18:27:50.430Z,38.876,140.539,10,4.5,mb,,,,1.2,us,usp0007nca,2014-11-07T01:00:57.962Z,"24 km ENE of Shinj?, Japan",earthquake,,,,27,reviewed,us,us
228
+ 1996-08-10T18:54:11.070Z,38.936,140.556,10,5.5,mwc,,,,0.9,us,usp0007ncf,2025-12-19T23:30:15.120Z,"26 km S of Yuzawa, Japan",earthquake,,,,,reviewed,us,hrv
229
+ 1996-08-10T23:10:45.720Z,38.88,140.628,10,5.7,mwc,,,,0.9,us,usp0007nd6,2022-04-29T20:27:57.898Z,"31 km ENE of Shinj?, Japan",earthquake,,,,,reviewed,us,hrv
230
+ 1996-08-11T01:59:23.820Z,38.848,140.509,10,5.2,ms,,,,0.8,us,usp0007ndf,2014-11-07T01:00:58.174Z,"20 km ENE of Shinj?, Japan",earthquake,,,,1,reviewed,us,us
231
+ 1996-08-11T06:01:32.910Z,38.878,140.537,10,4.7,mb,,,,1.1,us,usp0007nds,2014-11-07T01:00:58.212Z,"24 km ENE of Shinj?, Japan",earthquake,,,,46,reviewed,us,us
232
+ 1996-08-11T11:48:14.290Z,38.949,140.574,10,4.9,mb,,,,1,us,usp0007ne4,2014-11-07T01:00:58.270Z,"24 km SSE of Yuzawa, Japan",earthquake,,,,54,reviewed,us,us
233
+ 1996-08-11T11:52:26.890Z,38.932,140.616,10,4.8,mb,,,,1,us,usp0007ne6,2014-11-07T01:00:58.281Z,"27 km SSE of Yuzawa, Japan",earthquake,,,,45,reviewed,us,us
234
+ 1996-08-11T16:54:11.600Z,49.223,155.572,33,4.6,mb,,,,1.1,us,usp0007nej,2014-11-07T01:00:58.335Z,"166 km SSW of Severo-Kuril’sk, Russia",earthquake,,,,34,reviewed,us,us
235
+ 1996-08-13T02:13:01.740Z,38.844,140.509,10,5.3,mwc,,,,0.8,us,usp0007ng9,2025-12-19T23:30:16.226Z,"20 km ENE of Shinj?, Japan",earthquake,,,,,reviewed,us,hrv
236
+ 1996-08-15T16:03:32.510Z,36.023,139.785,54.7,4.6,mb,,,,1,us,usp0007nm7,2014-11-07T01:00:59.151Z,"5 km E of Sugito, Japan",earthquake,,,,39,reviewed,us,us
237
+ 1996-08-16T09:04:52.080Z,49.476,155.793,33,5.2,mb,,,,0.9,us,usp0007nn7,2014-11-07T01:00:59.290Z,"135 km S of Severo-Kuril’sk, Russia",earthquake,,,,122,reviewed,us,us
238
+ 1996-08-17T04:30:11.370Z,43.464,146.925,33,4.6,mb,,,,0.9,us,usp0007npp,2014-11-07T01:00:59.521Z,"40 km SSE of Shikotan, Russia",earthquake,,,,50,reviewed,us,us
239
+ 1996-08-17T06:29:13.710Z,44.555,147.859,33,5.1,mb,,,,1,us,usp0007npu,2014-11-07T01:00:59.537Z,"74 km S of Kuril’sk, Russia",earthquake,,,,106,reviewed,us,us
240
+ 1996-08-17T12:00:09.960Z,35.485,140.9,33,5.2,mwc,,,,0.9,us,usp0007nq3,2022-04-29T20:28:40.249Z,"28 km SSE of Hasaki, Japan",earthquake,,,,,reviewed,us,hrv
241
+ 1996-08-18T09:36:26.930Z,48.037,147.676,400,4.7,mb,,,,0.7,us,usp0007nr5,2014-11-07T01:00:59.723Z,"Sea of Okhotsk",earthquake,,,,86,reviewed,us,us
242
+ 1996-08-19T07:17:49.510Z,33.252,141.66,33,4.6,mb,,,,1,us,usp0007nsq,2014-11-07T01:00:59.946Z,"off the east coast of Honshu, Japan",earthquake,,,,25,reviewed,us,us
243
+ 1996-08-21T08:02:39.760Z,35.659,140.518,39.1,4.7,mb,,,,1.2,us,usp0007nvm,2014-11-07T01:01:00.344Z,"5 km SSW of Y?kaichiba, Japan",earthquake,,,,20,reviewed,us,us
244
+ 1996-08-21T14:40:53.870Z,45.746,149.238,155.9,5,mb,,,,0.9,us,usp0007nw1,2014-11-07T01:01:00.393Z,"120 km ENE of Kuril’sk, Russia",earthquake,,,,77,reviewed,us,us
245
+ 1996-08-22T14:42:28.210Z,49.907,157.586,63.9,4.9,mb,,,,0.9,us,usp0007nxd,2014-11-07T01:01:01.004Z,"134 km SE of Severo-Kuril’sk, Russia",earthquake,,,,11,reviewed,us,us
246
+ 1996-08-22T21:27:54.550Z,41.837,139.33,19,4.6,mb,,,,0.7,us,usp0007nxt,2014-11-07T01:01:01.046Z,"109 km W of Kamiiso, Japan",earthquake,,,,12,reviewed,us,us
247
+ 1996-08-27T01:44:10.580Z,42.822,143.799,113.4,4.6,mb,,,,0.95,us,usp0007p3k,2014-11-07T01:01:01.765Z,"49 km ESE of Obihiro, Japan",earthquake,,16.5,,1,reviewed,us,us
248
+ 1996-08-30T09:44:27.360Z,28.222,139.958,423.7,4.7,mb,,,,0.99,us,usp0007p83,2014-11-07T01:01:02.395Z,"Bonin Islands, Japan region",earthquake,,5,,15,reviewed,us,us
249
+ 1996-08-31T12:45:06.810Z,32.18,137.355,392.4,4.9,mb,,,,0.81,us,usp0007p8y,2014-11-07T01:01:02.557Z,"214 km SE of Shing?, Japan",earthquake,,,,61,reviewed,us,us
250
+ 1996-08-31T14:27:00.170Z,43.834,147.218,42.8,4.6,mb,,,,1.08,us,usp0007p90,2014-11-07T01:01:02.577Z,"40 km E of Shikotan, Russia",earthquake,,,,16,reviewed,us,us
251
+ 1996-09-01T00:26:42.080Z,45.082,149.249,33,4.5,mb,,,,1.04,us,usp0007p9j,2014-11-07T01:01:04.120Z,"109 km E of Kuril’sk, Russia",earthquake,,,,3,reviewed,us,us
252
+ 1996-09-01T13:31:17.430Z,44.024,148.474,33,4.6,mb,,,,1.05,us,usp0007paf,2014-11-07T01:01:05.026Z,"141 km SSE of Kuril’sk, Russia",earthquake,,,,18,reviewed,us,us
253
+ 1996-09-01T23:47:29.200Z,36.363,141.247,50,4.5,mb,,,,0.78,us,usp0007pb0,2014-11-07T01:01:05.299Z,"59 km ESE of Hitachi, Japan",earthquake,,,,2,reviewed,us,us
254
+ 1996-09-02T00:52:06.530Z,39.617,143.723,33,4.5,mb,,,,0.64,us,usp0007pb5,2014-11-07T01:01:05.351Z,"153 km E of Miyako, Japan",earthquake,,,,1,reviewed,us,us
255
+ 1996-09-02T07:48:03.400Z,44.624,149.475,33,5.2,mb,,,,1.02,us,usp0007pbg,2014-11-07T01:01:05.482Z,"142 km ESE of Kuril’sk, Russia",earthquake,,,,71,reviewed,us,us
256
+ 1996-09-02T12:10:15.660Z,26.231,128.816,33,4.7,mb,,,,0.92,us,usp0007pbk,2014-11-07T01:01:05.546Z,"93 km ESE of Nago, Japan",earthquake,,,,4,reviewed,us,us
257
+ 1996-09-03T09:57:26.820Z,40.203,142.652,33,5.1,mwc,,,,0.76,us,usp0007pcf,2025-12-19T23:30:43.508Z,"86 km NE of Miyako, Japan",earthquake,,,,,reviewed,us,hrv
258
+ 1996-09-04T03:37:53.250Z,29.966,130.265,52.1,5.3,mwc,,,,1,us,usp0007pdb,2022-04-29T20:30:58.096Z,"36 km SW of Yudomari, Japan",earthquake,,5.1,,,reviewed,us,hrv
259
+ 1996-09-04T15:18:27.420Z,29.038,140.833,65.4,5.2,mwc,,,,0.85,us,usp0007pe0,2025-12-19T23:30:46.731Z,"Izu Islands, Japan region",earthquake,,,,,reviewed,us,hrv
260
+ 1996-09-04T17:11:21.950Z,34.837,139.706,43.6,4.8,mb,,,,0.92,us,usp0007pe1,2014-11-07T01:01:06.525Z,"21 km SW of Tateyama, Japan",earthquake,,5.9,,9,reviewed,us,us
261
+ 1996-09-04T18:16:01.960Z,31.555,139.931,33,5.7,mwc,,,,1.21,us,usp0007pe2,2022-04-29T20:31:05.502Z,"Izu Islands, Japan region",earthquake,,,,,reviewed,us,hrv
262
+ 1996-09-08T01:48:45.650Z,43.745,147.571,33,5,mb,,,,0.85,us,usp0007pnf,2014-11-07T01:01:08.282Z,"68 km E of Shikotan, Russia",earthquake,,,,52,reviewed,us,us
263
+ 1996-09-09T04:34:20.510Z,30.434,130.726,33,5.7,mwc,,,,1.13,us,usp0007pqe,2022-04-29T20:32:19.363Z,"8 km NE of Koseda, Japan",earthquake,,,,,reviewed,us,hrv
264
+ 1996-09-09T12:23:03.270Z,43.65,147.255,44.6,4.9,mb,,,,0.9,us,usp0007pqy,2014-11-07T01:01:09.083Z,"46 km ESE of Shikotan, Russia",earthquake,,12.2,,33,reviewed,us,us
265
+ 1996-09-11T02:37:14.990Z,35.537,140.943,55,6.2,mwc,,,,0.88,us,usp0007pte,2022-04-29T20:32:26.473Z,"23 km SSE of Hasaki, Japan",earthquake,,,,,reviewed,us,hrv
266
+ 1996-09-11T23:07:08.990Z,40.796,143.064,33,4.6,mb,,,,1.01,us,usp0007puk,2014-11-07T01:01:09.967Z,"136 km ENE of Hachinohe, Japan",earthquake,,,,1,reviewed,us,us
267
+ 1996-09-13T00:09:51.620Z,38.255,141.971,48.1,4.8,mb,,,,1.07,us,usp0007pw3,2014-11-07T01:01:10.148Z,"61 km ESE of Ishinomaki, Japan",earthquake,,,,23,reviewed,us,us
268
+ 1996-09-14T12:46:04.260Z,29.06,130.17,33,4.6,mb,,,,1.38,us,usp0007pxt,2014-11-07T01:01:10.436Z,"102 km NE of Naze, Japan",earthquake,,,,5,reviewed,us,us
269
+ 1996-09-14T13:56:56.660Z,30.527,131.254,33,4.8,mb,,,,1.12,us,usp0007pxz,2014-11-07T01:01:10.540Z,"33 km SE of Nishinoomote, Japan",earthquake,,,,8,reviewed,us,us
270
+ 1996-09-14T14:32:47.760Z,27.67,139.801,485.1,4.6,mb,,,,0.85,us,usp0007py0,2014-11-07T01:01:10.544Z,"Bonin Islands, Japan region",earthquake,,7.2,,3,reviewed,us,us
271
+ 1996-09-14T16:27:19.530Z,43.282,146.713,56.7,4.7,mb,,,,0.87,us,usp0007py4,2014-11-07T01:01:10.638Z,"57 km S of Shikotan, Russia",earthquake,,,,5,reviewed,us,us
272
+ 1996-09-15T02:25:55.220Z,46.63,152.9,33,4.5,mb,,,,0.76,us,usp0007pz0,2014-11-07T01:01:11.013Z,"Kuril Islands",earthquake,,,,1,reviewed,us,us
273
+ 1996-09-16T10:00:20.810Z,33.145,137.553,356.5,4.6,mb,,,,0.92,us,usp0007q0r,2014-11-07T01:01:11.224Z,"159 km ESE of Shing?, Japan",earthquake,,3.2,,17,reviewed,us,us
274
+ 1996-09-17T23:47:07.120Z,43.648,147.213,33,5.5,mb,,,,0.85,us,usp0007q2m,2022-04-29T20:33:26.667Z,"43 km ESE of Shikotan, Russia",earthquake,,,,93,reviewed,us,us
275
+ 1996-09-18T00:13:07.080Z,43.01,146.87,53.2,5,mb,,,,0.87,us,usp0007q2q,2014-11-07T01:01:11.657Z,"88 km S of Shikotan, Russia",earthquake,,,,66,reviewed,us,us
276
+ 1996-09-18T03:25:46.110Z,32.501,141.42,33,5.7,mwc,,,,1.03,us,usp0007q2x,2022-04-29T20:33:28.160Z,"Izu Islands, Japan region",earthquake,,,,,reviewed,us,hrv
277
+ 1996-09-18T06:15:46.250Z,32.493,141.332,21.6,4.9,mb,,,,0.98,us,usp0007q34,2014-11-07T01:01:11.754Z,"Izu Islands, Japan region",earthquake,,,,16,reviewed,us,us
278
+ 1996-09-18T17:25:06.820Z,29.326,130.142,74.7,4.6,mb,,,,1.17,us,usp0007q3g,2014-11-07T01:01:11.788Z,"105 km SSW of Yudomari, Japan",earthquake,,7.2,,4,reviewed,us,us
279
+ 1996-09-19T04:45:31.020Z,32.519,141.434,20.1,5.4,mwc,,,,0.96,us,usp0007q47,2025-12-19T23:30:53.569Z,"Izu Islands, Japan region",earthquake,,6.3,,,reviewed,us,hrv
280
+ 1996-09-21T04:46:46.850Z,32.458,141.52,50.5,4.7,mb,,,,1,us,usp0007q8g,2014-11-07T01:01:12.398Z,"Izu Islands, Japan region",earthquake,,,,1,reviewed,us,us
281
+ 1996-09-21T08:27:55.950Z,31.025,141.331,33,4.6,mb,,,,0.59,us,usp0007q8n,2014-11-07T01:01:12.411Z,"Izu Islands, Japan region",earthquake,,,,4,reviewed,us,us
282
+ 1996-09-22T02:29:07.690Z,34.04,140.627,54.9,5.2,mwc,,,,0.97,us,usp0007qa1,2025-12-19T23:30:54.763Z,"125 km SSE of Tateyama, Japan",earthquake,,4.8,,,reviewed,us,hrv
283
+ 1996-09-23T14:56:47.580Z,44.51,148.233,33,4.8,mb,,,,0.89,us,usp0007qcm,2014-11-07T01:01:12.874Z,"84 km SSE of Kuril’sk, Russia",earthquake,,,,6,reviewed,us,us
284
+ 1996-09-24T21:43:14.610Z,48.222,153.123,33,5,mb,,,,0.7,us,usp0007qe7,2014-11-07T01:01:13.098Z,"Kuril Islands",earthquake,,,,44,reviewed,us,us
285
+ 1996-09-27T23:07:12.460Z,42.51,144.049,62.7,4.5,mb,,,,0.81,us,usp0007qkf,2014-11-07T01:01:14.014Z,"58 km SSW of Kushiro, Japan",earthquake,,,,14,reviewed,us,us
286
+ 1996-09-29T06:45:25.740Z,28.059,128.555,33,4.8,mb,,,,1.27,us,usp0007qp2,2014-11-07T01:01:14.491Z,"97 km WSW of Naze, Japan",earthquake,,,,3,reviewed,us,us
287
+ 1996-09-29T07:34:06.390Z,28.043,128.686,33,4.5,mb,,,,1.33,us,usp0007qp7,2014-11-07T01:01:14.627Z,"86 km WSW of Naze, Japan",earthquake,,,,3,reviewed,us,us
288
+ 1996-09-29T11:45:26.660Z,45.43,151.465,33,4.8,mb,,,,0.89,us,usp0007qpf,2014-11-07T01:01:14.664Z,"282 km E of Kuril’sk, Russia",earthquake,,,,15,reviewed,us,us
289
+ 1996-09-29T19:10:59.620Z,32.442,141.292,33,4.7,mb,,,,0.97,us,usp0007qqb,2014-11-07T01:01:14.744Z,"Izu Islands, Japan region",earthquake,,,,15,reviewed,us,us
290
+ 1996-09-30T06:25:39.540Z,25.831,143.478,33,4.6,mb,,,,0.78,us,usp0007qrb,2014-11-07T01:01:14.866Z,"Volcano Islands, Japan region",earthquake,,,,1,reviewed,us,us
291
+ 1996-09-30T08:17:17.010Z,33.256,141.409,33,4.9,mb,,,,0.36,us,usp0007qre,2014-11-07T01:01:14.872Z,"232 km SSE of Katsuura, Japan",earthquake,,,,1,reviewed,us,us
292
+ 1996-09-30T11:27:51.940Z,45.533,151.828,33,5.5,mwc,,,,0.92,us,usp0007qrs,2022-04-29T20:35:10.227Z,"Kuril Islands",earthquake,,,,,reviewed,us,hrv
293
+ 1996-09-30T11:45:47.140Z,45.463,151.739,33,4.9,mb,,,,1.12,us,usp0007qru,2014-11-07T01:01:14.937Z,"Kuril Islands",earthquake,,,,22,reviewed,us,us
294
+ 1996-09-30T16:37:20.620Z,45.48,151.779,33,4.6,mb,,,,1.08,us,usp0007qs2,2014-11-07T01:01:14.955Z,"Kuril Islands",earthquake,,,,8,reviewed,us,us
295
+ 1996-09-30T18:52:03.570Z,45.537,151.811,33,5.5,mwc,,,,0.86,us,usp0007qs7,2022-04-29T20:35:11.442Z,"Kuril Islands",earthquake,,,,,reviewed,us,hrv
296
+ 1996-10-01T00:25:41.750Z,45.475,151.788,50.2,5.1,mwc,,,,0.84,us,usp0007qsf,2025-12-19T23:31:01.543Z,"Kuril Islands",earthquake,,,,,reviewed,us,hrv
297
+ 1996-10-01T02:40:14.500Z,45.509,151.699,33,4.8,mb,,,,1.11,us,usp0007qsm,2014-11-07T01:01:16.900Z,"Kuril Islands",earthquake,,,,19,reviewed,us,us
298
+ 1996-10-01T11:01:25.280Z,44.073,148.353,33,5.4,mwc,,,,0.85,us,usp0007qt5,2025-12-19T23:31:03.740Z,"133 km SSE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
299
+ 1996-10-01T11:44:09.980Z,40.542,145.148,33,4.7,mb,,,,0.99,us,usp0007qt8,2014-11-07T01:01:17.391Z,"277 km SSE of Kushiro, Japan",earthquake,,,,3,reviewed,us,us
300
+ 1996-10-01T20:45:56.490Z,44.371,149.505,33,4.5,mb,,,,1.15,us,usp0007qtv,2014-11-07T01:01:17.940Z,"160 km SE of Kuril’sk, Russia",earthquake,,,,18,reviewed,us,us
301
+ 1996-10-02T04:19:49.710Z,41.174,142.059,73.3,4.7,mb,,,,0.91,us,usp0007qu9,2014-11-07T01:01:18.328Z,"71 km E of Mutsu, Japan",earthquake,,6.2,,13,reviewed,us,us
302
+ 1996-10-02T05:03:20.940Z,44.381,149.542,33,4.9,mb,,,,1.02,us,usp0007qud,2014-11-07T01:01:18.347Z,"161 km SE of Kuril’sk, Russia",earthquake,,,,16,reviewed,us,us
303
+ 1996-10-02T11:24:48.420Z,45.133,151.168,33,6,mwc,,,,0.77,us,usp0007quu,2022-04-29T20:35:17.678Z,"258 km E of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
304
+ 1996-10-02T17:27:16.120Z,28.467,139.379,462.4,4.8,mb,,,,0.84,us,usp0007qv5,2014-11-07T01:01:18.760Z,"Bonin Islands, Japan region",earthquake,,,,51,reviewed,us,us
305
+ 1996-10-02T21:34:59.150Z,34.492,141.112,38.4,4.8,mb,,,,0.71,us,usp0007qve,2014-11-07T01:01:18.848Z,"102 km SE of Katsuura, Japan",earthquake,,7.3,,3,reviewed,us,us
306
+ 1996-10-03T14:32:49.490Z,43.524,147.268,33,5,mb,,,,0.75,us,usp0007qwj,2014-11-07T01:01:19.304Z,"53 km SE of Shikotan, Russia",earthquake,,,,38,reviewed,us,us
307
+ 1996-10-03T18:21:35.220Z,27.953,128.172,45.7,4.7,mb,,,,1.08,us,usp0007qwq,2014-11-07T01:01:19.361Z,"136 km WSW of Naze, Japan",earthquake,,13.8,,8,reviewed,us,us
308
+ 1996-10-05T00:51:15.870Z,34.911,138.043,47.7,5.2,mb,,,,1.05,us,usp0007qyp,2014-11-07T01:01:19.694Z,"12 km NW of Kanaya, Japan",earthquake,,5.8,,4,reviewed,us,us
309
+ 1996-10-05T01:56:03.410Z,44.179,148.477,33,4.6,mb,,,,0.98,us,usp0007qyq,2014-11-07T01:01:19.702Z,"125 km SSE of Kuril’sk, Russia",earthquake,,,,12,reviewed,us,us
310
+ 1996-10-06T11:37:10.080Z,30.168,131.376,50.5,4.5,mb,,,,0.95,us,usp0007r0b,2014-11-07T01:01:19.985Z,"72 km SSE of Nishinoomote, Japan",earthquake,,13.1,,3,reviewed,us,us
311
+ 1996-10-06T12:56:03.820Z,34.832,138.02,33,4.7,mb,,,,0.79,us,usp0007r0g,2014-11-07T01:01:20.001Z,"7 km N of Kakegawa, Japan",earthquake,,,,4,reviewed,us,us
312
+ 1996-10-06T21:03:23.650Z,36.326,140.934,33,4.8,mb,,,,1.07,us,usp0007r11,2014-11-07T01:01:20.147Z,"31 km E of ?arai, Japan",earthquake,,,,19,reviewed,us,us
313
+ 1996-10-09T05:00:38.050Z,42.766,145.069,33,4.6,mb,,,,0.94,us,usp0007r4e,2014-11-07T01:01:20.627Z,"61 km ESE of Kushiro, Japan",earthquake,,,,4,reviewed,us,us
314
+ 1996-10-12T11:36:25.100Z,36.058,139.489,100.4,4.9,mb,,,,0.89,us,usp0007raa,2014-11-07T01:01:22.177Z,"2 km WSW of K?nosu, Japan",earthquake,,4.3,,46,reviewed,us,us
315
+ 1996-10-12T12:40:09.700Z,35.983,139.581,95.2,4.5,mb,,,,1,us,usp0007rae,2014-11-07T01:01:22.203Z,"2 km SE of Okegawa, Japan",earthquake,,6,,3,reviewed,us,us
316
+ 1996-10-13T01:19:05.840Z,24.996,128.072,39.8,4.7,mb,,,,0.99,us,usp0007rb6,2014-11-07T01:01:22.409Z,"131 km SSE of Itoman, Japan",earthquake,,,,12,reviewed,us,us
317
+ 1996-10-14T01:54:08.970Z,25.917,141.711,33,4.7,mb,,,,0.38,us,usp0007rcs,2014-11-07T01:01:22.605Z,"Volcano Islands, Japan region",earthquake,,,,1,reviewed,us,us
318
+ 1996-10-14T18:52:16.120Z,26.567,142.263,33,4.5,mb,,,,0.95,us,usp0007rdj,2014-11-07T01:01:22.675Z,"Bonin Islands, Japan region",earthquake,,,,4,reviewed,us,us
319
+ 1996-10-15T00:22:38.820Z,43.705,147.106,33,5.5,mb,,,,0.78,us,usp0007rdu,2022-04-29T20:35:48.542Z,"32 km ESE of Shikotan, Russia",earthquake,,,,80,reviewed,us,us
320
+ 1996-10-16T05:43:47.150Z,32.724,141.861,10,4.6,mb,,,,0.94,us,usp0007rgd,2014-11-07T01:01:23.137Z,"Izu Islands, Japan region",earthquake,,,,8,reviewed,us,us
321
+ 1996-10-16T19:15:19.130Z,26.555,130.221,40.4,4.5,mb,,,,1.23,us,usp0007rhf,2014-11-07T01:01:23.252Z,"213 km SSE of Naze, Japan",earthquake,,,,5,reviewed,us,us
322
+ 1996-10-17T15:24:05.720Z,30.564,131.177,37.5,5.1,mwc,,,,0.98,us,usp0007rjp,2022-04-29T20:35:58.835Z,"25 km SE of Nishinoomote, Japan",earthquake,,,,,reviewed,us,hrv
323
+ 1996-10-18T10:50:20.860Z,30.568,131.093,10,6.6,mwc,,,,1.21,us,usp0007rku,2022-04-29T20:36:03.560Z,"20 km SSE of Nishinoomote, Japan",earthquake,,,,,reviewed,us,hrv
324
+ 1996-10-18T11:12:08.360Z,30.436,131.393,10,4.7,mb,,,,1.17,us,usp0007rkv,2014-11-07T01:01:23.636Z,"Kyushu, Japan",earthquake,,,,7,reviewed,us,us
325
+ 1996-10-18T16:44:47.910Z,33.685,137.403,337.5,5.6,mwb,,,,0.9,us,usp0007rmb,2022-04-29T17:51:58.683Z,"102 km SSE of Toba, Japan",earthquake,,,,,reviewed,us,us
326
+ 1996-10-19T02:16:38.110Z,32.488,141.767,33,4.5,mb,,,,1.38,us,usp0007rn1,2014-11-07T01:01:23.808Z,"Izu Islands, Japan region",earthquake,,,,4,reviewed,us,us
327
+ 1996-10-19T03:07:16.320Z,31.861,131.802,33,4.7,mb,,,,1.49,us,usp0007rn3,2014-11-07T01:01:23.812Z,"36 km E of Miyazaki, Japan",earthquake,,,,18,reviewed,us,us
328
+ 1996-10-19T05:03:26.540Z,30.407,131.268,36.9,4.7,mb,,,,1.11,us,usp0007rn7,2014-11-07T01:01:23.827Z,"44 km SE of Nishinoomote, Japan",earthquake,,6.9,,8,reviewed,us,us
329
+ 1996-10-19T08:00:09.800Z,31.697,131.964,33,4.6,mb,,,,1.83,us,usp0007rne,2014-11-07T01:01:23.855Z,"57 km ESE of Miyazaki, Japan",earthquake,,,,1,reviewed,us,us
330
+ 1996-10-19T08:31:49.820Z,31.84,131.804,33,5.5,mwc,,,,1.25,us,usp0007rng,2022-04-29T20:36:17.388Z,"37 km ESE of Miyazaki, Japan",earthquake,,,,,reviewed,us,hrv
331
+ 1996-10-19T14:01:03.900Z,31.959,131.615,33,5.7,mwc,,,,1.15,us,usp0007rnz,2022-04-29T20:36:18.982Z,"19 km ENE of Miyazaki, Japan",earthquake,,,,,reviewed,us,hrv
332
+ 1996-10-19T14:44:40.790Z,31.885,131.468,22,6.7,mwc,,,,1.02,us,usp0007rp0,2022-04-29T20:36:25.353Z,"5 km SE of Miyazaki, Japan",earthquake,,,,,reviewed,us,hrv
333
+ 1996-10-19T19:25:08.020Z,31.827,131.912,33,4.7,mb,,,,1.46,us,usp0007rpb,2014-11-07T01:01:24.061Z,"47 km ESE of Miyazaki, Japan",earthquake,,,,9,reviewed,us,us
334
+ 1996-10-19T21:17:48.630Z,31.732,131.593,33,5.6,mwc,,,,1.04,us,usp0007rph,2022-04-29T20:36:28.045Z,"25 km NE of Nichinan, Japan",earthquake,,,,,reviewed,us,hrv
335
+ 1996-10-23T03:13:40.880Z,37.622,141.536,84.5,4.8,mb,,,,1,us,usp0007rth,2014-11-07T01:01:24.593Z,"49 km ENE of Namie, Japan",earthquake,,,,5,reviewed,us,us
336
+ 1996-10-23T12:05:49.710Z,44.65,149.461,33,5.5,mb,,,,0.89,us,usp0007ru3,2022-04-29T20:36:38.462Z,"140 km ESE of Kuril’sk, Russia",earthquake,,,,109,reviewed,us,us
337
+ 1996-10-24T02:14:56.820Z,34.213,139.061,33.9,4.8,mb,,,,0.98,us,usp0007rv9,2014-11-07T01:01:25.027Z,"52 km SSE of Shimoda, Japan",earthquake,,,,20,reviewed,us,us
338
+ 1996-10-24T03:19:06.370Z,25.743,142.765,33,4.9,mb,,,,1.09,us,usp0007rve,2014-11-07T01:01:25.059Z,"Volcano Islands, Japan region",earthquake,,,,22,reviewed,us,us
339
+ 1996-10-25T03:25:17.710Z,35.408,138.952,49.2,4.8,mb,,,,0.98,us,usp0007rx2,2014-11-07T01:01:25.913Z,"9 km N of Gotenba, Japan",earthquake,,4.3,,31,reviewed,us,us
340
+ 1996-10-25T12:09:58.650Z,25.657,142.837,33,4.5,mb,,,,0.9,us,usp0007rxg,2014-11-07T01:01:26.047Z,"Volcano Islands, Japan region",earthquake,,,,9,reviewed,us,us
341
+ 1996-10-26T03:11:37.410Z,25.621,143.201,33,4.7,mb,,,,0.82,us,usp0007ryd,2014-11-07T01:01:26.145Z,"Volcano Islands, Japan region",earthquake,,,,2,reviewed,us,us
342
+ 1996-10-26T08:17:15.380Z,36.041,139.663,100.5,4.8,mb,,,,0.77,us,usp0007ryv,2014-11-07T01:01:26.184Z,"2 km N of Shiraoka, Japan",earthquake,,4.5,,3,reviewed,us,us
343
+ 1996-10-27T07:20:06.520Z,45.445,150.257,33,4.7,mb,,,,0.89,us,usp0007s0g,2014-11-07T01:01:26.315Z,"188 km E of Kuril’sk, Russia",earthquake,,,,24,reviewed,us,us
344
+ 1996-10-27T16:36:50.370Z,34.221,139.227,33,4.7,mb,,,,0.97,us,usp0007s0y,2014-11-07T01:01:26.362Z,"56 km SSE of Shimoda, Japan",earthquake,,,,11,reviewed,us,us
345
+ 1996-10-27T16:51:09.900Z,34.261,139.172,33,4.9,mb,,,,1.08,us,usp0007s11,2014-11-07T01:01:26.370Z,"50 km SSE of Shimoda, Japan",earthquake,,,,38,reviewed,us,us
346
+ 1996-10-27T22:41:29.640Z,44.368,149.801,33,5.1,mb,,,,1.1,us,usp0007s1m,2014-11-07T01:01:26.581Z,"179 km ESE of Kuril’sk, Russia",earthquake,,,,38,reviewed,us,us
347
+ 1996-10-28T09:24:06.740Z,43.501,147.098,33,5.4,mwc,,,,0.86,us,usp0007s27,2022-04-29T20:36:53.210Z,"44 km SE of Shikotan, Russia",earthquake,,,,,reviewed,us,hrv
348
+ 1996-10-29T04:50:52.900Z,45.417,149.937,52.6,4.9,mb,,,,0.9,us,usp0007s3f,2014-11-07T01:01:26.835Z,"162 km E of Kuril’sk, Russia",earthquake,,,,56,reviewed,us,us
349
+ 1996-10-29T06:57:03.890Z,43.843,144.892,167.1,4.5,mb,,,,0.99,us,usp0007s3j,2014-11-07T01:01:26.847Z,"28 km NW of Shibetsu, Japan",earthquake,,9.4,,11,reviewed,us,us
350
+ 1996-10-29T10:31:15.990Z,45.329,151.844,44.1,5.2,mwc,,,,0.98,us,usp0007s3q,2025-12-19T23:31:27.534Z,"Kuril Islands",earthquake,,,,,reviewed,us,hrv
351
+ 1996-10-29T16:38:43.080Z,45.262,151.639,43.2,4.8,mb,,,,1.34,us,usp0007s46,2014-11-07T01:01:26.910Z,"295 km E of Kuril’sk, Russia",earthquake,,,,21,reviewed,us,us
352
+ 1996-10-29T18:39:16.400Z,46.589,149.329,42.2,4.5,mb,,,,1.28,us,usp0007s49,2014-11-07T01:01:26.917Z,"188 km NE of Kuril’sk, Russia",earthquake,,,,1,reviewed,us,us
353
+ 1996-10-30T04:43:21.870Z,45.447,151.741,44.4,5,mb,,,,0.74,us,usp0007s4v,2014-11-07T01:01:26.975Z,"Kuril Islands",earthquake,,,,46,reviewed,us,us
354
+ 1996-10-30T04:45:26.340Z,45.335,151.696,45.9,5.2,mb,,,,1.06,us,usp0007s4w,2014-11-07T01:01:26.984Z,"299 km E of Kuril’sk, Russia",earthquake,,,,59,reviewed,us,us
355
+ 1996-10-30T07:07:32.690Z,45.378,151.626,43.5,4.9,mb,,,,1.08,us,usp0007s4z,2014-11-07T01:01:27.019Z,"294 km E of Kuril’sk, Russia",earthquake,,,,25,reviewed,us,us
356
+ 1996-10-30T09:09:41.390Z,41.719,138.708,222.4,5.3,mwc,,,,0.81,us,usp0007s52,2025-12-19T23:31:28.707Z,"161 km W of Kamiiso, Japan",earthquake,,,,,reviewed,us,hrv
357
+ 1996-10-30T15:06:48.870Z,32.95,140.118,145.9,4.8,mb,,,,1.14,us,usp0007s5d,2014-11-07T01:01:27.321Z,"220 km SSE of Shimoda, Japan",earthquake,,6.3,,13,reviewed,us,us
358
+ 1996-10-30T19:29:51.560Z,30.638,131.118,53.5,4.6,mb,,,,1.01,us,usp0007s5q,2014-11-07T01:01:27.501Z,"15 km SE of Nishinoomote, Japan",earthquake,,5.9,,7,reviewed,us,us
359
+ 1996-10-31T17:37:23.390Z,43.536,147.166,59.6,5.4,mwc,,,,0.85,us,usp0007s75,2022-04-29T20:37:16.912Z,"46 km SE of Shikotan, Russia",earthquake,,,,,reviewed,us,hrv
360
+ 1996-11-01T17:17:47.260Z,45.754,151.835,33,4.5,mb,,,,1.26,us,usp0007s99,2014-11-07T01:01:30.278Z,"Kuril Islands",earthquake,,,,6,reviewed,us,us
361
+ 1996-11-01T19:50:01.260Z,34.206,139.219,11.5,5.1,mwc,,,,0.83,us,usp0007s9e,2022-04-29T20:37:41.471Z,"57 km SSE of Shimoda, Japan",earthquake,,2.6,,,reviewed,us,hrv
362
+ 1996-11-02T06:47:05.950Z,44.272,147.546,39.4,4.7,mb,,,,0.78,us,usp0007sa3,2014-11-07T01:01:30.798Z,"84 km NE of Shikotan, Russia",earthquake,,12.2,,27,reviewed,us,us
363
+ 1996-11-02T18:02:06.300Z,49.407,156.387,33,4.5,mb,,,,1.15,us,usp0007sar,2014-11-07T01:01:30.981Z,"142 km S of Severo-Kuril’sk, Russia",earthquake,,,,1,reviewed,us,us
364
+ 1996-11-02T19:42:25.720Z,43.783,151.895,33,4.9,mb,,,,0.87,us,usp0007sax,2014-11-07T01:01:31.028Z,"east of the Kuril Islands",earthquake,,,,43,reviewed,us,us
365
+ 1996-11-05T16:07:15.900Z,43.673,147.296,59.9,4.7,mb,,,,1.14,us,usp0007sg6,2014-11-07T01:01:32.801Z,"48 km ESE of Shikotan, Russia",earthquake,,,,24,reviewed,us,us
366
+ 1996-11-06T20:00:58.850Z,27.999,143.538,9,6.6,mwc,,,,0.83,us,usp0007sja,2022-04-29T20:38:54.642Z,"Bonin Islands, Japan region",earthquake,,,,,reviewed,us,hrv
367
+ 1996-11-06T20:37:00.610Z,28.055,143.607,10,4.7,mb,,,,1.37,us,usp0007sjd,2014-11-07T01:01:33.207Z,"Bonin Islands, Japan region",earthquake,,,,3,reviewed,us,us
368
+ 1996-11-06T22:25:59.950Z,28.019,143.641,10,4.8,mb,,,,1.3,us,usp0007sjk,2014-11-07T01:01:33.256Z,"Bonin Islands, Japan region",earthquake,,,,3,reviewed,us,us
369
+ 1996-11-07T01:15:20.710Z,27.968,143.81,10,4.7,mb,,,,1.19,us,usp0007sjt,2014-11-07T01:01:33.281Z,"Bonin Islands, Japan region",earthquake,,,,3,reviewed,us,us
370
+ 1996-11-07T04:38:23.940Z,28.158,143.506,10,4.8,mb,,,,0.9,us,usp0007sjz,2014-11-07T01:01:33.312Z,"Bonin Islands, Japan region",earthquake,,,,19,reviewed,us,us
371
+ 1996-11-07T06:46:49.750Z,27.913,143.742,10,4.5,mb,,,,1.25,us,usp0007skb,2014-11-07T01:01:33.375Z,"Bonin Islands, Japan region",earthquake,,,,2,reviewed,us,us
372
+ 1996-11-07T08:36:54.960Z,28.038,143.363,10,4.9,mb,,,,0.96,us,usp0007skr,2014-11-07T01:01:33.436Z,"Bonin Islands, Japan region",earthquake,,,,28,reviewed,us,us
373
+ 1996-11-07T10:03:54.060Z,28.063,143.513,10,5,mb,,,,1.33,us,usp0007sm1,2014-11-07T01:01:33.482Z,"Bonin Islands, Japan region",earthquake,,,,16,reviewed,us,us
374
+ 1996-11-07T22:24:07.230Z,25.029,141.884,75.5,4.7,mb,,,,1.2,us,usp0007snb,2014-11-07T01:01:33.596Z,"Volcano Islands, Japan region",earthquake,,15.8,,4,reviewed,us,us
375
+ 1996-11-07T23:46:43.670Z,28.2,143.411,10,4.8,mb,,,,1.47,us,usp0007snh,2014-11-07T01:01:33.624Z,"Bonin Islands, Japan region",earthquake,,,,3,reviewed,us,us
376
+ 1996-11-08T00:12:54.730Z,27.926,143.553,10,4.7,mb,,,,1.14,us,usp0007snj,2014-11-07T01:01:33.626Z,"Bonin Islands, Japan region",earthquake,,,,2,reviewed,us,us
377
+ 1996-11-08T01:13:11.140Z,28.092,143.516,10,4.9,mb,,,,0.67,us,usp0007snn,2014-11-07T01:01:33.633Z,"Bonin Islands, Japan region",earthquake,,,,17,reviewed,us,us
378
+ 1996-11-08T07:09:52.910Z,33.811,137.103,350,4.7,mb,,,,0.96,us,usp0007snx,2014-11-07T01:01:33.705Z,"near the south coast of Honshu, Japan",earthquake,,3.1,,36,reviewed,us,us
379
+ 1996-11-08T12:56:06.900Z,27.976,143.885,10,4.6,mb,,,,1.32,us,usp0007spa,2014-11-07T01:01:33.807Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
380
+ 1996-11-08T14:03:25.090Z,38.934,142.301,86.6,4.8,mb,,,,0.79,us,usp0007spd,2014-11-07T01:01:33.835Z,"52 km ESE of ?funato, Japan",earthquake,,,,2,reviewed,us,us
381
+ 1996-11-08T17:32:20.900Z,27.578,139.876,480,4.6,mb,,,,0.83,us,usp0007spm,2014-11-07T01:01:33.852Z,"Bonin Islands, Japan region",earthquake,,10.3,,20,reviewed,us,us
382
+ 1996-11-08T20:03:15.360Z,27.977,143.9,10,4.5,mb,,,,0.48,us,usp0007spv,2014-11-07T01:01:33.872Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
383
+ 1996-11-09T01:30:56.340Z,28.169,143.392,10,4.9,mb,,,,0.87,us,usp0007sq6,2014-11-07T01:01:33.894Z,"Bonin Islands, Japan region",earthquake,,,,17,reviewed,us,us
384
+ 1996-11-09T01:33:28.160Z,28.124,143.317,10,4.7,mb,,,,0.89,us,usp0007sq7,2014-11-07T01:01:33.899Z,"Bonin Islands, Japan region",earthquake,,,,8,reviewed,us,us
385
+ 1996-11-09T01:39:05.690Z,28.115,143.256,10,4.5,mb,,,,1.2,us,usp0007sq8,2014-11-07T01:01:33.902Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
386
+ 1996-11-09T04:39:44.050Z,28.14,143.442,10,4.5,mb,,,,0.96,us,usp0007sqh,2014-11-07T01:01:33.932Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
387
+ 1996-11-09T09:43:39.710Z,45.859,148.995,100,4.5,mb,,,,1.05,us,usp0007sr8,2014-11-07T01:01:33.996Z,"112 km NE of Kuril’sk, Russia",earthquake,,,,22,reviewed,us,us
388
+ 1996-11-10T13:31:31.600Z,28.176,143.379,10,4.9,mb,,,,0.83,us,usp0007st2,2014-11-07T01:01:34.208Z,"Bonin Islands, Japan region",earthquake,,,,20,reviewed,us,us
389
+ 1996-11-10T16:03:35.600Z,28.022,143.701,10,4.5,mb,,,,0.88,us,usp0007st7,2014-11-07T01:01:34.287Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
390
+ 1996-11-11T01:03:14.960Z,28.226,143.394,10,5.1,mb,,,,0.76,us,usp0007su0,2014-11-07T01:01:34.425Z,"Bonin Islands, Japan region",earthquake,,,,38,reviewed,us,us
391
+ 1996-11-11T03:50:52.610Z,30.592,131.069,33,5.4,mwc,,,,1.06,us,usp0007su3,2022-04-29T20:39:14.940Z,"17 km SSE of Nishinoomote, Japan",earthquake,,,,,reviewed,us,hrv
392
+ 1996-11-11T15:53:38.610Z,28.32,143.404,10,4.5,mb,,,,1,us,usp0007suy,2014-11-07T01:01:34.558Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
393
+ 1996-11-11T17:20:51.780Z,28.19,143.394,10,4.5,mb,,,,1.05,us,usp0007sv2,2014-11-07T01:01:34.568Z,"Bonin Islands, Japan region",earthquake,,,,4,reviewed,us,us
394
+ 1996-11-12T01:16:46.730Z,31.569,139.997,147.7,4.9,mb,,,,0.88,us,usp0007svm,2014-11-07T01:01:34.610Z,"Izu Islands, Japan region",earthquake,,,,22,reviewed,us,us
395
+ 1996-11-12T07:19:39.290Z,43.458,147.782,33,4.6,mb,,,,1.07,us,usp0007svw,2014-11-07T01:01:34.639Z,"93 km ESE of Shikotan, Russia",earthquake,,,,5,reviewed,us,us
396
+ 1996-11-12T07:23:03.240Z,43.208,147.996,33,5,mb,,,,1.23,us,usp0007svx,2014-11-07T01:01:34.643Z,"122 km ESE of Shikotan, Russia",earthquake,,,,29,reviewed,us,us
397
+ 1996-11-13T04:06:32.670Z,28.207,143.791,36.4,4.5,mb,,,,0.45,us,usp0007sy2,2014-11-07T01:01:34.916Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
398
+ 1996-11-13T05:03:08.840Z,49.809,157.391,33,5.1,mb,,,,0.77,us,usp0007sy5,2014-11-07T01:01:34.925Z,"131 km SE of Severo-Kuril’sk, Russia",earthquake,,,,39,reviewed,us,us
399
+ 1996-11-13T07:43:58.340Z,28.022,143.525,33,4.5,mb,,,,0.78,us,usp0007syh,2014-11-07T01:01:34.955Z,"Bonin Islands, Japan region",earthquake,,,,3,reviewed,us,us
400
+ 1996-11-14T00:19:05.940Z,43.492,146.878,64.6,4.5,mb,,,,0.9,us,usp0007szp,2014-11-07T01:01:35.062Z,"36 km SSE of Shikotan, Russia",earthquake,,,,8,reviewed,us,us
401
+ 1996-11-16T13:54:27.260Z,28.107,143.459,33,4.6,mb,,,,0.99,us,usp0007t3u,2014-11-07T01:01:36.030Z,"Bonin Islands, Japan region",earthquake,,,,10,reviewed,us,us
402
+ 1996-11-16T15:51:55.340Z,34.315,139.255,24.5,4.5,mb,,,,0.92,us,usp0007t3w,2014-11-07T01:01:36.038Z,"49 km SE of Shimoda, Japan",earthquake,,5,,4,reviewed,us,us
403
+ 1996-11-17T01:29:39.580Z,27.89,143.647,33,4.6,mb,,,,1.31,us,usp0007t4g,2014-11-07T01:01:36.101Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
404
+ 1996-11-18T23:51:25.140Z,46.608,151.345,91.1,5.1,mb,,,,0.84,us,usp0007t73,2014-11-07T01:01:36.581Z,"Kuril Islands",earthquake,,,,77,reviewed,us,us
405
+ 1996-11-20T02:27:47.980Z,34.35,141.132,33,6.1,mwc,,,,1.02,us,usp0007t8t,2022-04-29T20:40:14.042Z,"115 km SE of Katsuura, Japan",earthquake,,,,,reviewed,us,hrv
406
+ 1996-11-22T15:34:35.810Z,31.726,131.713,32.7,4.9,mb,,,,1.23,us,usp0007td7,2014-11-07T01:01:37.410Z,"35 km SE of Miyazaki, Japan",earthquake,,,,26,reviewed,us,us
407
+ 1996-11-23T22:39:59.520Z,35.649,140.149,68.1,4.9,mb,,,,0.94,us,usp0007tfb,2014-11-07T01:01:37.673Z,"1 km W of Yotsukaid?, Japan",earthquake,,4.1,,17,reviewed,us,us
408
+ 1996-11-24T09:53:53.320Z,43.995,147.696,33,4.6,mb,,,,1.15,us,usp0007tg6,2014-11-07T01:01:37.751Z,"81 km ENE of Shikotan, Russia",earthquake,,,,3,reviewed,us,us
409
+ 1996-11-25T00:26:36.850Z,38.402,133.609,432.2,4.6,mb,,,,1.07,us,usp0007th3,2014-11-07T01:01:37.821Z,"Sea of Japan",earthquake,,6,,19,reviewed,us,us
410
+ 1996-11-25T03:49:05.750Z,27.935,142.819,33,4.7,mb,,,,1.07,us,usp0007tha,2014-11-07T01:01:37.850Z,"Bonin Islands, Japan region",earthquake,,,,19,reviewed,us,us
411
+ 1996-11-28T07:40:43.470Z,34.557,140.116,66.6,5.6,mwc,,,,0.93,us,usp0007tp1,2022-04-29T20:40:58.417Z,"near the east coast of Honshu, Japan",earthquake,,,,,reviewed,us,hrv
412
+ 1996-11-30T08:08:03.860Z,45.419,151.817,33,5.2,mb,,,,0.93,us,usp0007ts3,2014-11-07T01:01:39.674Z,"Kuril Islands",earthquake,,,,81,reviewed,us,us
413
+ 1996-11-30T17:55:13.020Z,41.762,139.42,33,5,mb,,,,0.78,us,usp0007tsx,2014-11-07T01:01:39.779Z,"102 km W of Kamiiso, Japan",earthquake,,,,48,reviewed,us,us
414
+ 1996-12-02T03:00:12.250Z,28.114,143.183,35.5,4.7,mb,,,,0.93,us,usp0007tuw,2014-11-07T01:01:42.892Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
415
+ 1996-12-02T07:00:24.680Z,28.005,130.076,32,5.1,mb,,,,1.01,us,usp0007tuz,2014-11-07T01:01:42.966Z,"70 km SE of Naze, Japan",earthquake,,,,25,reviewed,us,us
416
+ 1996-12-02T09:04:08.610Z,30.506,131.258,33.6,4.8,mb,,,,0.83,us,usp0007tv3,2014-11-07T01:01:43.016Z,"35 km SE of Nishinoomote, Japan",earthquake,,6.1,,7,reviewed,us,us
417
+ 1996-12-02T22:17:59.240Z,31.789,131.314,49.2,6.7,mwc,,,,1,us,usp0007tw5,2022-04-29T20:41:13.709Z,"17 km SW of Miyazaki, Japan",earthquake,,3.5,,,reviewed,us,hrv
418
+ 1996-12-03T15:49:12.820Z,37.485,139.48,138.9,5.7,mwc,,,,0.78,us,usp0007txb,2022-04-29T16:34:58.095Z,"35 km SE of Muramatsu, Japan",earthquake,,,,,reviewed,us,hrv
419
+ 1996-12-05T00:25:05.980Z,44.07,150.369,33,5.2,mwc,,,,0.86,us,usp0007tz6,2025-12-19T22:15:23.897Z,"235 km SE of Kuril’sk, Russia",earthquake,,,,,reviewed,us,hrv
420
+ 1996-12-06T00:48:27.000Z,33.915,141.535,33,4.7,mb,,,,1.12,us,usp0007u0v,2014-11-07T01:01:44.699Z,"176 km SE of Katsuura, Japan",earthquake,,,,13,reviewed,us,us
421
+ 1996-12-06T03:30:30.700Z,33.982,141.492,33,5.4,mwc,,,,1.3,us,usp0007u12,2025-12-19T22:15:25.096Z,"168 km SE of Katsuura, Japan",earthquake,,,,,reviewed,us,hrv
422
+ 1996-12-06T03:52:58.630Z,43.852,147.12,66.9,4.5,mb,,,,0.89,us,usp0007u13,2014-11-07T01:01:44.938Z,"32 km E of Shikotan, Russia",earthquake,,24.2,,5,reviewed,us,us
423
+ 1996-12-06T08:41:19.340Z,44.141,148.326,33,4.7,mb,,,,1.04,us,usp0007u1d,2014-11-07T01:01:44.961Z,"125 km SSE of Kuril’sk, Russia",earthquake,,,,20,reviewed,us,us
424
+ 1996-12-06T23:06:26.830Z,33.281,140.559,60.8,5.2,mb,,,,0.91,us,usp0007u24,2014-11-07T01:01:45.040Z,"199 km SSE of Tateyama, Japan",earthquake,,4.7,,50,reviewed,us,us
425
+ 1996-12-06T23:21:19.140Z,27.837,140.766,33,4.9,mb,,,,0.81,us,usp0007u25,2014-11-07T01:01:45.056Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
426
+ 1996-12-07T20:32:24.950Z,45.803,151.521,33,5.1,mb,,,,0.87,us,usp0007u36,2014-11-07T01:01:45.222Z,"291 km ENE of Kuril’sk, Russia",earthquake,,,,79,reviewed,us,us
427
+ 1996-12-09T17:46:12.460Z,46.84,150.777,181.7,5.1,mb,,,,0.88,us,usp0007u6q,2014-11-07T01:01:45.933Z,"287 km NE of Kuril’sk, Russia",earthquake,,,,86,reviewed,us,us
428
+ 1996-12-12T07:20:34.430Z,31.695,131.807,31.3,5.3,mwc,,,,1.12,us,usp0007uak,2022-04-29T16:37:26.513Z,"43 km ENE of Nichinan, Japan",earthquake,,4.8,,,reviewed,us,hrv
429
+ 1996-12-12T07:44:35.990Z,31.683,131.797,39.7,4.6,ms,,,,1.29,us,usp0007uam,2014-11-07T01:01:46.566Z,"41 km ENE of Nichinan, Japan",earthquake,,8.2,,2,reviewed,us,us
430
+ 1996-12-13T04:10:16.500Z,37.141,128.764,10,4.8,mb,,,,1.25,us,usp0007uc1,2020-09-15T19:16:18.709Z,"20 km W of T’aebaek, South Korea",earthquake,,,,13,reviewed,us,us
431
+ 1996-12-13T10:35:49.930Z,28.878,140.944,100,4.6,mb,,,,0.91,us,usp0007ucf,2014-11-07T01:01:46.800Z,"Bonin Islands, Japan region",earthquake,,,,1,reviewed,us,us
432
+ 1996-12-13T20:28:50.640Z,48.477,154.255,33,4.7,mb,,,,0.72,us,usp0007ud9,2014-11-07T01:01:46.881Z,"279 km SSW of Severo-Kuril’sk, Russia",earthquake,,,,24,reviewed,us,us
433
+ 1996-12-15T17:58:06.330Z,46.981,151.908,33,4.9,mb,,,,0.92,us,usp0007ugv,2014-11-07T01:01:47.258Z,"Kuril Islands",earthquake,,,,74,reviewed,us,us
434
+ 1996-12-15T19:05:37.780Z,41.292,142.569,33,4.5,mb,,,,1.01,us,usp0007ugy,2014-11-07T01:01:47.353Z,"113 km E of Mutsu, Japan",earthquake,,,,1,reviewed,us,us
435
+ 1996-12-15T20:31:52.420Z,43.794,150.242,33,4.7,mb,,,,1.4,us,usp0007uh0,2014-11-07T01:01:47.421Z,"246 km SE of Kuril’sk, Russia",earthquake,,,,35,reviewed,us,us
436
+ 1996-12-21T01:28:45.270Z,36.025,139.767,44.8,5.5,mwc,,,,0.89,us,usp0007urn,2022-04-29T16:38:24.636Z,"3 km E of Sugito, Japan",earthquake,,,,,reviewed,us,hrv
437
+ 1996-12-22T14:53:27.620Z,43.207,138.92,226.5,6.5,mwc,,,,0.89,us,usp0007uuh,2022-04-29T16:38:48.331Z,"131 km W of Iwanai, Japan",earthquake,,,,,reviewed,us,hrv
438
+ 1996-12-22T22:16:41.620Z,45.86,150.497,98.1,5,mb,,,,0.82,us,usp0007uuw,2014-11-07T01:01:48.892Z,"216 km ENE of Kuril’sk, Russia",earthquake,,13,,63,reviewed,us,us
439
+ 1996-12-23T19:55:34.620Z,28.2,143.48,33,4.6,mb,,,,1.47,us,usp0007uwb,2014-11-07T01:01:49.065Z,"Bonin Islands, Japan region",earthquake,,,,3,reviewed,us,us
440
+ 1996-12-26T19:32:02.450Z,44.037,149.645,33,4.7,mb,,,,1.29,us,usp0007v0x,2014-11-07T01:01:50.112Z,"192 km SE of Kuril’sk, Russia",earthquake,,,,8,reviewed,us,us
441
+ 1996-12-28T03:55:00.370Z,46.255,150.8,33,4.5,mb,,,,1.23,us,usp0007v3p,2014-11-07T01:01:50.484Z,"254 km ENE of Kuril’sk, Russia",earthquake,,,,4,reviewed,us,us
442
+ 1996-12-28T14:32:05.320Z,33.269,141.132,33,4.5,mb,,,,0.65,us,usp0007v44,2014-11-07T01:01:50.572Z,"221 km SSE of Katsuura, Japan",earthquake,,,,2,reviewed,us,us
443
+ 1996-12-29T00:39:10.750Z,44.067,147.596,61.1,4.7,mb,,,,1,us,usp0007v4r,2014-11-07T01:01:50.643Z,"76 km ENE of Shikotan, Russia",earthquake,,10.6,,38,reviewed,us,us
20260905-231105-science-environment-dbcba6/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_maximum_magnitude_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_maximum_magnitude_audit",
34
+ "variant": "base",
35
+ "domain_name": "science_environment",
36
+ "task_name": "usgs_japan_kuril_annual_maximum_magnitude_audit",
37
+ "variant_name": "base",
38
+ "requires_task_data": True,
39
+ "task_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_maximum_magnitude_audit/base",
40
+ "input_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_maximum_magnitude_audit/base/input",
41
+ "software_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_maximum_magnitude_audit/base/software",
42
+ "remote_output_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_maximum_magnitude_audit/base/output",
43
+ "reference_dir": "/media/user/data/agenthle/science_environment/usgs_japan_kuril_annual_maximum_magnitude_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]
20260905-231105-science-environment-dbcba6/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())
20260905-231105-science-environment-dbcba6/environment/public_data/task_card.json ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "taskId": "science_environment/usgs_japan_kuril_annual_maximum_magnitude_audit__20260905-231105_science_environment_dbcba6",
3
+ "title": "USGS Fdsn Eq Japan Kuril 1996 1996 M4p5 Mag Max",
4
+ "summary": "Audit the real USGS FDSN Japan and Kuril trench earthquake catalog for 1996-1996 (events with magnitude >= 4.5) and produce reproducible annual annual maximum magnitude 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_1996_1996_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_japan_kuril_1996_1996_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_japan_kuril_1996_1996_m4p5.csv",
49
+ "format": "CSV",
50
+ "path": "input/usgs_fdsn_japan_kuril_1996_1996_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
+ }
20260905-231105-science-environment-dbcba6/instruction.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # USGS Fdsn Eq Japan Kuril 1996 1996 M4p5 Mag Max
2
+
3
+ Audit the real USGS FDSN Japan and Kuril trench earthquake catalog for 1996-1996 (events with magnitude >= 4.5) and produce reproducible annual annual maximum magnitude 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_1996_1996_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.
20260905-231105-science-environment-dbcba6/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
+
20260905-231105-science-environment-dbcba6/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)
20260905-231105-science-environment-dbcba6/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())
20260905-231105-science-environment-dbcba6/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}"
20260905-231105-science-environment-dbcba6/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/20260905-231105-science-environment-dbcba6"
6
+ description = "Audit the real USGS FDSN Japan and Kuril trench earthquake catalog for 1996-1996 (events with magnitude >= 4.5) and produce reproducible annual annual maximum magnitude 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 = "20260905-231105_science_environment_dbcba6"
14
+ task_id = "science_environment/usgs_japan_kuril_annual_maximum_magnitude_audit__20260905-231105_science_environment_dbcba6"
15
+ domain = "science_environment"
16
+ task = "usgs_japan_kuril_annual_maximum_magnitude_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
20260905-231105-science-environment-dbcba6/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
20260905-231105-science-environment-dbcba6/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())
20260905-231105-science-environment-dbcba6/tests/reference/__pycache__/evaluator.cpython-312.pyc ADDED
Binary file (6.24 kB). View file
 
20260905-231105-science-environment-dbcba6/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]
20260905-231105-science-environment-dbcba6/tests/reference/ground_truth/clean_series.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ Year,Departure from Average
2
+ 1996,7.200000
20260905-231105-science-environment-dbcba6/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
+ 1990,1996,1996,1,7.200000,7.200000,7.200000,7.200000,
20260905-231105-science-environment-dbcba6/tests/reference/ground_truth/summary.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "series_name": "USGS FDSN Japan and Kuril trench 1996-1996 earthquake annual maximum magnitude (min mag 4.5)",
3
+ "row_count": 1,
4
+ "year_range": {
5
+ "start": 1996,
6
+ "end": 1996
7
+ },
8
+ "value": {
9
+ "min": 7.2,
10
+ "min_year": 1996,
11
+ "max": 7.2,
12
+ "max_year": 1996,
13
+ "mean": 7.2,
14
+ "median": 7.2,
15
+ "sample_std": null
16
+ },
17
+ "threshold": 6.0,
18
+ "years_at_or_above_threshold": 1,
19
+ "first_threshold_year": 1996,
20
+ "last_threshold_year": 1996,
21
+ "year_aggregation": "max",
22
+ "source_row_count": 442
23
+ }
20260905-231105-science-environment-dbcba6/tests/reference/ground_truth/threshold_years.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ rank,year,departure,threshold
2
+ 1,1996,7.200000,6.000000
20260905-231105-science-environment-dbcba6/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
+
20260905-231105-science-environment-dbcba6/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)
20260905-231105-science-environment-dbcba6/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_1996_1996_m4p5_mag_max",
4
+ "domain": "science_environment",
5
+ "task": "usgs_japan_kuril_annual_maximum_magnitude_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": "4c849338148dad781957be1bf608d5bff70c522bd001471565a693c1453bc4c7",
28
+ "gold_output_hashes": {
29
+ "summary.json": "4eea91812e6ab723828a66111a370378f37c814ea91700d9d434bf4956e89e71",
30
+ "decadal_statistics.csv": "16976a125cd10d222c77658866b2de5c5fe95ed8462eab1bf04adc281a465d7d",
31
+ "threshold_years.csv": "a733c619aa1ca6af38505ded52561ef8761935f1579060cd9d95777975a2bd8d",
32
+ "clean_series.csv": "f0743d35a3c79fcc829bc2de246017da4fd68816cf1659a9a8e2dfe53241687e"
33
+ }
34
+ }
20260905-231105-science-environment-dbcba6/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())
20260905-231105-science-environment-dbcba6/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
20260905-231124-science-environment-25f2d6/.DS_Store ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5fe8f58f65fcdb66c6bd0c0f4401d3d60432a4f49be223f442e8a9692813f6e
3
+ size 6148
20260905-231124-science-environment-25f2d6/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
20260905-231124-science-environment-25f2d6/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/`.
20260905-231124-science-environment-25f2d6/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_global_1992_1993_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.
20260905-231124-science-environment-25f2d6/environment/public_data/input/analysis_spec.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "input_file": "usgs_fdsn_global_1992_1993_m4p5.csv",
3
+ "workflow_kind": "csv_annual_series_audit",
4
+ "year_column": "time",
5
+ "value_column": "mag",
6
+ "series_name": "USGS FDSN global 1992-1993 earthquake annual maximum magnitude (min mag 4.5)",
7
+ "threshold": 6.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 max; then compute reproducible annual-series audit outputs. Do not fetch new data.",
75
+ "year_aggregation": "max"
76
+ }
20260905-231124-science-environment-25f2d6/environment/public_data/input/source_context_windows.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
20260905-231124-science-environment-25f2d6/environment/public_data/input/usgs_fdsn_global_1992_1993_m4p5.csv ADDED
The diff for this file is too large to render. See raw diff
 
20260905-231124-science-environment-25f2d6/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_fdsn_annual_earthquake_maximum_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_fdsn_annual_earthquake_maximum_audit",
34
+ "variant": "base",
35
+ "domain_name": "science_environment",
36
+ "task_name": "usgs_fdsn_annual_earthquake_maximum_audit",
37
+ "variant_name": "base",
38
+ "requires_task_data": True,
39
+ "task_dir": "/media/user/data/agenthle/science_environment/usgs_fdsn_annual_earthquake_maximum_audit/base",
40
+ "input_dir": "/media/user/data/agenthle/science_environment/usgs_fdsn_annual_earthquake_maximum_audit/base/input",
41
+ "software_dir": "/media/user/data/agenthle/science_environment/usgs_fdsn_annual_earthquake_maximum_audit/base/software",
42
+ "remote_output_dir": "/media/user/data/agenthle/science_environment/usgs_fdsn_annual_earthquake_maximum_audit/base/output",
43
+ "reference_dir": "/media/user/data/agenthle/science_environment/usgs_fdsn_annual_earthquake_maximum_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]
20260905-231124-science-environment-25f2d6/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())
20260905-231124-science-environment-25f2d6/environment/public_data/task_card.json ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "taskId": "science_environment/usgs_fdsn_annual_earthquake_maximum_audit__20260905-231124_science_environment_25f2d6",
3
+ "title": "USGS Fdsn Eq Global 1992 1993 M4p5 Mag Max",
4
+ "summary": "Audit the real USGS FDSN global earthquake catalog for 1992-1993 (events with magnitude >= 4.5) and produce reproducible annual annual maximum magnitude 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_global_1992_1993_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_global_1992_1993_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_global_1992_1993_m4p5.csv",
49
+ "format": "CSV",
50
+ "path": "input/usgs_fdsn_global_1992_1993_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
+ }
20260905-231124-science-environment-25f2d6/instruction.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # USGS Fdsn Eq Global 1992 1993 M4p5 Mag Max
2
+
3
+ Audit the real USGS FDSN global earthquake catalog for 1992-1993 (events with magnitude >= 4.5) and produce reproducible annual annual maximum magnitude 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_global_1992_1993_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.
20260905-231124-science-environment-25f2d6/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
+
20260905-231124-science-environment-25f2d6/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)
20260905-231124-science-environment-25f2d6/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())
20260905-231124-science-environment-25f2d6/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}"
20260905-231124-science-environment-25f2d6/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/20260905-231124-science-environment-25f2d6"
6
+ description = "Audit the real USGS FDSN global earthquake catalog for 1992-1993 (events with magnitude >= 4.5) and produce reproducible annual annual maximum magnitude 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 = "20260905-231124_science_environment_25f2d6"
14
+ task_id = "science_environment/usgs_fdsn_annual_earthquake_maximum_audit__20260905-231124_science_environment_25f2d6"
15
+ domain = "science_environment"
16
+ task = "usgs_fdsn_annual_earthquake_maximum_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