cboettig commited on
Commit
eafb777
·
1 Parent(s): 235c345
Files changed (1) hide show
  1. explore.ipynb +713 -4
explore.ipynb CHANGED
@@ -229,7 +229,7 @@
229
  },
230
  {
231
  "cell_type": "code",
232
- "execution_count": null,
233
  "id": "21dbc7c4-20e2-4422-ac21-cd50badcae58",
234
  "metadata": {},
235
  "outputs": [
@@ -260,6 +260,17 @@
260
  },
261
  "metadata": {},
262
  "output_type": "display_data"
 
 
 
 
 
 
 
 
 
 
 
263
  }
264
  ],
265
  "source": [
@@ -333,12 +344,710 @@
333
  "import leafmap.maplibregl as leafmap\n",
334
  "\n",
335
  "m = leafmap.Map(style=\"positron\")\n",
336
- "#m.add_gdf(la_2023.mutate(geom = _.geom.convert(\"epsg:3310\",\"epsg:4326\")).execute(),layer_type=\"fill\", name = \"la_2023\", paint = {\"fill-opacity\": 0.5})\n",
337
- "#m.add_gdf(la_2024.mutate(geom = _.geom.convert(\"epsg:3310\",\"epsg:4326\")).execute(),layer_type=\"fill\", name = \"la_2024\", paint = {\"fill-opacity\": 0.5})\n",
338
  "m.add_gdf(diff.execute(),layer_type=\"fill\", name = \"diff\", paint = {\"fill-opacity\": 0.5})\n",
339
  "m.add_layer_control()\n",
340
  "m\n"
341
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  }
343
  ],
344
  "metadata": {
@@ -357,7 +1066,7 @@
357
  "name": "python",
358
  "nbconvert_exporter": "python",
359
  "pygments_lexer": "ipython3",
360
- "version": "3.10.12"
361
  }
362
  },
363
  "nbformat": 4,
 
229
  },
230
  {
231
  "cell_type": "code",
232
+ "execution_count": 30,
233
  "id": "21dbc7c4-20e2-4422-ac21-cd50badcae58",
234
  "metadata": {},
235
  "outputs": [
 
260
  },
261
  "metadata": {},
262
  "output_type": "display_data"
263
+ },
264
+ {
265
+ "ename": "InvalidInputException",
266
+ "evalue": "Invalid Input Error: Attempting to execute an unsuccessful or closed pending query result\nError: Catalog Error: Scalar Function with name st_make_valid does not exist!\nDid you mean \"ST_MakeValid\"?\nLINE 2: ...ACE TABLE t1 AS SELECT OBJECTID AS gid, st_make_valid(geom) AS geom, FROM st_r...\n ^",
267
+ "output_type": "error",
268
+ "traceback": [
269
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
270
+ "\u001b[0;31mInvalidInputException\u001b[0m Traceback (most recent call last)",
271
+ "File \u001b[0;32m<timed exec>:13\u001b[0m\n",
272
+ "\u001b[0;31mInvalidInputException\u001b[0m: Invalid Input Error: Attempting to execute an unsuccessful or closed pending query result\nError: Catalog Error: Scalar Function with name st_make_valid does not exist!\nDid you mean \"ST_MakeValid\"?\nLINE 2: ...ACE TABLE t1 AS SELECT OBJECTID AS gid, st_make_valid(geom) AS geom, FROM st_r...\n ^"
273
+ ]
274
  }
275
  ],
276
  "source": [
 
344
  "import leafmap.maplibregl as leafmap\n",
345
  "\n",
346
  "m = leafmap.Map(style=\"positron\")\n",
 
 
347
  "m.add_gdf(diff.execute(),layer_type=\"fill\", name = \"diff\", paint = {\"fill-opacity\": 0.5})\n",
348
  "m.add_layer_control()\n",
349
  "m\n"
350
  ]
351
+ },
352
+ {
353
+ "cell_type": "code",
354
+ "execution_count": 6,
355
+ "id": "72e833e6-0d7b-4508-a42d-cc7fc7df7c46",
356
+ "metadata": {},
357
+ "outputs": [
358
+ {
359
+ "data": {
360
+ "text/html": [
361
+ "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">r0 := DatabaseTable: ibis_read_parquet_3fotibldaretnd5wjeicmg4oli\n",
362
+ " OBJECTID int64\n",
363
+ " cpad_ACCESS_TYP string\n",
364
+ " cpad_PARK_NAME string\n",
365
+ " cpad_MNG_AGENCY string\n",
366
+ " cpad_MNG_AG_LEV string\n",
367
+ " reGAP int16\n",
368
+ " Easement int16\n",
369
+ " TYPE string\n",
370
+ " CA_County_Name string\n",
371
+ " CA_Region_Name string\n",
372
+ " TerrMar string\n",
373
+ " CA_Ecoregion_Name string\n",
374
+ " ACCESS_TYP string\n",
375
+ " MNG_AGNCY string\n",
376
+ " MNG_AG_LEV string\n",
377
+ " UNIT_NAME string\n",
378
+ " DefaultSelection string\n",
379
+ " CA_Ecoregion_Acres float32\n",
380
+ " CA_Region_Acres float32\n",
381
+ " CA_County_Acres float32\n",
382
+ " Acres float32\n",
383
+ " CA_Marine_Acres float32\n",
384
+ " Release_Year int16\n",
385
+ " mgmt_stack string\n",
386
+ " SHAPE binary\n",
387
+ " SHAPE_bbox xmin: float32\n",
388
+ " ymin: float32\n",
389
+ " xmax: float32\n",
390
+ " ymax: float32\n",
391
+ "\n",
392
+ "r1 := DatabaseTable: ibis_read_parquet_t3lw66szfrfcrj34bcr6dbmi64\n",
393
+ " OBJECTID int64\n",
394
+ " cpad_ACCESS_TYP string\n",
395
+ " cpad_PARK_NAME string\n",
396
+ " cpad_MNG_AGENCY string\n",
397
+ " cpad_MNG_AG_LEV string\n",
398
+ " reGAP int16\n",
399
+ " Easement int16\n",
400
+ " TYPE string\n",
401
+ " CA_County_Name string\n",
402
+ " CA_Region_Name string\n",
403
+ " TerrMar string\n",
404
+ " CA_Ecoregion_Name string\n",
405
+ " ACCESS_TYP string\n",
406
+ " MNG_AGNCY string\n",
407
+ " MNG_AG_LEV string\n",
408
+ " UNIT_NAME string\n",
409
+ " DefaultSelection string\n",
410
+ " CA_Ecoregion_Acres float32\n",
411
+ " CA_Region_Acres float32\n",
412
+ " CA_County_Acres float32\n",
413
+ " Acres float32\n",
414
+ " CA_Marine_Acres float32\n",
415
+ " Release_Year int16\n",
416
+ " mgmt_stack string\n",
417
+ " geom binary\n",
418
+ " SHAPE_bbox xmax: float64\n",
419
+ " xmin: float64\n",
420
+ " ymax: float64\n",
421
+ " ymin: float64\n",
422
+ "\n",
423
+ "r2 := Project[r1]\n",
424
+ " OBJECTID: r1.OBJECTID\n",
425
+ "\n",
426
+ "r3 := Project[r0]\n",
427
+ " OBJECTID: r0.OBJECTID\n",
428
+ " cpad_ACCESS_TYP: r0.cpad_ACCESS_TYP\n",
429
+ " cpad_PARK_NAME: r0.cpad_PARK_NAME\n",
430
+ " cpad_MNG_AGENCY: r0.cpad_MNG_AGENCY\n",
431
+ " cpad_MNG_AG_LEV: r0.cpad_MNG_AG_LEV\n",
432
+ " reGAP: r0.reGAP\n",
433
+ " Easement: r0.Easement\n",
434
+ " TYPE: r0.TYPE\n",
435
+ " CA_County_Name: r0.CA_County_Name\n",
436
+ " CA_Region_Name: r0.CA_Region_Name\n",
437
+ " TerrMar: r0.TerrMar\n",
438
+ " CA_Ecoregion_Name: r0.CA_Ecoregion_Name\n",
439
+ " ACCESS_TYP: r0.ACCESS_TYP\n",
440
+ " MNG_AGNCY: r0.MNG_AGNCY\n",
441
+ " MNG_AG_LEV: r0.MNG_AG_LEV\n",
442
+ " UNIT_NAME: r0.UNIT_NAME\n",
443
+ " DefaultSelection: r0.DefaultSelection\n",
444
+ " CA_Ecoregion_Acres: r0.CA_Ecoregion_Acres\n",
445
+ " CA_Region_Acres: r0.CA_Region_Acres\n",
446
+ " CA_County_Acres: r0.CA_County_Acres\n",
447
+ " Acres: r0.Acres\n",
448
+ " CA_Marine_Acres: r0.CA_Marine_Acres\n",
449
+ " Release_Year: r0.Release_Year\n",
450
+ " mgmt_stack: r0.mgmt_stack\n",
451
+ " SHAPE: Cast(r0.SHAPE, to=geospatial:geometry)\n",
452
+ " SHAPE_bbox: r0.SHAPE_bbox\n",
453
+ "\n",
454
+ "r4 := Project[r2]\n",
455
+ " OBJECTID: r2.OBJECTID\n",
456
+ " established: 2024\n",
457
+ "\n",
458
+ "r5 := Project[r3]\n",
459
+ " OBJECTID: r3.OBJECTID\n",
460
+ " cpad_ACCESS_TYP: r3.cpad_ACCESS_TYP\n",
461
+ " cpad_PARK_NAME: r3.cpad_PARK_NAME\n",
462
+ " cpad_MNG_AGENCY: r3.cpad_MNG_AGENCY\n",
463
+ " cpad_MNG_AG_LEV: r3.cpad_MNG_AG_LEV\n",
464
+ " reGAP: r3.reGAP\n",
465
+ " Easement: r3.Easement\n",
466
+ " TYPE: r3.TYPE\n",
467
+ " CA_County_Name: r3.CA_County_Name\n",
468
+ " CA_Region_Name: r3.CA_Region_Name\n",
469
+ " TerrMar: r3.TerrMar\n",
470
+ " CA_Ecoregion_Name: r3.CA_Ecoregion_Name\n",
471
+ " ACCESS_TYP: r3.ACCESS_TYP\n",
472
+ " MNG_AGNCY: r3.MNG_AGNCY\n",
473
+ " MNG_AG_LEV: r3.MNG_AG_LEV\n",
474
+ " UNIT_NAME: r3.UNIT_NAME\n",
475
+ " DefaultSelection: r3.DefaultSelection\n",
476
+ " CA_Ecoregion_Acres: r3.CA_Ecoregion_Acres\n",
477
+ " CA_Region_Acres: r3.CA_Region_Acres\n",
478
+ " CA_County_Acres: r3.CA_County_Acres\n",
479
+ " Acres: r3.Acres\n",
480
+ " CA_Marine_Acres: r3.CA_Marine_Acres\n",
481
+ " Release_Year: r3.Release_Year\n",
482
+ " mgmt_stack: r3.mgmt_stack\n",
483
+ " SHAPE: r3.SHAPE\n",
484
+ " SHAPE_bbox: r3.SHAPE_bbox\n",
485
+ " area: GeoArea(r3.SHAPE)\n",
486
+ "\n",
487
+ "r6 := JoinChain[r5]\n",
488
+ " JoinLink[left, r4]\n",
489
+ " r5.OBJECTID == r4.OBJECTID\n",
490
+ " values:\n",
491
+ " OBJECTID: r5.OBJECTID\n",
492
+ " cpad_ACCESS_TYP: r5.cpad_ACCESS_TYP\n",
493
+ " cpad_PARK_NAME: r5.cpad_PARK_NAME\n",
494
+ " cpad_MNG_AGENCY: r5.cpad_MNG_AGENCY\n",
495
+ " cpad_MNG_AG_LEV: r5.cpad_MNG_AG_LEV\n",
496
+ " reGAP: r5.reGAP\n",
497
+ " Easement: r5.Easement\n",
498
+ " TYPE: r5.TYPE\n",
499
+ " CA_County_Name: r5.CA_County_Name\n",
500
+ " CA_Region_Name: r5.CA_Region_Name\n",
501
+ " TerrMar: r5.TerrMar\n",
502
+ " CA_Ecoregion_Name: r5.CA_Ecoregion_Name\n",
503
+ " ACCESS_TYP: r5.ACCESS_TYP\n",
504
+ " MNG_AGNCY: r5.MNG_AGNCY\n",
505
+ " MNG_AG_LEV: r5.MNG_AG_LEV\n",
506
+ " UNIT_NAME: r5.UNIT_NAME\n",
507
+ " DefaultSelection: r5.DefaultSelection\n",
508
+ " CA_Ecoregion_Acres: r5.CA_Ecoregion_Acres\n",
509
+ " CA_Region_Acres: r5.CA_Region_Acres\n",
510
+ " CA_County_Acres: r5.CA_County_Acres\n",
511
+ " Acres: r5.Acres\n",
512
+ " CA_Marine_Acres: r5.CA_Marine_Acres\n",
513
+ " Release_Year: r5.Release_Year\n",
514
+ " mgmt_stack: r5.mgmt_stack\n",
515
+ " SHAPE: r5.SHAPE\n",
516
+ " SHAPE_bbox: r5.SHAPE_bbox\n",
517
+ " area: r5.area\n",
518
+ " OBJECTID_right: r4.OBJECTID\n",
519
+ " established: r4.established\n",
520
+ "\n",
521
+ "r7 := Project[r6]\n",
522
+ " OBJECTID: r6.OBJECTID\n",
523
+ " cpad_ACCESS_TYP: r6.cpad_ACCESS_TYP\n",
524
+ " cpad_PARK_NAME: r6.cpad_PARK_NAME\n",
525
+ " cpad_MNG_AGENCY: r6.cpad_MNG_AGENCY\n",
526
+ " cpad_MNG_AG_LEV: r6.cpad_MNG_AG_LEV\n",
527
+ " reGAP: r6.reGAP\n",
528
+ " Easement: r6.Easement\n",
529
+ " TYPE: r6.TYPE\n",
530
+ " CA_County_Name: r6.CA_County_Name\n",
531
+ " CA_Region_Name: r6.CA_Region_Name\n",
532
+ " TerrMar: r6.TerrMar\n",
533
+ " CA_Ecoregion_Name: r6.CA_Ecoregion_Name\n",
534
+ " ACCESS_TYP: r6.ACCESS_TYP\n",
535
+ " MNG_AGNCY: r6.MNG_AGNCY\n",
536
+ " MNG_AG_LEV: r6.MNG_AG_LEV\n",
537
+ " UNIT_NAME: r6.UNIT_NAME\n",
538
+ " DefaultSelection: r6.DefaultSelection\n",
539
+ " CA_Ecoregion_Acres: r6.CA_Ecoregion_Acres\n",
540
+ " CA_Region_Acres: r6.CA_Region_Acres\n",
541
+ " CA_County_Acres: r6.CA_County_Acres\n",
542
+ " Acres: r6.Acres\n",
543
+ " CA_Marine_Acres: r6.CA_Marine_Acres\n",
544
+ " Release_Year: r6.Release_Year\n",
545
+ " mgmt_stack: r6.mgmt_stack\n",
546
+ " SHAPE: r6.SHAPE\n",
547
+ " SHAPE_bbox: r6.SHAPE_bbox\n",
548
+ " area: r6.area\n",
549
+ " OBJECTID_right: r6.OBJECTID_right\n",
550
+ " established: Coalesce([r6.established, 2023])\n",
551
+ "\n",
552
+ "Project[r7]\n",
553
+ " OBJECTID: r7.OBJECTID\n",
554
+ " cpad_ACCESS_TYP: r7.cpad_ACCESS_TYP\n",
555
+ " cpad_PARK_NAME: r7.cpad_PARK_NAME\n",
556
+ " cpad_MNG_AGENCY: r7.cpad_MNG_AGENCY\n",
557
+ " cpad_MNG_AG_LEV: r7.cpad_MNG_AG_LEV\n",
558
+ " reGAP: r7.reGAP\n",
559
+ " Easement: r7.Easement\n",
560
+ " TYPE: r7.TYPE\n",
561
+ " CA_County_Name: r7.CA_County_Name\n",
562
+ " CA_Region_Name: r7.CA_Region_Name\n",
563
+ " TerrMar: r7.TerrMar\n",
564
+ " CA_Ecoregion_Name: r7.CA_Ecoregion_Name\n",
565
+ " ACCESS_TYP: r7.ACCESS_TYP\n",
566
+ " MNG_AGNCY: r7.MNG_AGNCY\n",
567
+ " MNG_AG_LEV: r7.MNG_AG_LEV\n",
568
+ " UNIT_NAME: r7.UNIT_NAME\n",
569
+ " DefaultSelection: r7.DefaultSelection\n",
570
+ " CA_Ecoregion_Acres: r7.CA_Ecoregion_Acres\n",
571
+ " CA_Region_Acres: r7.CA_Region_Acres\n",
572
+ " CA_County_Acres: r7.CA_County_Acres\n",
573
+ " Acres: r7.Acres\n",
574
+ " CA_Marine_Acres: r7.CA_Marine_Acres\n",
575
+ " Release_Year: r7.Release_Year\n",
576
+ " mgmt_stack: r7.mgmt_stack\n",
577
+ " SHAPE: GeoConvert(r7.SHAPE, source='epsg:3310', target='epsg:4326')\n",
578
+ " SHAPE_bbox: r7.SHAPE_bbox\n",
579
+ " area: r7.area\n",
580
+ " OBJECTID_right: r7.OBJECTID_right\n",
581
+ " established: r7.established\n",
582
+ "</pre>\n"
583
+ ],
584
+ "text/plain": [
585
+ "r0 := DatabaseTable: ibis_read_parquet_3fotibldaretnd5wjeicmg4oli\n",
586
+ " OBJECTID int64\n",
587
+ " cpad_ACCESS_TYP string\n",
588
+ " cpad_PARK_NAME string\n",
589
+ " cpad_MNG_AGENCY string\n",
590
+ " cpad_MNG_AG_LEV string\n",
591
+ " reGAP int16\n",
592
+ " Easement int16\n",
593
+ " TYPE string\n",
594
+ " CA_County_Name string\n",
595
+ " CA_Region_Name string\n",
596
+ " TerrMar string\n",
597
+ " CA_Ecoregion_Name string\n",
598
+ " ACCESS_TYP string\n",
599
+ " MNG_AGNCY string\n",
600
+ " MNG_AG_LEV string\n",
601
+ " UNIT_NAME string\n",
602
+ " DefaultSelection string\n",
603
+ " CA_Ecoregion_Acres float32\n",
604
+ " CA_Region_Acres float32\n",
605
+ " CA_County_Acres float32\n",
606
+ " Acres float32\n",
607
+ " CA_Marine_Acres float32\n",
608
+ " Release_Year int16\n",
609
+ " mgmt_stack string\n",
610
+ " SHAPE binary\n",
611
+ " SHAPE_bbox xmin: float32\n",
612
+ " ymin: float32\n",
613
+ " xmax: float32\n",
614
+ " ymax: float32\n",
615
+ "\n",
616
+ "r1 := DatabaseTable: ibis_read_parquet_t3lw66szfrfcrj34bcr6dbmi64\n",
617
+ " OBJECTID int64\n",
618
+ " cpad_ACCESS_TYP string\n",
619
+ " cpad_PARK_NAME string\n",
620
+ " cpad_MNG_AGENCY string\n",
621
+ " cpad_MNG_AG_LEV string\n",
622
+ " reGAP int16\n",
623
+ " Easement int16\n",
624
+ " TYPE string\n",
625
+ " CA_County_Name string\n",
626
+ " CA_Region_Name string\n",
627
+ " TerrMar string\n",
628
+ " CA_Ecoregion_Name string\n",
629
+ " ACCESS_TYP string\n",
630
+ " MNG_AGNCY string\n",
631
+ " MNG_AG_LEV string\n",
632
+ " UNIT_NAME string\n",
633
+ " DefaultSelection string\n",
634
+ " CA_Ecoregion_Acres float32\n",
635
+ " CA_Region_Acres float32\n",
636
+ " CA_County_Acres float32\n",
637
+ " Acres float32\n",
638
+ " CA_Marine_Acres float32\n",
639
+ " Release_Year int16\n",
640
+ " mgmt_stack string\n",
641
+ " geom binary\n",
642
+ " SHAPE_bbox xmax: float64\n",
643
+ " xmin: float64\n",
644
+ " ymax: float64\n",
645
+ " ymin: float64\n",
646
+ "\n",
647
+ "r2 := Project[r1]\n",
648
+ " OBJECTID: r1.OBJECTID\n",
649
+ "\n",
650
+ "r3 := Project[r0]\n",
651
+ " OBJECTID: r0.OBJECTID\n",
652
+ " cpad_ACCESS_TYP: r0.cpad_ACCESS_TYP\n",
653
+ " cpad_PARK_NAME: r0.cpad_PARK_NAME\n",
654
+ " cpad_MNG_AGENCY: r0.cpad_MNG_AGENCY\n",
655
+ " cpad_MNG_AG_LEV: r0.cpad_MNG_AG_LEV\n",
656
+ " reGAP: r0.reGAP\n",
657
+ " Easement: r0.Easement\n",
658
+ " TYPE: r0.TYPE\n",
659
+ " CA_County_Name: r0.CA_County_Name\n",
660
+ " CA_Region_Name: r0.CA_Region_Name\n",
661
+ " TerrMar: r0.TerrMar\n",
662
+ " CA_Ecoregion_Name: r0.CA_Ecoregion_Name\n",
663
+ " ACCESS_TYP: r0.ACCESS_TYP\n",
664
+ " MNG_AGNCY: r0.MNG_AGNCY\n",
665
+ " MNG_AG_LEV: r0.MNG_AG_LEV\n",
666
+ " UNIT_NAME: r0.UNIT_NAME\n",
667
+ " DefaultSelection: r0.DefaultSelection\n",
668
+ " CA_Ecoregion_Acres: r0.CA_Ecoregion_Acres\n",
669
+ " CA_Region_Acres: r0.CA_Region_Acres\n",
670
+ " CA_County_Acres: r0.CA_County_Acres\n",
671
+ " Acres: r0.Acres\n",
672
+ " CA_Marine_Acres: r0.CA_Marine_Acres\n",
673
+ " Release_Year: r0.Release_Year\n",
674
+ " mgmt_stack: r0.mgmt_stack\n",
675
+ " SHAPE: Cast(r0.SHAPE, to=geospatial:geometry)\n",
676
+ " SHAPE_bbox: r0.SHAPE_bbox\n",
677
+ "\n",
678
+ "r4 := Project[r2]\n",
679
+ " OBJECTID: r2.OBJECTID\n",
680
+ " established: 2024\n",
681
+ "\n",
682
+ "r5 := Project[r3]\n",
683
+ " OBJECTID: r3.OBJECTID\n",
684
+ " cpad_ACCESS_TYP: r3.cpad_ACCESS_TYP\n",
685
+ " cpad_PARK_NAME: r3.cpad_PARK_NAME\n",
686
+ " cpad_MNG_AGENCY: r3.cpad_MNG_AGENCY\n",
687
+ " cpad_MNG_AG_LEV: r3.cpad_MNG_AG_LEV\n",
688
+ " reGAP: r3.reGAP\n",
689
+ " Easement: r3.Easement\n",
690
+ " TYPE: r3.TYPE\n",
691
+ " CA_County_Name: r3.CA_County_Name\n",
692
+ " CA_Region_Name: r3.CA_Region_Name\n",
693
+ " TerrMar: r3.TerrMar\n",
694
+ " CA_Ecoregion_Name: r3.CA_Ecoregion_Name\n",
695
+ " ACCESS_TYP: r3.ACCESS_TYP\n",
696
+ " MNG_AGNCY: r3.MNG_AGNCY\n",
697
+ " MNG_AG_LEV: r3.MNG_AG_LEV\n",
698
+ " UNIT_NAME: r3.UNIT_NAME\n",
699
+ " DefaultSelection: r3.DefaultSelection\n",
700
+ " CA_Ecoregion_Acres: r3.CA_Ecoregion_Acres\n",
701
+ " CA_Region_Acres: r3.CA_Region_Acres\n",
702
+ " CA_County_Acres: r3.CA_County_Acres\n",
703
+ " Acres: r3.Acres\n",
704
+ " CA_Marine_Acres: r3.CA_Marine_Acres\n",
705
+ " Release_Year: r3.Release_Year\n",
706
+ " mgmt_stack: r3.mgmt_stack\n",
707
+ " SHAPE: r3.SHAPE\n",
708
+ " SHAPE_bbox: r3.SHAPE_bbox\n",
709
+ " area: GeoArea(r3.SHAPE)\n",
710
+ "\n",
711
+ "r6 := JoinChain[r5]\n",
712
+ " JoinLink[left, r4]\n",
713
+ " r5.OBJECTID == r4.OBJECTID\n",
714
+ " values:\n",
715
+ " OBJECTID: r5.OBJECTID\n",
716
+ " cpad_ACCESS_TYP: r5.cpad_ACCESS_TYP\n",
717
+ " cpad_PARK_NAME: r5.cpad_PARK_NAME\n",
718
+ " cpad_MNG_AGENCY: r5.cpad_MNG_AGENCY\n",
719
+ " cpad_MNG_AG_LEV: r5.cpad_MNG_AG_LEV\n",
720
+ " reGAP: r5.reGAP\n",
721
+ " Easement: r5.Easement\n",
722
+ " TYPE: r5.TYPE\n",
723
+ " CA_County_Name: r5.CA_County_Name\n",
724
+ " CA_Region_Name: r5.CA_Region_Name\n",
725
+ " TerrMar: r5.TerrMar\n",
726
+ " CA_Ecoregion_Name: r5.CA_Ecoregion_Name\n",
727
+ " ACCESS_TYP: r5.ACCESS_TYP\n",
728
+ " MNG_AGNCY: r5.MNG_AGNCY\n",
729
+ " MNG_AG_LEV: r5.MNG_AG_LEV\n",
730
+ " UNIT_NAME: r5.UNIT_NAME\n",
731
+ " DefaultSelection: r5.DefaultSelection\n",
732
+ " CA_Ecoregion_Acres: r5.CA_Ecoregion_Acres\n",
733
+ " CA_Region_Acres: r5.CA_Region_Acres\n",
734
+ " CA_County_Acres: r5.CA_County_Acres\n",
735
+ " Acres: r5.Acres\n",
736
+ " CA_Marine_Acres: r5.CA_Marine_Acres\n",
737
+ " Release_Year: r5.Release_Year\n",
738
+ " mgmt_stack: r5.mgmt_stack\n",
739
+ " SHAPE: r5.SHAPE\n",
740
+ " SHAPE_bbox: r5.SHAPE_bbox\n",
741
+ " area: r5.area\n",
742
+ " OBJECTID_right: r4.OBJECTID\n",
743
+ " established: r4.established\n",
744
+ "\n",
745
+ "r7 := Project[r6]\n",
746
+ " OBJECTID: r6.OBJECTID\n",
747
+ " cpad_ACCESS_TYP: r6.cpad_ACCESS_TYP\n",
748
+ " cpad_PARK_NAME: r6.cpad_PARK_NAME\n",
749
+ " cpad_MNG_AGENCY: r6.cpad_MNG_AGENCY\n",
750
+ " cpad_MNG_AG_LEV: r6.cpad_MNG_AG_LEV\n",
751
+ " reGAP: r6.reGAP\n",
752
+ " Easement: r6.Easement\n",
753
+ " TYPE: r6.TYPE\n",
754
+ " CA_County_Name: r6.CA_County_Name\n",
755
+ " CA_Region_Name: r6.CA_Region_Name\n",
756
+ " TerrMar: r6.TerrMar\n",
757
+ " CA_Ecoregion_Name: r6.CA_Ecoregion_Name\n",
758
+ " ACCESS_TYP: r6.ACCESS_TYP\n",
759
+ " MNG_AGNCY: r6.MNG_AGNCY\n",
760
+ " MNG_AG_LEV: r6.MNG_AG_LEV\n",
761
+ " UNIT_NAME: r6.UNIT_NAME\n",
762
+ " DefaultSelection: r6.DefaultSelection\n",
763
+ " CA_Ecoregion_Acres: r6.CA_Ecoregion_Acres\n",
764
+ " CA_Region_Acres: r6.CA_Region_Acres\n",
765
+ " CA_County_Acres: r6.CA_County_Acres\n",
766
+ " Acres: r6.Acres\n",
767
+ " CA_Marine_Acres: r6.CA_Marine_Acres\n",
768
+ " Release_Year: r6.Release_Year\n",
769
+ " mgmt_stack: r6.mgmt_stack\n",
770
+ " SHAPE: r6.SHAPE\n",
771
+ " SHAPE_bbox: r6.SHAPE_bbox\n",
772
+ " area: r6.area\n",
773
+ " OBJECTID_right: r6.OBJECTID_right\n",
774
+ " established: Coalesce([r6.established, 2023])\n",
775
+ "\n",
776
+ "Project[r7]\n",
777
+ " OBJECTID: r7.OBJECTID\n",
778
+ " cpad_ACCESS_TYP: r7.cpad_ACCESS_TYP\n",
779
+ " cpad_PARK_NAME: r7.cpad_PARK_NAME\n",
780
+ " cpad_MNG_AGENCY: r7.cpad_MNG_AGENCY\n",
781
+ " cpad_MNG_AG_LEV: r7.cpad_MNG_AG_LEV\n",
782
+ " reGAP: r7.reGAP\n",
783
+ " Easement: r7.Easement\n",
784
+ " TYPE: r7.TYPE\n",
785
+ " CA_County_Name: r7.CA_County_Name\n",
786
+ " CA_Region_Name: r7.CA_Region_Name\n",
787
+ " TerrMar: r7.TerrMar\n",
788
+ " CA_Ecoregion_Name: r7.CA_Ecoregion_Name\n",
789
+ " ACCESS_TYP: r7.ACCESS_TYP\n",
790
+ " MNG_AGNCY: r7.MNG_AGNCY\n",
791
+ " MNG_AG_LEV: r7.MNG_AG_LEV\n",
792
+ " UNIT_NAME: r7.UNIT_NAME\n",
793
+ " DefaultSelection: r7.DefaultSelection\n",
794
+ " CA_Ecoregion_Acres: r7.CA_Ecoregion_Acres\n",
795
+ " CA_Region_Acres: r7.CA_Region_Acres\n",
796
+ " CA_County_Acres: r7.CA_County_Acres\n",
797
+ " Acres: r7.Acres\n",
798
+ " CA_Marine_Acres: r7.CA_Marine_Acres\n",
799
+ " Release_Year: r7.Release_Year\n",
800
+ " mgmt_stack: r7.mgmt_stack\n",
801
+ " SHAPE: GeoConvert(r7.SHAPE, source='epsg:3310', target='epsg:4326')\n",
802
+ " SHAPE_bbox: r7.SHAPE_bbox\n",
803
+ " area: r7.area\n",
804
+ " OBJECTID_right: r7.OBJECTID_right\n",
805
+ " established: r7.established"
806
+ ]
807
+ },
808
+ "execution_count": 6,
809
+ "metadata": {},
810
+ "output_type": "execute_result"
811
+ }
812
+ ],
813
+ "source": [
814
+ "ca"
815
+ ]
816
+ },
817
+ {
818
+ "cell_type": "code",
819
+ "execution_count": 27,
820
+ "id": "7c9344b1-bbde-4c5a-b2cc-6e4a32bfb8cb",
821
+ "metadata": {},
822
+ "outputs": [],
823
+ "source": [
824
+ "import leafmap.maplibregl as leafmap\n",
825
+ "import ibis\n",
826
+ "from ibis import _\n",
827
+ "ca_parquet = \"ca_areas.parquet\"\n",
828
+ "\n",
829
+ "con = ibis.duckdb.connect()\n",
830
+ "new2024 = (con\n",
831
+ " .read_parquet(\"new2024.parquet\")\n",
832
+ " .select(\"OBJECTID\")\n",
833
+ " .mutate(established = 2024)\n",
834
+ " )\n",
835
+ "\n",
836
+ "ca = (con\n",
837
+ " .read_parquet(ca_parquet)\n",
838
+ " .cast({\"SHAPE\": \"geometry\"})\n",
839
+ " .mutate(area = _.SHAPE.area())\n",
840
+ " .filter(_.reGAP < 3)\n",
841
+ " .left_join(new2024, \"OBJECTID\")\n",
842
+ " .mutate(established=_.established.fill_null(2023))\n",
843
+ " .mutate(geom = _.SHAPE.convert(\"epsg:3310\",\"epsg:4326\"))\n",
844
+ " .rename(name = \"UNIT_NAME\", access_type = \"ACCESS_TYP\", manager = \"MNG_AGNCY\", manager_type = \"MNG_AG_LEV\", id = \"OBJECTID\")\n",
845
+ " .select(_.established, _.reGAP, _.name, _.access_type, _.manager, _.manager_type, _.Easement, _.Acres, _.id, _.geom)\n",
846
+ " )\n"
847
+ ]
848
+ },
849
+ {
850
+ "cell_type": "code",
851
+ "execution_count": 32,
852
+ "id": "6f3df8c1-a603-4dd5-be84-8deaae928d0a",
853
+ "metadata": {},
854
+ "outputs": [
855
+ {
856
+ "data": {
857
+ "text/html": [
858
+ "<div>\n",
859
+ "<style scoped>\n",
860
+ " .dataframe tbody tr th:only-of-type {\n",
861
+ " vertical-align: middle;\n",
862
+ " }\n",
863
+ "\n",
864
+ " .dataframe tbody tr th {\n",
865
+ " vertical-align: top;\n",
866
+ " }\n",
867
+ "\n",
868
+ " .dataframe thead th {\n",
869
+ " text-align: right;\n",
870
+ " }\n",
871
+ "</style>\n",
872
+ "<table border=\"1\" class=\"dataframe\">\n",
873
+ " <thead>\n",
874
+ " <tr style=\"text-align: right;\">\n",
875
+ " <th></th>\n",
876
+ " <th>manager_type</th>\n",
877
+ " <th>area</th>\n",
878
+ " </tr>\n",
879
+ " </thead>\n",
880
+ " <tbody>\n",
881
+ " <tr>\n",
882
+ " <th>0</th>\n",
883
+ " <td>Non Profit</td>\n",
884
+ " <td>458009.641083</td>\n",
885
+ " </tr>\n",
886
+ " <tr>\n",
887
+ " <th>1</th>\n",
888
+ " <td>Federal</td>\n",
889
+ " <td>158633.082092</td>\n",
890
+ " </tr>\n",
891
+ " <tr>\n",
892
+ " <th>2</th>\n",
893
+ " <td>State</td>\n",
894
+ " <td>106750.540298</td>\n",
895
+ " </tr>\n",
896
+ " <tr>\n",
897
+ " <th>3</th>\n",
898
+ " <td>Special District</td>\n",
899
+ " <td>94705.677739</td>\n",
900
+ " </tr>\n",
901
+ " <tr>\n",
902
+ " <th>4</th>\n",
903
+ " <td>County</td>\n",
904
+ " <td>15834.462494</td>\n",
905
+ " </tr>\n",
906
+ " <tr>\n",
907
+ " <th>5</th>\n",
908
+ " <td>Unknown</td>\n",
909
+ " <td>8292.326221</td>\n",
910
+ " </tr>\n",
911
+ " <tr>\n",
912
+ " <th>6</th>\n",
913
+ " <td>City</td>\n",
914
+ " <td>2773.695034</td>\n",
915
+ " </tr>\n",
916
+ " <tr>\n",
917
+ " <th>7</th>\n",
918
+ " <td>Private</td>\n",
919
+ " <td>42.579013</td>\n",
920
+ " </tr>\n",
921
+ " <tr>\n",
922
+ " <th>8</th>\n",
923
+ " <td>Home Owners Association</td>\n",
924
+ " <td>39.521428</td>\n",
925
+ " </tr>\n",
926
+ " <tr>\n",
927
+ " <th>9</th>\n",
928
+ " <td>Joint Powers Authority (JPA)</td>\n",
929
+ " <td>11.565516</td>\n",
930
+ " </tr>\n",
931
+ " <tr>\n",
932
+ " <th>10</th>\n",
933
+ " <td>Government</td>\n",
934
+ " <td>4.377818</td>\n",
935
+ " </tr>\n",
936
+ " <tr>\n",
937
+ " <th>11</th>\n",
938
+ " <td>Local Government</td>\n",
939
+ " <td>0.029984</td>\n",
940
+ " </tr>\n",
941
+ " </tbody>\n",
942
+ "</table>\n",
943
+ "</div>"
944
+ ],
945
+ "text/plain": [
946
+ " manager_type area\n",
947
+ "0 Non Profit 458009.641083\n",
948
+ "1 Federal 158633.082092\n",
949
+ "2 State 106750.540298\n",
950
+ "3 Special District 94705.677739\n",
951
+ "4 County 15834.462494\n",
952
+ "5 Unknown 8292.326221\n",
953
+ "6 City 2773.695034\n",
954
+ "7 Private 42.579013\n",
955
+ "8 Home Owners Association 39.521428\n",
956
+ "9 Joint Powers Authority (JPA) 11.565516\n",
957
+ "10 Government 4.377818\n",
958
+ "11 Local Government 0.029984"
959
+ ]
960
+ },
961
+ "execution_count": 32,
962
+ "metadata": {},
963
+ "output_type": "execute_result"
964
+ }
965
+ ],
966
+ "source": [
967
+ "# compute some summary tables:\n",
968
+ "(ca\n",
969
+ " .filter(_.established == 2024)\n",
970
+ " .group_by(_.manager_type)\n",
971
+ " .agg(area = _.Acres.sum())\n",
972
+ " .order_by(_.area.desc())\n",
973
+ " .execute()\n",
974
+ ")"
975
+ ]
976
+ },
977
+ {
978
+ "cell_type": "code",
979
+ "execution_count": 35,
980
+ "id": "fa06abe4-b3fc-4b75-bce0-d1df1b3ad9fd",
981
+ "metadata": {},
982
+ "outputs": [],
983
+ "source": [
984
+ "gdf = ca.filter(_.manager_type == \"State\").execute()"
985
+ ]
986
+ },
987
+ {
988
+ "cell_type": "code",
989
+ "execution_count": 36,
990
+ "id": "c62854f6-1456-4207-8c69-53af17970102",
991
+ "metadata": {},
992
+ "outputs": [
993
+ {
994
+ "data": {
995
+ "application/vnd.jupyter.widget-view+json": {
996
+ "model_id": "3da2341d220f4240990fe9d2e72a05f4",
997
+ "version_major": 2,
998
+ "version_minor": 1
999
+ },
1000
+ "text/plain": [
1001
+ "Map(height='600px', map_options={'bearing': 0, 'center': (0, 20), 'pitch': 0, 'style': 'https://basemaps.carto…"
1002
+ ]
1003
+ },
1004
+ "execution_count": 36,
1005
+ "metadata": {},
1006
+ "output_type": "execute_result"
1007
+ }
1008
+ ],
1009
+ "source": [
1010
+ "established = {'property': 'established',\n",
1011
+ " 'type': 'categorical',\n",
1012
+ " 'stops': [\n",
1013
+ " [2023, \"#26542C80\"], \n",
1014
+ " [2024, \"#F3AB3D80\"]]\n",
1015
+ " }\n",
1016
+ "gap = {\n",
1017
+ " 'property': 'reGAP',\n",
1018
+ " 'type': 'categorical',\n",
1019
+ " 'stops': [\n",
1020
+ " [1, \"#26633d\"],\n",
1021
+ " [2, \"#879647\"],\n",
1022
+ " [3, \"#BBBBBB\"],\n",
1023
+ " [4, \"#F8F8F8\"]]\n",
1024
+ " }\n",
1025
+ "paint = {\"fill-color\": established}\n",
1026
+ "\n",
1027
+ "m = leafmap.Map(style=\"positron\")\n",
1028
+ "m.add_gdf(gdf,layer_type=\"fill\", name = \"CA 30x30\", paint = paint)\n",
1029
+ "m.add_layer_control()\n",
1030
+ "m"
1031
+ ]
1032
+ },
1033
+ {
1034
+ "cell_type": "code",
1035
+ "execution_count": 18,
1036
+ "id": "41e73ac8-4612-49d9-9f59-b09ac0717c6d",
1037
+ "metadata": {},
1038
+ "outputs": [
1039
+ {
1040
+ "data": {
1041
+ "text/plain": [
1042
+ "True"
1043
+ ]
1044
+ },
1045
+ "execution_count": 18,
1046
+ "metadata": {},
1047
+ "output_type": "execute_result"
1048
+ }
1049
+ ],
1050
+ "source": []
1051
  }
1052
  ],
1053
  "metadata": {
 
1066
  "name": "python",
1067
  "nbconvert_exporter": "python",
1068
  "pygments_lexer": "ipython3",
1069
+ "version": "3.11.10"
1070
  }
1071
  },
1072
  "nbformat": 4,