Spaces:
Running
Running
cassiebuhler
commited on
Commit
·
430f057
1
Parent(s):
10e8f52
adding justice40
Browse files- get_zonal_stats.ipynb +43 -488
get_zonal_stats.ipynb
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
},
|
11 |
{
|
12 |
"cell_type": "code",
|
13 |
-
"execution_count":
|
14 |
"id": "ba047a55-642d-4c27-a367-5f35f4406218",
|
15 |
"metadata": {},
|
16 |
"outputs": [],
|
@@ -36,7 +36,7 @@
|
|
36 |
},
|
37 |
{
|
38 |
"cell_type": "code",
|
39 |
-
"execution_count":
|
40 |
"id": "8b5656db-2d1d-4ca8-826d-7588126e52e8",
|
41 |
"metadata": {},
|
42 |
"outputs": [],
|
@@ -65,7 +65,7 @@
|
|
65 |
},
|
66 |
{
|
67 |
"cell_type": "code",
|
68 |
-
"execution_count":
|
69 |
"id": "9a0e3446-16ac-40b0-9e34-db0157038c5a",
|
70 |
"metadata": {},
|
71 |
"outputs": [],
|
@@ -107,7 +107,7 @@
|
|
107 |
},
|
108 |
{
|
109 |
"cell_type": "code",
|
110 |
-
"execution_count":
|
111 |
"id": "ce66bae6-bac5-4837-9b01-fde16a00c303",
|
112 |
"metadata": {},
|
113 |
"outputs": [],
|
@@ -136,19 +136,10 @@
|
|
136 |
},
|
137 |
{
|
138 |
"cell_type": "code",
|
139 |
-
"execution_count":
|
140 |
"id": "66dec912-ad8a-41cf-a5c2-6ec9cc350984",
|
141 |
"metadata": {},
|
142 |
-
"outputs": [
|
143 |
-
{
|
144 |
-
"name": "stdout",
|
145 |
-
"output_type": "stream",
|
146 |
-
"text": [
|
147 |
-
"CPU times: user 1min 52s, sys: 5.01 s, total: 1min 57s\n",
|
148 |
-
"Wall time: 1min 57s\n"
|
149 |
-
]
|
150 |
-
}
|
151 |
-
],
|
152 |
"source": [
|
153 |
"%%time\n",
|
154 |
"tif_file = 'SpeciesRichness_All.tif'\n",
|
@@ -158,19 +149,10 @@
|
|
158 |
},
|
159 |
{
|
160 |
"cell_type": "code",
|
161 |
-
"execution_count":
|
162 |
"id": "b081ec1a-ea91-485e-95f9-12cd06c2002a",
|
163 |
"metadata": {},
|
164 |
-
"outputs": [
|
165 |
-
{
|
166 |
-
"name": "stdout",
|
167 |
-
"output_type": "stream",
|
168 |
-
"text": [
|
169 |
-
"CPU times: user 1min 50s, sys: 4.47 s, total: 1min 54s\n",
|
170 |
-
"Wall time: 1min 54s\n"
|
171 |
-
]
|
172 |
-
}
|
173 |
-
],
|
174 |
"source": [
|
175 |
"%%time\n",
|
176 |
"tif_file = 'RSR_All.tif'\n",
|
@@ -242,27 +224,10 @@
|
|
242 |
},
|
243 |
{
|
244 |
"cell_type": "code",
|
245 |
-
"execution_count":
|
246 |
"id": "33ac0fb7-2cde-448d-a634-1973e34ac14f",
|
247 |
"metadata": {},
|
248 |
-
"outputs": [
|
249 |
-
{
|
250 |
-
"name": "stderr",
|
251 |
-
"output_type": "stream",
|
252 |
-
"text": [
|
253 |
-
"/opt/venv/lib/python3.10/site-packages/rasterstats/io.py:335: NodataWarning: Setting nodata to -999; specify nodata explicitly\n",
|
254 |
-
" warnings.warn(\n"
|
255 |
-
]
|
256 |
-
},
|
257 |
-
{
|
258 |
-
"name": "stdout",
|
259 |
-
"output_type": "stream",
|
260 |
-
"text": [
|
261 |
-
"CPU times: user 1min 58s, sys: 4.93 s, total: 2min 3s\n",
|
262 |
-
"Wall time: 2min 3s\n"
|
263 |
-
]
|
264 |
-
}
|
265 |
-
],
|
266 |
"source": [
|
267 |
"%%time\n",
|
268 |
"tif_file = 'deforest_carbon_100m_cog.tif'\n",
|
@@ -281,19 +246,10 @@
|
|
281 |
},
|
282 |
{
|
283 |
"cell_type": "code",
|
284 |
-
"execution_count":
|
285 |
"id": "d2a8c10f-e94b-4eef-940f-2af9599edee1",
|
286 |
"metadata": {},
|
287 |
-
"outputs": [
|
288 |
-
{
|
289 |
-
"name": "stdout",
|
290 |
-
"output_type": "stream",
|
291 |
-
"text": [
|
292 |
-
"CPU times: user 1min 53s, sys: 4.81 s, total: 1min 58s\n",
|
293 |
-
"Wall time: 1min 58s\n"
|
294 |
-
]
|
295 |
-
}
|
296 |
-
],
|
297 |
"source": [
|
298 |
"%%time\n",
|
299 |
"tif_file = 'natcrop_bii_100m_cog.tif'\n",
|
@@ -304,19 +260,10 @@
|
|
304 |
},
|
305 |
{
|
306 |
"cell_type": "code",
|
307 |
-
"execution_count":
|
308 |
"id": "1c318f39-7ca0-4f3c-80fb-73f72202e4e0",
|
309 |
"metadata": {},
|
310 |
-
"outputs": [
|
311 |
-
{
|
312 |
-
"name": "stdout",
|
313 |
-
"output_type": "stream",
|
314 |
-
"text": [
|
315 |
-
"CPU times: user 1min 53s, sys: 4.9 s, total: 1min 58s\n",
|
316 |
-
"Wall time: 1min 58s\n"
|
317 |
-
]
|
318 |
-
}
|
319 |
-
],
|
320 |
"source": [
|
321 |
"%%time\n",
|
322 |
"tif_file = 'natcrop_fii_100m_cog.tif'\n",
|
@@ -328,27 +275,10 @@
|
|
328 |
},
|
329 |
{
|
330 |
"cell_type": "code",
|
331 |
-
"execution_count":
|
332 |
"id": "aef9070a-c87a-463e-81b8-3cc6c5c9d484",
|
333 |
"metadata": {},
|
334 |
-
"outputs": [
|
335 |
-
{
|
336 |
-
"name": "stderr",
|
337 |
-
"output_type": "stream",
|
338 |
-
"text": [
|
339 |
-
"/opt/conda/lib/python3.12/site-packages/rasterstats/io.py:335: NodataWarning: Setting nodata to -999; specify nodata explicitly\n",
|
340 |
-
" warnings.warn(\n"
|
341 |
-
]
|
342 |
-
},
|
343 |
-
{
|
344 |
-
"name": "stdout",
|
345 |
-
"output_type": "stream",
|
346 |
-
"text": [
|
347 |
-
"CPU times: user 3min 13s, sys: 55 s, total: 4min 8s\n",
|
348 |
-
"Wall time: 4min 8s\n"
|
349 |
-
]
|
350 |
-
}
|
351 |
-
],
|
352 |
"source": [
|
353 |
"%%time\n",
|
354 |
"tif_file = 'natcrop_expansion_100m_cog.tif'\n",
|
@@ -372,19 +302,10 @@
|
|
372 |
},
|
373 |
{
|
374 |
"cell_type": "code",
|
375 |
-
"execution_count":
|
376 |
"id": "6bdaba61-30c1-49d6-a4e6-db68f1daafa3",
|
377 |
"metadata": {},
|
378 |
-
"outputs": [
|
379 |
-
{
|
380 |
-
"name": "stdout",
|
381 |
-
"output_type": "stream",
|
382 |
-
"text": [
|
383 |
-
"CPU times: user 3min 16s, sys: 57 s, total: 4min 13s\n",
|
384 |
-
"Wall time: 4min 12s\n"
|
385 |
-
]
|
386 |
-
}
|
387 |
-
],
|
388 |
"source": [
|
389 |
"%%time\n",
|
390 |
"tif_file = 'hfp_2021_100m_v1-2_cog.tif'\n",
|
@@ -402,7 +323,7 @@
|
|
402 |
},
|
403 |
{
|
404 |
"cell_type": "code",
|
405 |
-
"execution_count":
|
406 |
"id": "c4a19013-65f1-4eef-be2d-0cf1be3d0f7f",
|
407 |
"metadata": {},
|
408 |
"outputs": [],
|
@@ -465,7 +386,7 @@
|
|
465 |
},
|
466 |
{
|
467 |
"cell_type": "code",
|
468 |
-
"execution_count":
|
469 |
"id": "4e678f01-73af-4f99-a565-e9b7f04d9547",
|
470 |
"metadata": {},
|
471 |
"outputs": [],
|
@@ -484,27 +405,10 @@
|
|
484 |
},
|
485 |
{
|
486 |
"cell_type": "code",
|
487 |
-
"execution_count":
|
488 |
"id": "c5046d6b-9798-46d3-a1bc-548e29414007",
|
489 |
"metadata": {},
|
490 |
-
"outputs": [
|
491 |
-
{
|
492 |
-
"name": "stdout",
|
493 |
-
"output_type": "stream",
|
494 |
-
"text": [
|
495 |
-
"EPSG:4326\n",
|
496 |
-
"Unique values in raster: [-9.990e+02 0.000e+00 1.000e-04 ... 9.998e-01 9.999e-01 1.000e+00]\n",
|
497 |
-
"EPSG:4326\n",
|
498 |
-
"Unique values in raster: [-9.990e+02 0.000e+00 4.000e-04 ... 9.998e-01 9.999e-01 1.000e+00]\n",
|
499 |
-
"EPSG:4326\n",
|
500 |
-
"Unique values in raster: [-9.990e+02 0.000e+00 3.000e-04 ... 9.998e-01 9.999e-01 1.000e+00]\n",
|
501 |
-
"EPSG:4326\n",
|
502 |
-
"Unique values in raster: [-9.990e+02 0.000e+00 2.400e-03 ... 9.943e-01 9.952e-01 9.959e-01]\n",
|
503 |
-
"EPSG:4326\n",
|
504 |
-
"Unique values in raster: [-9.990e+02 0.000e+00 9.000e-03 ... 9.998e-01 9.999e-01 1.000e+00]\n"
|
505 |
-
]
|
506 |
-
}
|
507 |
-
],
|
508 |
"source": [
|
509 |
"gdf = gpd.read_parquet(\"svi2020_us_tract_clean.parquet\")\n",
|
510 |
"svi = gdf[['SVI','geometry']]\n",
|
@@ -523,19 +427,10 @@
|
|
523 |
},
|
524 |
{
|
525 |
"cell_type": "code",
|
526 |
-
"execution_count":
|
527 |
"id": "6a36b77f-d0be-45bd-9318-da4b57eaf353",
|
528 |
"metadata": {},
|
529 |
-
"outputs": [
|
530 |
-
{
|
531 |
-
"name": "stdout",
|
532 |
-
"output_type": "stream",
|
533 |
-
"text": [
|
534 |
-
"CPU times: user 3min 26s, sys: 56.6 s, total: 4min 23s\n",
|
535 |
-
"Wall time: 4min 27s\n"
|
536 |
-
]
|
537 |
-
}
|
538 |
-
],
|
539 |
"source": [
|
540 |
"%%time\n",
|
541 |
"tif_file = 'svi.tif'\n",
|
@@ -546,19 +441,10 @@
|
|
546 |
},
|
547 |
{
|
548 |
"cell_type": "code",
|
549 |
-
"execution_count":
|
550 |
"id": "05ef74e2-3f23-4f69-8cd3-8862cb73a259",
|
551 |
"metadata": {},
|
552 |
-
"outputs": [
|
553 |
-
{
|
554 |
-
"name": "stdout",
|
555 |
-
"output_type": "stream",
|
556 |
-
"text": [
|
557 |
-
"CPU times: user 3min 22s, sys: 56.4 s, total: 4min 18s\n",
|
558 |
-
"Wall time: 4min 27s\n"
|
559 |
-
]
|
560 |
-
}
|
561 |
-
],
|
562 |
"source": [
|
563 |
"%%time\n",
|
564 |
"vec_file = './cpad-stats-temp.parquet'\n",
|
@@ -569,19 +455,10 @@
|
|
569 |
},
|
570 |
{
|
571 |
"cell_type": "code",
|
572 |
-
"execution_count":
|
573 |
"id": "23417a03-38c2-4b31-8340-f08ec8a11631",
|
574 |
"metadata": {},
|
575 |
-
"outputs": [
|
576 |
-
{
|
577 |
-
"name": "stdout",
|
578 |
-
"output_type": "stream",
|
579 |
-
"text": [
|
580 |
-
"CPU times: user 3min 11s, sys: 54.3 s, total: 4min 5s\n",
|
581 |
-
"Wall time: 4min 5s\n"
|
582 |
-
]
|
583 |
-
}
|
584 |
-
],
|
585 |
"source": [
|
586 |
"%%time\n",
|
587 |
"vec_file = './cpad-stats-temp.parquet'\n",
|
@@ -592,19 +469,10 @@
|
|
592 |
},
|
593 |
{
|
594 |
"cell_type": "code",
|
595 |
-
"execution_count":
|
596 |
"id": "de86d7f0-6cdc-4d05-bdee-d9803cbd83bd",
|
597 |
"metadata": {},
|
598 |
-
"outputs": [
|
599 |
-
{
|
600 |
-
"name": "stdout",
|
601 |
-
"output_type": "stream",
|
602 |
-
"text": [
|
603 |
-
"CPU times: user 3min 11s, sys: 54.1 s, total: 4min 5s\n",
|
604 |
-
"Wall time: 4min 5s\n"
|
605 |
-
]
|
606 |
-
}
|
607 |
-
],
|
608 |
"source": [
|
609 |
"%%time\n",
|
610 |
"vec_file = './cpad-stats-temp.parquet'\n",
|
@@ -614,19 +482,10 @@
|
|
614 |
},
|
615 |
{
|
616 |
"cell_type": "code",
|
617 |
-
"execution_count":
|
618 |
"id": "0c49dd50-7dd3-4240-9af8-3e32ec656bc0",
|
619 |
"metadata": {},
|
620 |
-
"outputs": [
|
621 |
-
{
|
622 |
-
"name": "stdout",
|
623 |
-
"output_type": "stream",
|
624 |
-
"text": [
|
625 |
-
"CPU times: user 3min 13s, sys: 54.7 s, total: 4min 8s\n",
|
626 |
-
"Wall time: 4min 7s\n"
|
627 |
-
]
|
628 |
-
}
|
629 |
-
],
|
630 |
"source": [
|
631 |
"%%time\n",
|
632 |
"vec_file = './cpad-stats-temp.parquet'\n",
|
@@ -644,19 +503,10 @@
|
|
644 |
},
|
645 |
{
|
646 |
"cell_type": "code",
|
647 |
-
"execution_count":
|
648 |
"id": "3678a91f-72f7-4339-a409-a97776cba043",
|
649 |
"metadata": {},
|
650 |
-
"outputs": [
|
651 |
-
{
|
652 |
-
"name": "stdout",
|
653 |
-
"output_type": "stream",
|
654 |
-
"text": [
|
655 |
-
"EPSG:4326\n",
|
656 |
-
"Unique values in raster: [0. 1.]\n"
|
657 |
-
]
|
658 |
-
}
|
659 |
-
],
|
660 |
"source": [
|
661 |
"#clean up\n",
|
662 |
"justice40 = (con\n",
|
@@ -673,7 +523,7 @@
|
|
673 |
},
|
674 |
{
|
675 |
"cell_type": "code",
|
676 |
-
"execution_count":
|
677 |
"id": "8faa425f-6f9c-4189-a53a-24dd0250c539",
|
678 |
"metadata": {},
|
679 |
"outputs": [],
|
@@ -726,19 +576,10 @@
|
|
726 |
},
|
727 |
{
|
728 |
"cell_type": "code",
|
729 |
-
"execution_count":
|
730 |
"id": "f5f7297a-e31b-4d3c-ae1c-7e3d78bc141a",
|
731 |
"metadata": {},
|
732 |
-
"outputs": [
|
733 |
-
{
|
734 |
-
"name": "stdout",
|
735 |
-
"output_type": "stream",
|
736 |
-
"text": [
|
737 |
-
"CPU times: user 2min 2s, sys: 29.1 s, total: 2min 31s\n",
|
738 |
-
"Wall time: 2min 32s\n"
|
739 |
-
]
|
740 |
-
}
|
741 |
-
],
|
742 |
"source": [
|
743 |
"%%time\n",
|
744 |
"tif_file = 'ca_justice40.tif'\n",
|
@@ -757,231 +598,10 @@
|
|
757 |
},
|
758 |
{
|
759 |
"cell_type": "code",
|
760 |
-
"execution_count":
|
761 |
"id": "2e4de199-82d4-4e2b-8572-6fe19b57d1ee",
|
762 |
"metadata": {},
|
763 |
-
"outputs": [
|
764 |
-
{
|
765 |
-
"data": {
|
766 |
-
"text/html": [
|
767 |
-
"<div>\n",
|
768 |
-
"<style scoped>\n",
|
769 |
-
" .dataframe tbody tr th:only-of-type {\n",
|
770 |
-
" vertical-align: middle;\n",
|
771 |
-
" }\n",
|
772 |
-
"\n",
|
773 |
-
" .dataframe tbody tr th {\n",
|
774 |
-
" vertical-align: top;\n",
|
775 |
-
" }\n",
|
776 |
-
"\n",
|
777 |
-
" .dataframe thead th {\n",
|
778 |
-
" text-align: right;\n",
|
779 |
-
" }\n",
|
780 |
-
"</style>\n",
|
781 |
-
"<table border=\"1\" class=\"dataframe\">\n",
|
782 |
-
" <thead>\n",
|
783 |
-
" <tr style=\"text-align: right;\">\n",
|
784 |
-
" <th></th>\n",
|
785 |
-
" <th>established</th>\n",
|
786 |
-
" <th>reGAP</th>\n",
|
787 |
-
" <th>name</th>\n",
|
788 |
-
" <th>access_type</th>\n",
|
789 |
-
" <th>manager</th>\n",
|
790 |
-
" <th>manager_type</th>\n",
|
791 |
-
" <th>Easement</th>\n",
|
792 |
-
" <th>Acres</th>\n",
|
793 |
-
" <th>id</th>\n",
|
794 |
-
" <th>type</th>\n",
|
795 |
-
" <th>...</th>\n",
|
796 |
-
" <th>all_species_rwr</th>\n",
|
797 |
-
" <th>all_species_richness</th>\n",
|
798 |
-
" <th>human_impact</th>\n",
|
799 |
-
" <th>svi</th>\n",
|
800 |
-
" <th>justice40</th>\n",
|
801 |
-
" <th>svi_socioeconomic_status</th>\n",
|
802 |
-
" <th>svi_household_char</th>\n",
|
803 |
-
" <th>svi_racial_ethnic_minority</th>\n",
|
804 |
-
" <th>svi_housing_transit</th>\n",
|
805 |
-
" <th>geom</th>\n",
|
806 |
-
" </tr>\n",
|
807 |
-
" </thead>\n",
|
808 |
-
" <tbody>\n",
|
809 |
-
" <tr>\n",
|
810 |
-
" <th>0</th>\n",
|
811 |
-
" <td>2024</td>\n",
|
812 |
-
" <td>2</td>\n",
|
813 |
-
" <td>Six Rivers National Forest</td>\n",
|
814 |
-
" <td>Open Access</td>\n",
|
815 |
-
" <td>United States Forest Service</td>\n",
|
816 |
-
" <td>Federal</td>\n",
|
817 |
-
" <td>0</td>\n",
|
818 |
-
" <td>0.191763</td>\n",
|
819 |
-
" <td>100001</td>\n",
|
820 |
-
" <td>Land</td>\n",
|
821 |
-
" <td>...</td>\n",
|
822 |
-
" <td>0.355</td>\n",
|
823 |
-
" <td>346.0</td>\n",
|
824 |
-
" <td>2339.00</td>\n",
|
825 |
-
" <td>0.521</td>\n",
|
826 |
-
" <td>0.0</td>\n",
|
827 |
-
" <td>0.29</td>\n",
|
828 |
-
" <td>0.522</td>\n",
|
829 |
-
" <td>0.428</td>\n",
|
830 |
-
" <td>0.816</td>\n",
|
831 |
-
" <td>MULTIPOLYGON Z (((-123.94358 41.95869 0.00000,...</td>\n",
|
832 |
-
" </tr>\n",
|
833 |
-
" <tr>\n",
|
834 |
-
" <th>1</th>\n",
|
835 |
-
" <td>2024</td>\n",
|
836 |
-
" <td>1</td>\n",
|
837 |
-
" <td>Six Rivers National Forest</td>\n",
|
838 |
-
" <td>Open Access</td>\n",
|
839 |
-
" <td>United States Forest Service</td>\n",
|
840 |
-
" <td>Federal</td>\n",
|
841 |
-
" <td>0</td>\n",
|
842 |
-
" <td>0.247565</td>\n",
|
843 |
-
" <td>100002</td>\n",
|
844 |
-
" <td>Land</td>\n",
|
845 |
-
" <td>...</td>\n",
|
846 |
-
" <td>0.355</td>\n",
|
847 |
-
" <td>346.0</td>\n",
|
848 |
-
" <td>870.50</td>\n",
|
849 |
-
" <td>0.521</td>\n",
|
850 |
-
" <td>0.0</td>\n",
|
851 |
-
" <td>0.29</td>\n",
|
852 |
-
" <td>0.522</td>\n",
|
853 |
-
" <td>0.428</td>\n",
|
854 |
-
" <td>0.816</td>\n",
|
855 |
-
" <td>MULTIPOLYGON Z (((-123.98793 41.94847 0.00000,...</td>\n",
|
856 |
-
" </tr>\n",
|
857 |
-
" <tr>\n",
|
858 |
-
" <th>2</th>\n",
|
859 |
-
" <td>2024</td>\n",
|
860 |
-
" <td>1</td>\n",
|
861 |
-
" <td>Six Rivers National Forest</td>\n",
|
862 |
-
" <td>Open Access</td>\n",
|
863 |
-
" <td>United States Forest Service</td>\n",
|
864 |
-
" <td>Federal</td>\n",
|
865 |
-
" <td>0</td>\n",
|
866 |
-
" <td>1.046992</td>\n",
|
867 |
-
" <td>100003</td>\n",
|
868 |
-
" <td>Land</td>\n",
|
869 |
-
" <td>...</td>\n",
|
870 |
-
" <td>0.355</td>\n",
|
871 |
-
" <td>346.0</td>\n",
|
872 |
-
" <td>429.00</td>\n",
|
873 |
-
" <td>0.521</td>\n",
|
874 |
-
" <td>0.0</td>\n",
|
875 |
-
" <td>0.29</td>\n",
|
876 |
-
" <td>0.522</td>\n",
|
877 |
-
" <td>0.429</td>\n",
|
878 |
-
" <td>0.816</td>\n",
|
879 |
-
" <td>MULTIPOLYGON Z (((-123.87957 41.97172 0.00000,...</td>\n",
|
880 |
-
" </tr>\n",
|
881 |
-
" <tr>\n",
|
882 |
-
" <th>3</th>\n",
|
883 |
-
" <td>2024</td>\n",
|
884 |
-
" <td>1</td>\n",
|
885 |
-
" <td>Six Rivers National Forest</td>\n",
|
886 |
-
" <td>Open Access</td>\n",
|
887 |
-
" <td>United States Forest Service</td>\n",
|
888 |
-
" <td>Federal</td>\n",
|
889 |
-
" <td>0</td>\n",
|
890 |
-
" <td>0.293964</td>\n",
|
891 |
-
" <td>100004</td>\n",
|
892 |
-
" <td>Land</td>\n",
|
893 |
-
" <td>...</td>\n",
|
894 |
-
" <td>0.355</td>\n",
|
895 |
-
" <td>346.0</td>\n",
|
896 |
-
" <td>3907.00</td>\n",
|
897 |
-
" <td>0.521</td>\n",
|
898 |
-
" <td>0.0</td>\n",
|
899 |
-
" <td>0.29</td>\n",
|
900 |
-
" <td>0.522</td>\n",
|
901 |
-
" <td>0.428</td>\n",
|
902 |
-
" <td>0.816</td>\n",
|
903 |
-
" <td>MULTIPOLYGON Z (((-123.84466 41.99139 0.00000,...</td>\n",
|
904 |
-
" </tr>\n",
|
905 |
-
" <tr>\n",
|
906 |
-
" <th>4</th>\n",
|
907 |
-
" <td>2024</td>\n",
|
908 |
-
" <td>1</td>\n",
|
909 |
-
" <td>Six Rivers National Forest</td>\n",
|
910 |
-
" <td>Open Access</td>\n",
|
911 |
-
" <td>United States Forest Service</td>\n",
|
912 |
-
" <td>Federal</td>\n",
|
913 |
-
" <td>0</td>\n",
|
914 |
-
" <td>0.912564</td>\n",
|
915 |
-
" <td>100005</td>\n",
|
916 |
-
" <td>Land</td>\n",
|
917 |
-
" <td>...</td>\n",
|
918 |
-
" <td>0.355</td>\n",
|
919 |
-
" <td>346.0</td>\n",
|
920 |
-
" <td>698.25</td>\n",
|
921 |
-
" <td>0.521</td>\n",
|
922 |
-
" <td>0.0</td>\n",
|
923 |
-
" <td>0.29</td>\n",
|
924 |
-
" <td>0.522</td>\n",
|
925 |
-
" <td>0.428</td>\n",
|
926 |
-
" <td>0.816</td>\n",
|
927 |
-
" <td>MULTIPOLYGON Z (((-123.86194 41.98176 0.00000,...</td>\n",
|
928 |
-
" </tr>\n",
|
929 |
-
" </tbody>\n",
|
930 |
-
"</table>\n",
|
931 |
-
"<p>5 rows × 25 columns</p>\n",
|
932 |
-
"</div>"
|
933 |
-
],
|
934 |
-
"text/plain": [
|
935 |
-
" established reGAP name access_type \\\n",
|
936 |
-
"0 2024 2 Six Rivers National Forest Open Access \n",
|
937 |
-
"1 2024 1 Six Rivers National Forest Open Access \n",
|
938 |
-
"2 2024 1 Six Rivers National Forest Open Access \n",
|
939 |
-
"3 2024 1 Six Rivers National Forest Open Access \n",
|
940 |
-
"4 2024 1 Six Rivers National Forest Open Access \n",
|
941 |
-
"\n",
|
942 |
-
" manager manager_type Easement Acres id \\\n",
|
943 |
-
"0 United States Forest Service Federal 0 0.191763 100001 \n",
|
944 |
-
"1 United States Forest Service Federal 0 0.247565 100002 \n",
|
945 |
-
"2 United States Forest Service Federal 0 1.046992 100003 \n",
|
946 |
-
"3 United States Forest Service Federal 0 0.293964 100004 \n",
|
947 |
-
"4 United States Forest Service Federal 0 0.912564 100005 \n",
|
948 |
-
"\n",
|
949 |
-
" type ... all_species_rwr all_species_richness human_impact svi \\\n",
|
950 |
-
"0 Land ... 0.355 346.0 2339.00 0.521 \n",
|
951 |
-
"1 Land ... 0.355 346.0 870.50 0.521 \n",
|
952 |
-
"2 Land ... 0.355 346.0 429.00 0.521 \n",
|
953 |
-
"3 Land ... 0.355 346.0 3907.00 0.521 \n",
|
954 |
-
"4 Land ... 0.355 346.0 698.25 0.521 \n",
|
955 |
-
"\n",
|
956 |
-
" justice40 svi_socioeconomic_status svi_household_char \\\n",
|
957 |
-
"0 0.0 0.29 0.522 \n",
|
958 |
-
"1 0.0 0.29 0.522 \n",
|
959 |
-
"2 0.0 0.29 0.522 \n",
|
960 |
-
"3 0.0 0.29 0.522 \n",
|
961 |
-
"4 0.0 0.29 0.522 \n",
|
962 |
-
"\n",
|
963 |
-
" svi_racial_ethnic_minority svi_housing_transit \\\n",
|
964 |
-
"0 0.428 0.816 \n",
|
965 |
-
"1 0.428 0.816 \n",
|
966 |
-
"2 0.429 0.816 \n",
|
967 |
-
"3 0.428 0.816 \n",
|
968 |
-
"4 0.428 0.816 \n",
|
969 |
-
"\n",
|
970 |
-
" geom \n",
|
971 |
-
"0 MULTIPOLYGON Z (((-123.94358 41.95869 0.00000,... \n",
|
972 |
-
"1 MULTIPOLYGON Z (((-123.98793 41.94847 0.00000,... \n",
|
973 |
-
"2 MULTIPOLYGON Z (((-123.87957 41.97172 0.00000,... \n",
|
974 |
-
"3 MULTIPOLYGON Z (((-123.84466 41.99139 0.00000,... \n",
|
975 |
-
"4 MULTIPOLYGON Z (((-123.86194 41.98176 0.00000,... \n",
|
976 |
-
"\n",
|
977 |
-
"[5 rows x 25 columns]"
|
978 |
-
]
|
979 |
-
},
|
980 |
-
"execution_count": 130,
|
981 |
-
"metadata": {},
|
982 |
-
"output_type": "execute_result"
|
983 |
-
}
|
984 |
-
],
|
985 |
"source": [
|
986 |
"## clean up\n",
|
987 |
"con = ibis.duckdb.connect(extensions=[\"spatial\"])\n",
|
@@ -1032,18 +652,10 @@
|
|
1032 |
},
|
1033 |
{
|
1034 |
"cell_type": "code",
|
1035 |
-
"execution_count":
|
1036 |
"id": "05c791c9-888a-483a-9dbb-a2ba7eb1bce2",
|
1037 |
"metadata": {},
|
1038 |
-
"outputs": [
|
1039 |
-
{
|
1040 |
-
"name": "stderr",
|
1041 |
-
"output_type": "stream",
|
1042 |
-
"text": [
|
1043 |
-
"Note: Environment variable`HF_TOKEN` is set and is the current active token independently from the token you've just configured.\n"
|
1044 |
-
]
|
1045 |
-
}
|
1046 |
-
],
|
1047 |
"source": [
|
1048 |
"import subprocess\n",
|
1049 |
"import os\n",
|
@@ -1087,67 +699,10 @@
|
|
1087 |
},
|
1088 |
{
|
1089 |
"cell_type": "code",
|
1090 |
-
"execution_count":
|
1091 |
"id": "1f2d179d-6d47-4e84-83c6-7cb3d969fc00",
|
1092 |
"metadata": {},
|
1093 |
-
"outputs": [
|
1094 |
-
{
|
1095 |
-
"name": "stderr",
|
1096 |
-
"output_type": "stream",
|
1097 |
-
"text": [
|
1098 |
-
"cpad-stats.geojson:6: ignoring dimensions beyond two: in JSON object [-123.94358428532209,41.95869046159588,0]\n",
|
1099 |
-
"cpad-stats.geojson:6: ignoring dimensions beyond two: in JSON object {\"type\":\"Feature\",\"properties\":{\"established\":2024,\"reGAP\":2,\"name\":\"Six Rivers National Forest\",\"access_type\":\"Open Access\",\"manager\":\"United States Forest Service\",\"manager_type\":\"Federal\",\"Easement\":0,\"Acres\":0.19176256656646729,\"id\":100001,\"type\":\"Land\",\"richness\":4,\"rsr\":0.007,\"deforest_carbon\":0,\"irrecoverable_carbon\":4,\"manageable_carbon\":85,\"all_species_rwr\":0.355,\"all_species_richness\":346,\"human_impact\":2339,\"svi\":0.521,\"justice40\":0,\"svi_socioeconomic_status\":0.29,\"svi_household_ch...\n",
|
1100 |
-
"81196 features, 77613888 bytes of geometry, 3021623 bytes of string pool\n",
|
1101 |
-
"Choosing a maxzoom of -z10 for features typically 1202 feet (367 meters) apart, and at least 77 feet (24 meters) apart\n",
|
1102 |
-
"Choosing a maxzoom of -z13 for resolution of about 39 feet (11 meters) within features\n",
|
1103 |
-
"tile 4/2/6 size is 739078 with detail 12, >500000 \n",
|
1104 |
-
"tile 5/5/12 size is 1225784 with detail 12, >500000 \n",
|
1105 |
-
"tile 5/5/12 size is 720473 with detail 11, >500000 \n",
|
1106 |
-
"tile 6/11/25 size is 559822 with detail 12, >500000 \n",
|
1107 |
-
"tile 6/10/24 size is 1012378 with detail 12, >500000 \n",
|
1108 |
-
"tile 6/10/24 size is 686077 with detail 11, >500000 \n",
|
1109 |
-
"tile 7/20/49 size is 642314 with detail 12, >500000 \n",
|
1110 |
-
"tile 7/22/51 size is 600090 with detail 12, >500000 \n",
|
1111 |
-
" 99.9% 13/1335/3225 \n",
|
1112 |
-
" 100.0% 13/1278/3041 \r"
|
1113 |
-
]
|
1114 |
-
},
|
1115 |
-
{
|
1116 |
-
"name": "stdout",
|
1117 |
-
"output_type": "stream",
|
1118 |
-
"text": [
|
1119 |
-
"Successfully generated PMTiles file: cpad-stats.pmtiles\n"
|
1120 |
-
]
|
1121 |
-
},
|
1122 |
-
{
|
1123 |
-
"data": {
|
1124 |
-
"application/vnd.jupyter.widget-view+json": {
|
1125 |
-
"model_id": "0cb245402c8d42e4ab020ace580d13eb",
|
1126 |
-
"version_major": 2,
|
1127 |
-
"version_minor": 0
|
1128 |
-
},
|
1129 |
-
"text/plain": [
|
1130 |
-
"cpad-stats.pmtiles: 0%| | 0.00/90.4M [00:00<?, ?B/s]"
|
1131 |
-
]
|
1132 |
-
},
|
1133 |
-
"metadata": {},
|
1134 |
-
"output_type": "display_data"
|
1135 |
-
},
|
1136 |
-
{
|
1137 |
-
"data": {
|
1138 |
-
"application/vnd.jupyter.widget-view+json": {
|
1139 |
-
"model_id": "78f91869800d474ebd77500c15db063f",
|
1140 |
-
"version_major": 2,
|
1141 |
-
"version_minor": 0
|
1142 |
-
},
|
1143 |
-
"text/plain": [
|
1144 |
-
"cpad-stats.parquet: 0%| | 0.00/204M [00:00<?, ?B/s]"
|
1145 |
-
]
|
1146 |
-
},
|
1147 |
-
"metadata": {},
|
1148 |
-
"output_type": "display_data"
|
1149 |
-
}
|
1150 |
-
],
|
1151 |
"source": [
|
1152 |
"gdf = ca.execute().set_crs(\"EPSG:4326\")\n",
|
1153 |
"gdf.to_file(\"cpad-stats.geojson\")\n",
|
|
|
10 |
},
|
11 |
{
|
12 |
"cell_type": "code",
|
13 |
+
"execution_count": null,
|
14 |
"id": "ba047a55-642d-4c27-a367-5f35f4406218",
|
15 |
"metadata": {},
|
16 |
"outputs": [],
|
|
|
36 |
},
|
37 |
{
|
38 |
"cell_type": "code",
|
39 |
+
"execution_count": null,
|
40 |
"id": "8b5656db-2d1d-4ca8-826d-7588126e52e8",
|
41 |
"metadata": {},
|
42 |
"outputs": [],
|
|
|
65 |
},
|
66 |
{
|
67 |
"cell_type": "code",
|
68 |
+
"execution_count": null,
|
69 |
"id": "9a0e3446-16ac-40b0-9e34-db0157038c5a",
|
70 |
"metadata": {},
|
71 |
"outputs": [],
|
|
|
107 |
},
|
108 |
{
|
109 |
"cell_type": "code",
|
110 |
+
"execution_count": null,
|
111 |
"id": "ce66bae6-bac5-4837-9b01-fde16a00c303",
|
112 |
"metadata": {},
|
113 |
"outputs": [],
|
|
|
136 |
},
|
137 |
{
|
138 |
"cell_type": "code",
|
139 |
+
"execution_count": null,
|
140 |
"id": "66dec912-ad8a-41cf-a5c2-6ec9cc350984",
|
141 |
"metadata": {},
|
142 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
"source": [
|
144 |
"%%time\n",
|
145 |
"tif_file = 'SpeciesRichness_All.tif'\n",
|
|
|
149 |
},
|
150 |
{
|
151 |
"cell_type": "code",
|
152 |
+
"execution_count": null,
|
153 |
"id": "b081ec1a-ea91-485e-95f9-12cd06c2002a",
|
154 |
"metadata": {},
|
155 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
"source": [
|
157 |
"%%time\n",
|
158 |
"tif_file = 'RSR_All.tif'\n",
|
|
|
224 |
},
|
225 |
{
|
226 |
"cell_type": "code",
|
227 |
+
"execution_count": null,
|
228 |
"id": "33ac0fb7-2cde-448d-a634-1973e34ac14f",
|
229 |
"metadata": {},
|
230 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
"source": [
|
232 |
"%%time\n",
|
233 |
"tif_file = 'deforest_carbon_100m_cog.tif'\n",
|
|
|
246 |
},
|
247 |
{
|
248 |
"cell_type": "code",
|
249 |
+
"execution_count": null,
|
250 |
"id": "d2a8c10f-e94b-4eef-940f-2af9599edee1",
|
251 |
"metadata": {},
|
252 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
"source": [
|
254 |
"%%time\n",
|
255 |
"tif_file = 'natcrop_bii_100m_cog.tif'\n",
|
|
|
260 |
},
|
261 |
{
|
262 |
"cell_type": "code",
|
263 |
+
"execution_count": null,
|
264 |
"id": "1c318f39-7ca0-4f3c-80fb-73f72202e4e0",
|
265 |
"metadata": {},
|
266 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
"source": [
|
268 |
"%%time\n",
|
269 |
"tif_file = 'natcrop_fii_100m_cog.tif'\n",
|
|
|
275 |
},
|
276 |
{
|
277 |
"cell_type": "code",
|
278 |
+
"execution_count": null,
|
279 |
"id": "aef9070a-c87a-463e-81b8-3cc6c5c9d484",
|
280 |
"metadata": {},
|
281 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
"source": [
|
283 |
"%%time\n",
|
284 |
"tif_file = 'natcrop_expansion_100m_cog.tif'\n",
|
|
|
302 |
},
|
303 |
{
|
304 |
"cell_type": "code",
|
305 |
+
"execution_count": null,
|
306 |
"id": "6bdaba61-30c1-49d6-a4e6-db68f1daafa3",
|
307 |
"metadata": {},
|
308 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
"source": [
|
310 |
"%%time\n",
|
311 |
"tif_file = 'hfp_2021_100m_v1-2_cog.tif'\n",
|
|
|
323 |
},
|
324 |
{
|
325 |
"cell_type": "code",
|
326 |
+
"execution_count": null,
|
327 |
"id": "c4a19013-65f1-4eef-be2d-0cf1be3d0f7f",
|
328 |
"metadata": {},
|
329 |
"outputs": [],
|
|
|
386 |
},
|
387 |
{
|
388 |
"cell_type": "code",
|
389 |
+
"execution_count": null,
|
390 |
"id": "4e678f01-73af-4f99-a565-e9b7f04d9547",
|
391 |
"metadata": {},
|
392 |
"outputs": [],
|
|
|
405 |
},
|
406 |
{
|
407 |
"cell_type": "code",
|
408 |
+
"execution_count": null,
|
409 |
"id": "c5046d6b-9798-46d3-a1bc-548e29414007",
|
410 |
"metadata": {},
|
411 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
"source": [
|
413 |
"gdf = gpd.read_parquet(\"svi2020_us_tract_clean.parquet\")\n",
|
414 |
"svi = gdf[['SVI','geometry']]\n",
|
|
|
427 |
},
|
428 |
{
|
429 |
"cell_type": "code",
|
430 |
+
"execution_count": null,
|
431 |
"id": "6a36b77f-d0be-45bd-9318-da4b57eaf353",
|
432 |
"metadata": {},
|
433 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
434 |
"source": [
|
435 |
"%%time\n",
|
436 |
"tif_file = 'svi.tif'\n",
|
|
|
441 |
},
|
442 |
{
|
443 |
"cell_type": "code",
|
444 |
+
"execution_count": null,
|
445 |
"id": "05ef74e2-3f23-4f69-8cd3-8862cb73a259",
|
446 |
"metadata": {},
|
447 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
"source": [
|
449 |
"%%time\n",
|
450 |
"vec_file = './cpad-stats-temp.parquet'\n",
|
|
|
455 |
},
|
456 |
{
|
457 |
"cell_type": "code",
|
458 |
+
"execution_count": null,
|
459 |
"id": "23417a03-38c2-4b31-8340-f08ec8a11631",
|
460 |
"metadata": {},
|
461 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
"source": [
|
463 |
"%%time\n",
|
464 |
"vec_file = './cpad-stats-temp.parquet'\n",
|
|
|
469 |
},
|
470 |
{
|
471 |
"cell_type": "code",
|
472 |
+
"execution_count": null,
|
473 |
"id": "de86d7f0-6cdc-4d05-bdee-d9803cbd83bd",
|
474 |
"metadata": {},
|
475 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
"source": [
|
477 |
"%%time\n",
|
478 |
"vec_file = './cpad-stats-temp.parquet'\n",
|
|
|
482 |
},
|
483 |
{
|
484 |
"cell_type": "code",
|
485 |
+
"execution_count": null,
|
486 |
"id": "0c49dd50-7dd3-4240-9af8-3e32ec656bc0",
|
487 |
"metadata": {},
|
488 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
"source": [
|
490 |
"%%time\n",
|
491 |
"vec_file = './cpad-stats-temp.parquet'\n",
|
|
|
503 |
},
|
504 |
{
|
505 |
"cell_type": "code",
|
506 |
+
"execution_count": null,
|
507 |
"id": "3678a91f-72f7-4339-a409-a97776cba043",
|
508 |
"metadata": {},
|
509 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
"source": [
|
511 |
"#clean up\n",
|
512 |
"justice40 = (con\n",
|
|
|
523 |
},
|
524 |
{
|
525 |
"cell_type": "code",
|
526 |
+
"execution_count": null,
|
527 |
"id": "8faa425f-6f9c-4189-a53a-24dd0250c539",
|
528 |
"metadata": {},
|
529 |
"outputs": [],
|
|
|
576 |
},
|
577 |
{
|
578 |
"cell_type": "code",
|
579 |
+
"execution_count": null,
|
580 |
"id": "f5f7297a-e31b-4d3c-ae1c-7e3d78bc141a",
|
581 |
"metadata": {},
|
582 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
"source": [
|
584 |
"%%time\n",
|
585 |
"tif_file = 'ca_justice40.tif'\n",
|
|
|
598 |
},
|
599 |
{
|
600 |
"cell_type": "code",
|
601 |
+
"execution_count": null,
|
602 |
"id": "2e4de199-82d4-4e2b-8572-6fe19b57d1ee",
|
603 |
"metadata": {},
|
604 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
605 |
"source": [
|
606 |
"## clean up\n",
|
607 |
"con = ibis.duckdb.connect(extensions=[\"spatial\"])\n",
|
|
|
652 |
},
|
653 |
{
|
654 |
"cell_type": "code",
|
655 |
+
"execution_count": null,
|
656 |
"id": "05c791c9-888a-483a-9dbb-a2ba7eb1bce2",
|
657 |
"metadata": {},
|
658 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
659 |
"source": [
|
660 |
"import subprocess\n",
|
661 |
"import os\n",
|
|
|
699 |
},
|
700 |
{
|
701 |
"cell_type": "code",
|
702 |
+
"execution_count": null,
|
703 |
"id": "1f2d179d-6d47-4e84-83c6-7cb3d969fc00",
|
704 |
"metadata": {},
|
705 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
706 |
"source": [
|
707 |
"gdf = ca.execute().set_crs(\"EPSG:4326\")\n",
|
708 |
"gdf.to_file(\"cpad-stats.geojson\")\n",
|