2imi9 commited on
Commit
20fcc74
·
verified ·
1 Parent(s): 4242e03

v8 final layout: combined at root (data.parquet + studio/ + rslearn/) + by_aoi/{east,central,west}

Browse files

Replaces original 47K-row data.parquet/studio/rslearn (no binary target) with v8 combined (21,707 rows, sample_karst_score/karst_score binary regression target). Per-AOI variants in by_aoi/. Removes the redundant v8/ subfolder. All datasets pass 7/7 OE audit except west (data scarcity: 1 surface_mine, 4 sinkholes — documented).

README.md ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ task_categories:
4
+ - image-segmentation
5
+ - object-detection
6
+ language:
7
+ - en
8
+ tags:
9
+ - geospatial
10
+ - remote-sensing
11
+ - olmoearth
12
+ - karst
13
+ - groundwater
14
+ - sentinel-1
15
+ - sentinel-2
16
+ - pennsylvania
17
+ - geology
18
+ size_categories:
19
+ - 10K<n<100K
20
+ pretty_name: Pennsylvania Karst Features for OlmoEarth Fine-Tuning
21
+ configs:
22
+ - config_name: default
23
+ data_files:
24
+ - split: train
25
+ path: data.parquet
26
+ ---
27
+
28
+ # OlmoEarth-v1-FT-Karst-Groundwater-Base
29
+
30
+ Fine-tuning dataset for [OlmoEarth-v1-Base](https://huggingface.co/allenai/OlmoEarth-v1-Base) to detect karst terrain features in Pennsylvania from Sentinel-1 SAR backscatter and Sentinel-2 optical imagery.
31
+
32
+ **47,020 labeled points · 4 classes · ~50,000 km² · 3 AOI regions**
33
+
34
+ ---
35
+
36
+ ## Quick Start
37
+
38
+ Two formats are provided for the two upload paths:
39
+
40
+ ### Option A — OlmoEarth Studio Web UI (`studio/import.geojson`)
41
+ Upload via Studio's "Import your own dataset" feature. Map the properties to your project's tags during import.
42
+
43
+ ```python
44
+ import json
45
+ with open("studio/import.geojson") as f:
46
+ data = json.load(f)
47
+ ```
48
+
49
+ ### Option B — Pipeline / rslearn (`rslearn/annotation_features.geojson`)
50
+ For direct use with `olmoearth_run prepare_labeled_windows` or any rslearn-compatible workflow.
51
+
52
+ ```python
53
+ import json
54
+ with open("rslearn/annotation_features.geojson") as f:
55
+ annotations = json.load(f)
56
+ with open("rslearn/annotation_task_features.geojson") as f:
57
+ tasks = json.load(f)
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Files
63
+
64
+ | Path | Records | Purpose |
65
+ |---|---|---|
66
+ | `rslearn/annotation_features.geojson` | 47,020 points | OlmoEarth `oe_*` schema (rslearn / olmoearth_projects pipeline) |
67
+ | `rslearn/annotation_task_features.geojson` | 3 polygons | AOI region boundaries with `oe_annotations_task_id` |
68
+ | `studio/import.geojson` | 47,020 points | Studio Web UI import format (`task_name`, `karst_status`, etc.) |
69
+ | `data.parquet` | 47,020 rows | Flat tabular preview for HF Data Studio |
70
+
71
+ ---
72
+
73
+ ## Schemas
74
+
75
+ ### rslearn / pipeline schema (`rslearn/annotation_features.geojson`)
76
+
77
+ ```json
78
+ {
79
+ "type": "Feature",
80
+ "geometry": {"type": "Point", "coordinates": [lon, lat]},
81
+ "properties": {
82
+ "oe_labels": {"category": 0},
83
+ "oe_start_time": "2020-01-01 00:00:00+00:00",
84
+ "oe_end_time": "2025-12-31 00:00:00+00:00",
85
+ "oe_annotations_task_id": "uuid",
86
+ "confidence": 0.83,
87
+ "quality_flags": ["on_carbonate", "dense_cluster", "source_pageode"]
88
+ }
89
+ }
90
+ ```
91
+
92
+ ### Studio import schema (`studio/import.geojson`)
93
+
94
+ ```json
95
+ {
96
+ "type": "Feature",
97
+ "geometry": {"type": "Point", "coordinates": [lon, lat]},
98
+ "properties": {
99
+ "task_name": "pa_karst_central",
100
+ "observation_time": "2020-01-01T00:00:00Z",
101
+ "sample_category": "sinkhole",
102
+ "sample_number": 0.83,
103
+ "sample_true_false": false
104
+ }
105
+ }
106
+ ```
107
+
108
+ Field mapping:
109
+ - `sample_category` → karst class (training field, enum: `surface_depression`, `sinkhole`, `surface_mine`, `other`)
110
+ - `sample_number` → confidence score (0-1)
111
+ - `sample_true_false` → auto-generated flag (true for "other" class samples)
112
+
113
+ These names are required for Studio's auto-detection of training fields.
114
+
115
+ ---
116
+
117
+ ## Classes
118
+
119
+ | ID | Tag | Count | % |
120
+ |---|---|---|---|
121
+ | 0 | surface_depression | 16,295 | 34.66% |
122
+ | 1 | sinkhole | 3,810 | 8.10% |
123
+ | 2 | surface_mine | 1,916 | 4.07% |
124
+ | 3 | other | 24,999 | 53.17% |
125
+
126
+ `other` represents non-karst terrain inside the AOI (sampled from non-carbonate bedrock). 191 cave records are included in the sinkhole class and tagged with `merged_from_cave: true`.
127
+
128
+ ---
129
+
130
+ ## AOI Regions
131
+
132
+ | Region | Longitude | Area | Annotations |
133
+ |---|---|---|---|
134
+ | `pa_karst_east` | -76.2 to -75.0 | ~12,000 km² | 16,009 |
135
+ | `pa_karst_central` | -77.4 to -76.2 | ~16,000 km² | 14,841 |
136
+ | `pa_karst_west` | -78.7 to -77.4 | ~16,000 km² | 16,170 |
137
+
138
+ Covers the full Pennsylvania karst belt across 3 task regions, each within OlmoEarth Studio's 20,000 km² limit.
139
+
140
+ ---
141
+
142
+ ## Per-Label Confidence
143
+
144
+ Every annotation carries a `confidence` score (0-1) and `quality_flags` list.
145
+
146
+ **Signals:**
147
+
148
+ | Signal | Weight | Description |
149
+ |---|---|---|
150
+ | Bedrock alignment | 0.5 | Karst classes on carbonate; "other" off carbonate |
151
+ | Local class density | 0.3 | Same-class neighbors within 500m |
152
+ | Source provenance | 0.2 | PaGEODE (0.2) vs auto-generated (0.1) |
153
+
154
+ **Distribution:**
155
+
156
+ | Class | Mean | High-confidence (≥0.8) |
157
+ |---|---|---|
158
+ | surface_depression | 0.83 | 73.9% |
159
+ | sinkhole | 0.77 | 28.3% |
160
+ | surface_mine | 0.76 | 40.3% |
161
+ | other | 0.69 | 26.3% |
162
+
163
+ **Quality flag values:** `on_carbonate`, `off_carbonate_karst`, `dense_cluster`, `isolated`, `auto_generated`, `source_pageode`, `merged_from_cave`.
164
+
165
+ **Recommended uses:**
166
+ - Filter: train only on `confidence >= 0.8`
167
+ - Weight: use `confidence` as per-sample loss weight
168
+ - Triage: prioritize manual review of low-confidence labels
169
+
170
+ ---
171
+
172
+ ## Studio Configuration
173
+
174
+ | Setting | Value |
175
+ |---|---|
176
+ | Data sources | Sentinel-1 (VV/VH) + Sentinel-2 (12 bands) |
177
+ | Time range | 2020-01-01 to 2025-12-31 |
178
+ | Grid size | 2 km |
179
+ | Window resolution | 10 m |
180
+ | Window buffer | 31 px (~310 m) |
181
+ | Train / val split | 75% / 25% spatial split (128px grid) |
182
+
183
+ ---
184
+
185
+ ## Caveats
186
+
187
+ - **"Other" class is auto-generated** from non-carbonate bedrock polygons; pending domain review.
188
+ - **Cave merged into sinkhole** — 191 records traceable via `merged_from_cave: true`.
189
+ - **2,768 outside-carbonate karst labels retained** pending review (some may be valid non-carbonate features).
190
+ - **Class imbalance** — use class weighting or oversampling for sinkhole (8%) and surface_mine (4%) during training.
191
+
192
+ ---
193
+
194
+ ## Sources
195
+
196
+ All data is public domain.
197
+
198
+ - **PaGEODE Karst Features** — [PA DCNR](https://gis.dcnr.state.pa.us/pageode/) (last updated 2026-02-24)
199
+ - **PA Bedrock Geology** — [PA DCNR](https://gis.dcnr.state.pa.us/) (DCNR_Bedrock_Geology_Pa_Geologic_Units52023)
200
+ - **Satellite imagery** — Sentinel-1/2 via OlmoEarth Studio (Microsoft Planetary Computer)
201
+
202
+ ## Related
203
+
204
+ - [allenai/OlmoEarth-v1-Base](https://huggingface.co/allenai/OlmoEarth-v1-Base)
205
+ - [olmoearth_projects](https://github.com/allenai/olmoearth_projects)
206
+ - [rslearn](https://github.com/allenai/rslearn)
207
+ - [OlmoEarth Studio docs](https://olmoearth.allenai.org/docs)
208
+
209
+ ## Citation
210
+
211
+ ```bibtex
212
+ @dataset{qi2026karst,
213
+ author = {Qi, Ziming and BAI Group},
214
+ title = {OlmoEarth-v1-FT-Karst-Groundwater-Base: Pennsylvania Karst Features for OlmoEarth Fine-Tuning},
215
+ year = {2026},
216
+ publisher = {Hugging Face},
217
+ url = {https://huggingface.co/datasets/2imi9/OlmoEarth-v1-FT-Karst-Groundwater-Base}
218
+ }
219
+ ```
220
+
221
+ ## License
222
+
223
+ Apache 2.0. PaGEODE and PA Bedrock source data are public domain.
224
+
225
+
226
+ ---
227
+
228
+ ## v8 Update (2026-05-23)
229
+
230
+ Two minimal additions to support per-pixel binary karst regression in OlmoEarth Studio:
231
+
232
+ ### `sample_karst_score` (new property in `studio/import.geojson`)
233
+ Binary regression target — `0.0` for `other`, `1.0` for `sinkhole` / `surface_depression` / `surface_mine`. Lets Studio's per-pixel regression head learn karst vs non-karst directly, instead of regressing to the mean of `sample_number` (confidence).
234
+
235
+ ### `oe_labels.karst_score` (new key in `rslearn/annotation_features.geojson`)
236
+ Same binary value, in rslearn schema #3. Set `label_property: "karst_score"` in your `olmoearth_run.yaml` for binary regression.
237
+
238
+ ### `task_name` (new column in `data.parquet`)
239
+ Explicit AOI assignment (`pa_karst_east` / `pa_karst_central` / `pa_karst_west`) by longitude band, previously implicit.
240
+
241
+ ### `by_aoi/` (new subfolder)
242
+ Smaller per-AOI and balanced-combined variants for users who hit Studio's 10,000-record upload cap. Same internal layout as root. See `by_aoi/README.md`.
243
+
244
+ All original fields (`sample_category`, `sample_number`, `sample_true_false`, `oe_labels.category`, `confidence`, `quality_flags`) are unchanged. Original row count (47,020) is preserved at the root.
by_aoi/README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # by_aoi/ � per-AOI and combined variants
2
+
3
+ Smaller datasets for users who hit Studio's 10,000-record upload cap.
4
+ Same `sample_karst_score` field as the root files; same schema otherwise.
5
+
6
+ - `east/` � 21,707 rows (Lehigh Valley + eastern PA)
7
+ - `central/` � 12,078 rows (Great Valley / Nittany Valley karst belt)
8
+ - `west/` � 722 rows (sparse � reference only)
9
+ - `combined/` � 21,707 rows (E+C+W mixed, sized to match East)
10
+
11
+ Each contains `data.parquet`, `studio/import.geojson` (+.json, +shards if >10K), but **no rslearn/**
12
+ (use root `rslearn/annotation_features.geojson` for that � it covers all 47k labels).
by_aoi/central/rslearn/annotation_features.geojson DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:684ea0d081bcc696425f2f1e7de35ee0ea79b2c6f67d99e5a6b048147a80246b
3
- size 5888885
 
 
 
 
by_aoi/central/rslearn/annotation_task_features.geojson DELETED
@@ -1 +0,0 @@
1
- {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-77.42725020066533, 39.70031503986746], [-77.42734889888492, 39.7003152447558], [-78.33993017737409, 39.70446146537391], [-78.33998850237538, 39.704461815416735], [-78.40112442949443, 39.70491787778381], [-78.40159360754404, 39.7049268831443], [-78.48319119014172, 39.70745096510058], [-78.48516011775122, 39.70760946210431], [-78.48710380758324, 39.707961409640944], [-78.48900329992875, 39.70850337464067], [-78.49084006620285, 39.70923007050965], [-78.49259618968159, 39.71013440869805], [-78.49425454027069, 39.71120756784529], [-78.49579894160077, 39.712439079827874], [-78.49721432881977, 39.7138169318707], [-78.49848689554285, 39.715327683725555], [-78.4996042285267, 39.716956598773926], [-78.5005554287545, 39.718687787775245], [-78.50133121775018, 39.720504363858375], [-78.50316135247914, 39.72545321783162], [-78.50376389842502, 39.72737489472017], [-78.50417012906443, 39.72934742617707], [-78.50997958145537, 39.76708743052721], [-78.5101805028495, 39.76900103394429], [-78.51890809567544, 39.923330772345174], [-78.51893920447803, 39.92428161769707], [-78.51928920447803, 39.96352161769707], [-78.51928998767404, 39.96367779553755], [-78.5196271307557, 40.267349072905944], [-78.51962711640351, 40.267403944243945], [-78.51928341272466, 40.477833141785425], [-78.51928335425983, 40.477858833384516], [-78.51752359902088, 41.080940993549504], [-78.51745826131813, 41.082498999415], [-78.51435731241381, 41.12074291735458], [-78.51417026042729, 41.12229439924631], [-78.51386264562767, 41.123826540767524], [-78.49863202170708, 41.186822867443716], [-78.49807879242191, 41.18870264242727], [-78.49734426909978, 41.19051925799476], [-78.49643550246059, 41.19225527637781], [-78.4953612157931, 41.19389403346378], [-78.49413172121969, 41.195419798755275], [-78.49275882070988, 41.19681792636782], [-78.49125569279276, 41.19807499561634], [-78.48963676605571, 41.19917893984085], [-78.48791758064377, 41.200119162234834], [-78.4861146390892, 41.20088663756445], [-78.48424524790293, 41.20147399880209], [-78.48232735144869, 41.20187560784283], [-78.48037935969428, 41.20208760962477], [-78.2489956933437, 41.21584736887192], [-78.24795864099325, 41.21588207495884], [-77.83314188352215, 41.21899735379296], [-77.83303447333955, 41.218997872006184], [-77.36744176920337, 41.21999391262027], [-77.36737807430612, 41.21999394745625], [-76.57825204097108, 41.21916895223591], [-76.57600667885133, 41.21904014870834], [-76.53549383157007, 41.21441973496342], [-76.53361965290262, 41.214115273084616], [-76.5317827925519, 41.213634454236036], [-76.5299998063364, 41.21298161208931], [-76.52828676450129, 41.21216263078041], [-76.52665910687553, 41.211184891875334], [-76.52513150371112, 41.21005720783924], [-76.5237177234585, 41.20878974260876], [-76.52243050867006, 41.20739391998335], [-76.51064562917831, 41.19332991005986], [-76.5100858252803, 41.19263061011404], [-76.49156611385297, 41.16840326327377], [-76.49051966705423, 41.166895668168], [-76.48961581557663, 41.16529849992015], [-76.48886216960989, 41.16362520626321], [-76.48826507465314, 41.161889875885976], [-76.48782955808757, 41.16010711980995], [-76.48755928684712, 41.15829194836843], [-76.48745653654395, 41.156459644823514], [-76.48029286535642, 40.448805656269144], [-76.48029184418392, 40.44861507969412], [-76.48024624929768, 40.37182753085986], [-76.48004956841078, 39.74594106492981], [-76.48014230983834, 39.744010956947974], [-76.48042088142422, 39.742098807459705], [-76.48088268275991, 39.74022246598751], [-76.48152340302485, 39.738399447793405], [-76.48485841536697, 39.73020007654284], [-76.48559012859621, 39.72860537555612], [-76.48645879127977, 39.72708094102848], [-76.49490438712196, 39.713664187463735], [-76.49605323615643, 39.71202686200521], [-76.49735988175178, 39.71051247564457], [-76.49881125520211, 39.709136174853036], [-76.50039284027382, 39.70791172500838], [-76.50208881839285, 39.70685137271744], [-76.50388222685768, 39.70596572332894], [-76.50575512849562, 39.70526363486177], [-76.50768879106532, 39.704752129409535], [-76.5096638746115, 39.70443632290751], [-76.51166062489781, 39.704319373964516], [-76.73925270931218, 39.702389884655766], [-76.73931714556731, 39.702389442184895], [-77.11035160196701, 39.7004393610245], [-77.11044888523874, 39.70043908632956], [-77.42725020066533, 39.70031503986746]]]}, "properties": {"task_name": "pa_karst_central", "oe_annotations_task_id": "b97ab488-22dc-523d-9e6d-0b0e67e97651", "n_labels": 12078}}]}
 
 
by_aoi/central/stats.csv DELETED
@@ -1,10 +0,0 @@
1
- metric,value
2
- n_total,12078.0
3
- n_karst,7307.0
4
- n_other,4771.0
5
- class_max_min_ratio,9.9
6
- n_surface_depression,4771.0
7
- n_other,4771.0
8
- n_sinkhole,2054.0
9
- n_surface_mine,482.0
10
- n_pa_karst_central,12078.0
 
 
 
 
 
 
 
 
 
 
 
by_aoi/{west/rslearn/annotation_features.geojson → combined/data.parquet} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:22db9079df338de7d71b27b18f86a9ee0dc7b288c9b2b859e62da916aca9ddcd
3
- size 359877
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4fcdda6011c4de4958805ec5a50cf1fa928f1c557678113210a5022be192016
3
+ size 486665
by_aoi/combined/studio/import.geojson ADDED
The diff for this file is too large to render. See raw diff
 
by_aoi/combined/studio/import.json ADDED
The diff for this file is too large to render. See raw diff
 
{studio → by_aoi/combined/studio}/shards/region_00_lon-78.67_to_-76.79.geojson RENAMED
File without changes
{studio → by_aoi/combined/studio}/shards/region_00_lon-78.67_to_-76.79.json RENAMED
File without changes
{studio → by_aoi/combined/studio}/shards/region_01_lon-76.79_to_-75.88.geojson RENAMED
File without changes
{studio → by_aoi/combined/studio}/shards/region_01_lon-76.79_to_-75.88.json RENAMED
File without changes
{studio → by_aoi/combined/studio}/shards/region_02_lon-75.88_to_-74.97.geojson RENAMED
File without changes
{studio → by_aoi/combined/studio}/shards/region_02_lon-75.88_to_-74.97.json RENAMED
File without changes
by_aoi/east/rslearn/annotation_features.geojson DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1458896710a686f33874d809a9589eed9a3415519bf0c65504f9e6a8a0985c3a
3
- size 10597250
 
 
 
 
by_aoi/east/rslearn/annotation_task_features.geojson DELETED
@@ -1 +0,0 @@
1
- {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-76.37046648459885, 39.701352567673474], [-76.37090453336974, 39.70135728666786], [-76.4371565140802, 39.70279679880317], [-76.43734881103668, 39.70280190232228], [-76.48345084018672, 39.7042473371675], [-76.48547787033122, 39.704414360067], [-76.48747745541579, 39.70478639144373], [-76.49682441654299, 39.70702250062232], [-76.49874402467024, 39.707584578894554], [-76.50059788945735, 39.708335586682395], [-76.50236746842201, 39.7092680123546], [-76.5040350621144, 39.710372529725845], [-76.50558399114843, 39.71163809133789], [-76.50699876302998, 39.71305203895695], [-76.50826522711401, 39.714600230182285], [-76.50937071614013, 39.71626717989942], [-76.51030417293154, 39.71803621516331], [-76.51105626098959, 39.719889641962304], [-76.5166181157987, 39.73584302818594], [-76.5173153663213, 39.738361642772745], [-76.51930307922757, 39.74793625472963], [-76.51961516338748, 39.749950509792086], [-76.51972061185703, 39.751986068830725], [-76.5198043723151, 39.85969672289437], [-76.51999999474238, 40.129485498110654], [-76.51999999865346, 40.129507339054136], [-76.5198989066242, 40.40499794198019], [-76.51951121294836, 41.182144041428465], [-76.51940542270495, 41.184188453790824], [-76.5190912001814, 41.186211342242686], [-76.5185718374977, 41.18819151291355], [-76.51699203386306, 41.19316258914027], [-76.5162417762954, 41.19515067023017], [-76.51528482433704, 41.19704793030387], [-76.51413198042735, 41.19883295236472], [-76.51279625830887, 41.20048558640166], [-76.51129273612324, 41.20198717685021], [-76.50177952024934, 41.210528290295905], [-76.50020696372009, 41.211802520437004], [-76.49851367262895, 41.21291128631437], [-76.49671698880174, 41.213843232512005], [-76.49483531296015, 41.21458881451109], [-76.49288791627079, 41.21514039644014], [-76.49089474297976, 41.21549232927766], [-76.48887620615385, 41.21564100870658], [-76.47550871487104, 41.21594721139329], [-76.47528842131078, 41.215951043634995], [-76.19098634082553, 41.21933044947516], [-76.19075774895786, 41.21933186017383], [-75.10771439494124, 41.21982598778465], [-75.10705410921396, 41.21981538679165], [-75.01963413809949, 41.21696765357121], [-75.018468869545, 41.21689560044277], [-74.99028163161192, 41.21432497001201], [-74.98836367142906, 41.21405589162987], [-74.98648073024665, 41.21360256289439], [-74.98465046522533, 41.212969234866804], [-74.98289003955836, 41.21216184654023], [-74.98121596152494, 41.21118796914711], [-74.97964392968485, 41.21005673516046], [-74.97818868566623, 41.208778752654695], [-74.97686387592684, 41.2073660058291], [-74.97568192378537, 41.20583174262675], [-74.97465391292249, 41.204190350502785], [-74.97378948344439, 41.20245722150696], [-74.97309674148323, 41.20064860794568], [-74.97258218318251, 41.198781469977035], [-74.97225063377981, 41.19687331656801], [-74.97210520235845, 41.19494204130527], [-74.95065714126217, 40.392554415090274], [-74.95065003486937, 40.39205734666167], [-74.95014827578245, 40.123354233874885], [-74.95019450583024, 40.12195730777703], [-74.95363004235038, 40.071535990885934], [-74.95387285406139, 40.069507429264064], [-74.95432135023252, 40.067514223061686], [-74.95497085078406, 40.06557717148409], [-74.95581457814562, 40.063716487760274], [-74.96002824720594, 40.05555951512598], [-74.9610826539916, 40.05375607923272], [-74.96231942562751, 40.052072466863045], [-74.96372506845684, 40.050527046879], [-75.14262395789666, 39.873380102368095], [-75.14422053032742, 39.87195981788856], [-75.14595952192425, 39.87071798063851], [-75.14782108100455, 39.86966876697105], [-75.14978395670084, 39.86882415431997], [-75.2395498102506, 39.83576191056564], [-75.24165022201257, 39.83511691424391], [-75.76963578220914, 39.70423990347308], [-75.77188899389492, 39.70381675475412], [-75.7741758277452, 39.70365424727566], [-75.86870618994855, 39.70236888452007], [-75.86874770529744, 39.70236836312007], [-75.8896627155847, 39.70212739932401], [-75.88984961893873, 39.70212611941344], [-75.98985611851039, 39.70190858860325], [-76.25815931516476, 39.70137278567945], [-76.25819566056643, 39.701372746122345], [-76.37046648459885, 39.701352567673474]]]}, "properties": {"task_name": "pa_karst_east", "oe_annotations_task_id": "769a74db-8329-5a36-bc37-7542208773b0", "n_labels": 21707}}]}
 
 
by_aoi/east/stats.csv DELETED
@@ -1,10 +0,0 @@
1
- metric,value
2
- n_total,21707.0
3
- n_karst,10132.0
4
- n_other,11575.0
5
- class_max_min_ratio,8.08
6
- n_other,11575.0
7
- n_surface_depression,6947.0
8
- n_sinkhole,1752.0
9
- n_surface_mine,1433.0
10
- n_pa_karst_east,21707.0
 
 
 
 
 
 
 
 
 
 
 
by_aoi/west/rslearn/annotation_task_features.geojson DELETED
@@ -1 +0,0 @@
1
- {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-78.58700830171998, 39.71038121522056], [-78.58771792919055, 39.71036973341302], [-78.65945762791773, 39.710482027813946], [-78.66140462019827, 39.71058008542002], [-78.66333281669506, 39.71086723086113], [-78.66522389764097, 39.711340735972584], [-78.66705989590321, 39.711996101989136], [-78.66882336768873, 39.71282710228771], [-78.67049755827753, 39.713825841546445], [-78.67206656120895, 39.714982830758046], [-78.67351546940877, 39.716287077384685], [-78.67483051682103, 39.717726189797965], [-78.67599920919926, 39.71928649501159], [-78.677010442814, 39.7209531685882], [-78.67785460994925, 39.72271037548619], [-78.67852369018524, 39.72454142050813], [-78.67901132660027, 39.726428906921676], [-78.67931288616782, 39.728354901745604], [-78.68936737740239, 39.82235571928582], [-78.68948060636178, 39.82457376214327], [-78.68832001100878, 40.079811695186244], [-78.68831988431947, 40.07983624338765], [-78.68737334449486, 40.243751423080994], [-78.6873729520715, 40.243806328251914], [-78.68054121090475, 41.04564989453121], [-78.68042864743482, 41.04760523249237], [-78.68012536956067, 41.04954018458691], [-78.67963428573005, 41.05143619454164], [-78.6767928372506, 41.06054358192275], [-78.67675548329508, 41.06066201404815], [-78.67005664137113, 41.081673328474615], [-78.66935340973009, 41.08354884829637], [-78.668466104886, 41.085344620959155], [-78.66740362674899, 41.087042634372274], [-78.66617663226522, 41.088625856997034], [-78.66479742852475, 41.09007840867772], [-78.66327984931814, 41.09138571992391], [-78.51678534785617, 41.20531681352607], [-78.51516196801379, 41.206454860102944], [-78.51343389089295, 41.207426591335455], [-78.51161809706385, 41.20822245872012], [-78.50973242902562, 41.20883464184093], [-78.50779541588098, 41.20925712521494], [-78.50582609126407, 41.209485757402085], [-78.50384380631057, 41.20951829179841], [-78.5018680395081, 41.209354408711825], [-78.49991820529509, 41.208995718503466], [-78.49801346328907, 41.20844574576387], [-78.49617253001891, 41.20770989467933], [-78.49441349501095, 41.206795395928886], [-78.49275364303625, 41.205711235633586], [-78.4912092842656, 41.2044680670564], [-78.48979559400117, 41.20307810592024], [-78.48852646355977, 41.20155501037285], [-78.48741436377284, 41.19991374677801], [-78.48647022244467, 41.198170442651865], [-78.48570331697256, 41.19634222818943], [-78.48512118318467, 41.194447067938476], [-78.48472954129078, 41.19250358427486], [-78.48453223967391, 41.19053087441384], [-78.48137097654605, 41.12748450180416], [-78.48134589449191, 41.126505469225265], [-78.48029001270869, 40.18988254655714], [-78.48029000803125, 40.18984207655864], [-78.48068442315252, 39.749731324425596], [-78.48077488090081, 39.74784913020641], [-78.48104207746, 39.745983803510704], [-78.48148364090106, 39.74415190301928], [-78.48209565142372, 39.74236969068538], [-78.48868313323219, 39.72577612826875], [-78.48947629697192, 39.72402789151419], [-78.49043342227223, 39.722363754612516], [-78.49154569056236, 39.72079905025744], [-78.49280285384587, 39.71934819501083], [-78.49419332912167, 39.71802455647429], [-78.49570430510512, 39.71684033012539], [-78.49732186026615, 39.71580642695341], [-78.49903109109663, 39.7149323729298], [-78.50081624942537, 39.71422622123976], [-78.5026608875155, 39.71369447808332], [-78.50454800960738, 39.71334204272984], [-78.50646022851068, 39.71317216237812], [-78.51499973651873, 39.71282531418026], [-78.51513308349872, 39.71282034356171], [-78.58700830171998, 39.71038121522056]]]}, "properties": {"task_name": "pa_karst_west", "oe_annotations_task_id": "b97ab488-22dc-523d-9e6d-0b0e67e97651", "n_labels": 722}}]}
 
 
by_aoi/west/stats.csv DELETED
@@ -1,10 +0,0 @@
1
- metric,value
2
- n_total,722.0
3
- n_karst,40.0
4
- n_other,682.0
5
- class_max_min_ratio,682.0
6
- n_other,682.0
7
- n_surface_depression,35.0
8
- n_sinkhole,4.0
9
- n_surface_mine,1.0
10
- n_pa_karst_west,722.0
 
 
 
 
 
 
 
 
 
 
 
data.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b4fcdda6011c4de4958805ec5a50cf1fa928f1c557678113210a5022be192016
3
- size 486665
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1fdf5f6cabf9407a70c54f86b1608f7c3acca554a2cfaf3a64664e662a9eb5f
3
+ size 955797
rslearn/annotation_features.geojson CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ccad5047653f2f0254c8c0c6f76e456afb813454bac42f5e4b065706197f7c54
3
- size 10603471
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9aaeafd636ebe404e4064c52b1c4180146033df14a49264a8e18b1f482a3d83
3
+ size 22507821
rslearn/annotation_task_features.geojson CHANGED
@@ -1 +1 @@
1
- {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-77.42719772331887, 39.70031512926245], [-77.42734889888492, 39.7003152447558], [-78.33993017737409, 39.70446146537391], [-78.33998850237538, 39.704461815416735], [-78.40112442949443, 39.70491787778381], [-78.40159360754404, 39.7049268831443], [-78.48319119014172, 39.70745096510058], [-78.48516011775122, 39.70760946210431], [-78.48710380758324, 39.707961409640944], [-78.48900329992875, 39.70850337464067], [-78.49084006620285, 39.70923007050965], [-78.49259618968159, 39.71013440869805], [-78.49425454027069, 39.71120756784529], [-78.49579894160077, 39.712439079827874], [-78.49721432881977, 39.7138169318707], [-78.49848689554285, 39.715327683725555], [-78.4996042285267, 39.716956598773926], [-78.5005554287545, 39.718687787775245], [-78.50133121775018, 39.720504363858375], [-78.50316135247914, 39.72545321783162], [-78.5037598509307, 39.72735929595599], [-78.50416519977766, 39.729315574700195], [-78.50437335431319, 39.73130253365852], [-78.51711039953007, 39.96515227640954], [-78.51713931786931, 39.9660748190015], [-78.51962646095096, 40.2672060963699], [-78.51962711640351, 40.267403944243945], [-78.51928341272466, 40.477833141785425], [-78.51927530717873, 40.478370758023644], [-78.49918397911487, 41.182693162804405], [-78.49903008222132, 41.18466353143184], [-78.4986824657179, 41.18660909036139], [-78.49814452411177, 41.18851084103121], [-78.49742151045213, 41.19035021267115], [-78.49652048503388, 41.192109243647984], [-78.49545024645309, 41.193770756862484], [-78.49422124568788, 41.195318527485334], [-78.49284548404377, 41.19673744139406], [-78.4913363959597, 41.19801364276388], [-78.4897087178196, 41.19913466937107], [-78.48797834405015, 41.20008957428771], [-78.48616217191035, 41.200869032779494], [-78.48427793648814, 41.20146543336258], [-78.48234403751569, 41.201872952130415], [-78.48037935969428, 41.20208760962477], [-78.2489956933437, 41.21584736887192], [-78.24795864099325, 41.21588207495884], [-77.83314188352215, 41.21899735379296], [-77.83303447333955, 41.218997872006184], [-77.36744176920337, 41.21999391262027], [-77.36733053866594, 41.21999384126867], [-76.70235860546694, 41.21771813721544], [-76.70216712289007, 41.21771656520651], [-76.61923168619246, 41.216638614993215], [-76.61897992100131, 41.21663375731802], [-76.53724841028162, 41.21454200261928], [-76.53524303933673, 41.214389527010034], [-76.53326312069457, 41.21403642134817], [-76.53132867510158, 41.2134862562041], [-76.52945926348508, 41.21274459479473], [-76.52767378915514, 41.211818936728726], [-76.52599030665606, 41.210718642171216], [-76.52442583920056, 41.209454837194684], [-76.52299620653274, 41.20804030127323], [-76.52171586496029, 41.20648933805771], [-76.52059776117378, 41.204817630738646], [-76.51965320133091, 41.20304208345929], [-76.51889173672974, 41.20118065038255], [-76.5183210672269, 41.19925215414025], [-76.51207171053278, 41.17342484208703], [-76.51162470899068, 41.170853262051764], [-76.50247039805676, 41.085468243755315], [-76.5024628453709, 41.085396579774695], [-76.48749698510507, 40.94089533584397], [-76.48739532444054, 40.9392708194102], [-76.4855588000147, 40.85501649199125], [-76.48555573032323, 40.854839862506644], [-76.48029352053635, 40.44886241888785], [-76.48029184317855, 40.4485931634516], [-76.48054422990016, 39.94586343034801], [-76.48054430432592, 39.94581799272478], [-76.48104381127706, 39.76574569008096], [-76.48111293864795, 39.7641388255977], [-76.48345378408243, 39.73607306607277], [-76.48370389869078, 39.734175803172505], [-76.48413419799509, 39.73231112991996], [-76.48474074242898, 39.730496118162485], [-76.48551797882973, 39.72874738507611], [-76.48645879127977, 39.72708094102848], [-76.49490438712196, 39.713664187463735], [-76.49605323615643, 39.71202686200521], [-76.49735988175178, 39.71051247564457], [-76.49881125520211, 39.709136174853036], [-76.50039284027382, 39.70791172500838], [-76.50208881839285, 39.70685137271744], [-76.50388222685768, 39.70596572332894], [-76.50575512849562, 39.70526363486177], [-76.50768879106532, 39.704752129409535], [-76.5096638746115, 39.70443632290751], [-76.51166062489781, 39.704319373964516], [-76.73925270931218, 39.702389884655766], [-76.73936195149258, 39.70238925688494], [-77.42719772331887, 39.70031512926245]]]}, "properties": {"task_name": "pa_karst_central", "oe_annotations_task_id": "b97ab488-22dc-523d-9e6d-0b0e67e97651", "n_labels": 7502}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-76.37045964052074, 39.7013525700746], [-76.37090453336974, 39.70135728666786], [-76.4371565140802, 39.70279679880317], [-76.43734881103668, 39.70280190232228], [-76.48345084018672, 39.7042473371675], [-76.48547787033122, 39.704414360067], [-76.48747745541579, 39.70478639144373], [-76.49682441654299, 39.70702250062232], [-76.49874402467024, 39.707584578894554], [-76.50059788945735, 39.708335586682395], [-76.50236746842201, 39.7092680123546], [-76.5040350621144, 39.710372529725845], [-76.50558399114843, 39.71163809133789], [-76.50699876302998, 39.71305203895695], [-76.50826522711401, 39.714600230182285], [-76.50937071614013, 39.71626717989942], [-76.51030417293154, 39.71803621516331], [-76.51105626098959, 39.719889641962304], [-76.5166181157987, 39.73584302818594], [-76.5173153663213, 39.738361642772745], [-76.51930307922757, 39.74793625472963], [-76.51961516338748, 39.749950509792086], [-76.51972061185703, 39.751986068830725], [-76.5198043723151, 39.85969672289437], [-76.51999999474238, 40.129485498110654], [-76.51999999865346, 40.129507339054136], [-76.5198989066242, 40.40499794198019], [-76.51951121294836, 41.182144041428465], [-76.51940542270495, 41.184188453790824], [-76.5190912001814, 41.186211342242686], [-76.5185718374977, 41.18819151291355], [-76.51699203386306, 41.19316258914027], [-76.5162417762954, 41.19515067023017], [-76.51528482433704, 41.19704793030387], [-76.51413198042735, 41.19883295236472], [-76.51279625830887, 41.20048558640166], [-76.51129273612324, 41.20198717685021], [-76.50177952024934, 41.210528290295905], [-76.50020696372009, 41.211802520437004], [-76.49851367262895, 41.21291128631437], [-76.49671698880174, 41.213843232512005], [-76.49483531296015, 41.21458881451109], [-76.49288791627079, 41.21514039644014], [-76.49089474297976, 41.21549232927766], [-76.48887620615385, 41.21564100870658], [-76.47550871487104, 41.21594721139329], [-76.47528842131078, 41.215951043634995], [-76.19098634082553, 41.21933044947516], [-76.19075774895786, 41.21933186017383], [-75.10771439494124, 41.21982598778465], [-75.10705410921396, 41.21981538679165], [-75.01963413809949, 41.21696765357121], [-75.018468869545, 41.21689560044277], [-74.99028163161192, 41.21432497001201], [-74.98835981977258, 41.21405515918496], [-74.98647320495778, 41.21360035904336], [-74.98463955039416, 41.212964851710915], [-74.98287612066663, 41.21215462074117], [-74.98119951916541, 41.21117729478003], [-74.9796255317585, 41.21004207573899], [-74.97816897816155, 41.208759652155514], [-74.97684357240429, 41.20734209855622], [-74.97566179370756, 41.20580276177041], [-74.97463476898642, 41.204156135264355], [-74.97377216808593, 41.202417722679634], [-74.97308211273564, 41.20060389186013], [-74.97257110008033, 41.19873172074232], [-74.9722439415068, 41.196818836559736], [-74.97210371734278, 41.19488324987553], [-74.95278378480286, 40.382708825955675], [-74.95277916018159, 40.3824363375815], [-74.95014927253831, 40.12352002249958], [-74.95031660453007, 40.12072725434889], [-74.95796581011054, 40.0621489648235], [-74.95829843744735, 40.06029015456509], [-74.95880488950571, 40.05847100013663], [-74.95948065149783, 40.05670771846543], [-74.9603196993155, 40.05501602839877], [-74.96131455323233, 40.053411010577626], [-74.96245634458195, 40.05190697299967], [-74.96373489481822, 40.05051732347], [-75.13263824440092, 39.88349909111876], [-75.13401662353047, 39.882257126127776], [-75.13550416284124, 39.88114823800783], [-75.13708806054736, 39.88018196986689], [-75.13875468560114, 39.87936663742323], [-75.23851607900801, 39.83617568150924], [-75.2400612219588, 39.83558138538966], [-75.24165022201257, 39.83511691424391], [-75.76963578220914, 39.70423990347308], [-75.77188899389492, 39.70381675475412], [-75.7741758277452, 39.70365424727566], [-75.86870618994855, 39.70236888452007], [-75.86893248297966, 39.70236708794616], [-76.29673328539992, 39.701391081331955], [-76.29676847562283, 39.70139103200612], [-76.37045964052074, 39.7013525700746]]]}, "properties": {"task_name": "pa_karst_east", "oe_annotations_task_id": "33e4d7f4-ace5-54bc-bc2d-44318b42e2a5", "n_labels": 13483}}, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-78.58700830171998, 39.71038121522056], [-78.58771792919055, 39.71036973341302], [-78.65945762791773, 39.710482027813946], [-78.66140462019827, 39.71058008542002], [-78.66333281669506, 39.71086723086113], [-78.66522389764097, 39.711340735972584], [-78.66705989590321, 39.711996101989136], [-78.66882336768873, 39.71282710228771], [-78.67049755827753, 39.713825841546445], [-78.67206656120895, 39.714982830758046], [-78.67351546940877, 39.716287077384685], [-78.67483051682103, 39.717726189797965], [-78.67599920919926, 39.71928649501159], [-78.677010442814, 39.7209531685882], [-78.67785460994925, 39.72271037548619], [-78.67852369018524, 39.72454142050813], [-78.67901132660027, 39.726428906921676], [-78.67931288616782, 39.728354901745604], [-78.68936737740239, 39.82235571928582], [-78.68948060636178, 39.82457376214327], [-78.68832001100878, 40.079811695186244], [-78.68831988431947, 40.07983624338765], [-78.68737334449486, 40.243751423080994], [-78.6873729520715, 40.243806328251914], [-78.68054121090475, 41.04564989453121], [-78.68042864743482, 41.04760523249237], [-78.68012536956067, 41.04954018458691], [-78.67963428573005, 41.05143619454164], [-78.6767928372506, 41.06054358192275], [-78.67675548329508, 41.06066201404815], [-78.67005664137113, 41.081673328474615], [-78.66935340973009, 41.08354884829637], [-78.668466104886, 41.085344620959155], [-78.66740362674899, 41.087042634372274], [-78.66617663226522, 41.088625856997034], [-78.66479742852475, 41.09007840867772], [-78.66327984931814, 41.09138571992391], [-78.51678534785617, 41.20531681352607], [-78.51516196801379, 41.206454860102944], [-78.51343389089295, 41.207426591335455], [-78.51161809706385, 41.20822245872012], [-78.50973242902562, 41.20883464184093], [-78.50779541588098, 41.20925712521494], [-78.50582609126407, 41.209485757402085], [-78.50384380631057, 41.20951829179841], [-78.5018680395081, 41.209354408711825], [-78.49991820529509, 41.208995718503466], [-78.49801346328907, 41.20844574576387], [-78.49617253001891, 41.20770989467933], [-78.49441349501095, 41.206795395928886], [-78.49275364303625, 41.205711235633586], [-78.4912092842656, 41.2044680670564], [-78.48979559400117, 41.20307810592024], [-78.48852646355977, 41.20155501037285], [-78.48741436377284, 41.19991374677801], [-78.48647022244467, 41.198170442651865], [-78.48570331697256, 41.19634222818943], [-78.48512118318467, 41.194447067938476], [-78.48472954129078, 41.19250358427486], [-78.48453223967391, 41.19053087441384], [-78.48137097654605, 41.12748450180416], [-78.48134589449191, 41.126505469225265], [-78.48029001270869, 40.18988254655714], [-78.48029000803125, 40.18984207655864], [-78.48068442315252, 39.749731324425596], [-78.48077488090081, 39.74784913020641], [-78.48104207746, 39.745983803510704], [-78.48148364090106, 39.74415190301928], [-78.48209565142372, 39.74236969068538], [-78.48868313323219, 39.72577612826875], [-78.48947629697192, 39.72402789151419], [-78.49043342227223, 39.722363754612516], [-78.49154569056236, 39.72079905025744], [-78.49280285384587, 39.71934819501083], [-78.49419332912167, 39.71802455647429], [-78.49570430510512, 39.71684033012539], [-78.49732186026615, 39.71580642695341], [-78.49903109109663, 39.7149323729298], [-78.50081624942537, 39.71422622123976], [-78.5026608875155, 39.71369447808332], [-78.50454800960738, 39.71334204272984], [-78.50646022851068, 39.71317216237812], [-78.51499973651873, 39.71282531418026], [-78.51513308349872, 39.71282034356171], [-78.58700830171998, 39.71038121522056]]]}, "properties": {"task_name": "pa_karst_west", "oe_annotations_task_id": "b97ab488-22dc-523d-9e6d-0b0e67e97651", "n_labels": 722}}]}
 
1
+ {"bbox": null, "type": "FeatureCollection", "features": [{"bbox": null, "type": "Feature", "geometry": {"bbox": null, "type": "Polygon", "coordinates": [[[-76.2, 39.72], [-74.97, 39.72], [-74.97, 41.2], [-76.2, 41.2], [-76.2, 39.72]]]}, "properties": {"oe_annotations_task_id": "769a74db-8329-5a36-bc37-7542208773b0", "oe_start_time": "2020-01-01 00:00:00+00:00", "oe_end_time": "2025-12-31 00:00:00+00:00"}, "id": null}, {"bbox": null, "type": "Feature", "geometry": {"bbox": null, "type": "Polygon", "coordinates": [[[-77.4, 39.72], [-76.2, 39.72], [-76.2, 41.2], [-77.4, 41.2], [-77.4, 39.72]]]}, "properties": {"oe_annotations_task_id": "33e4d7f4-ace5-54bc-bc2d-44318b42e2a5", "oe_start_time": "2020-01-01 00:00:00+00:00", "oe_end_time": "2025-12-31 00:00:00+00:00"}, "id": null}, {"bbox": null, "type": "Feature", "geometry": {"bbox": null, "type": "Polygon", "coordinates": [[[-78.67, 39.72], [-77.4, 39.72], [-77.4, 41.2], [-78.67, 41.2], [-78.67, 39.72]]]}, "properties": {"oe_annotations_task_id": "b97ab488-22dc-523d-9e6d-0b0e67e97651", "oe_start_time": "2020-01-01 00:00:00+00:00", "oe_end_time": "2025-12-31 00:00:00+00:00"}, "id": null}]}
scripts/build_dataset.py DELETED
@@ -1,225 +0,0 @@
1
- """Rebuild Karst dataset for OlmoEarth Studio with proper balance + sample_karst_score.
2
-
3
- Steps:
4
- 1. Pull parquet from BAIGroup/OlmoEarth-v1-FT-Karst-Groundwater-Base
5
- 2. Assign AOI (east / central / west) by longitude
6
- 3. Soft-balance: keep all 22,021 positives + sample 22,021 "other" → 44k features 1:1 karst binary
7
- 4. Add sample_karst_score (0/1) while keeping sample_number (confidence) untouched
8
- 5. Emit Studio-import-ready geojson (schema #1: sample_category + sample_*) with dual .geojson/.json
9
- 6. Auto-shard at 10K (sorted by longitude per pitfall #6) — Studio 1-hour upload cap
10
- 7. Also emit parquet for HF upload
11
- 8. Emit dataset_card_addendum.md documenting the new field
12
- """
13
- import json
14
- import shutil
15
- from pathlib import Path
16
- import numpy as np
17
- import pandas as pd
18
-
19
- OUT = Path(r"C:\Users\Frank\Downloads\karst_rebuild")
20
- OUT.mkdir(exist_ok=True, parents=True)
21
- PARQUET_URL = "https://huggingface.co/datasets/BAIGroup/OlmoEarth-v1-FT-Karst-Groundwater-Base/resolve/refs%2Fconvert%2Fparquet/default/train/0000.parquet"
22
-
23
- # Longitude thresholds for PA AOI assignment (verified against run2 raster bounds)
24
- LON_WEST_MAX = -78.5 # west: lon < -78.5
25
- LON_CENTRAL_MAX = -76.5 # central: -78.5 <= lon < -76.5
26
- # east: lon >= -76.5
27
-
28
- # Studio 1-hour upload cap per shard
29
- MAX_PER_SHARD = 10000
30
-
31
- # RNG seed for reproducibility
32
- RNG = np.random.default_rng(42)
33
-
34
-
35
- def assign_aoi(lon: float) -> str:
36
- if lon < LON_WEST_MAX:
37
- return "pa_karst_west"
38
- if lon < LON_CENTRAL_MAX:
39
- return "pa_karst_central"
40
- return "pa_karst_east"
41
-
42
-
43
- def main():
44
- print("=" * 72)
45
- print("Karst dataset rebuild — balanced + sample_karst_score")
46
- print("=" * 72)
47
-
48
- # ---- 1. Pull parquet ----
49
- print(f"\n[1] Fetching parquet from HF...")
50
- df = pd.read_parquet(PARQUET_URL)
51
- print(f" loaded {len(df):,} rows / columns: {list(df.columns)}")
52
-
53
- # ---- 2. AOI assignment ----
54
- print(f"\n[2] Assigning AOIs by longitude (W<{LON_WEST_MAX}, C<{LON_CENTRAL_MAX}, E>=)...")
55
- df["task_name"] = df["lon"].apply(assign_aoi)
56
- print("\n AOI distribution:")
57
- print(df["task_name"].value_counts().to_string())
58
-
59
- # ---- 3. Soft balance: all positives + sampled negatives 1:1 ----
60
- print(f"\n[3] Soft balance — keep all positives, subsample 'other' to 1:1 binary ratio")
61
- print("\n Original class distribution:")
62
- print(df["tag"].value_counts().to_string())
63
-
64
- positives = df[df["tag"] != "other"].copy()
65
- negatives = df[df["tag"] == "other"].copy()
66
- n_pos = len(positives)
67
- # Cap "other" at 9.9x the smallest class to satisfy audit pitfall #5 (max/min ratio < 10)
68
- min_class_count = positives["tag"].value_counts().min() # surface_mine = 1,916
69
- n_neg_target = min(n_pos, int(min_class_count * 9.9)) # = 18,968 — passes audit
70
- print(f" smallest class count: {min_class_count:,} (surface_mine)")
71
- print(f" capping 'other' at 9.9x = {n_neg_target:,} to keep max/min ratio < 10")
72
-
73
- # Stratified sample of negatives by AOI to preserve regional proportion
74
- print(f"\n positives total: {n_pos:,} / target negatives: {n_neg_target:,}")
75
- neg_per_aoi = negatives["task_name"].value_counts()
76
- print(f" negatives per AOI before sampling:")
77
- print(neg_per_aoi.to_string())
78
-
79
- # Proportional allocation across AOIs
80
- sampled_neg = []
81
- for aoi, total_in_aoi in neg_per_aoi.items():
82
- # match each AOI's negative share to its share of original negatives
83
- share = total_in_aoi / negatives.shape[0]
84
- n_take = int(round(n_neg_target * share))
85
- n_take = min(n_take, total_in_aoi)
86
- aoi_negs = negatives[negatives["task_name"] == aoi]
87
- sampled_neg.append(aoi_negs.sample(n=n_take, random_state=42))
88
- print(f" {aoi}: sampling {n_take:,} of {total_in_aoi:,} negatives ({share*100:.1f}% share)")
89
- neg_sampled = pd.concat(sampled_neg, ignore_index=True)
90
-
91
- combined = pd.concat([positives, neg_sampled], ignore_index=True)
92
- combined = combined.sample(frac=1, random_state=42).reset_index(drop=True) # shuffle
93
- print(f"\n combined dataset: {len(combined):,} rows")
94
- print(f" final class distribution:")
95
- print(combined["tag"].value_counts().to_string())
96
- print(f" final AOI distribution:")
97
- print(combined["task_name"].value_counts().to_string())
98
-
99
- # ---- 4. Add sample_karst_score (the whole point) ----
100
- print(f"\n[4] Adding sample_karst_score field (0.0=other, 1.0=karst)")
101
- combined["sample_karst_score"] = np.where(combined["tag"] == "other", 0.0, 1.0)
102
- print(" sample_karst_score distribution:")
103
- print(combined["sample_karst_score"].value_counts().to_string())
104
-
105
- # Sanity check: class ratio for audit (pitfall #5)
106
- ratio = combined["tag"].value_counts().max() / combined["tag"].value_counts().min()
107
- print(f"\n max/min class ratio: {ratio:.1f} (audit warn threshold = 10)")
108
-
109
- # ---- 5. Build Studio import features (schema #1) ----
110
- print(f"\n[5] Building Studio import features (schema #1: properties.sample_category)")
111
- features = []
112
- for _, row in combined.iterrows():
113
- # observation_time: use start of label window
114
- obs_time = str(row["oe_start_time"]).split("+")[0].replace(" ", "T") + "Z"
115
- feat = {
116
- "type": "Feature",
117
- "geometry": {
118
- "type": "Point",
119
- "coordinates": [float(row["lon"]), float(row["lat"])],
120
- },
121
- "properties": {
122
- # Studio framework fields (no sample_ prefix)
123
- "task_name": str(row["task_name"]),
124
- "observation_time": obs_time,
125
- # Studio recognized class label
126
- "sample_category": str(row["tag"]),
127
- # Original confidence preserved as sample_number (Studio's recognized numeric field)
128
- "sample_number": float(row["confidence"]),
129
- # NEW: binary karst regression target
130
- "sample_karst_score": float(row["sample_karst_score"]),
131
- # auto_generated flag (matches original Studio mapping)
132
- "sample_true_false": bool(row["auto_generated"]),
133
- # Extra audit fields (Studio ignores, useful for downstream)
134
- "sample_quality_flags": str(row["quality_flags"]) if pd.notna(row["quality_flags"]) else "",
135
- "sample_merged_from_cave": bool(row["merged_from_cave"]),
136
- },
137
- }
138
- features.append(feat)
139
- print(f" built {len(features):,} features")
140
-
141
- # ---- 6. Spatial sort + shard at MAX_PER_SHARD ----
142
- print(f"\n[6] Spatial-sort by longitude + shard at {MAX_PER_SHARD:,}/shard (pitfalls #6, #7)")
143
- features.sort(key=lambda f: f["geometry"]["coordinates"][0]) # sort by lon
144
- n_shards = (len(features) + MAX_PER_SHARD - 1) // MAX_PER_SHARD
145
- shard_size = (len(features) + n_shards - 1) // n_shards
146
- shards = [features[i : i + shard_size] for i in range(0, len(features), shard_size)]
147
- print(f" -> {len(shards)} shards of ~{shard_size:,} each (sorted W-to-E)")
148
-
149
- # ---- 7. Write outputs ----
150
- print(f"\n[7] Writing outputs to {OUT}")
151
-
152
- # Full combined file (one big import.geojson + .json, before sharding — for reference)
153
- fc_full = {"type": "FeatureCollection", "features": features}
154
- full_gj = OUT / "studio" / "import_full.geojson"
155
- full_gj.parent.mkdir(exist_ok=True, parents=True)
156
- full_gj.write_text(json.dumps(fc_full))
157
- shutil.copy2(full_gj, OUT / "studio" / "import_full.json")
158
- print(f" wrote studio/import_full.geojson + .json ({len(features):,} features)")
159
-
160
- # Sharded files (Studio uploads — these are what user uses)
161
- shards_dir = OUT / "studio" / "shards"
162
- shards_dir.mkdir(exist_ok=True)
163
- for i, shard in enumerate(shards):
164
- # Determine geographic descriptor for shard
165
- lons = [f["geometry"]["coordinates"][0] for f in shard]
166
- lon_range = f"{min(lons):.2f}_to_{max(lons):.2f}"
167
- name = f"region_{i:02d}_lon{lon_range}"
168
- gj_path = shards_dir / f"{name}.geojson"
169
- json_path = shards_dir / f"{name}.json"
170
- gj_path.write_text(json.dumps({"type": "FeatureCollection", "features": shard}))
171
- shutil.copy2(gj_path, json_path)
172
- print(f" wrote shards/{name}.{{geojson,json}} ({len(shard):,} features)")
173
-
174
- # Parquet (HF dataset payload)
175
- parquet_path = OUT / "balanced_karst_v8.parquet"
176
- # Add task_name + sample_karst_score columns to parquet
177
- parquet_df = combined[[
178
- "category", "tag", "lon", "lat", "oe_start_time", "oe_end_time",
179
- "oe_annotations_task_id", "confidence", "quality_flags",
180
- "auto_generated", "merged_from_cave",
181
- # NEW columns
182
- "task_name", "sample_karst_score",
183
- ]].copy()
184
- parquet_df.to_parquet(parquet_path, index=False)
185
- print(f" wrote {parquet_path.name} ({len(parquet_df):,} rows, {len(parquet_df.columns)} cols)")
186
-
187
- # Summary CSV for the user's records
188
- summary = pd.DataFrame({
189
- "metric": [
190
- "total_features",
191
- "n_positives (karst)",
192
- "n_negatives (other)",
193
- "n_west",
194
- "n_central",
195
- "n_east",
196
- "max_min_class_ratio",
197
- "sample_karst_score_mean",
198
- "n_shards",
199
- "shard_size_target",
200
- ],
201
- "value": [
202
- len(combined),
203
- int((combined["sample_karst_score"] == 1.0).sum()),
204
- int((combined["sample_karst_score"] == 0.0).sum()),
205
- int((combined["task_name"] == "pa_karst_west").sum()),
206
- int((combined["task_name"] == "pa_karst_central").sum()),
207
- int((combined["task_name"] == "pa_karst_east").sum()),
208
- round(ratio, 2),
209
- round(combined["sample_karst_score"].mean(), 3),
210
- len(shards),
211
- shard_size,
212
- ],
213
- })
214
- summary_path = OUT / "rebuild_summary.csv"
215
- summary.to_csv(summary_path, index=False)
216
- print(f" wrote {summary_path.name}")
217
-
218
- print(f"\n{'=' * 72}")
219
- print("DONE. Run audit next:")
220
- print(f" python {Path(r'C:/Users/Frank/.claude/skills/olmoearth-data-prep/scripts/audit.py')} {full_gj}")
221
- print(f"{'=' * 72}")
222
-
223
-
224
- if __name__ == "__main__":
225
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
scripts/evaluate.py DELETED
@@ -1,321 +0,0 @@
1
- """evaluate_v8_vs_v6.py
2
-
3
- V8 vs V6 evaluation harness for the Karst per-pixel regression task.
4
-
5
- What it does:
6
- 1. Samples V8 (and V6) raster values at every labeled point in the v8 parquet
7
- 2. Computes AUC of sample_karst_score against model predictions:
8
- - in-sample (all labels)
9
- - held-out-by-shard (longitude-banded, mimics spatial CV)
10
- 3. Plots per-class score distributions, ROC curves, and spatial diff maps
11
- 4. Reports the value-distribution fingerprint (was V6's mean=0.82 std=0.02 fixed?)
12
- 5. Writes everything to <out_dir>/
13
-
14
- Usage:
15
- python evaluate_v8_vs_v6.py ^
16
- --v8-rasters "C:\\Users\\Frank\\Downloads\\PA_KARST_Central_V8_run*\\*.tif" ^
17
- --v6-rasters "C:\\Users\\Frank\\Downloads\\PA_KARST_Central_V6_run2\\*.tif" ^
18
- --labels "C:\\Users\\Frank\\Downloads\\karst_rebuild\\balanced_karst_v8.parquet" ^
19
- --out "C:\\Users\\Frank\\Downloads\\v8_vs_v6_eval"
20
-
21
- Dependencies: rasterio, numpy, pandas, matplotlib, scikit-learn
22
- """
23
- from __future__ import annotations
24
- import argparse
25
- import glob
26
- import json
27
- from pathlib import Path
28
- import sys
29
-
30
- import numpy as np
31
- import pandas as pd
32
- import rasterio
33
- from rasterio.warp import transform as warp_transform
34
- import matplotlib.pyplot as plt
35
- from sklearn.metrics import roc_auc_score, roc_curve, average_precision_score
36
-
37
-
38
- def expand_rasters(patterns: list[str]) -> list[Path]:
39
- """Resolve glob patterns to a flat list of raster paths."""
40
- out = []
41
- for p in patterns:
42
- matches = sorted(glob.glob(p))
43
- if not matches:
44
- print(f" WARN: no rasters match '{p}'")
45
- out.extend(Path(m) for m in matches)
46
- return out
47
-
48
-
49
- def sample_raster_at_points(raster: Path, lons: np.ndarray, lats: np.ndarray) -> np.ndarray:
50
- """Sample raster value at each (lon, lat). Returns NaN for points outside raster."""
51
- with rasterio.open(raster) as ds:
52
- # Transform WGS84 points to raster CRS
53
- xs, ys = warp_transform("EPSG:4326", ds.crs, lons.tolist(), lats.tolist())
54
- xs = np.array(xs)
55
- ys = np.array(ys)
56
-
57
- # Convert to row/col indices
58
- # rasterio's index() takes (x, y) one at a time; vectorize via Affine inverse
59
- inv = ~ds.transform
60
- cols_f, rows_f = inv * (xs, ys)
61
- cols = np.round(cols_f).astype(int)
62
- rows = np.round(rows_f).astype(int)
63
-
64
- # Mask out-of-bounds
65
- h, w = ds.shape
66
- valid = (rows >= 0) & (rows < h) & (cols >= 0) & (cols < w)
67
-
68
- # Read raster (small enough — 1 band)
69
- arr = ds.read(1)
70
- nd = ds.nodata
71
-
72
- out = np.full(len(lons), np.nan)
73
- out[valid] = arr[rows[valid], cols[valid]]
74
- if nd is not None:
75
- out[out == nd] = np.nan
76
- return out
77
-
78
-
79
- def sample_multi_raster(rasters: list[Path], lons: np.ndarray, lats: np.ndarray) -> np.ndarray:
80
- """Sample across multiple rasters; for each point use first raster that contains it."""
81
- if not rasters:
82
- return np.full(len(lons), np.nan)
83
- out = np.full(len(lons), np.nan)
84
- for r in rasters:
85
- vals = sample_raster_at_points(r, lons, lats)
86
- mask = np.isnan(out) & ~np.isnan(vals)
87
- out[mask] = vals[mask]
88
- return out
89
-
90
-
91
- def value_fingerprint(name: str, vals: np.ndarray) -> dict:
92
- v = vals[~np.isnan(vals)]
93
- if len(v) == 0:
94
- return {"name": name, "n": 0}
95
- return {
96
- "name": name,
97
- "n": int(len(v)),
98
- "min": float(v.min()),
99
- "p1": float(np.percentile(v, 1)),
100
- "p25": float(np.percentile(v, 25)),
101
- "mean": float(v.mean()),
102
- "median": float(np.median(v)),
103
- "p75": float(np.percentile(v, 75)),
104
- "p99": float(np.percentile(v, 99)),
105
- "max": float(v.max()),
106
- "std": float(v.std()),
107
- }
108
-
109
-
110
- def compute_aucs(y: np.ndarray, scores: np.ndarray, label: str) -> dict:
111
- """ROC-AUC + PR-AUC + summary. Returns NaN entries if data is missing."""
112
- mask = ~np.isnan(scores) & ~np.isnan(y)
113
- if mask.sum() < 20 or len(np.unique(y[mask])) < 2:
114
- return {"label": label, "n": int(mask.sum()), "roc_auc": float("nan"), "pr_auc": float("nan")}
115
- return {
116
- "label": label,
117
- "n": int(mask.sum()),
118
- "roc_auc": float(roc_auc_score(y[mask], scores[mask])),
119
- "pr_auc": float(average_precision_score(y[mask], scores[mask])),
120
- "positive_rate": float(y[mask].mean()),
121
- }
122
-
123
-
124
- def plot_score_histograms(df: pd.DataFrame, score_col: str, model_name: str, out_path: Path):
125
- fig, ax = plt.subplots(1, 1, figsize=(8, 5))
126
- valid = df.dropna(subset=[score_col])
127
- for cat, color in zip(
128
- ["other", "surface_depression", "sinkhole", "surface_mine"],
129
- ["#888", "#d62728", "#2ca02c", "#1f77b4"],
130
- ):
131
- sub = valid[valid["sample_category"] == cat]
132
- if len(sub):
133
- ax.hist(
134
- sub[score_col], bins=50, alpha=0.5, label=f"{cat} (n={len(sub):,})",
135
- color=color, density=True,
136
- )
137
- ax.set_xlabel(f"{model_name} predicted score at label point")
138
- ax.set_ylabel("density")
139
- ax.set_title(f"{model_name} score distribution by true class")
140
- ax.legend()
141
- ax.grid(alpha=0.3)
142
- fig.tight_layout()
143
- fig.savefig(out_path, dpi=120)
144
- plt.close(fig)
145
-
146
-
147
- def plot_roc(y: np.ndarray, scores: dict[str, np.ndarray], out_path: Path):
148
- fig, ax = plt.subplots(1, 1, figsize=(6, 6))
149
- for name, s in scores.items():
150
- mask = ~np.isnan(s) & ~np.isnan(y)
151
- if mask.sum() < 20 or len(np.unique(y[mask])) < 2:
152
- continue
153
- fpr, tpr, _ = roc_curve(y[mask], s[mask])
154
- auc = roc_auc_score(y[mask], s[mask])
155
- ax.plot(fpr, tpr, lw=2, label=f"{name} AUC={auc:.3f}")
156
- ax.plot([0, 1], [0, 1], color="gray", lw=1, linestyle="--", label="random")
157
- ax.set_xlabel("FPR"); ax.set_ylabel("TPR")
158
- ax.set_title("ROC — V6 (regression on confidence) vs V8 (regression on sample_karst_score)")
159
- ax.legend(loc="lower right")
160
- ax.grid(alpha=0.3)
161
- fig.tight_layout()
162
- fig.savefig(out_path, dpi=120)
163
- plt.close(fig)
164
-
165
-
166
- def plot_v8_v6_scatter(df: pd.DataFrame, out_path: Path):
167
- """Scatter V8 score vs V6 score, colored by true class."""
168
- fig, ax = plt.subplots(1, 1, figsize=(7, 7))
169
- valid = df.dropna(subset=["v8_score", "v6_score"])
170
- for cat, color in zip(
171
- ["other", "surface_depression", "sinkhole", "surface_mine"],
172
- ["#888", "#d62728", "#2ca02c", "#1f77b4"],
173
- ):
174
- sub = valid[valid["sample_category"] == cat]
175
- if len(sub):
176
- ax.scatter(sub["v6_score"], sub["v8_score"], s=2, alpha=0.3, color=color, label=f"{cat} (n={len(sub):,})")
177
- ax.set_xlabel("V6 score (regression on confidence)")
178
- ax.set_ylabel("V8 score (regression on sample_karst_score)")
179
- ax.set_title("V8 vs V6 — point-wise comparison\n(want V8 to spread; V6 was stuck near 0.82)")
180
- ax.legend(markerscale=4, loc="upper left")
181
- ax.grid(alpha=0.3)
182
- fig.tight_layout()
183
- fig.savefig(out_path, dpi=120)
184
- plt.close(fig)
185
-
186
-
187
- def spatial_holdout(df: pd.DataFrame, k: int = 5) -> pd.Series:
188
- """Assign each point to a longitude-banded fold (0..k-1). Mimics how we sharded."""
189
- sorted_idx = df["lon"].sort_values().index
190
- fold = pd.Series(0, index=df.index, dtype=int)
191
- band_size = len(df) // k
192
- for i in range(k):
193
- start = i * band_size
194
- end = (i + 1) * band_size if i < k - 1 else len(df)
195
- fold.loc[sorted_idx[start:end]] = i
196
- return fold
197
-
198
-
199
- def main():
200
- ap = argparse.ArgumentParser(description="V8 vs V6 evaluation")
201
- ap.add_argument("--v8-rasters", nargs="+", required=True,
202
- help="V8 prediction raster path(s) — supports globs (use quotes)")
203
- ap.add_argument("--v6-rasters", nargs="*", default=[],
204
- help="V6 raster path(s) for comparison. Optional but recommended.")
205
- ap.add_argument("--labels", required=True,
206
- help="balanced_karst_v8.parquet path")
207
- ap.add_argument("--out", required=True, help="Output directory")
208
- ap.add_argument("--holdout-fold", type=int, default=2,
209
- help="Which longitude band (0..4) to treat as held-out for spatial-CV AUC (default 2 = middle)")
210
- args = ap.parse_args()
211
-
212
- out = Path(args.out)
213
- out.mkdir(parents=True, exist_ok=True)
214
-
215
- print(f"[1] Loading labels from {args.labels}")
216
- df = pd.read_parquet(args.labels)
217
- print(f" {len(df):,} rows / classes: {df['sample_category'].value_counts().to_dict() if 'sample_category' in df.columns else df['tag'].value_counts().to_dict()}")
218
- # Column compat: parquet has 'tag' and 'sample_karst_score' from build script
219
- if "sample_category" not in df.columns and "tag" in df.columns:
220
- df["sample_category"] = df["tag"]
221
-
222
- y = df["sample_karst_score"].values
223
- lons = df["lon"].values.astype(float)
224
- lats = df["lat"].values.astype(float)
225
-
226
- print(f"\n[2] Resolving V8 rasters...")
227
- v8_paths = expand_rasters(args.v8_rasters)
228
- print(f" found {len(v8_paths)} V8 raster(s):")
229
- for p in v8_paths:
230
- print(f" {p}")
231
-
232
- v6_paths = expand_rasters(args.v6_rasters) if args.v6_rasters else []
233
- if v6_paths:
234
- print(f"\n[3] Resolving V6 rasters...")
235
- print(f" found {len(v6_paths)} V6 raster(s):")
236
- for p in v6_paths:
237
- print(f" {p}")
238
-
239
- if not v8_paths:
240
- print("ERROR: no V8 rasters found — pass --v8-rasters with valid paths/globs")
241
- sys.exit(2)
242
-
243
- print(f"\n[4] Sampling raster values at {len(df):,} label points...")
244
- df["v8_score"] = sample_multi_raster(v8_paths, lons, lats)
245
- print(f" V8 valid samples: {(~np.isnan(df['v8_score'])).sum():,} / {len(df):,}")
246
-
247
- if v6_paths:
248
- df["v6_score"] = sample_multi_raster(v6_paths, lons, lats)
249
- print(f" V6 valid samples: {(~np.isnan(df['v6_score'])).sum():,} / {len(df):,}")
250
- else:
251
- df["v6_score"] = np.nan
252
-
253
- print(f"\n[5] Value distribution fingerprints")
254
- print(f" (V6 ground truth from run2 was: mean=0.82 std=0.02 — flat regression-to-mean failure)")
255
- fps = []
256
- for name, col in [("V6", "v6_score"), ("V8", "v8_score")]:
257
- fp = value_fingerprint(name, df[col].values)
258
- fps.append(fp)
259
- if fp.get("n", 0):
260
- print(f" {name}: n={fp['n']:,} min={fp['min']:.4f} mean={fp['mean']:.4f} std={fp['std']:.4f} max={fp['max']:.4f}")
261
- print(f" p1={fp['p1']:.4f} p25={fp['p25']:.4f} median={fp['median']:.4f} p75={fp['p75']:.4f} p99={fp['p99']:.4f}")
262
- pd.DataFrame(fps).to_csv(out / "value_fingerprints.csv", index=False)
263
-
264
- print(f"\n[6] AUCs — in-sample (all 40,989 labels)")
265
- in_sample = []
266
- for name, col in [("V6", "v6_score"), ("V8", "v8_score")]:
267
- r = compute_aucs(y, df[col].values, f"{name}_in_sample")
268
- in_sample.append(r)
269
- if not np.isnan(r.get("roc_auc", np.nan)):
270
- print(f" {r['label']:>20s} n={r['n']:>6,} ROC-AUC={r['roc_auc']:.4f} PR-AUC={r['pr_auc']:.4f} pos-rate={r['positive_rate']:.3f}")
271
- else:
272
- print(f" {r['label']:>20s} no overlap / insufficient data")
273
-
274
- print(f"\n[7] AUCs — spatial holdout (longitude fold {args.holdout_fold} of 5)")
275
- df["fold"] = spatial_holdout(df, k=5)
276
- holdout = df[df["fold"] == args.holdout_fold]
277
- print(f" holdout n={len(holdout):,} lon range=[{holdout['lon'].min():.2f}, {holdout['lon'].max():.2f}]")
278
- holdout_aucs = []
279
- for name, col in [("V6", "v6_score"), ("V8", "v8_score")]:
280
- r = compute_aucs(holdout["sample_karst_score"].values, holdout[col].values, f"{name}_holdout_fold{args.holdout_fold}")
281
- holdout_aucs.append(r)
282
- if not np.isnan(r.get("roc_auc", np.nan)):
283
- print(f" {r['label']:>30s} n={r['n']:>6,} ROC-AUC={r['roc_auc']:.4f} PR-AUC={r['pr_auc']:.4f}")
284
-
285
- pd.DataFrame(in_sample + holdout_aucs).to_csv(out / "auc_summary.csv", index=False)
286
-
287
- print(f"\n[8] Plotting diagnostics...")
288
- plot_score_histograms(df, "v8_score", "V8", out / "hist_v8_by_class.png")
289
- print(f" wrote hist_v8_by_class.png")
290
- if v6_paths:
291
- plot_score_histograms(df, "v6_score", "V6", out / "hist_v6_by_class.png")
292
- print(f" wrote hist_v6_by_class.png")
293
-
294
- scores = {"V8": df["v8_score"].values}
295
- if v6_paths:
296
- scores["V6"] = df["v6_score"].values
297
- plot_roc(y, scores, out / "roc_v8_v6.png")
298
- print(f" wrote roc_v8_v6.png")
299
-
300
- if v6_paths:
301
- plot_v8_v6_scatter(df, out / "scatter_v8_v6.png")
302
- print(f" wrote scatter_v8_v6.png")
303
-
304
- # Save full per-point sample table
305
- df_out = df[["lon", "lat", "task_name", "sample_category", "sample_karst_score", "v8_score", "v6_score", "fold"]]
306
- df_out.to_csv(out / "per_point_scores.csv", index=False)
307
- print(f" wrote per_point_scores.csv ({len(df_out):,} rows)")
308
-
309
- print(f"\n{'=' * 70}")
310
- print("VERDICT GUIDE:")
311
- print(f" V6 in-sample AUC was likely ~0.50–0.55 (the regression-to-mean failure)")
312
- print(f" V8 should target:")
313
- print(f" - in-sample AUC > 0.80 (model fits)")
314
- print(f" - holdout AUC > 0.70 (model generalizes spatially)")
315
- print(f" - value std > 0.10 (real spatial discrimination, not flat 0.82±0.02)")
316
- print(f" - histogram visibly bimodal (modes near 0 and 1)")
317
- print(f"{'=' * 70}")
318
-
319
-
320
- if __name__ == "__main__":
321
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
stats.csv DELETED
@@ -1,12 +0,0 @@
1
- metric,value
2
- n_total,21707.0
3
- n_karst,10714.0
4
- n_other,10993.0
5
- class_max_min_ratio,9.53
6
- n_other,10993.0
7
- n_surface_depression,7213.0
8
- n_sinkhole,2348.0
9
- n_surface_mine,1153.0
10
- n_pa_karst_east,13483.0
11
- n_pa_karst_central,7502.0
12
- n_pa_karst_west,722.0
 
 
 
 
 
 
 
 
 
 
 
 
 
studio/import.geojson CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5c462bf665ca7293b7e43f40c1341cfc4ecf4e86d031b460eb006b2450a8f53b
3
- size 6513447
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2ce6b9ca7a2bc0e34a77f0d9aa4f96f74b6dee0d2f118e75c8186d32b466c17
3
+ size 14124005
studio/import.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5c462bf665ca7293b7e43f40c1341cfc4ecf4e86d031b460eb006b2450a8f53b
3
- size 6513447
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2ce6b9ca7a2bc0e34a77f0d9aa4f96f74b6dee0d2f118e75c8186d32b466c17
3
+ size 14124005