Add P0 infrastructure for the Volve-DIA benchmark
Set up the data, parsing and quality-control layer for a public benchmark on the Volve daily drilling reports (DDR) and WITSML real-time data. - Data manifest with SHA-256 hashes of the three Volve subtrees in use. - DDR XML parser into DuckDB (1,759 reports, 26 wellbores, 23,447 activities, 17 tables) with locked expected counts. - Render QC of the publisher HTML against the XML (272,544 items). - OCR client for the shared chandra vLLM service, with a page cache keyed on model, prompt hash, dpi, max_tokens and temperature, and OCR QC against the HTML on a 26-report pilot. - Run logging (scripts/runlog.sh, logs/index.csv), the P0 runner and 40 tests. - Research plan, technical overview and progress page (in Vietnamese). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
42
volve_dia/names.py
Normal file
42
volve_dia/names.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""Wellbore names. Volve spells one wellbore in up to five ways:
|
||||
|
||||
DDR XML nameWellbore NO 15/9-F-15 A
|
||||
DDR file stem 15_9_F_15_A (15_9_F_15_A_2009_05_01.xml)
|
||||
NPD code (wellboreAlias) 15/9-F-15 A
|
||||
WITSML folder Norway-StatoilHydro-15_$47$_9-F-15A
|
||||
WITSML MetaFileInfo.txt 15/9-F-15A, NO 15/9-F-1 B
|
||||
|
||||
`canonical` maps every form to the NPD code with one space before the sidetrack suffix ("15/9-F-15 A"),
|
||||
`stem` maps a canonical name back to the file-stem form.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
_FOLDER_PREFIX = re.compile(r"^[A-Za-z]+-[A-Za-z]+-(?=(?:NO\s+)?\d)") # Norway-Statoil-, NA-NA-
|
||||
_STEM = re.compile(r"(\d+)_(\d+)_(?:(F)_)?(\d+)(?:_([A-Z]+\d*))?")
|
||||
_NPD = re.compile(r"(\d+/\d+-(?:F-)?\d+)\s*([A-Z]+\d*)?")
|
||||
|
||||
|
||||
def canonical(name: str) -> str:
|
||||
s = re.sub(r"\s+", " ", name.strip()).replace("_$47$_", "/").replace("$47$", "/")
|
||||
s = _FOLDER_PREFIX.sub("", s)
|
||||
s = re.sub(r"^NO\s+", "", s)
|
||||
m = _STEM.fullmatch(s)
|
||||
if m:
|
||||
a, b, f, n, suffix = m.groups()
|
||||
s = f"{a}/{b}-{'F-' if f else ''}{n}" + (f" {suffix}" if suffix else "")
|
||||
m = _NPD.fullmatch(s)
|
||||
if not m:
|
||||
raise ValueError(f"not a Volve wellbore name: {name!r}")
|
||||
return m.group(1) + (f" {m.group(2)}" if m.group(2) else "")
|
||||
|
||||
|
||||
def stem(name: str) -> str:
|
||||
return re.sub(r"[/\- ]", "_", canonical(name))
|
||||
|
||||
|
||||
def well_of(name: str) -> str:
|
||||
"""The well (slot) a wellbore belongs to: '15/9-F-15 A' -> '15/9-F-15'."""
|
||||
return canonical(name).split(" ")[0]
|
||||
Reference in New Issue
Block a user