Upload archive analysis and data for rare species
Browse filesNo additional images were matched, rs_links CSV is for adjusting Rare Species dataset to avoid duplicate images within species
.gitattributes
CHANGED
|
@@ -66,3 +66,4 @@ visuals/phyla_ToL_tree.pdf filter=lfs diff=lfs merge=lfs -text
|
|
| 66 |
eol_realign/data/links_inner.csv filter=lfs diff=lfs merge=lfs -text
|
| 67 |
eol_realign/data/links_manifest_cargo_on_md5.csv filter=lfs diff=lfs merge=lfs -text
|
| 68 |
eol_realign/data/links_cargo_manifest_IDmismatch.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 66 |
eol_realign/data/links_inner.csv filter=lfs diff=lfs merge=lfs -text
|
| 67 |
eol_realign/data/links_manifest_cargo_on_md5.csv filter=lfs diff=lfs merge=lfs -text
|
| 68 |
eol_realign/data/links_cargo_manifest_IDmismatch.csv filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
eol_realign/data/eol-cargo-archive_combined-manifest-checksums_links.csv filter=lfs diff=lfs merge=lfs -text
|
eol_realign/data/eol-cargo-archive_combined-manifest-checksums_links.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c53ba3c261089abe0ce8fc7e21fc21baa111db3e06333aaedc090f66c5a9519
|
| 3 |
+
size 3545231521
|
eol_realign/data/rs_links.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
eol_realign/notebooks/links_rs_duplicates.ipynb
CHANGED
|
@@ -9,25 +9,36 @@
|
|
| 9 |
"import pandas as pd"
|
| 10 |
]
|
| 11 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
{
|
| 13 |
"cell_type": "markdown",
|
| 14 |
"metadata": {},
|
| 15 |
"source": [
|
| 16 |
-
"### Read in Links CSV file"
|
|
|
|
|
|
|
| 17 |
]
|
| 18 |
},
|
| 19 |
{
|
| 20 |
"cell_type": "code",
|
| 21 |
-
"execution_count":
|
| 22 |
"metadata": {},
|
| 23 |
"outputs": [],
|
| 24 |
"source": [
|
| 25 |
-
"links_manifest_cargo = pd.read_csv(\"../data/
|
| 26 |
]
|
| 27 |
},
|
| 28 |
{
|
| 29 |
"cell_type": "code",
|
| 30 |
-
"execution_count":
|
| 31 |
"metadata": {},
|
| 32 |
"outputs": [
|
| 33 |
{
|
|
@@ -35,28 +46,29 @@
|
|
| 35 |
"output_type": "stream",
|
| 36 |
"text": [
|
| 37 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 38 |
-
"RangeIndex:
|
| 39 |
-
"Data columns (total
|
| 40 |
-
" # Column
|
| 41 |
-
"--- ------
|
| 42 |
-
" 0
|
| 43 |
-
" 1
|
| 44 |
-
" 2
|
| 45 |
-
" 3
|
| 46 |
-
" 4
|
| 47 |
-
" 5
|
| 48 |
-
" 6
|
| 49 |
-
" 7
|
| 50 |
-
" 8
|
| 51 |
-
" 9
|
| 52 |
-
" 10
|
| 53 |
-
" 11
|
| 54 |
-
" 12
|
| 55 |
-
" 13
|
| 56 |
-
" 14
|
| 57 |
-
" 15
|
| 58 |
-
"
|
| 59 |
-
"
|
|
|
|
| 60 |
]
|
| 61 |
}
|
| 62 |
],
|
|
@@ -73,7 +85,7 @@
|
|
| 73 |
},
|
| 74 |
{
|
| 75 |
"cell_type": "code",
|
| 76 |
-
"execution_count":
|
| 77 |
"metadata": {},
|
| 78 |
"outputs": [
|
| 79 |
{
|
|
@@ -102,7 +114,7 @@
|
|
| 102 |
}
|
| 103 |
],
|
| 104 |
"source": [
|
| 105 |
-
"rs_catalog = pd.read_csv(\"
|
| 106 |
" low_memory=False,\n",
|
| 107 |
" dtype = {\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 108 |
"rs_catalog.info(show_counts = True)"
|
|
@@ -110,7 +122,7 @@
|
|
| 110 |
},
|
| 111 |
{
|
| 112 |
"cell_type": "code",
|
| 113 |
-
"execution_count":
|
| 114 |
"metadata": {},
|
| 115 |
"outputs": [],
|
| 116 |
"source": [
|
|
@@ -120,7 +132,7 @@
|
|
| 120 |
},
|
| 121 |
{
|
| 122 |
"cell_type": "code",
|
| 123 |
-
"execution_count":
|
| 124 |
"metadata": {},
|
| 125 |
"outputs": [
|
| 126 |
{
|
|
@@ -129,39 +141,40 @@
|
|
| 129 |
"text": [
|
| 130 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 131 |
"RangeIndex: 12552 entries, 0 to 12551\n",
|
| 132 |
-
"Data columns (total
|
| 133 |
-
" # Column
|
| 134 |
-
"--- ------
|
| 135 |
-
" 0 rarespecies_id
|
| 136 |
-
" 1 eol_content_id_rs
|
| 137 |
-
" 2 eol_page_id_rs
|
| 138 |
-
" 3 kingdom
|
| 139 |
-
" 4 phylum
|
| 140 |
-
" 5 class
|
| 141 |
-
" 6 order
|
| 142 |
-
" 7 family
|
| 143 |
-
" 8 genus
|
| 144 |
-
" 9 species
|
| 145 |
-
" 10 sciName
|
| 146 |
-
" 11 combined_id_rs
|
| 147 |
-
" 12
|
| 148 |
-
" 13
|
| 149 |
-
" 14
|
| 150 |
-
" 15
|
| 151 |
-
" 16
|
| 152 |
-
" 17
|
| 153 |
-
" 18
|
| 154 |
-
" 19
|
| 155 |
-
" 20
|
| 156 |
-
" 21
|
| 157 |
-
" 22
|
| 158 |
-
" 23
|
| 159 |
-
" 24
|
| 160 |
-
" 25
|
| 161 |
-
" 26
|
| 162 |
-
" 27
|
| 163 |
-
"
|
| 164 |
-
"
|
|
|
|
| 165 |
]
|
| 166 |
}
|
| 167 |
],
|
|
@@ -169,51 +182,52 @@
|
|
| 169 |
"rs_links = pd.merge(rs_catalog,\n",
|
| 170 |
" links_manifest_cargo,\n",
|
| 171 |
" left_on = \"combined_id_rs\",\n",
|
| 172 |
-
" right_on = \"
|
| 173 |
" how = \"inner\")\n",
|
| 174 |
"rs_links.info(show_counts = True)"
|
| 175 |
]
|
| 176 |
},
|
| 177 |
{
|
| 178 |
"cell_type": "code",
|
| 179 |
-
"execution_count":
|
| 180 |
"metadata": {},
|
| 181 |
"outputs": [
|
| 182 |
{
|
| 183 |
"data": {
|
| 184 |
"text/plain": [
|
| 185 |
-
"rarespecies_id
|
| 186 |
-
"eol_content_id_rs
|
| 187 |
-
"eol_page_id_rs
|
| 188 |
-
"kingdom
|
| 189 |
-
"phylum
|
| 190 |
-
"class
|
| 191 |
-
"order
|
| 192 |
-
"family
|
| 193 |
-
"genus
|
| 194 |
-
"species
|
| 195 |
-
"sciName
|
| 196 |
-
"combined_id_rs
|
| 197 |
-
"
|
| 198 |
-
"
|
| 199 |
-
"
|
| 200 |
-
"
|
| 201 |
-
"
|
| 202 |
-
"
|
| 203 |
-
"
|
| 204 |
-
"
|
| 205 |
-
"
|
| 206 |
-
"
|
| 207 |
-
"
|
| 208 |
-
"
|
| 209 |
-
"
|
| 210 |
-
"
|
| 211 |
-
"
|
| 212 |
-
"
|
|
|
|
| 213 |
"dtype: int64"
|
| 214 |
]
|
| 215 |
},
|
| 216 |
-
"execution_count":
|
| 217 |
"metadata": {},
|
| 218 |
"output_type": "execute_result"
|
| 219 |
}
|
|
@@ -222,6 +236,13 @@
|
|
| 222 |
"rs_links.nunique()"
|
| 223 |
]
|
| 224 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
{
|
| 226 |
"cell_type": "markdown",
|
| 227 |
"metadata": {},
|
|
@@ -231,7 +252,7 @@
|
|
| 231 |
},
|
| 232 |
{
|
| 233 |
"cell_type": "code",
|
| 234 |
-
"execution_count":
|
| 235 |
"metadata": {},
|
| 236 |
"outputs": [
|
| 237 |
{
|
|
@@ -240,7 +261,7 @@
|
|
| 240 |
"11826"
|
| 241 |
]
|
| 242 |
},
|
| 243 |
-
"execution_count":
|
| 244 |
"metadata": {},
|
| 245 |
"output_type": "execute_result"
|
| 246 |
}
|
|
@@ -252,7 +273,7 @@
|
|
| 252 |
},
|
| 253 |
{
|
| 254 |
"cell_type": "code",
|
| 255 |
-
"execution_count":
|
| 256 |
"metadata": {},
|
| 257 |
"outputs": [
|
| 258 |
{
|
|
@@ -264,7 +285,7 @@
|
|
| 264 |
" '29975068_45509269']"
|
| 265 |
]
|
| 266 |
},
|
| 267 |
-
"execution_count":
|
| 268 |
"metadata": {},
|
| 269 |
"output_type": "execute_result"
|
| 270 |
}
|
|
@@ -275,20 +296,20 @@
|
|
| 275 |
},
|
| 276 |
{
|
| 277 |
"cell_type": "code",
|
| 278 |
-
"execution_count":
|
| 279 |
"metadata": {},
|
| 280 |
"outputs": [
|
| 281 |
{
|
| 282 |
"data": {
|
| 283 |
"text/plain": [
|
| 284 |
-
"
|
| 285 |
-
"
|
| 286 |
-
"
|
| 287 |
-
"
|
| 288 |
"Name: combined_id_rs, dtype: object"
|
| 289 |
]
|
| 290 |
},
|
| 291 |
-
"execution_count":
|
| 292 |
"metadata": {},
|
| 293 |
"output_type": "execute_result"
|
| 294 |
}
|
|
@@ -299,7 +320,7 @@
|
|
| 299 |
},
|
| 300 |
{
|
| 301 |
"cell_type": "code",
|
| 302 |
-
"execution_count":
|
| 303 |
"metadata": {},
|
| 304 |
"outputs": [
|
| 305 |
{
|
|
@@ -335,7 +356,7 @@
|
|
| 335 |
},
|
| 336 |
{
|
| 337 |
"cell_type": "code",
|
| 338 |
-
"execution_count":
|
| 339 |
"metadata": {},
|
| 340 |
"outputs": [
|
| 341 |
{
|
|
@@ -356,7 +377,7 @@
|
|
| 356 |
"dtype: int64"
|
| 357 |
]
|
| 358 |
},
|
| 359 |
-
"execution_count":
|
| 360 |
"metadata": {},
|
| 361 |
"output_type": "execute_result"
|
| 362 |
}
|
|
@@ -367,7 +388,7 @@
|
|
| 367 |
},
|
| 368 |
{
|
| 369 |
"cell_type": "code",
|
| 370 |
-
"execution_count":
|
| 371 |
"metadata": {},
|
| 372 |
"outputs": [
|
| 373 |
{
|
|
@@ -411,7 +432,7 @@
|
|
| 411 |
"Name: count, dtype: int64"
|
| 412 |
]
|
| 413 |
},
|
| 414 |
-
"execution_count":
|
| 415 |
"metadata": {},
|
| 416 |
"output_type": "execute_result"
|
| 417 |
}
|
|
@@ -422,7 +443,7 @@
|
|
| 422 |
},
|
| 423 |
{
|
| 424 |
"cell_type": "code",
|
| 425 |
-
"execution_count":
|
| 426 |
"metadata": {},
|
| 427 |
"outputs": [],
|
| 428 |
"source": [
|
|
@@ -436,7 +457,7 @@
|
|
| 436 |
},
|
| 437 |
{
|
| 438 |
"cell_type": "code",
|
| 439 |
-
"execution_count":
|
| 440 |
"metadata": {},
|
| 441 |
"outputs": [
|
| 442 |
{
|
|
@@ -450,7 +471,7 @@
|
|
| 450 |
" array([46560546])]"
|
| 451 |
]
|
| 452 |
},
|
| 453 |
-
"execution_count":
|
| 454 |
"metadata": {},
|
| 455 |
"output_type": "execute_result"
|
| 456 |
}
|
|
@@ -464,7 +485,7 @@
|
|
| 464 |
},
|
| 465 |
{
|
| 466 |
"cell_type": "code",
|
| 467 |
-
"execution_count":
|
| 468 |
"metadata": {},
|
| 469 |
"outputs": [
|
| 470 |
{
|
|
@@ -478,7 +499,7 @@
|
|
| 478 |
" (46560546, 24)]"
|
| 479 |
]
|
| 480 |
},
|
| 481 |
-
"execution_count":
|
| 482 |
"metadata": {},
|
| 483 |
"output_type": "execute_result"
|
| 484 |
}
|
|
@@ -501,7 +522,7 @@
|
|
| 501 |
},
|
| 502 |
{
|
| 503 |
"cell_type": "code",
|
| 504 |
-
"execution_count":
|
| 505 |
"metadata": {},
|
| 506 |
"outputs": [
|
| 507 |
{
|
|
@@ -541,9 +562,9 @@
|
|
| 541 |
" </thead>\n",
|
| 542 |
" <tbody>\n",
|
| 543 |
" <tr>\n",
|
| 544 |
-
" <th>
|
| 545 |
-
" <td>
|
| 546 |
-
" <td>
|
| 547 |
" <td>205909</td>\n",
|
| 548 |
" <td>Animalia</td>\n",
|
| 549 |
" <td>Chordata</td>\n",
|
|
@@ -553,12 +574,12 @@
|
|
| 553 |
" <td>Scaphirhynchus</td>\n",
|
| 554 |
" <td>albus</td>\n",
|
| 555 |
" <td>Scaphirhynchus albus</td>\n",
|
| 556 |
-
" <td>
|
| 557 |
" </tr>\n",
|
| 558 |
" <tr>\n",
|
| 559 |
-
" <th>
|
| 560 |
-
" <td>
|
| 561 |
-
" <td>
|
| 562 |
" <td>205909</td>\n",
|
| 563 |
" <td>Animalia</td>\n",
|
| 564 |
" <td>Chordata</td>\n",
|
|
@@ -568,7 +589,7 @@
|
|
| 568 |
" <td>Scaphirhynchus</td>\n",
|
| 569 |
" <td>albus</td>\n",
|
| 570 |
" <td>Scaphirhynchus albus</td>\n",
|
| 571 |
-
" <td>
|
| 572 |
" </tr>\n",
|
| 573 |
" <tr>\n",
|
| 574 |
" <th>7916</th>\n",
|
|
@@ -586,9 +607,9 @@
|
|
| 586 |
" <td>30098499_205909</td>\n",
|
| 587 |
" </tr>\n",
|
| 588 |
" <tr>\n",
|
| 589 |
-
" <th>
|
| 590 |
-
" <td>
|
| 591 |
-
" <td>
|
| 592 |
" <td>205909</td>\n",
|
| 593 |
" <td>Animalia</td>\n",
|
| 594 |
" <td>Chordata</td>\n",
|
|
@@ -598,12 +619,12 @@
|
|
| 598 |
" <td>Scaphirhynchus</td>\n",
|
| 599 |
" <td>albus</td>\n",
|
| 600 |
" <td>Scaphirhynchus albus</td>\n",
|
| 601 |
-
" <td>
|
| 602 |
" </tr>\n",
|
| 603 |
" <tr>\n",
|
| 604 |
-
" <th>
|
| 605 |
-
" <td>
|
| 606 |
-
" <td>
|
| 607 |
" <td>205909</td>\n",
|
| 608 |
" <td>Animalia</td>\n",
|
| 609 |
" <td>Chordata</td>\n",
|
|
@@ -613,36 +634,43 @@
|
|
| 613 |
" <td>Scaphirhynchus</td>\n",
|
| 614 |
" <td>albus</td>\n",
|
| 615 |
" <td>Scaphirhynchus albus</td>\n",
|
| 616 |
-
" <td>
|
| 617 |
" </tr>\n",
|
| 618 |
" </tbody>\n",
|
| 619 |
"</table>\n",
|
| 620 |
"</div>"
|
| 621 |
],
|
| 622 |
"text/plain": [
|
| 623 |
-
"
|
| 624 |
-
"
|
| 625 |
-
"
|
| 626 |
-
"7916
|
| 627 |
-
"
|
| 628 |
-
"
|
| 629 |
"\n",
|
| 630 |
-
" kingdom phylum class order
|
| 631 |
-
"
|
| 632 |
-
"
|
| 633 |
-
"7916 Animalia Chordata Actinopterygii Acipenseriformes
|
| 634 |
-
"
|
| 635 |
-
"
|
| 636 |
"\n",
|
| 637 |
-
"
|
| 638 |
-
"
|
| 639 |
-
"
|
| 640 |
-
"7916 Scaphirhynchus albus Scaphirhynchus albus
|
| 641 |
-
"
|
| 642 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 643 |
]
|
| 644 |
},
|
| 645 |
-
"execution_count":
|
| 646 |
"metadata": {},
|
| 647 |
"output_type": "execute_result"
|
| 648 |
}
|
|
@@ -661,7 +689,7 @@
|
|
| 661 |
},
|
| 662 |
{
|
| 663 |
"cell_type": "code",
|
| 664 |
-
"execution_count":
|
| 665 |
"metadata": {},
|
| 666 |
"outputs": [
|
| 667 |
{
|
|
@@ -701,9 +729,9 @@
|
|
| 701 |
" </thead>\n",
|
| 702 |
" <tbody>\n",
|
| 703 |
" <tr>\n",
|
| 704 |
-
" <th>
|
| 705 |
-
" <td>
|
| 706 |
-
" <td>
|
| 707 |
" <td>46560546</td>\n",
|
| 708 |
" <td>Animalia</td>\n",
|
| 709 |
" <td>Chordata</td>\n",
|
|
@@ -713,12 +741,12 @@
|
|
| 713 |
" <td>Raja</td>\n",
|
| 714 |
" <td>asterias</td>\n",
|
| 715 |
" <td>Raja asterias</td>\n",
|
| 716 |
-
" <td>
|
| 717 |
" </tr>\n",
|
| 718 |
" <tr>\n",
|
| 719 |
-
" <th>
|
| 720 |
-
" <td>
|
| 721 |
-
" <td>
|
| 722 |
" <td>46560546</td>\n",
|
| 723 |
" <td>Animalia</td>\n",
|
| 724 |
" <td>Chordata</td>\n",
|
|
@@ -728,12 +756,12 @@
|
|
| 728 |
" <td>Raja</td>\n",
|
| 729 |
" <td>asterias</td>\n",
|
| 730 |
" <td>Raja asterias</td>\n",
|
| 731 |
-
" <td>
|
| 732 |
" </tr>\n",
|
| 733 |
" <tr>\n",
|
| 734 |
-
" <th>
|
| 735 |
-
" <td>
|
| 736 |
-
" <td>
|
| 737 |
" <td>46560546</td>\n",
|
| 738 |
" <td>Animalia</td>\n",
|
| 739 |
" <td>Chordata</td>\n",
|
|
@@ -743,12 +771,12 @@
|
|
| 743 |
" <td>Raja</td>\n",
|
| 744 |
" <td>asterias</td>\n",
|
| 745 |
" <td>Raja asterias</td>\n",
|
| 746 |
-
" <td>
|
| 747 |
" </tr>\n",
|
| 748 |
" <tr>\n",
|
| 749 |
-
" <th>
|
| 750 |
-
" <td>
|
| 751 |
-
" <td>
|
| 752 |
" <td>46560546</td>\n",
|
| 753 |
" <td>Animalia</td>\n",
|
| 754 |
" <td>Chordata</td>\n",
|
|
@@ -758,12 +786,12 @@
|
|
| 758 |
" <td>Raja</td>\n",
|
| 759 |
" <td>asterias</td>\n",
|
| 760 |
" <td>Raja asterias</td>\n",
|
| 761 |
-
" <td>
|
| 762 |
" </tr>\n",
|
| 763 |
" <tr>\n",
|
| 764 |
-
" <th>
|
| 765 |
-
" <td>
|
| 766 |
-
" <td>
|
| 767 |
" <td>46560546</td>\n",
|
| 768 |
" <td>Animalia</td>\n",
|
| 769 |
" <td>Chordata</td>\n",
|
|
@@ -773,7 +801,7 @@
|
|
| 773 |
" <td>Raja</td>\n",
|
| 774 |
" <td>asterias</td>\n",
|
| 775 |
" <td>Raja asterias</td>\n",
|
| 776 |
-
" <td>
|
| 777 |
" </tr>\n",
|
| 778 |
" </tbody>\n",
|
| 779 |
"</table>\n",
|
|
@@ -781,28 +809,28 @@
|
|
| 781 |
],
|
| 782 |
"text/plain": [
|
| 783 |
" rarespecies_id eol_content_id_rs eol_page_id_rs \\\n",
|
|
|
|
| 784 |
"3655 12633820-3a3a-4c77-bd38-7221bd18b747 27648157 46560546 \n",
|
| 785 |
-
"
|
| 786 |
-
"2347 de4a6ca0-6fc2-40de-907e-c99b98a9ca3e 27648164 46560546 \n",
|
| 787 |
-
"3481 2bcba9f3-a3a4-4a2b-a4f4-84e35be0e35f 27648163 46560546 \n",
|
| 788 |
"1358 d436ec20-202d-44ec-9081-ca59afef356f 27648166 46560546 \n",
|
|
|
|
| 789 |
"\n",
|
| 790 |
" kingdom phylum class order family genus species \\\n",
|
|
|
|
| 791 |
"3655 Animalia Chordata Chondrichthyes Rajiformes Rajidae Raja asterias \n",
|
| 792 |
-
"
|
| 793 |
-
"2347 Animalia Chordata Chondrichthyes Rajiformes Rajidae Raja asterias \n",
|
| 794 |
-
"3481 Animalia Chordata Chondrichthyes Rajiformes Rajidae Raja asterias \n",
|
| 795 |
"1358 Animalia Chordata Chondrichthyes Rajiformes Rajidae Raja asterias \n",
|
|
|
|
| 796 |
"\n",
|
| 797 |
" sciName combined_id_rs \n",
|
|
|
|
| 798 |
"3655 Raja asterias 27648157_46560546 \n",
|
| 799 |
-
"
|
| 800 |
-
"
|
| 801 |
-
"
|
| 802 |
-
"1358 Raja asterias 27648166_46560546 "
|
| 803 |
]
|
| 804 |
},
|
| 805 |
-
"execution_count":
|
| 806 |
"metadata": {},
|
| 807 |
"output_type": "execute_result"
|
| 808 |
}
|
|
@@ -820,7 +848,26 @@
|
|
| 820 |
},
|
| 821 |
{
|
| 822 |
"cell_type": "code",
|
| 823 |
-
"execution_count":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 824 |
"metadata": {},
|
| 825 |
"outputs": [
|
| 826 |
{
|
|
@@ -844,6 +891,12 @@
|
|
| 844 |
" <thead>\n",
|
| 845 |
" <tr style=\"text-align: right;\">\n",
|
| 846 |
" <th></th>\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 847 |
" <th>eol_content_id</th>\n",
|
| 848 |
" <th>eol_page_id</th>\n",
|
| 849 |
" <th>medium_source_url</th>\n",
|
|
@@ -854,12 +907,8 @@
|
|
| 854 |
" <th>source_0706</th>\n",
|
| 855 |
" <th>source_0726</th>\n",
|
| 856 |
" <th>source_1206</th>\n",
|
| 857 |
-
" <th>
|
| 858 |
-
" <th>
|
| 859 |
-
" <th>combined_id_manifest_checksums</th>\n",
|
| 860 |
-
" <th>eol_content_id_cargo</th>\n",
|
| 861 |
-
" <th>eol_page_id_cargo</th>\n",
|
| 862 |
-
" <th>combined_id_cargo</th>\n",
|
| 863 |
" </tr>\n",
|
| 864 |
" </thead>\n",
|
| 865 |
" <tbody>\n",
|
|
@@ -869,23 +918,24 @@
|
|
| 869 |
],
|
| 870 |
"text/plain": [
|
| 871 |
"Empty DataFrame\n",
|
| 872 |
-
"Columns: [eol_content_id, eol_page_id, medium_source_url, eol_full_size_copy_url, license_name, copyright_owner, expected_image_filename, source_0706, source_0726, source_1206,
|
| 873 |
"Index: []"
|
| 874 |
]
|
| 875 |
},
|
| 876 |
-
"execution_count":
|
| 877 |
"metadata": {},
|
| 878 |
"output_type": "execute_result"
|
| 879 |
}
|
| 880 |
],
|
| 881 |
"source": [
|
| 882 |
"# check if content IDs get recycled, content ID: 27648165, now online as: 30223317\n",
|
| 883 |
-
"
|
|
|
|
| 884 |
]
|
| 885 |
},
|
| 886 |
{
|
| 887 |
"cell_type": "code",
|
| 888 |
-
"execution_count":
|
| 889 |
"metadata": {},
|
| 890 |
"outputs": [
|
| 891 |
{
|
|
@@ -909,6 +959,12 @@
|
|
| 909 |
" <thead>\n",
|
| 910 |
" <tr style=\"text-align: right;\">\n",
|
| 911 |
" <th></th>\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 912 |
" <th>eol_content_id</th>\n",
|
| 913 |
" <th>eol_page_id</th>\n",
|
| 914 |
" <th>medium_source_url</th>\n",
|
|
@@ -919,12 +975,8 @@
|
|
| 919 |
" <th>source_0706</th>\n",
|
| 920 |
" <th>source_0726</th>\n",
|
| 921 |
" <th>source_1206</th>\n",
|
| 922 |
-
" <th>
|
| 923 |
-
" <th>
|
| 924 |
-
" <th>combined_id_manifest_checksums</th>\n",
|
| 925 |
-
" <th>eol_content_id_cargo</th>\n",
|
| 926 |
-
" <th>eol_page_id_cargo</th>\n",
|
| 927 |
-
" <th>combined_id_cargo</th>\n",
|
| 928 |
" </tr>\n",
|
| 929 |
" </thead>\n",
|
| 930 |
" <tbody>\n",
|
|
@@ -934,11 +986,11 @@
|
|
| 934 |
],
|
| 935 |
"text/plain": [
|
| 936 |
"Empty DataFrame\n",
|
| 937 |
-
"Columns: [eol_content_id, eol_page_id, medium_source_url, eol_full_size_copy_url, license_name, copyright_owner, expected_image_filename, source_0706, source_0726, source_1206,
|
| 938 |
"Index: []"
|
| 939 |
]
|
| 940 |
},
|
| 941 |
-
"execution_count":
|
| 942 |
"metadata": {},
|
| 943 |
"output_type": "execute_result"
|
| 944 |
}
|
|
@@ -948,6 +1000,76 @@
|
|
| 948 |
"links_manifest_cargo.loc[links_manifest_cargo[\"eol_content_id\"] == 30223317]"
|
| 949 |
]
|
| 950 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 951 |
{
|
| 952 |
"cell_type": "markdown",
|
| 953 |
"metadata": {},
|
|
@@ -957,14 +1079,14 @@
|
|
| 957 |
},
|
| 958 |
{
|
| 959 |
"cell_type": "code",
|
| 960 |
-
"execution_count":
|
| 961 |
"metadata": {},
|
| 962 |
"outputs": [],
|
| 963 |
"source": [
|
| 964 |
"# Save CSV of mismatched, they should be salvageable.\n",
|
| 965 |
"# We saw these images both online and in our cargo, just with different IDs\n",
|
| 966 |
"\n",
|
| 967 |
-
"mismatched_rs.to_csv(\"../data/
|
| 968 |
]
|
| 969 |
},
|
| 970 |
{
|
|
@@ -985,17 +1107,17 @@
|
|
| 985 |
},
|
| 986 |
{
|
| 987 |
"cell_type": "code",
|
| 988 |
-
"execution_count":
|
| 989 |
"metadata": {},
|
| 990 |
"outputs": [],
|
| 991 |
"source": [
|
| 992 |
-
"rs_links[\"md5_dupes\"] = rs_links.duplicated(subset = \"
|
| 993 |
"rs_links[\"rs_id_dupes\"] = rs_links.duplicated(subset = \"rarespecies_id\", keep = \"first\")"
|
| 994 |
]
|
| 995 |
},
|
| 996 |
{
|
| 997 |
"cell_type": "code",
|
| 998 |
-
"execution_count":
|
| 999 |
"metadata": {},
|
| 1000 |
"outputs": [
|
| 1001 |
{
|
|
@@ -1006,7 +1128,7 @@
|
|
| 1006 |
"Name: count, dtype: int64"
|
| 1007 |
]
|
| 1008 |
},
|
| 1009 |
-
"execution_count":
|
| 1010 |
"metadata": {},
|
| 1011 |
"output_type": "execute_result"
|
| 1012 |
}
|
|
@@ -1017,7 +1139,7 @@
|
|
| 1017 |
},
|
| 1018 |
{
|
| 1019 |
"cell_type": "code",
|
| 1020 |
-
"execution_count":
|
| 1021 |
"metadata": {},
|
| 1022 |
"outputs": [
|
| 1023 |
{
|
|
@@ -1029,7 +1151,7 @@
|
|
| 1029 |
"Name: count, dtype: int64"
|
| 1030 |
]
|
| 1031 |
},
|
| 1032 |
-
"execution_count":
|
| 1033 |
"metadata": {},
|
| 1034 |
"output_type": "execute_result"
|
| 1035 |
}
|
|
@@ -1047,46 +1169,47 @@
|
|
| 1047 |
},
|
| 1048 |
{
|
| 1049 |
"cell_type": "code",
|
| 1050 |
-
"execution_count":
|
| 1051 |
"metadata": {},
|
| 1052 |
"outputs": [
|
| 1053 |
{
|
| 1054 |
"data": {
|
| 1055 |
"text/plain": [
|
| 1056 |
-
"rarespecies_id
|
| 1057 |
-
"eol_content_id_rs
|
| 1058 |
-
"eol_page_id_rs
|
| 1059 |
-
"kingdom
|
| 1060 |
-
"phylum
|
| 1061 |
-
"class
|
| 1062 |
-
"order
|
| 1063 |
-
"family
|
| 1064 |
-
"genus
|
| 1065 |
-
"species
|
| 1066 |
-
"sciName
|
| 1067 |
-
"combined_id_rs
|
| 1068 |
-
"
|
| 1069 |
-
"
|
| 1070 |
-
"
|
| 1071 |
-
"
|
| 1072 |
-
"
|
| 1073 |
-
"
|
| 1074 |
-
"
|
| 1075 |
-
"
|
| 1076 |
-
"
|
| 1077 |
-
"
|
| 1078 |
-
"
|
| 1079 |
-
"
|
| 1080 |
-
"
|
| 1081 |
-
"
|
| 1082 |
-
"
|
| 1083 |
-
"
|
| 1084 |
-
"
|
| 1085 |
-
"
|
|
|
|
| 1086 |
"dtype: int64"
|
| 1087 |
]
|
| 1088 |
},
|
| 1089 |
-
"execution_count":
|
| 1090 |
"metadata": {},
|
| 1091 |
"output_type": "execute_result"
|
| 1092 |
}
|
|
@@ -1099,7 +1222,7 @@
|
|
| 1099 |
},
|
| 1100 |
{
|
| 1101 |
"cell_type": "code",
|
| 1102 |
-
"execution_count":
|
| 1103 |
"metadata": {},
|
| 1104 |
"outputs": [
|
| 1105 |
{
|
|
@@ -1119,7 +1242,7 @@
|
|
| 1119 |
"Name: count, dtype: int64"
|
| 1120 |
]
|
| 1121 |
},
|
| 1122 |
-
"execution_count":
|
| 1123 |
"metadata": {},
|
| 1124 |
"output_type": "execute_result"
|
| 1125 |
}
|
|
@@ -1144,7 +1267,7 @@
|
|
| 1144 |
},
|
| 1145 |
{
|
| 1146 |
"cell_type": "code",
|
| 1147 |
-
"execution_count":
|
| 1148 |
"metadata": {},
|
| 1149 |
"outputs": [
|
| 1150 |
{
|
|
@@ -1153,7 +1276,7 @@
|
|
| 1153 |
"[4453333, 460289, 45277122, 46561158, 1286909, 45510188, 45510548, 791049]"
|
| 1154 |
]
|
| 1155 |
},
|
| 1156 |
-
"execution_count":
|
| 1157 |
"metadata": {},
|
| 1158 |
"output_type": "execute_result"
|
| 1159 |
}
|
|
@@ -1165,7 +1288,7 @@
|
|
| 1165 |
},
|
| 1166 |
{
|
| 1167 |
"cell_type": "code",
|
| 1168 |
-
"execution_count":
|
| 1169 |
"metadata": {
|
| 1170 |
"lines_to_next_cell": 2
|
| 1171 |
},
|
|
@@ -1177,13 +1300,13 @@
|
|
| 1177 |
"for pg_id in rs_sci_dupe_pgs:\n",
|
| 1178 |
" num_images = links_manifest_cargo.loc[links_manifest_cargo[\"eol_page_id\"] == pg_id].shape[0]\n",
|
| 1179 |
" num_images_by_pg[pg_id] = num_images\n",
|
| 1180 |
-
" num_unique_images = links_manifest_cargo.loc[links_manifest_cargo[\"eol_page_id\"] == pg_id, \"
|
| 1181 |
" num_unique_imgs_by_pg[pg_id] = num_unique_images"
|
| 1182 |
]
|
| 1183 |
},
|
| 1184 |
{
|
| 1185 |
"cell_type": "code",
|
| 1186 |
-
"execution_count":
|
| 1187 |
"metadata": {},
|
| 1188 |
"outputs": [
|
| 1189 |
{
|
|
@@ -1192,7 +1315,7 @@
|
|
| 1192 |
"80"
|
| 1193 |
]
|
| 1194 |
},
|
| 1195 |
-
"execution_count":
|
| 1196 |
"metadata": {},
|
| 1197 |
"output_type": "execute_result"
|
| 1198 |
}
|
|
@@ -1203,7 +1326,7 @@
|
|
| 1203 |
},
|
| 1204 |
{
|
| 1205 |
"cell_type": "code",
|
| 1206 |
-
"execution_count":
|
| 1207 |
"metadata": {},
|
| 1208 |
"outputs": [
|
| 1209 |
{
|
|
@@ -1233,7 +1356,7 @@
|
|
| 1233 |
},
|
| 1234 |
{
|
| 1235 |
"cell_type": "code",
|
| 1236 |
-
"execution_count":
|
| 1237 |
"metadata": {},
|
| 1238 |
"outputs": [
|
| 1239 |
{
|
|
@@ -1374,7 +1497,7 @@
|
|
| 1374 |
"4 leucoryx Oryx leucoryx 29462184_331080 "
|
| 1375 |
]
|
| 1376 |
},
|
| 1377 |
-
"execution_count":
|
| 1378 |
"metadata": {},
|
| 1379 |
"output_type": "execute_result"
|
| 1380 |
}
|
|
@@ -1385,23 +1508,23 @@
|
|
| 1385 |
},
|
| 1386 |
{
|
| 1387 |
"cell_type": "code",
|
| 1388 |
-
"execution_count":
|
| 1389 |
"metadata": {},
|
| 1390 |
"outputs": [
|
| 1391 |
{
|
| 1392 |
"data": {
|
| 1393 |
"text/plain": [
|
| 1394 |
-
"
|
| 1395 |
-
"
|
| 1396 |
-
"
|
| 1397 |
-
"
|
| 1398 |
-
"
|
| 1399 |
-
"
|
| 1400 |
-
"
|
| 1401 |
"Name: file_name, dtype: object"
|
| 1402 |
]
|
| 1403 |
},
|
| 1404 |
-
"execution_count":
|
| 1405 |
"metadata": {},
|
| 1406 |
"output_type": "execute_result"
|
| 1407 |
}
|
|
@@ -1413,298 +1536,29 @@
|
|
| 1413 |
},
|
| 1414 |
{
|
| 1415 |
"cell_type": "code",
|
| 1416 |
-
"execution_count":
|
| 1417 |
"metadata": {},
|
| 1418 |
"outputs": [],
|
| 1419 |
"source": [
|
| 1420 |
"# save filelist for easier fetching\n",
|
| 1421 |
-
"rs_catalog[\"file_name\"].to_csv(\"../data/rs_file_list.txt\", index = False)"
|
|
|
|
| 1422 |
]
|
| 1423 |
},
|
| 1424 |
{
|
| 1425 |
"cell_type": "markdown",
|
| 1426 |
"metadata": {},
|
| 1427 |
"source": [
|
| 1428 |
-
"
|
| 1429 |
-
"\n",
|
| 1430 |
-
"We want to see if we can replace the species that don't have at least 30 unique images per species in our rare species dataset. We need the full list of options from IUCN...We did hold out all 400?\n",
|
| 1431 |
-
"\n",
|
| 1432 |
-
"Would require going back and checking for species in predicted catalog that aren't in catalog, then comparing that to `links_manifest_cargo_on_md5`."
|
| 1433 |
]
|
| 1434 |
},
|
| 1435 |
{
|
| 1436 |
"cell_type": "code",
|
| 1437 |
-
"execution_count":
|
| 1438 |
"metadata": {},
|
| 1439 |
"outputs": [],
|
| 1440 |
"source": [
|
| 1441 |
-
"
|
| 1442 |
-
"catalog = pd.read_csv(\"../../data/data/catalog.csv\", low_memory=False)"
|
| 1443 |
-
]
|
| 1444 |
-
},
|
| 1445 |
-
{
|
| 1446 |
-
"cell_type": "code",
|
| 1447 |
-
"execution_count": 35,
|
| 1448 |
-
"metadata": {},
|
| 1449 |
-
"outputs": [],
|
| 1450 |
-
"source": [
|
| 1451 |
-
"# process catalog\n",
|
| 1452 |
-
"catalog = catalog.loc[catalog.split != \"train_small\"]\n",
|
| 1453 |
-
"eol_catalog = catalog.loc[catalog.eol_content_id.notna()]\n",
|
| 1454 |
-
"eol_catalog = eol_catalog.astype({\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 1455 |
-
"\n",
|
| 1456 |
-
"# process pred-cat\n",
|
| 1457 |
-
"eol_pred_cat = pred_cat.loc[pred_cat.eol_content_id.notna()]\n",
|
| 1458 |
-
"eol_pred_cat = eol_pred_cat.astype({\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})"
|
| 1459 |
-
]
|
| 1460 |
-
},
|
| 1461 |
-
{
|
| 1462 |
-
"cell_type": "code",
|
| 1463 |
-
"execution_count": 39,
|
| 1464 |
-
"metadata": {},
|
| 1465 |
-
"outputs": [
|
| 1466 |
-
{
|
| 1467 |
-
"name": "stdout",
|
| 1468 |
-
"output_type": "stream",
|
| 1469 |
-
"text": [
|
| 1470 |
-
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 1471 |
-
"RangeIndex: 6277374 entries, 0 to 6277373\n",
|
| 1472 |
-
"Data columns (total 18 columns):\n",
|
| 1473 |
-
" # Column Non-Null Count Dtype \n",
|
| 1474 |
-
"--- ------ -------------- ----- \n",
|
| 1475 |
-
" 0 split 6277374 non-null object \n",
|
| 1476 |
-
" 1 treeoflife_id 6277374 non-null object \n",
|
| 1477 |
-
" 2 eol_content_id_pred 6277374 non-null int64 \n",
|
| 1478 |
-
" 3 eol_page_id 6277374 non-null int64 \n",
|
| 1479 |
-
" 4 bioscan_part 0 non-null float64\n",
|
| 1480 |
-
" 5 bioscan_filename 0 non-null object \n",
|
| 1481 |
-
" 6 inat21_filename 0 non-null object \n",
|
| 1482 |
-
" 7 inat21_cls_name 0 non-null object \n",
|
| 1483 |
-
" 8 inat21_cls_num 0 non-null float64\n",
|
| 1484 |
-
" 9 kingdom 6016565 non-null object \n",
|
| 1485 |
-
" 10 phylum 6018161 non-null object \n",
|
| 1486 |
-
" 11 class 5998392 non-null object \n",
|
| 1487 |
-
" 12 order 5992253 non-null object \n",
|
| 1488 |
-
" 13 family 5975682 non-null object \n",
|
| 1489 |
-
" 14 genus 5967267 non-null object \n",
|
| 1490 |
-
" 15 species 5978567 non-null object \n",
|
| 1491 |
-
" 16 common 6277374 non-null object \n",
|
| 1492 |
-
" 17 eol_content_id_cat 6250420 non-null float64\n",
|
| 1493 |
-
"dtypes: float64(3), int64(2), object(13)\n",
|
| 1494 |
-
"memory usage: 862.1+ MB\n"
|
| 1495 |
-
]
|
| 1496 |
-
}
|
| 1497 |
-
],
|
| 1498 |
-
"source": [
|
| 1499 |
-
"full_pred_cat = pd.merge(eol_pred_cat, eol_catalog[[\"treeoflife_id\", \"eol_content_id\"]], on = \"treeoflife_id\", how = \"left\", suffixes = (\"_pred\", \"_cat\"))\n",
|
| 1500 |
-
"full_pred_cat.info(show_counts = True)"
|
| 1501 |
-
]
|
| 1502 |
-
},
|
| 1503 |
-
{
|
| 1504 |
-
"cell_type": "code",
|
| 1505 |
-
"execution_count": 41,
|
| 1506 |
-
"metadata": {},
|
| 1507 |
-
"outputs": [
|
| 1508 |
-
{
|
| 1509 |
-
"data": {
|
| 1510 |
-
"text/plain": [
|
| 1511 |
-
"26954"
|
| 1512 |
-
]
|
| 1513 |
-
},
|
| 1514 |
-
"execution_count": 41,
|
| 1515 |
-
"metadata": {},
|
| 1516 |
-
"output_type": "execute_result"
|
| 1517 |
-
}
|
| 1518 |
-
],
|
| 1519 |
-
"source": [
|
| 1520 |
-
"non_cat_ids = list(full_pred_cat.loc[full_pred_cat[\"eol_content_id_cat\"].isna(), \"treeoflife_id\"])\n",
|
| 1521 |
-
"len(non_cat_ids)"
|
| 1522 |
-
]
|
| 1523 |
-
},
|
| 1524 |
-
{
|
| 1525 |
-
"cell_type": "code",
|
| 1526 |
-
"execution_count": 54,
|
| 1527 |
-
"metadata": {},
|
| 1528 |
-
"outputs": [
|
| 1529 |
-
{
|
| 1530 |
-
"name": "stderr",
|
| 1531 |
-
"output_type": "stream",
|
| 1532 |
-
"text": [
|
| 1533 |
-
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_2421/666684240.py:2: SettingWithCopyWarning: \n",
|
| 1534 |
-
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
| 1535 |
-
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
| 1536 |
-
"\n",
|
| 1537 |
-
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
| 1538 |
-
" pot_imgs[\"sciName\"] = pot_imgs[\"genus\"] + \" \" + pot_imgs[\"species\"]\n"
|
| 1539 |
-
]
|
| 1540 |
-
},
|
| 1541 |
-
{
|
| 1542 |
-
"data": {
|
| 1543 |
-
"text/plain": [
|
| 1544 |
-
"split 2\n",
|
| 1545 |
-
"treeoflife_id 26954\n",
|
| 1546 |
-
"eol_content_id 26954\n",
|
| 1547 |
-
"eol_page_id 831\n",
|
| 1548 |
-
"bioscan_part 0\n",
|
| 1549 |
-
"bioscan_filename 0\n",
|
| 1550 |
-
"inat21_filename 0\n",
|
| 1551 |
-
"inat21_cls_name 0\n",
|
| 1552 |
-
"inat21_cls_num 0\n",
|
| 1553 |
-
"kingdom 2\n",
|
| 1554 |
-
"phylum 6\n",
|
| 1555 |
-
"class 18\n",
|
| 1556 |
-
"order 106\n",
|
| 1557 |
-
"family 285\n",
|
| 1558 |
-
"genus 566\n",
|
| 1559 |
-
"species 749\n",
|
| 1560 |
-
"common 796\n",
|
| 1561 |
-
"sciName 802\n",
|
| 1562 |
-
"dtype: int64"
|
| 1563 |
-
]
|
| 1564 |
-
},
|
| 1565 |
-
"execution_count": 54,
|
| 1566 |
-
"metadata": {},
|
| 1567 |
-
"output_type": "execute_result"
|
| 1568 |
-
}
|
| 1569 |
-
],
|
| 1570 |
-
"source": [
|
| 1571 |
-
"pot_imgs = eol_pred_cat.loc[eol_pred_cat.treeoflife_id.isin(non_cat_ids)]\n",
|
| 1572 |
-
"pot_imgs[\"sciName\"] = pot_imgs[\"genus\"] + \" \" + pot_imgs[\"species\"]\n",
|
| 1573 |
-
"pot_imgs.nunique()"
|
| 1574 |
-
]
|
| 1575 |
-
},
|
| 1576 |
-
{
|
| 1577 |
-
"cell_type": "markdown",
|
| 1578 |
-
"metadata": {},
|
| 1579 |
-
"source": [
|
| 1580 |
-
"Interesting, we have 831 unique EOL page IDs, but only 802 unique scientific names. Wonder how that matches up with 7-tuples."
|
| 1581 |
-
]
|
| 1582 |
-
},
|
| 1583 |
-
{
|
| 1584 |
-
"cell_type": "code",
|
| 1585 |
-
"execution_count": 55,
|
| 1586 |
-
"metadata": {},
|
| 1587 |
-
"outputs": [
|
| 1588 |
-
{
|
| 1589 |
-
"name": "stderr",
|
| 1590 |
-
"output_type": "stream",
|
| 1591 |
-
"text": [
|
| 1592 |
-
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_2421/3965230711.py:2: SettingWithCopyWarning: \n",
|
| 1593 |
-
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
| 1594 |
-
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
| 1595 |
-
"\n",
|
| 1596 |
-
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
| 1597 |
-
" pot_imgs[\"duplicate\"] = pot_imgs.duplicated(subset = taxa, keep = \"first\")\n"
|
| 1598 |
-
]
|
| 1599 |
-
},
|
| 1600 |
-
{
|
| 1601 |
-
"data": {
|
| 1602 |
-
"text/plain": [
|
| 1603 |
-
"duplicate\n",
|
| 1604 |
-
"True 26152\n",
|
| 1605 |
-
"False 802\n",
|
| 1606 |
-
"Name: count, dtype: int64"
|
| 1607 |
-
]
|
| 1608 |
-
},
|
| 1609 |
-
"execution_count": 55,
|
| 1610 |
-
"metadata": {},
|
| 1611 |
-
"output_type": "execute_result"
|
| 1612 |
-
}
|
| 1613 |
-
],
|
| 1614 |
-
"source": [
|
| 1615 |
-
"taxa = list(pot_imgs.columns)[9:-2]\n",
|
| 1616 |
-
"pot_imgs[\"duplicate\"] = pot_imgs.duplicated(subset = taxa, keep = \"first\")\n",
|
| 1617 |
-
"\n",
|
| 1618 |
-
"# our species count this way is num true in duplicate\n",
|
| 1619 |
-
"pot_imgs.duplicate.value_counts()"
|
| 1620 |
-
]
|
| 1621 |
-
},
|
| 1622 |
-
{
|
| 1623 |
-
"cell_type": "markdown",
|
| 1624 |
-
"metadata": {},
|
| 1625 |
-
"source": [
|
| 1626 |
-
"Okay, so this matches up with our `sciName` count."
|
| 1627 |
-
]
|
| 1628 |
-
},
|
| 1629 |
-
{
|
| 1630 |
-
"cell_type": "code",
|
| 1631 |
-
"execution_count": 56,
|
| 1632 |
-
"metadata": {},
|
| 1633 |
-
"outputs": [
|
| 1634 |
-
{
|
| 1635 |
-
"data": {
|
| 1636 |
-
"text/plain": [
|
| 1637 |
-
"(279370, 24)"
|
| 1638 |
-
]
|
| 1639 |
-
},
|
| 1640 |
-
"execution_count": 56,
|
| 1641 |
-
"metadata": {},
|
| 1642 |
-
"output_type": "execute_result"
|
| 1643 |
-
}
|
| 1644 |
-
],
|
| 1645 |
-
"source": [
|
| 1646 |
-
"eol_cols = list(pot_imgs.columns)[1:4] + list(pot_imgs.columns)[9:]\n",
|
| 1647 |
-
"\n",
|
| 1648 |
-
"pot_imgs = pot_imgs[eol_cols]\n",
|
| 1649 |
-
"\n",
|
| 1650 |
-
"#compare to catalog sciNames\n",
|
| 1651 |
-
"eol_catalog[\"sciName\"] = eol_catalog[\"genus\"] + \" \" + eol_catalog[\"species\"]\n",
|
| 1652 |
-
"\n",
|
| 1653 |
-
"overlap_sciNames = pd.merge(pot_imgs, eol_catalog[eol_cols[:-1]], on = \"sciName\", how = \"inner\")\n",
|
| 1654 |
-
"overlap_sciNames.shape"
|
| 1655 |
-
]
|
| 1656 |
-
},
|
| 1657 |
-
{
|
| 1658 |
-
"cell_type": "code",
|
| 1659 |
-
"execution_count": 58,
|
| 1660 |
-
"metadata": {},
|
| 1661 |
-
"outputs": [
|
| 1662 |
-
{
|
| 1663 |
-
"data": {
|
| 1664 |
-
"text/plain": [
|
| 1665 |
-
"treeoflife_id_x 3994\n",
|
| 1666 |
-
"eol_content_id_x 3994\n",
|
| 1667 |
-
"eol_page_id_x 402\n",
|
| 1668 |
-
"kingdom_x 2\n",
|
| 1669 |
-
"phylum_x 6\n",
|
| 1670 |
-
"class_x 15\n",
|
| 1671 |
-
"order_x 81\n",
|
| 1672 |
-
"family_x 192\n",
|
| 1673 |
-
"genus_x 320\n",
|
| 1674 |
-
"species_x 390\n",
|
| 1675 |
-
"common_x 402\n",
|
| 1676 |
-
"sciName 402\n",
|
| 1677 |
-
"duplicate 2\n",
|
| 1678 |
-
"treeoflife_id_y 28738\n",
|
| 1679 |
-
"eol_content_id_y 28738\n",
|
| 1680 |
-
"eol_page_id_y 444\n",
|
| 1681 |
-
"kingdom_y 2\n",
|
| 1682 |
-
"phylum_y 6\n",
|
| 1683 |
-
"class_y 15\n",
|
| 1684 |
-
"order_y 81\n",
|
| 1685 |
-
"family_y 192\n",
|
| 1686 |
-
"genus_y 320\n",
|
| 1687 |
-
"species_y 390\n",
|
| 1688 |
-
"common_y 402\n",
|
| 1689 |
-
"dtype: int64"
|
| 1690 |
-
]
|
| 1691 |
-
},
|
| 1692 |
-
"execution_count": 58,
|
| 1693 |
-
"metadata": {},
|
| 1694 |
-
"output_type": "execute_result"
|
| 1695 |
-
}
|
| 1696 |
-
],
|
| 1697 |
-
"source": [
|
| 1698 |
-
"overlap_sciNames.nunique()"
|
| 1699 |
-
]
|
| 1700 |
-
},
|
| 1701 |
-
{
|
| 1702 |
-
"cell_type": "markdown",
|
| 1703 |
-
"metadata": {},
|
| 1704 |
-
"source": [
|
| 1705 |
-
"Here are our other 402 species, so we didn't hold out anything but the 400 chosen.\n",
|
| 1706 |
-
"\n",
|
| 1707 |
-
"We're stuck with less images for some of them unless we source images from elsewhere."
|
| 1708 |
]
|
| 1709 |
},
|
| 1710 |
{
|
|
@@ -1734,7 +1588,7 @@
|
|
| 1734 |
"name": "python",
|
| 1735 |
"nbconvert_exporter": "python",
|
| 1736 |
"pygments_lexer": "ipython3",
|
| 1737 |
-
"version": "3.11.
|
| 1738 |
}
|
| 1739 |
},
|
| 1740 |
"nbformat": 4,
|
|
|
|
| 9 |
"import pandas as pd"
|
| 10 |
]
|
| 11 |
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "code",
|
| 14 |
+
"execution_count": 2,
|
| 15 |
+
"metadata": {},
|
| 16 |
+
"outputs": [],
|
| 17 |
+
"source": [
|
| 18 |
+
"RS_FILEPATH = \"../../rare_species/data/\""
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
{
|
| 22 |
"cell_type": "markdown",
|
| 23 |
"metadata": {},
|
| 24 |
"source": [
|
| 25 |
+
"### Read in Links CSV file\n",
|
| 26 |
+
"\n",
|
| 27 |
+
"Full cargo archive has some more content than the [original `links_manifest_cargo_on_md5.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_manifest_cargo_on_md5.csv)."
|
| 28 |
]
|
| 29 |
},
|
| 30 |
{
|
| 31 |
"cell_type": "code",
|
| 32 |
+
"execution_count": 3,
|
| 33 |
"metadata": {},
|
| 34 |
"outputs": [],
|
| 35 |
"source": [
|
| 36 |
+
"links_manifest_cargo = pd.read_csv(\"../data/eol-cargo-archive_combined-manifest-checksums_links.csv\", low_memory=False)"
|
| 37 |
]
|
| 38 |
},
|
| 39 |
{
|
| 40 |
"cell_type": "code",
|
| 41 |
+
"execution_count": 4,
|
| 42 |
"metadata": {},
|
| 43 |
"outputs": [
|
| 44 |
{
|
|
|
|
| 46 |
"output_type": "stream",
|
| 47 |
"text": [
|
| 48 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 49 |
+
"RangeIndex: 7514001 entries, 0 to 7514000\n",
|
| 50 |
+
"Data columns (total 17 columns):\n",
|
| 51 |
+
" # Column Non-Null Count Dtype \n",
|
| 52 |
+
"--- ------ -------------- ----- \n",
|
| 53 |
+
" 0 filename_archive 7514001 non-null object\n",
|
| 54 |
+
" 1 md5_archive 7514001 non-null object\n",
|
| 55 |
+
" 2 combined_id_archive 7514001 non-null object\n",
|
| 56 |
+
" 3 filename_manifest 7514001 non-null object\n",
|
| 57 |
+
" 4 md5_combined_manifest 7514001 non-null object\n",
|
| 58 |
+
" 5 combined_id_manifest_redownload 7514001 non-null object\n",
|
| 59 |
+
" 6 eol_content_id 7514001 non-null int64 \n",
|
| 60 |
+
" 7 eol_page_id 7514001 non-null int64 \n",
|
| 61 |
+
" 8 medium_source_url 7514001 non-null object\n",
|
| 62 |
+
" 9 eol_full_size_copy_url 7514001 non-null object\n",
|
| 63 |
+
" 10 license_name 7514001 non-null object\n",
|
| 64 |
+
" 11 copyright_owner 6860825 non-null object\n",
|
| 65 |
+
" 12 expected_image_filename 7514001 non-null object\n",
|
| 66 |
+
" 13 source_0706 7514001 non-null bool \n",
|
| 67 |
+
" 14 source_0726 7514001 non-null bool \n",
|
| 68 |
+
" 15 source_1206 7514001 non-null bool \n",
|
| 69 |
+
" 16 combined_id_full_manifest 7514001 non-null object\n",
|
| 70 |
+
"dtypes: bool(3), int64(2), object(12)\n",
|
| 71 |
+
"memory usage: 824.1+ MB\n"
|
| 72 |
]
|
| 73 |
}
|
| 74 |
],
|
|
|
|
| 85 |
},
|
| 86 |
{
|
| 87 |
"cell_type": "code",
|
| 88 |
+
"execution_count": 5,
|
| 89 |
"metadata": {},
|
| 90 |
"outputs": [
|
| 91 |
{
|
|
|
|
| 114 |
}
|
| 115 |
],
|
| 116 |
"source": [
|
| 117 |
+
"rs_catalog = pd.read_csv(RS_FILEPATH + \"rarespecies-catalog.csv\",\n",
|
| 118 |
" low_memory=False,\n",
|
| 119 |
" dtype = {\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 120 |
"rs_catalog.info(show_counts = True)"
|
|
|
|
| 122 |
},
|
| 123 |
{
|
| 124 |
"cell_type": "code",
|
| 125 |
+
"execution_count": 6,
|
| 126 |
"metadata": {},
|
| 127 |
"outputs": [],
|
| 128 |
"source": [
|
|
|
|
| 132 |
},
|
| 133 |
{
|
| 134 |
"cell_type": "code",
|
| 135 |
+
"execution_count": 7,
|
| 136 |
"metadata": {},
|
| 137 |
"outputs": [
|
| 138 |
{
|
|
|
|
| 141 |
"text": [
|
| 142 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 143 |
"RangeIndex: 12552 entries, 0 to 12551\n",
|
| 144 |
+
"Data columns (total 29 columns):\n",
|
| 145 |
+
" # Column Non-Null Count Dtype \n",
|
| 146 |
+
"--- ------ -------------- ----- \n",
|
| 147 |
+
" 0 rarespecies_id 12552 non-null object\n",
|
| 148 |
+
" 1 eol_content_id_rs 12552 non-null int64 \n",
|
| 149 |
+
" 2 eol_page_id_rs 12552 non-null int64 \n",
|
| 150 |
+
" 3 kingdom 12552 non-null object\n",
|
| 151 |
+
" 4 phylum 12552 non-null object\n",
|
| 152 |
+
" 5 class 12552 non-null object\n",
|
| 153 |
+
" 6 order 12552 non-null object\n",
|
| 154 |
+
" 7 family 12552 non-null object\n",
|
| 155 |
+
" 8 genus 12552 non-null object\n",
|
| 156 |
+
" 9 species 12552 non-null object\n",
|
| 157 |
+
" 10 sciName 12552 non-null object\n",
|
| 158 |
+
" 11 combined_id_rs 12552 non-null object\n",
|
| 159 |
+
" 12 filename_archive 12552 non-null object\n",
|
| 160 |
+
" 13 md5_archive 12552 non-null object\n",
|
| 161 |
+
" 14 combined_id_archive 12552 non-null object\n",
|
| 162 |
+
" 15 filename_manifest 12552 non-null object\n",
|
| 163 |
+
" 16 md5_combined_manifest 12552 non-null object\n",
|
| 164 |
+
" 17 combined_id_manifest_redownload 12552 non-null object\n",
|
| 165 |
+
" 18 eol_content_id 12552 non-null int64 \n",
|
| 166 |
+
" 19 eol_page_id 12552 non-null int64 \n",
|
| 167 |
+
" 20 medium_source_url 12552 non-null object\n",
|
| 168 |
+
" 21 eol_full_size_copy_url 12552 non-null object\n",
|
| 169 |
+
" 22 license_name 12552 non-null object\n",
|
| 170 |
+
" 23 copyright_owner 11171 non-null object\n",
|
| 171 |
+
" 24 expected_image_filename 12552 non-null object\n",
|
| 172 |
+
" 25 source_0706 12552 non-null bool \n",
|
| 173 |
+
" 26 source_0726 12552 non-null bool \n",
|
| 174 |
+
" 27 source_1206 12552 non-null bool \n",
|
| 175 |
+
" 28 combined_id_full_manifest 12552 non-null object\n",
|
| 176 |
+
"dtypes: bool(3), int64(4), object(22)\n",
|
| 177 |
+
"memory usage: 2.5+ MB\n"
|
| 178 |
]
|
| 179 |
}
|
| 180 |
],
|
|
|
|
| 182 |
"rs_links = pd.merge(rs_catalog,\n",
|
| 183 |
" links_manifest_cargo,\n",
|
| 184 |
" left_on = \"combined_id_rs\",\n",
|
| 185 |
+
" right_on = \"combined_id_archive\", # merge on archive (replaced cargo)\n",
|
| 186 |
" how = \"inner\")\n",
|
| 187 |
"rs_links.info(show_counts = True)"
|
| 188 |
]
|
| 189 |
},
|
| 190 |
{
|
| 191 |
"cell_type": "code",
|
| 192 |
+
"execution_count": 8,
|
| 193 |
"metadata": {},
|
| 194 |
"outputs": [
|
| 195 |
{
|
| 196 |
"data": {
|
| 197 |
"text/plain": [
|
| 198 |
+
"rarespecies_id 11826\n",
|
| 199 |
+
"eol_content_id_rs 11826\n",
|
| 200 |
+
"eol_page_id_rs 400\n",
|
| 201 |
+
"kingdom 1\n",
|
| 202 |
+
"phylum 5\n",
|
| 203 |
+
"class 15\n",
|
| 204 |
+
"order 85\n",
|
| 205 |
+
"family 202\n",
|
| 206 |
+
"genus 316\n",
|
| 207 |
+
"species 385\n",
|
| 208 |
+
"sciName 400\n",
|
| 209 |
+
"combined_id_rs 11826\n",
|
| 210 |
+
"filename_archive 11826\n",
|
| 211 |
+
"md5_archive 11663\n",
|
| 212 |
+
"combined_id_archive 11826\n",
|
| 213 |
+
"filename_manifest 12221\n",
|
| 214 |
+
"md5_combined_manifest 11663\n",
|
| 215 |
+
"combined_id_manifest_redownload 12221\n",
|
| 216 |
+
"eol_content_id 12221\n",
|
| 217 |
+
"eol_page_id 447\n",
|
| 218 |
+
"medium_source_url 12056\n",
|
| 219 |
+
"eol_full_size_copy_url 12119\n",
|
| 220 |
+
"license_name 15\n",
|
| 221 |
+
"copyright_owner 3724\n",
|
| 222 |
+
"expected_image_filename 12221\n",
|
| 223 |
+
"source_0706 2\n",
|
| 224 |
+
"source_0726 2\n",
|
| 225 |
+
"source_1206 2\n",
|
| 226 |
+
"combined_id_full_manifest 12221\n",
|
| 227 |
"dtype: int64"
|
| 228 |
]
|
| 229 |
},
|
| 230 |
+
"execution_count": 8,
|
| 231 |
"metadata": {},
|
| 232 |
"output_type": "execute_result"
|
| 233 |
}
|
|
|
|
| 236 |
"rs_links.nunique()"
|
| 237 |
]
|
| 238 |
},
|
| 239 |
+
{
|
| 240 |
+
"cell_type": "markdown",
|
| 241 |
+
"metadata": {},
|
| 242 |
+
"source": [
|
| 243 |
+
"All these numbers match our check with the cargo file."
|
| 244 |
+
]
|
| 245 |
+
},
|
| 246 |
{
|
| 247 |
"cell_type": "markdown",
|
| 248 |
"metadata": {},
|
|
|
|
| 252 |
},
|
| 253 |
{
|
| 254 |
"cell_type": "code",
|
| 255 |
+
"execution_count": 9,
|
| 256 |
"metadata": {},
|
| 257 |
"outputs": [
|
| 258 |
{
|
|
|
|
| 261 |
"11826"
|
| 262 |
]
|
| 263 |
},
|
| 264 |
+
"execution_count": 9,
|
| 265 |
"metadata": {},
|
| 266 |
"output_type": "execute_result"
|
| 267 |
}
|
|
|
|
| 273 |
},
|
| 274 |
{
|
| 275 |
"cell_type": "code",
|
| 276 |
+
"execution_count": 10,
|
| 277 |
"metadata": {},
|
| 278 |
"outputs": [
|
| 279 |
{
|
|
|
|
| 285 |
" '29975068_45509269']"
|
| 286 |
]
|
| 287 |
},
|
| 288 |
+
"execution_count": 10,
|
| 289 |
"metadata": {},
|
| 290 |
"output_type": "execute_result"
|
| 291 |
}
|
|
|
|
| 296 |
},
|
| 297 |
{
|
| 298 |
"cell_type": "code",
|
| 299 |
+
"execution_count": 11,
|
| 300 |
"metadata": {},
|
| 301 |
"outputs": [
|
| 302 |
{
|
| 303 |
"data": {
|
| 304 |
"text/plain": [
|
| 305 |
+
"7687 21071827_355546\n",
|
| 306 |
+
"6923 27808045_46570095\n",
|
| 307 |
+
"7019 20599607_45513966\n",
|
| 308 |
+
"873 28902910_311199\n",
|
| 309 |
"Name: combined_id_rs, dtype: object"
|
| 310 |
]
|
| 311 |
},
|
| 312 |
+
"execution_count": 11,
|
| 313 |
"metadata": {},
|
| 314 |
"output_type": "execute_result"
|
| 315 |
}
|
|
|
|
| 320 |
},
|
| 321 |
{
|
| 322 |
"cell_type": "code",
|
| 323 |
+
"execution_count": 12,
|
| 324 |
"metadata": {},
|
| 325 |
"outputs": [
|
| 326 |
{
|
|
|
|
| 356 |
},
|
| 357 |
{
|
| 358 |
"cell_type": "code",
|
| 359 |
+
"execution_count": 13,
|
| 360 |
"metadata": {},
|
| 361 |
"outputs": [
|
| 362 |
{
|
|
|
|
| 377 |
"dtype: int64"
|
| 378 |
]
|
| 379 |
},
|
| 380 |
+
"execution_count": 13,
|
| 381 |
"metadata": {},
|
| 382 |
"output_type": "execute_result"
|
| 383 |
}
|
|
|
|
| 388 |
},
|
| 389 |
{
|
| 390 |
"cell_type": "code",
|
| 391 |
+
"execution_count": 14,
|
| 392 |
"metadata": {},
|
| 393 |
"outputs": [
|
| 394 |
{
|
|
|
|
| 432 |
"Name: count, dtype: int64"
|
| 433 |
]
|
| 434 |
},
|
| 435 |
+
"execution_count": 14,
|
| 436 |
"metadata": {},
|
| 437 |
"output_type": "execute_result"
|
| 438 |
}
|
|
|
|
| 443 |
},
|
| 444 |
{
|
| 445 |
"cell_type": "code",
|
| 446 |
+
"execution_count": 15,
|
| 447 |
"metadata": {},
|
| 448 |
"outputs": [],
|
| 449 |
"source": [
|
|
|
|
| 457 |
},
|
| 458 |
{
|
| 459 |
"cell_type": "code",
|
| 460 |
+
"execution_count": 16,
|
| 461 |
"metadata": {},
|
| 462 |
"outputs": [
|
| 463 |
{
|
|
|
|
| 471 |
" array([46560546])]"
|
| 472 |
]
|
| 473 |
},
|
| 474 |
+
"execution_count": 16,
|
| 475 |
"metadata": {},
|
| 476 |
"output_type": "execute_result"
|
| 477 |
}
|
|
|
|
| 485 |
},
|
| 486 |
{
|
| 487 |
"cell_type": "code",
|
| 488 |
+
"execution_count": 17,
|
| 489 |
"metadata": {},
|
| 490 |
"outputs": [
|
| 491 |
{
|
|
|
|
| 499 |
" (46560546, 24)]"
|
| 500 |
]
|
| 501 |
},
|
| 502 |
+
"execution_count": 17,
|
| 503 |
"metadata": {},
|
| 504 |
"output_type": "execute_result"
|
| 505 |
}
|
|
|
|
| 522 |
},
|
| 523 |
{
|
| 524 |
"cell_type": "code",
|
| 525 |
+
"execution_count": 18,
|
| 526 |
"metadata": {},
|
| 527 |
"outputs": [
|
| 528 |
{
|
|
|
|
| 562 |
" </thead>\n",
|
| 563 |
" <tbody>\n",
|
| 564 |
" <tr>\n",
|
| 565 |
+
" <th>1413</th>\n",
|
| 566 |
+
" <td>d239159f-cb15-4c30-8aeb-d8177f8cf34a</td>\n",
|
| 567 |
+
" <td>30098492</td>\n",
|
| 568 |
" <td>205909</td>\n",
|
| 569 |
" <td>Animalia</td>\n",
|
| 570 |
" <td>Chordata</td>\n",
|
|
|
|
| 574 |
" <td>Scaphirhynchus</td>\n",
|
| 575 |
" <td>albus</td>\n",
|
| 576 |
" <td>Scaphirhynchus albus</td>\n",
|
| 577 |
+
" <td>30098492_205909</td>\n",
|
| 578 |
" </tr>\n",
|
| 579 |
" <tr>\n",
|
| 580 |
+
" <th>7619</th>\n",
|
| 581 |
+
" <td>4d7436d1-82de-416b-8a51-6452efd45f44</td>\n",
|
| 582 |
+
" <td>30098515</td>\n",
|
| 583 |
" <td>205909</td>\n",
|
| 584 |
" <td>Animalia</td>\n",
|
| 585 |
" <td>Chordata</td>\n",
|
|
|
|
| 589 |
" <td>Scaphirhynchus</td>\n",
|
| 590 |
" <td>albus</td>\n",
|
| 591 |
" <td>Scaphirhynchus albus</td>\n",
|
| 592 |
+
" <td>30098515_205909</td>\n",
|
| 593 |
" </tr>\n",
|
| 594 |
" <tr>\n",
|
| 595 |
" <th>7916</th>\n",
|
|
|
|
| 607 |
" <td>30098499_205909</td>\n",
|
| 608 |
" </tr>\n",
|
| 609 |
" <tr>\n",
|
| 610 |
+
" <th>11026</th>\n",
|
| 611 |
+
" <td>a9560f41-403d-46a0-a92a-9694cceffe96</td>\n",
|
| 612 |
+
" <td>30098523</td>\n",
|
| 613 |
" <td>205909</td>\n",
|
| 614 |
" <td>Animalia</td>\n",
|
| 615 |
" <td>Chordata</td>\n",
|
|
|
|
| 619 |
" <td>Scaphirhynchus</td>\n",
|
| 620 |
" <td>albus</td>\n",
|
| 621 |
" <td>Scaphirhynchus albus</td>\n",
|
| 622 |
+
" <td>30098523_205909</td>\n",
|
| 623 |
" </tr>\n",
|
| 624 |
" <tr>\n",
|
| 625 |
+
" <th>193</th>\n",
|
| 626 |
+
" <td>ba2857c7-f02d-44f9-a116-8a450dc53e14</td>\n",
|
| 627 |
+
" <td>30098516</td>\n",
|
| 628 |
" <td>205909</td>\n",
|
| 629 |
" <td>Animalia</td>\n",
|
| 630 |
" <td>Chordata</td>\n",
|
|
|
|
| 634 |
" <td>Scaphirhynchus</td>\n",
|
| 635 |
" <td>albus</td>\n",
|
| 636 |
" <td>Scaphirhynchus albus</td>\n",
|
| 637 |
+
" <td>30098516_205909</td>\n",
|
| 638 |
" </tr>\n",
|
| 639 |
" </tbody>\n",
|
| 640 |
"</table>\n",
|
| 641 |
"</div>"
|
| 642 |
],
|
| 643 |
"text/plain": [
|
| 644 |
+
" rarespecies_id eol_content_id_rs \\\n",
|
| 645 |
+
"1413 d239159f-cb15-4c30-8aeb-d8177f8cf34a 30098492 \n",
|
| 646 |
+
"7619 4d7436d1-82de-416b-8a51-6452efd45f44 30098515 \n",
|
| 647 |
+
"7916 2d342a7c-7e0c-4981-9630-019bb90183be 30098499 \n",
|
| 648 |
+
"11026 a9560f41-403d-46a0-a92a-9694cceffe96 30098523 \n",
|
| 649 |
+
"193 ba2857c7-f02d-44f9-a116-8a450dc53e14 30098516 \n",
|
| 650 |
"\n",
|
| 651 |
+
" eol_page_id_rs kingdom phylum class order \\\n",
|
| 652 |
+
"1413 205909 Animalia Chordata Actinopterygii Acipenseriformes \n",
|
| 653 |
+
"7619 205909 Animalia Chordata Actinopterygii Acipenseriformes \n",
|
| 654 |
+
"7916 205909 Animalia Chordata Actinopterygii Acipenseriformes \n",
|
| 655 |
+
"11026 205909 Animalia Chordata Actinopterygii Acipenseriformes \n",
|
| 656 |
+
"193 205909 Animalia Chordata Actinopterygii Acipenseriformes \n",
|
| 657 |
"\n",
|
| 658 |
+
" family genus species sciName \\\n",
|
| 659 |
+
"1413 Acipenseridae Scaphirhynchus albus Scaphirhynchus albus \n",
|
| 660 |
+
"7619 Acipenseridae Scaphirhynchus albus Scaphirhynchus albus \n",
|
| 661 |
+
"7916 Acipenseridae Scaphirhynchus albus Scaphirhynchus albus \n",
|
| 662 |
+
"11026 Acipenseridae Scaphirhynchus albus Scaphirhynchus albus \n",
|
| 663 |
+
"193 Acipenseridae Scaphirhynchus albus Scaphirhynchus albus \n",
|
| 664 |
+
"\n",
|
| 665 |
+
" combined_id_rs \n",
|
| 666 |
+
"1413 30098492_205909 \n",
|
| 667 |
+
"7619 30098515_205909 \n",
|
| 668 |
+
"7916 30098499_205909 \n",
|
| 669 |
+
"11026 30098523_205909 \n",
|
| 670 |
+
"193 30098516_205909 "
|
| 671 |
]
|
| 672 |
},
|
| 673 |
+
"execution_count": 18,
|
| 674 |
"metadata": {},
|
| 675 |
"output_type": "execute_result"
|
| 676 |
}
|
|
|
|
| 689 |
},
|
| 690 |
{
|
| 691 |
"cell_type": "code",
|
| 692 |
+
"execution_count": 19,
|
| 693 |
"metadata": {},
|
| 694 |
"outputs": [
|
| 695 |
{
|
|
|
|
| 729 |
" </thead>\n",
|
| 730 |
" <tbody>\n",
|
| 731 |
" <tr>\n",
|
| 732 |
+
" <th>9702</th>\n",
|
| 733 |
+
" <td>92da8fa4-fb94-42b3-9483-86d2672d6644</td>\n",
|
| 734 |
+
" <td>27648165</td>\n",
|
| 735 |
" <td>46560546</td>\n",
|
| 736 |
" <td>Animalia</td>\n",
|
| 737 |
" <td>Chordata</td>\n",
|
|
|
|
| 741 |
" <td>Raja</td>\n",
|
| 742 |
" <td>asterias</td>\n",
|
| 743 |
" <td>Raja asterias</td>\n",
|
| 744 |
+
" <td>27648165_46560546</td>\n",
|
| 745 |
" </tr>\n",
|
| 746 |
" <tr>\n",
|
| 747 |
+
" <th>3655</th>\n",
|
| 748 |
+
" <td>12633820-3a3a-4c77-bd38-7221bd18b747</td>\n",
|
| 749 |
+
" <td>27648157</td>\n",
|
| 750 |
" <td>46560546</td>\n",
|
| 751 |
" <td>Animalia</td>\n",
|
| 752 |
" <td>Chordata</td>\n",
|
|
|
|
| 756 |
" <td>Raja</td>\n",
|
| 757 |
" <td>asterias</td>\n",
|
| 758 |
" <td>Raja asterias</td>\n",
|
| 759 |
+
" <td>27648157_46560546</td>\n",
|
| 760 |
" </tr>\n",
|
| 761 |
" <tr>\n",
|
| 762 |
+
" <th>2025</th>\n",
|
| 763 |
+
" <td>6cb50905-48ee-4770-9605-91a95e3d027c</td>\n",
|
| 764 |
+
" <td>27648159</td>\n",
|
| 765 |
" <td>46560546</td>\n",
|
| 766 |
" <td>Animalia</td>\n",
|
| 767 |
" <td>Chordata</td>\n",
|
|
|
|
| 771 |
" <td>Raja</td>\n",
|
| 772 |
" <td>asterias</td>\n",
|
| 773 |
" <td>Raja asterias</td>\n",
|
| 774 |
+
" <td>27648159_46560546</td>\n",
|
| 775 |
" </tr>\n",
|
| 776 |
" <tr>\n",
|
| 777 |
+
" <th>1358</th>\n",
|
| 778 |
+
" <td>d436ec20-202d-44ec-9081-ca59afef356f</td>\n",
|
| 779 |
+
" <td>27648166</td>\n",
|
| 780 |
" <td>46560546</td>\n",
|
| 781 |
" <td>Animalia</td>\n",
|
| 782 |
" <td>Chordata</td>\n",
|
|
|
|
| 786 |
" <td>Raja</td>\n",
|
| 787 |
" <td>asterias</td>\n",
|
| 788 |
" <td>Raja asterias</td>\n",
|
| 789 |
+
" <td>27648166_46560546</td>\n",
|
| 790 |
" </tr>\n",
|
| 791 |
" <tr>\n",
|
| 792 |
+
" <th>6574</th>\n",
|
| 793 |
+
" <td>a7c43306-6a3a-4d94-b7f0-147ad9f20a73</td>\n",
|
| 794 |
+
" <td>27648160</td>\n",
|
| 795 |
" <td>46560546</td>\n",
|
| 796 |
" <td>Animalia</td>\n",
|
| 797 |
" <td>Chordata</td>\n",
|
|
|
|
| 801 |
" <td>Raja</td>\n",
|
| 802 |
" <td>asterias</td>\n",
|
| 803 |
" <td>Raja asterias</td>\n",
|
| 804 |
+
" <td>27648160_46560546</td>\n",
|
| 805 |
" </tr>\n",
|
| 806 |
" </tbody>\n",
|
| 807 |
"</table>\n",
|
|
|
|
| 809 |
],
|
| 810 |
"text/plain": [
|
| 811 |
" rarespecies_id eol_content_id_rs eol_page_id_rs \\\n",
|
| 812 |
+
"9702 92da8fa4-fb94-42b3-9483-86d2672d6644 27648165 46560546 \n",
|
| 813 |
"3655 12633820-3a3a-4c77-bd38-7221bd18b747 27648157 46560546 \n",
|
| 814 |
+
"2025 6cb50905-48ee-4770-9605-91a95e3d027c 27648159 46560546 \n",
|
|
|
|
|
|
|
| 815 |
"1358 d436ec20-202d-44ec-9081-ca59afef356f 27648166 46560546 \n",
|
| 816 |
+
"6574 a7c43306-6a3a-4d94-b7f0-147ad9f20a73 27648160 46560546 \n",
|
| 817 |
"\n",
|
| 818 |
" kingdom phylum class order family genus species \\\n",
|
| 819 |
+
"9702 Animalia Chordata Chondrichthyes Rajiformes Rajidae Raja asterias \n",
|
| 820 |
"3655 Animalia Chordata Chondrichthyes Rajiformes Rajidae Raja asterias \n",
|
| 821 |
+
"2025 Animalia Chordata Chondrichthyes Rajiformes Rajidae Raja asterias \n",
|
|
|
|
|
|
|
| 822 |
"1358 Animalia Chordata Chondrichthyes Rajiformes Rajidae Raja asterias \n",
|
| 823 |
+
"6574 Animalia Chordata Chondrichthyes Rajiformes Rajidae Raja asterias \n",
|
| 824 |
"\n",
|
| 825 |
" sciName combined_id_rs \n",
|
| 826 |
+
"9702 Raja asterias 27648165_46560546 \n",
|
| 827 |
"3655 Raja asterias 27648157_46560546 \n",
|
| 828 |
+
"2025 Raja asterias 27648159_46560546 \n",
|
| 829 |
+
"1358 Raja asterias 27648166_46560546 \n",
|
| 830 |
+
"6574 Raja asterias 27648160_46560546 "
|
|
|
|
| 831 |
]
|
| 832 |
},
|
| 833 |
+
"execution_count": 19,
|
| 834 |
"metadata": {},
|
| 835 |
"output_type": "execute_result"
|
| 836 |
}
|
|
|
|
| 848 |
},
|
| 849 |
{
|
| 850 |
"cell_type": "code",
|
| 851 |
+
"execution_count": 20,
|
| 852 |
+
"metadata": {},
|
| 853 |
+
"outputs": [],
|
| 854 |
+
"source": [
|
| 855 |
+
"def get_archive_content(combined_id):\n",
|
| 856 |
+
" return combined_id.split(\"_\")[0]"
|
| 857 |
+
]
|
| 858 |
+
},
|
| 859 |
+
{
|
| 860 |
+
"cell_type": "code",
|
| 861 |
+
"execution_count": 21,
|
| 862 |
+
"metadata": {},
|
| 863 |
+
"outputs": [],
|
| 864 |
+
"source": [
|
| 865 |
+
"links_manifest_cargo[\"eol_content_id_archive\"] = links_manifest_cargo[\"combined_id_archive\"].apply(get_archive_content)"
|
| 866 |
+
]
|
| 867 |
+
},
|
| 868 |
+
{
|
| 869 |
+
"cell_type": "code",
|
| 870 |
+
"execution_count": 22,
|
| 871 |
"metadata": {},
|
| 872 |
"outputs": [
|
| 873 |
{
|
|
|
|
| 891 |
" <thead>\n",
|
| 892 |
" <tr style=\"text-align: right;\">\n",
|
| 893 |
" <th></th>\n",
|
| 894 |
+
" <th>filename_archive</th>\n",
|
| 895 |
+
" <th>md5_archive</th>\n",
|
| 896 |
+
" <th>combined_id_archive</th>\n",
|
| 897 |
+
" <th>filename_manifest</th>\n",
|
| 898 |
+
" <th>md5_combined_manifest</th>\n",
|
| 899 |
+
" <th>combined_id_manifest_redownload</th>\n",
|
| 900 |
" <th>eol_content_id</th>\n",
|
| 901 |
" <th>eol_page_id</th>\n",
|
| 902 |
" <th>medium_source_url</th>\n",
|
|
|
|
| 907 |
" <th>source_0706</th>\n",
|
| 908 |
" <th>source_0726</th>\n",
|
| 909 |
" <th>source_1206</th>\n",
|
| 910 |
+
" <th>combined_id_full_manifest</th>\n",
|
| 911 |
+
" <th>eol_content_id_archive</th>\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 912 |
" </tr>\n",
|
| 913 |
" </thead>\n",
|
| 914 |
" <tbody>\n",
|
|
|
|
| 918 |
],
|
| 919 |
"text/plain": [
|
| 920 |
"Empty DataFrame\n",
|
| 921 |
+
"Columns: [filename_archive, md5_archive, combined_id_archive, filename_manifest, md5_combined_manifest, combined_id_manifest_redownload, eol_content_id, eol_page_id, medium_source_url, eol_full_size_copy_url, license_name, copyright_owner, expected_image_filename, source_0706, source_0726, source_1206, combined_id_full_manifest, eol_content_id_archive]\n",
|
| 922 |
"Index: []"
|
| 923 |
]
|
| 924 |
},
|
| 925 |
+
"execution_count": 22,
|
| 926 |
"metadata": {},
|
| 927 |
"output_type": "execute_result"
|
| 928 |
}
|
| 929 |
],
|
| 930 |
"source": [
|
| 931 |
"# check if content IDs get recycled, content ID: 27648165, now online as: 30223317\n",
|
| 932 |
+
"# is eol_content_id the archive content ID?\n",
|
| 933 |
+
"links_manifest_cargo.loc[links_manifest_cargo[\"eol_content_id_archive\"] == 30223317]"
|
| 934 |
]
|
| 935 |
},
|
| 936 |
{
|
| 937 |
"cell_type": "code",
|
| 938 |
+
"execution_count": 23,
|
| 939 |
"metadata": {},
|
| 940 |
"outputs": [
|
| 941 |
{
|
|
|
|
| 959 |
" <thead>\n",
|
| 960 |
" <tr style=\"text-align: right;\">\n",
|
| 961 |
" <th></th>\n",
|
| 962 |
+
" <th>filename_archive</th>\n",
|
| 963 |
+
" <th>md5_archive</th>\n",
|
| 964 |
+
" <th>combined_id_archive</th>\n",
|
| 965 |
+
" <th>filename_manifest</th>\n",
|
| 966 |
+
" <th>md5_combined_manifest</th>\n",
|
| 967 |
+
" <th>combined_id_manifest_redownload</th>\n",
|
| 968 |
" <th>eol_content_id</th>\n",
|
| 969 |
" <th>eol_page_id</th>\n",
|
| 970 |
" <th>medium_source_url</th>\n",
|
|
|
|
| 975 |
" <th>source_0706</th>\n",
|
| 976 |
" <th>source_0726</th>\n",
|
| 977 |
" <th>source_1206</th>\n",
|
| 978 |
+
" <th>combined_id_full_manifest</th>\n",
|
| 979 |
+
" <th>eol_content_id_archive</th>\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 980 |
" </tr>\n",
|
| 981 |
" </thead>\n",
|
| 982 |
" <tbody>\n",
|
|
|
|
| 986 |
],
|
| 987 |
"text/plain": [
|
| 988 |
"Empty DataFrame\n",
|
| 989 |
+
"Columns: [filename_archive, md5_archive, combined_id_archive, filename_manifest, md5_combined_manifest, combined_id_manifest_redownload, eol_content_id, eol_page_id, medium_source_url, eol_full_size_copy_url, license_name, copyright_owner, expected_image_filename, source_0706, source_0726, source_1206, combined_id_full_manifest, eol_content_id_archive]\n",
|
| 990 |
"Index: []"
|
| 991 |
]
|
| 992 |
},
|
| 993 |
+
"execution_count": 23,
|
| 994 |
"metadata": {},
|
| 995 |
"output_type": "execute_result"
|
| 996 |
}
|
|
|
|
| 1000 |
"links_manifest_cargo.loc[links_manifest_cargo[\"eol_content_id\"] == 30223317]"
|
| 1001 |
]
|
| 1002 |
},
|
| 1003 |
+
{
|
| 1004 |
+
"cell_type": "code",
|
| 1005 |
+
"execution_count": 24,
|
| 1006 |
+
"metadata": {},
|
| 1007 |
+
"outputs": [
|
| 1008 |
+
{
|
| 1009 |
+
"data": {
|
| 1010 |
+
"text/html": [
|
| 1011 |
+
"<div>\n",
|
| 1012 |
+
"<style scoped>\n",
|
| 1013 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1014 |
+
" vertical-align: middle;\n",
|
| 1015 |
+
" }\n",
|
| 1016 |
+
"\n",
|
| 1017 |
+
" .dataframe tbody tr th {\n",
|
| 1018 |
+
" vertical-align: top;\n",
|
| 1019 |
+
" }\n",
|
| 1020 |
+
"\n",
|
| 1021 |
+
" .dataframe thead th {\n",
|
| 1022 |
+
" text-align: right;\n",
|
| 1023 |
+
" }\n",
|
| 1024 |
+
"</style>\n",
|
| 1025 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1026 |
+
" <thead>\n",
|
| 1027 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1028 |
+
" <th></th>\n",
|
| 1029 |
+
" <th>filename_archive</th>\n",
|
| 1030 |
+
" <th>md5_archive</th>\n",
|
| 1031 |
+
" <th>combined_id_archive</th>\n",
|
| 1032 |
+
" <th>filename_manifest</th>\n",
|
| 1033 |
+
" <th>md5_combined_manifest</th>\n",
|
| 1034 |
+
" <th>combined_id_manifest_redownload</th>\n",
|
| 1035 |
+
" <th>eol_content_id</th>\n",
|
| 1036 |
+
" <th>eol_page_id</th>\n",
|
| 1037 |
+
" <th>medium_source_url</th>\n",
|
| 1038 |
+
" <th>eol_full_size_copy_url</th>\n",
|
| 1039 |
+
" <th>license_name</th>\n",
|
| 1040 |
+
" <th>copyright_owner</th>\n",
|
| 1041 |
+
" <th>expected_image_filename</th>\n",
|
| 1042 |
+
" <th>source_0706</th>\n",
|
| 1043 |
+
" <th>source_0726</th>\n",
|
| 1044 |
+
" <th>source_1206</th>\n",
|
| 1045 |
+
" <th>combined_id_full_manifest</th>\n",
|
| 1046 |
+
" <th>eol_content_id_archive</th>\n",
|
| 1047 |
+
" <th>eol_content_id_manifest</th>\n",
|
| 1048 |
+
" </tr>\n",
|
| 1049 |
+
" </thead>\n",
|
| 1050 |
+
" <tbody>\n",
|
| 1051 |
+
" </tbody>\n",
|
| 1052 |
+
"</table>\n",
|
| 1053 |
+
"</div>"
|
| 1054 |
+
],
|
| 1055 |
+
"text/plain": [
|
| 1056 |
+
"Empty DataFrame\n",
|
| 1057 |
+
"Columns: [filename_archive, md5_archive, combined_id_archive, filename_manifest, md5_combined_manifest, combined_id_manifest_redownload, eol_content_id, eol_page_id, medium_source_url, eol_full_size_copy_url, license_name, copyright_owner, expected_image_filename, source_0706, source_0726, source_1206, combined_id_full_manifest, eol_content_id_archive, eol_content_id_manifest]\n",
|
| 1058 |
+
"Index: []"
|
| 1059 |
+
]
|
| 1060 |
+
},
|
| 1061 |
+
"execution_count": 24,
|
| 1062 |
+
"metadata": {},
|
| 1063 |
+
"output_type": "execute_result"
|
| 1064 |
+
}
|
| 1065 |
+
],
|
| 1066 |
+
"source": [
|
| 1067 |
+
"# to be sure we check manifest\n",
|
| 1068 |
+
"links_manifest_cargo[\"eol_content_id_manifest\"] = links_manifest_cargo[\"combined_id_full_manifest\"].apply(get_archive_content)\n",
|
| 1069 |
+
"\n",
|
| 1070 |
+
"links_manifest_cargo.loc[links_manifest_cargo[\"eol_content_id_manifest\"] == 30223317]"
|
| 1071 |
+
]
|
| 1072 |
+
},
|
| 1073 |
{
|
| 1074 |
"cell_type": "markdown",
|
| 1075 |
"metadata": {},
|
|
|
|
| 1079 |
},
|
| 1080 |
{
|
| 1081 |
"cell_type": "code",
|
| 1082 |
+
"execution_count": 25,
|
| 1083 |
"metadata": {},
|
| 1084 |
"outputs": [],
|
| 1085 |
"source": [
|
| 1086 |
"# Save CSV of mismatched, they should be salvageable.\n",
|
| 1087 |
"# We saw these images both online and in our cargo, just with different IDs\n",
|
| 1088 |
"\n",
|
| 1089 |
+
"mismatched_rs.to_csv(\"../data/archive_mismatched_rarespecies.csv\", index=False)"
|
| 1090 |
]
|
| 1091 |
},
|
| 1092 |
{
|
|
|
|
| 1107 |
},
|
| 1108 |
{
|
| 1109 |
"cell_type": "code",
|
| 1110 |
+
"execution_count": 26,
|
| 1111 |
"metadata": {},
|
| 1112 |
"outputs": [],
|
| 1113 |
"source": [
|
| 1114 |
+
"rs_links[\"md5_dupes\"] = rs_links.duplicated(subset = \"md5_archive\", keep = \"first\")\n",
|
| 1115 |
"rs_links[\"rs_id_dupes\"] = rs_links.duplicated(subset = \"rarespecies_id\", keep = \"first\")"
|
| 1116 |
]
|
| 1117 |
},
|
| 1118 |
{
|
| 1119 |
"cell_type": "code",
|
| 1120 |
+
"execution_count": 27,
|
| 1121 |
"metadata": {},
|
| 1122 |
"outputs": [
|
| 1123 |
{
|
|
|
|
| 1128 |
"Name: count, dtype: int64"
|
| 1129 |
]
|
| 1130 |
},
|
| 1131 |
+
"execution_count": 27,
|
| 1132 |
"metadata": {},
|
| 1133 |
"output_type": "execute_result"
|
| 1134 |
}
|
|
|
|
| 1139 |
},
|
| 1140 |
{
|
| 1141 |
"cell_type": "code",
|
| 1142 |
+
"execution_count": 28,
|
| 1143 |
"metadata": {},
|
| 1144 |
"outputs": [
|
| 1145 |
{
|
|
|
|
| 1151 |
"Name: count, dtype: int64"
|
| 1152 |
]
|
| 1153 |
},
|
| 1154 |
+
"execution_count": 28,
|
| 1155 |
"metadata": {},
|
| 1156 |
"output_type": "execute_result"
|
| 1157 |
}
|
|
|
|
| 1169 |
},
|
| 1170 |
{
|
| 1171 |
"cell_type": "code",
|
| 1172 |
+
"execution_count": 29,
|
| 1173 |
"metadata": {},
|
| 1174 |
"outputs": [
|
| 1175 |
{
|
| 1176 |
"data": {
|
| 1177 |
"text/plain": [
|
| 1178 |
+
"rarespecies_id 163\n",
|
| 1179 |
+
"eol_content_id_rs 163\n",
|
| 1180 |
+
"eol_page_id_rs 80\n",
|
| 1181 |
+
"kingdom 1\n",
|
| 1182 |
+
"phylum 4\n",
|
| 1183 |
+
"class 9\n",
|
| 1184 |
+
"order 37\n",
|
| 1185 |
+
"family 56\n",
|
| 1186 |
+
"genus 73\n",
|
| 1187 |
+
"species 80\n",
|
| 1188 |
+
"sciName 80\n",
|
| 1189 |
+
"combined_id_rs 163\n",
|
| 1190 |
+
"filename_archive 163\n",
|
| 1191 |
+
"md5_archive 163\n",
|
| 1192 |
+
"combined_id_archive 163\n",
|
| 1193 |
+
"filename_manifest 163\n",
|
| 1194 |
+
"md5_combined_manifest 163\n",
|
| 1195 |
+
"combined_id_manifest_redownload 163\n",
|
| 1196 |
+
"eol_content_id 163\n",
|
| 1197 |
+
"eol_page_id 80\n",
|
| 1198 |
+
"medium_source_url 163\n",
|
| 1199 |
+
"eol_full_size_copy_url 163\n",
|
| 1200 |
+
"license_name 10\n",
|
| 1201 |
+
"copyright_owner 54\n",
|
| 1202 |
+
"expected_image_filename 163\n",
|
| 1203 |
+
"source_0706 2\n",
|
| 1204 |
+
"source_0726 2\n",
|
| 1205 |
+
"source_1206 2\n",
|
| 1206 |
+
"combined_id_full_manifest 163\n",
|
| 1207 |
+
"md5_dupes 1\n",
|
| 1208 |
+
"rs_id_dupes 1\n",
|
| 1209 |
"dtype: int64"
|
| 1210 |
]
|
| 1211 |
},
|
| 1212 |
+
"execution_count": 29,
|
| 1213 |
"metadata": {},
|
| 1214 |
"output_type": "execute_result"
|
| 1215 |
}
|
|
|
|
| 1222 |
},
|
| 1223 |
{
|
| 1224 |
"cell_type": "code",
|
| 1225 |
+
"execution_count": 30,
|
| 1226 |
"metadata": {},
|
| 1227 |
"outputs": [
|
| 1228 |
{
|
|
|
|
| 1242 |
"Name: count, dtype: int64"
|
| 1243 |
]
|
| 1244 |
},
|
| 1245 |
+
"execution_count": 30,
|
| 1246 |
"metadata": {},
|
| 1247 |
"output_type": "execute_result"
|
| 1248 |
}
|
|
|
|
| 1267 |
},
|
| 1268 |
{
|
| 1269 |
"cell_type": "code",
|
| 1270 |
+
"execution_count": 31,
|
| 1271 |
"metadata": {},
|
| 1272 |
"outputs": [
|
| 1273 |
{
|
|
|
|
| 1276 |
"[4453333, 460289, 45277122, 46561158, 1286909, 45510188, 45510548, 791049]"
|
| 1277 |
]
|
| 1278 |
},
|
| 1279 |
+
"execution_count": 31,
|
| 1280 |
"metadata": {},
|
| 1281 |
"output_type": "execute_result"
|
| 1282 |
}
|
|
|
|
| 1288 |
},
|
| 1289 |
{
|
| 1290 |
"cell_type": "code",
|
| 1291 |
+
"execution_count": 32,
|
| 1292 |
"metadata": {
|
| 1293 |
"lines_to_next_cell": 2
|
| 1294 |
},
|
|
|
|
| 1300 |
"for pg_id in rs_sci_dupe_pgs:\n",
|
| 1301 |
" num_images = links_manifest_cargo.loc[links_manifest_cargo[\"eol_page_id\"] == pg_id].shape[0]\n",
|
| 1302 |
" num_images_by_pg[pg_id] = num_images\n",
|
| 1303 |
+
" num_unique_images = links_manifest_cargo.loc[links_manifest_cargo[\"eol_page_id\"] == pg_id, \"md5_archive\"].nunique()\n",
|
| 1304 |
" num_unique_imgs_by_pg[pg_id] = num_unique_images"
|
| 1305 |
]
|
| 1306 |
},
|
| 1307 |
{
|
| 1308 |
"cell_type": "code",
|
| 1309 |
+
"execution_count": 33,
|
| 1310 |
"metadata": {},
|
| 1311 |
"outputs": [
|
| 1312 |
{
|
|
|
|
| 1315 |
"80"
|
| 1316 |
]
|
| 1317 |
},
|
| 1318 |
+
"execution_count": 33,
|
| 1319 |
"metadata": {},
|
| 1320 |
"output_type": "execute_result"
|
| 1321 |
}
|
|
|
|
| 1326 |
},
|
| 1327 |
{
|
| 1328 |
"cell_type": "code",
|
| 1329 |
+
"execution_count": 34,
|
| 1330 |
"metadata": {},
|
| 1331 |
"outputs": [
|
| 1332 |
{
|
|
|
|
| 1356 |
},
|
| 1357 |
{
|
| 1358 |
"cell_type": "code",
|
| 1359 |
+
"execution_count": 35,
|
| 1360 |
"metadata": {},
|
| 1361 |
"outputs": [
|
| 1362 |
{
|
|
|
|
| 1497 |
"4 leucoryx Oryx leucoryx 29462184_331080 "
|
| 1498 |
]
|
| 1499 |
},
|
| 1500 |
+
"execution_count": 35,
|
| 1501 |
"metadata": {},
|
| 1502 |
"output_type": "execute_result"
|
| 1503 |
}
|
|
|
|
| 1508 |
},
|
| 1509 |
{
|
| 1510 |
"cell_type": "code",
|
| 1511 |
+
"execution_count": 36,
|
| 1512 |
"metadata": {},
|
| 1513 |
"outputs": [
|
| 1514 |
{
|
| 1515 |
"data": {
|
| 1516 |
"text/plain": [
|
| 1517 |
+
"11143 28913274_330971_eol-full-size-copy.jpg\n",
|
| 1518 |
+
"8577 28895396_319982_eol-full-size-copy.jpg\n",
|
| 1519 |
+
"9267 22765674_791137_eol-full-size-copy.jpg\n",
|
| 1520 |
+
"10563 21669746_1181772_eol-full-size-copy.jpg\n",
|
| 1521 |
+
"5600 8965876_1038796_eol-full-size-copy.jpg\n",
|
| 1522 |
+
"9448 28905600_212582_eol-full-size-copy.jpg\n",
|
| 1523 |
+
"4526 21554082_1038643_eol-full-size-copy.jpg\n",
|
| 1524 |
"Name: file_name, dtype: object"
|
| 1525 |
]
|
| 1526 |
},
|
| 1527 |
+
"execution_count": 36,
|
| 1528 |
"metadata": {},
|
| 1529 |
"output_type": "execute_result"
|
| 1530 |
}
|
|
|
|
| 1536 |
},
|
| 1537 |
{
|
| 1538 |
"cell_type": "code",
|
| 1539 |
+
"execution_count": 37,
|
| 1540 |
"metadata": {},
|
| 1541 |
"outputs": [],
|
| 1542 |
"source": [
|
| 1543 |
"# save filelist for easier fetching\n",
|
| 1544 |
+
"#rs_catalog[\"file_name\"].to_csv(\"../data/rs_file_list.txt\", index = False)\n",
|
| 1545 |
+
"# Not needed now"
|
| 1546 |
]
|
| 1547 |
},
|
| 1548 |
{
|
| 1549 |
"cell_type": "markdown",
|
| 1550 |
"metadata": {},
|
| 1551 |
"source": [
|
| 1552 |
+
"Save `rs_links` to file for adjusting Rare Species images for uniqueness."
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1553 |
]
|
| 1554 |
},
|
| 1555 |
{
|
| 1556 |
"cell_type": "code",
|
| 1557 |
+
"execution_count": 38,
|
| 1558 |
"metadata": {},
|
| 1559 |
"outputs": [],
|
| 1560 |
"source": [
|
| 1561 |
+
"rs_links.to_csv(\"../data/rs_links.csv\", index = False)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1562 |
]
|
| 1563 |
},
|
| 1564 |
{
|
|
|
|
| 1588 |
"name": "python",
|
| 1589 |
"nbconvert_exporter": "python",
|
| 1590 |
"pygments_lexer": "ipython3",
|
| 1591 |
+
"version": "3.11.3"
|
| 1592 |
}
|
| 1593 |
},
|
| 1594 |
"nbformat": 4,
|
eol_realign/notebooks/links_rs_duplicates.py
CHANGED
|
@@ -16,11 +16,16 @@
|
|
| 16 |
# %%
|
| 17 |
import pandas as pd
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
# %% [markdown]
|
| 20 |
# ### Read in Links CSV file
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# %%
|
| 23 |
-
links_manifest_cargo = pd.read_csv("../data/
|
| 24 |
|
| 25 |
# %%
|
| 26 |
links_manifest_cargo.info(show_counts=True)
|
|
@@ -29,7 +34,7 @@ links_manifest_cargo.info(show_counts=True)
|
|
| 29 |
# ## Check on Rare Species Catalog
|
| 30 |
|
| 31 |
# %%
|
| 32 |
-
rs_catalog = pd.read_csv("
|
| 33 |
low_memory=False,
|
| 34 |
dtype = {"eol_content_id": "int64", "eol_page_id": "int64"})
|
| 35 |
rs_catalog.info(show_counts = True)
|
|
@@ -42,13 +47,16 @@ rs_catalog.rename(columns={'eol_content_id': 'eol_content_id_rs', 'eol_page_id':
|
|
| 42 |
rs_links = pd.merge(rs_catalog,
|
| 43 |
links_manifest_cargo,
|
| 44 |
left_on = "combined_id_rs",
|
| 45 |
-
right_on = "
|
| 46 |
how = "inner")
|
| 47 |
rs_links.info(show_counts = True)
|
| 48 |
|
| 49 |
# %%
|
| 50 |
rs_links.nunique()
|
| 51 |
|
|
|
|
|
|
|
|
|
|
| 52 |
# %% [markdown]
|
| 53 |
# Let's check the mismatched cargo/manifest entries for those last 174...
|
| 54 |
|
|
@@ -107,17 +115,33 @@ big_mismatch.loc[big_mismatch["eol_page_id_rs"] == 205909].sample(5)
|
|
| 107 |
# %%
|
| 108 |
big_mismatch.loc[big_mismatch["eol_page_id_rs"] == 46560546].sample(5)
|
| 109 |
|
|
|
|
| 110 |
# %% [markdown]
|
| 111 |
# Meanwhile, these are giving me 404's: 27648160, 27648159, 27648164, 27648161, 27648166
|
| 112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
# %%
|
| 114 |
# check if content IDs get recycled, content ID: 27648165, now online as: 30223317
|
| 115 |
-
|
|
|
|
| 116 |
|
| 117 |
# %%
|
| 118 |
# Is it in manifest?
|
| 119 |
links_manifest_cargo.loc[links_manifest_cargo["eol_content_id"] == 30223317]
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
# %% [markdown]
|
| 122 |
# This tracks with all eol content IDs being unique across manifest versions...would there be some other intermediate stage where it changed IDs _again_?!
|
| 123 |
|
|
@@ -125,7 +149,7 @@ links_manifest_cargo.loc[links_manifest_cargo["eol_content_id"] == 30223317]
|
|
| 125 |
# Save CSV of mismatched, they should be salvageable.
|
| 126 |
# We saw these images both online and in our cargo, just with different IDs
|
| 127 |
|
| 128 |
-
mismatched_rs.to_csv("../data/
|
| 129 |
|
| 130 |
# %% [markdown]
|
| 131 |
# Most of our images for some of these species are missing their metadata. For the vast majority of the species, it's just 1 or 2 images.
|
|
@@ -136,7 +160,7 @@ mismatched_rs.to_csv("../data/mismatched_rarespecies.csv", index=False)
|
|
| 136 |
# Now I want some more info on those duplicated MD5's.
|
| 137 |
|
| 138 |
# %%
|
| 139 |
-
rs_links["md5_dupes"] = rs_links.duplicated(subset = "
|
| 140 |
rs_links["rs_id_dupes"] = rs_links.duplicated(subset = "rarespecies_id", keep = "first")
|
| 141 |
|
| 142 |
# %%
|
|
@@ -173,7 +197,7 @@ num_unique_imgs_by_pg = {}
|
|
| 173 |
for pg_id in rs_sci_dupe_pgs:
|
| 174 |
num_images = links_manifest_cargo.loc[links_manifest_cargo["eol_page_id"] == pg_id].shape[0]
|
| 175 |
num_images_by_pg[pg_id] = num_images
|
| 176 |
-
num_unique_images = links_manifest_cargo.loc[links_manifest_cargo["eol_page_id"] == pg_id, "
|
| 177 |
num_unique_imgs_by_pg[pg_id] = num_unique_images
|
| 178 |
|
| 179 |
|
|
@@ -197,72 +221,13 @@ rs_catalog["file_name"].sample(7)
|
|
| 197 |
|
| 198 |
# %%
|
| 199 |
# save filelist for easier fetching
|
| 200 |
-
rs_catalog["file_name"].to_csv("../data/rs_file_list.txt", index = False)
|
| 201 |
-
|
| 202 |
-
# %% [markdown]
|
| 203 |
-
# ### Check for number of _unique_ images per species
|
| 204 |
-
#
|
| 205 |
-
# We want to see if we can replace the species that don't have at least 30 unique images per species in our rare species dataset. We need the full list of options from IUCN...We did hold out all 400?
|
| 206 |
-
#
|
| 207 |
-
# Would require going back and checking for species in predicted catalog that aren't in catalog, then comparing that to `links_manifest_cargo_on_md5`.
|
| 208 |
-
|
| 209 |
-
# %%
|
| 210 |
-
pred_cat = pd.read_csv("../../data/predicted-catalog.csv", low_memory=False)
|
| 211 |
-
catalog = pd.read_csv("../../data/data/catalog.csv", low_memory=False)
|
| 212 |
-
|
| 213 |
-
# %%
|
| 214 |
-
# process catalog
|
| 215 |
-
catalog = catalog.loc[catalog.split != "train_small"]
|
| 216 |
-
eol_catalog = catalog.loc[catalog.eol_content_id.notna()]
|
| 217 |
-
eol_catalog = eol_catalog.astype({"eol_content_id": "int64", "eol_page_id": "int64"})
|
| 218 |
-
|
| 219 |
-
# process pred-cat
|
| 220 |
-
eol_pred_cat = pred_cat.loc[pred_cat.eol_content_id.notna()]
|
| 221 |
-
eol_pred_cat = eol_pred_cat.astype({"eol_content_id": "int64", "eol_page_id": "int64"})
|
| 222 |
-
|
| 223 |
-
# %%
|
| 224 |
-
full_pred_cat = pd.merge(eol_pred_cat, eol_catalog[["treeoflife_id", "eol_content_id"]], on = "treeoflife_id", how = "left", suffixes = ("_pred", "_cat"))
|
| 225 |
-
full_pred_cat.info(show_counts = True)
|
| 226 |
-
|
| 227 |
-
# %%
|
| 228 |
-
non_cat_ids = list(full_pred_cat.loc[full_pred_cat["eol_content_id_cat"].isna(), "treeoflife_id"])
|
| 229 |
-
len(non_cat_ids)
|
| 230 |
-
|
| 231 |
-
# %%
|
| 232 |
-
pot_imgs = eol_pred_cat.loc[eol_pred_cat.treeoflife_id.isin(non_cat_ids)]
|
| 233 |
-
pot_imgs["sciName"] = pot_imgs["genus"] + " " + pot_imgs["species"]
|
| 234 |
-
pot_imgs.nunique()
|
| 235 |
|
| 236 |
# %% [markdown]
|
| 237 |
-
#
|
| 238 |
|
| 239 |
# %%
|
| 240 |
-
|
| 241 |
-
pot_imgs["duplicate"] = pot_imgs.duplicated(subset = taxa, keep = "first")
|
| 242 |
-
|
| 243 |
-
# our species count this way is num true in duplicate
|
| 244 |
-
pot_imgs.duplicate.value_counts()
|
| 245 |
-
|
| 246 |
-
# %% [markdown]
|
| 247 |
-
# Okay, so this matches up with our `sciName` count.
|
| 248 |
-
|
| 249 |
-
# %%
|
| 250 |
-
eol_cols = list(pot_imgs.columns)[1:4] + list(pot_imgs.columns)[9:]
|
| 251 |
-
|
| 252 |
-
pot_imgs = pot_imgs[eol_cols]
|
| 253 |
-
|
| 254 |
-
#compare to catalog sciNames
|
| 255 |
-
eol_catalog["sciName"] = eol_catalog["genus"] + " " + eol_catalog["species"]
|
| 256 |
-
|
| 257 |
-
overlap_sciNames = pd.merge(pot_imgs, eol_catalog[eol_cols[:-1]], on = "sciName", how = "inner")
|
| 258 |
-
overlap_sciNames.shape
|
| 259 |
-
|
| 260 |
-
# %%
|
| 261 |
-
overlap_sciNames.nunique()
|
| 262 |
-
|
| 263 |
-
# %% [markdown]
|
| 264 |
-
# Here are our other 402 species, so we didn't hold out anything but the 400 chosen.
|
| 265 |
-
#
|
| 266 |
-
# We're stuck with less images for some of them unless we source images from elsewhere.
|
| 267 |
|
| 268 |
# %%
|
|
|
|
| 16 |
# %%
|
| 17 |
import pandas as pd
|
| 18 |
|
| 19 |
+
# %%
|
| 20 |
+
RS_FILEPATH = "../../rare_species/data/"
|
| 21 |
+
|
| 22 |
# %% [markdown]
|
| 23 |
# ### Read in Links CSV file
|
| 24 |
+
#
|
| 25 |
+
# Full cargo archive has some more content than the [original `links_manifest_cargo_on_md5.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_manifest_cargo_on_md5.csv).
|
| 26 |
|
| 27 |
# %%
|
| 28 |
+
links_manifest_cargo = pd.read_csv("../data/eol-cargo-archive_combined-manifest-checksums_links.csv", low_memory=False)
|
| 29 |
|
| 30 |
# %%
|
| 31 |
links_manifest_cargo.info(show_counts=True)
|
|
|
|
| 34 |
# ## Check on Rare Species Catalog
|
| 35 |
|
| 36 |
# %%
|
| 37 |
+
rs_catalog = pd.read_csv(RS_FILEPATH + "rarespecies-catalog.csv",
|
| 38 |
low_memory=False,
|
| 39 |
dtype = {"eol_content_id": "int64", "eol_page_id": "int64"})
|
| 40 |
rs_catalog.info(show_counts = True)
|
|
|
|
| 47 |
rs_links = pd.merge(rs_catalog,
|
| 48 |
links_manifest_cargo,
|
| 49 |
left_on = "combined_id_rs",
|
| 50 |
+
right_on = "combined_id_archive", # merge on archive (replaced cargo)
|
| 51 |
how = "inner")
|
| 52 |
rs_links.info(show_counts = True)
|
| 53 |
|
| 54 |
# %%
|
| 55 |
rs_links.nunique()
|
| 56 |
|
| 57 |
+
# %% [markdown]
|
| 58 |
+
# All these numbers match our check with the cargo file.
|
| 59 |
+
|
| 60 |
# %% [markdown]
|
| 61 |
# Let's check the mismatched cargo/manifest entries for those last 174...
|
| 62 |
|
|
|
|
| 115 |
# %%
|
| 116 |
big_mismatch.loc[big_mismatch["eol_page_id_rs"] == 46560546].sample(5)
|
| 117 |
|
| 118 |
+
|
| 119 |
# %% [markdown]
|
| 120 |
# Meanwhile, these are giving me 404's: 27648160, 27648159, 27648164, 27648161, 27648166
|
| 121 |
|
| 122 |
+
# %%
|
| 123 |
+
def get_archive_content(combined_id):
|
| 124 |
+
return combined_id.split("_")[0]
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
# %%
|
| 128 |
+
links_manifest_cargo["eol_content_id_archive"] = links_manifest_cargo["combined_id_archive"].apply(get_archive_content)
|
| 129 |
+
|
| 130 |
# %%
|
| 131 |
# check if content IDs get recycled, content ID: 27648165, now online as: 30223317
|
| 132 |
+
# is eol_content_id the archive content ID?
|
| 133 |
+
links_manifest_cargo.loc[links_manifest_cargo["eol_content_id_archive"] == 30223317]
|
| 134 |
|
| 135 |
# %%
|
| 136 |
# Is it in manifest?
|
| 137 |
links_manifest_cargo.loc[links_manifest_cargo["eol_content_id"] == 30223317]
|
| 138 |
|
| 139 |
+
# %%
|
| 140 |
+
# to be sure we check manifest
|
| 141 |
+
links_manifest_cargo["eol_content_id_manifest"] = links_manifest_cargo["combined_id_full_manifest"].apply(get_archive_content)
|
| 142 |
+
|
| 143 |
+
links_manifest_cargo.loc[links_manifest_cargo["eol_content_id_manifest"] == 30223317]
|
| 144 |
+
|
| 145 |
# %% [markdown]
|
| 146 |
# This tracks with all eol content IDs being unique across manifest versions...would there be some other intermediate stage where it changed IDs _again_?!
|
| 147 |
|
|
|
|
| 149 |
# Save CSV of mismatched, they should be salvageable.
|
| 150 |
# We saw these images both online and in our cargo, just with different IDs
|
| 151 |
|
| 152 |
+
mismatched_rs.to_csv("../data/archive_mismatched_rarespecies.csv", index=False)
|
| 153 |
|
| 154 |
# %% [markdown]
|
| 155 |
# Most of our images for some of these species are missing their metadata. For the vast majority of the species, it's just 1 or 2 images.
|
|
|
|
| 160 |
# Now I want some more info on those duplicated MD5's.
|
| 161 |
|
| 162 |
# %%
|
| 163 |
+
rs_links["md5_dupes"] = rs_links.duplicated(subset = "md5_archive", keep = "first")
|
| 164 |
rs_links["rs_id_dupes"] = rs_links.duplicated(subset = "rarespecies_id", keep = "first")
|
| 165 |
|
| 166 |
# %%
|
|
|
|
| 197 |
for pg_id in rs_sci_dupe_pgs:
|
| 198 |
num_images = links_manifest_cargo.loc[links_manifest_cargo["eol_page_id"] == pg_id].shape[0]
|
| 199 |
num_images_by_pg[pg_id] = num_images
|
| 200 |
+
num_unique_images = links_manifest_cargo.loc[links_manifest_cargo["eol_page_id"] == pg_id, "md5_archive"].nunique()
|
| 201 |
num_unique_imgs_by_pg[pg_id] = num_unique_images
|
| 202 |
|
| 203 |
|
|
|
|
| 221 |
|
| 222 |
# %%
|
| 223 |
# save filelist for easier fetching
|
| 224 |
+
#rs_catalog["file_name"].to_csv("../data/rs_file_list.txt", index = False)
|
| 225 |
+
# Not needed now
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
# %% [markdown]
|
| 228 |
+
# Save `rs_links` to file for adjusting Rare Species images for uniqueness.
|
| 229 |
|
| 230 |
# %%
|
| 231 |
+
rs_links.to_csv("../data/rs_links.csv", index = False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
# %%
|