Skip to content

Commit

Permalink
Adjust more places to validation
Browse files Browse the repository at this point in the history
rename store>write closes #304
  • Loading branch information
johanvdw committed Nov 28, 2022
1 parent cf6f402 commit 0844be5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 102 deletions.
134 changes: 42 additions & 92 deletions docs/validation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"source": [
"from niche_vlaanderen import Niche\n",
"nv = Niche()\n",
"nv.run_config_file(\"/home/johan/Desktop/bwk_tiny/tiny.yaml\")\n",
"nv.run_config_file(\"../tests/data/bwk_tiny/tiny.yaml\")\n",
"nv.plot(5)"
]
},
Expand All @@ -88,13 +88,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 77.72it/s]\n"
"100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 67.92it/s]\n"
]
}
],
"source": [
"from niche_vlaanderen.bwk_overlay import NicheOverlay\n",
"overlay = NicheOverlay(niche=nv, map=\"/home/johan/Desktop/bwk_tiny/bwk_clip.shp\")"
"from niche_vlaanderen.validation import NicheValidation\n",
"validation = NicheValidation(niche=nv, map=\"../tests/data/bwk_tiny/bwk_clip.shp\")"
]
},
{
Expand Down Expand Up @@ -193,7 +193,7 @@
" <td>None</td>\n",
" <td>0</td>\n",
" <td>...</td>\n",
" <td>15.0</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand Down Expand Up @@ -291,7 +291,7 @@
"\n",
" NICH_1_1 NICH_1_2 NICH_2_1 NICH_2_2 NICH_3_1 NICH_3_2 NICH_4_1 \\\n",
"0 28.0 NaN NaN NaN NaN NaN NaN \n",
"1 15.0 NaN NaN NaN NaN NaN NaN \n",
"1 NaN NaN NaN NaN NaN NaN NaN \n",
"2 27.0 NaN NaN NaN NaN NaN NaN \n",
"3 NaN NaN 19.0 NaN NaN NaN NaN \n",
"4 5.0 NaN NaN NaN NaN NaN NaN \n",
Expand All @@ -312,7 +312,7 @@
}
],
"source": [
"overlay.map"
"validation.map"
]
},
{
Expand Down Expand Up @@ -344,16 +344,16 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 77.10it/s]\n",
"/home/johan/Nextcloud/_proj/niche/niche_vlaanderen/niche_vlaanderen/bwk_overlay.py:226: UserWarning: No overlap between potential vegetation map and shape_id 0\n",
" warnings.warn(f\"No overlap between potential vegetation map and shape_id {i}\")\n",
"/home/johan/Nextcloud/_proj/niche/niche_vlaanderen/niche_vlaanderen/bwk_overlay.py:226: UserWarning: No overlap between potential vegetation map and shape_id 2\n",
" warnings.warn(f\"No overlap between potential vegetation map and shape_id {i}\")\n"
"100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 69.77it/s]\n",
"/home/johan/Nextcloud/_proj/niche/niche_vlaanderen/niche_vlaanderen/validation.py:191: UserWarning: No overlap between potential vegetation map and shape_id 0\n",
" warnings.warn(\n",
"/home/johan/Nextcloud/_proj/niche/niche_vlaanderen/niche_vlaanderen/validation.py:191: UserWarning: No overlap between potential vegetation map and shape_id 2\n",
" warnings.warn(\n"
]
}
],
"source": [
"overlay1 = NicheOverlay(niche=nv, map=\"/home/johan/Desktop/bwk_tiny/bwk_clip.shp\", upscale=1)"
"validation1 = NicheValidation(niche=nv, map=\"/home/johan/Desktop/bwk_tiny/bwk_clip.shp\", upscale=1)"
]
},
{
Expand Down Expand Up @@ -418,27 +418,17 @@
" <td>0.019679</td>\n",
" <td>0.580379</td>\n",
" <td>1.0</td>\n",
" <td>97.489540</td>\n",
" <td>97.48954</td>\n",
" <td>96.720418</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>0.587310</td>\n",
" <td>0.353707</td>\n",
" <td>0.348184</td>\n",
" <td>0.239126</td>\n",
" <td>1.0</td>\n",
" <td>40.336134</td>\n",
" <td>40.715467</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>0.071813</td>\n",
" <td>0.358689</td>\n",
" <td>0.071813</td>\n",
" <td>0.000000</td>\n",
" <td>1.0</td>\n",
" <td>0.000000</td>\n",
" <td>0.00000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
Expand All @@ -448,7 +438,7 @@
" <td>0.004235</td>\n",
" <td>0.000000</td>\n",
" <td>1.0</td>\n",
" <td>0.000000</td>\n",
" <td>0.00000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
Expand All @@ -458,7 +448,7 @@
" <td>0.006143</td>\n",
" <td>0.000000</td>\n",
" <td>1.0</td>\n",
" <td>0.000000</td>\n",
" <td>0.00000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" </tbody>\n",
Expand All @@ -469,18 +459,16 @@
" area_effective nonpot nonpot_opt pot polygon_count \\\n",
"vegetation \n",
"5 0.600058 0.014945 0.019679 0.580379 1.0 \n",
"15 0.587310 0.353707 0.348184 0.239126 1.0 \n",
"19 0.071813 0.358689 0.071813 0.000000 1.0 \n",
"27 0.004235 0.004982 0.004235 0.000000 1.0 \n",
"28 0.006143 0.004982 0.006143 0.000000 1.0 \n",
"\n",
" score score_opt \n",
"vegetation \n",
"5 97.489540 96.720418 \n",
"15 40.336134 40.715467 \n",
"19 0.000000 0.000000 \n",
"27 0.000000 0.000000 \n",
"28 0.000000 0.000000 "
" score score_opt \n",
"vegetation \n",
"5 97.48954 96.720418 \n",
"19 0.00000 0.000000 \n",
"27 0.00000 0.000000 \n",
"28 0.00000 0.000000 "
]
},
"execution_count": 5,
Expand All @@ -489,7 +477,7 @@
}
],
"source": [
"overlay.summary"
"validation.summary"
]
},
{
Expand Down Expand Up @@ -536,7 +524,6 @@
" <tr style=\"text-align: right;\">\n",
" <th>vegetation</th>\n",
" <th>5</th>\n",
" <th>15</th>\n",
" <th>19</th>\n",
" <th>27</th>\n",
" <th>28</th>\n",
Expand All @@ -547,7 +534,6 @@
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
Expand All @@ -556,13 +542,11 @@
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.004982</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>NaN</td>\n",
" <td>0.353707</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand All @@ -571,14 +555,12 @@
" <th>2</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.004982</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.358689</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand All @@ -589,20 +571,19 @@
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"vegetation 5 15 19 27 28\n",
"shape_id \n",
"0 NaN NaN NaN NaN 0.004982\n",
"1 NaN 0.353707 NaN NaN NaN\n",
"2 NaN NaN NaN 0.004982 NaN\n",
"3 NaN NaN 0.358689 NaN NaN\n",
"4 0.014945 NaN NaN NaN NaN"
"vegetation 5 19 27 28\n",
"shape_id \n",
"0 NaN NaN NaN 0.004982\n",
"1 NaN NaN NaN NaN\n",
"2 NaN NaN 0.004982 NaN\n",
"3 NaN 0.358689 NaN NaN\n",
"4 0.014945 NaN NaN NaN"
]
},
"execution_count": 6,
Expand All @@ -611,7 +592,7 @@
}
],
"source": [
"overlay.area_nonpot"
"validation.area_nonpot"
]
},
{
Expand Down Expand Up @@ -642,7 +623,6 @@
" <tr style=\"text-align: right;\">\n",
" <th>vegetation</th>\n",
" <th>5</th>\n",
" <th>15</th>\n",
" <th>19</th>\n",
" <th>27</th>\n",
" <th>28</th>\n",
Expand All @@ -653,7 +633,6 @@
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
Expand All @@ -662,13 +641,11 @@
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.006143</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>NaN</td>\n",
" <td>0.348184</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand All @@ -677,14 +654,12 @@
" <th>2</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.004235</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.071813</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand All @@ -695,20 +670,19 @@
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"vegetation 5 15 19 27 28\n",
"shape_id \n",
"0 NaN NaN NaN NaN 0.006143\n",
"1 NaN 0.348184 NaN NaN NaN\n",
"2 NaN NaN NaN 0.004235 NaN\n",
"3 NaN NaN 0.071813 NaN NaN\n",
"4 0.019679 NaN NaN NaN NaN"
"vegetation 5 19 27 28\n",
"shape_id \n",
"0 NaN NaN NaN 0.006143\n",
"1 NaN NaN NaN NaN\n",
"2 NaN NaN 0.004235 NaN\n",
"3 NaN 0.071813 NaN NaN\n",
"4 0.019679 NaN NaN NaN"
]
},
"execution_count": 7,
Expand All @@ -717,7 +691,7 @@
}
],
"source": [
"overlay.area_nonpot_optimistic"
"validation.area_nonpot_optimistic"
]
},
{
Expand All @@ -736,7 +710,7 @@
"metadata": {},
"outputs": [],
"source": [
"overlay.store('/tmp/test', overwrite=True)"
"validation.write('_validation', overwrite=True)"
]
},
{
Expand Down Expand Up @@ -767,32 +741,8 @@
],
"source": [
"import os\n",
"os.listdir('/tmp/test')"
"os.listdir('_validation')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f3e4ac23",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "ddd5eddc",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "f73fde29",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 0844be5

Please sign in to comment.