Work with data#

This guide shows how to access Open Climate Risk output data using Icechunk, a versioned data format for cloud-native geospatial data.

Prerequisites#

  • Python environment with xarray, icechunk, duckdb, dask and lonboard installed.

What you’ll learn#

  • How to open and inspect the fire risk raster dataset

  • How to work with specific variables and spatial subsets

  • How to open and subset the raster sampled building vector dataset

Raster / Xarray#

Import required libraries#

import icechunk
import xarray as xr

Connect to the Icechunk repository#

Production fire risk data is stored in an Icechunk repository on S3. We’ll connect to version v1.1.0 of the wind-adjusted fire risk output. For valid versions, check out the GitHub releases page.

# Configure S3 storage for the Icechunk repository
version = 'v1.1.0'
storage = icechunk.s3_storage(
    bucket='us-west-2.opendata.source.coop',
    prefix=f'carbonplan/carbonplan-ocr/output/fire-risk/tensor/production/{version}/ocr.icechunk',
    region='us-west-2',
    anonymous=True,
)

# Open the repository
repo = icechunk.Repository.open(storage)

# Create a read-only session on the main branch
session = repo.readonly_session('main')

Open the dataset with xarray#

# Open the dataset
ds = xr.open_dataset(session.store, engine='zarr', chunks={})
ds
<xarray.Dataset> Size: 652GB
Dimensions:        (latitude: 97579, longitude: 208881)
Coordinates:
  * latitude       (latitude) float64 781kB 22.43 22.43 22.43 ... 52.48 52.48
  * longitude      (longitude) float64 2MB -128.4 -128.4 ... -64.05 -64.05
Data variables:
    bp_2047_riley  (latitude, longitude) float32 82GB dask.array<chunksize=(6000, 4500), meta=np.ndarray>
    bp_2011_riley  (latitude, longitude) float32 82GB dask.array<chunksize=(6000, 4500), meta=np.ndarray>
    bp_2047        (latitude, longitude) float32 82GB dask.array<chunksize=(6000, 4500), meta=np.ndarray>
    bp_2011        (latitude, longitude) float32 82GB dask.array<chunksize=(6000, 4500), meta=np.ndarray>
    rps_scott      (latitude, longitude) float32 82GB dask.array<chunksize=(6000, 4500), meta=np.ndarray>
    rps_2047       (latitude, longitude) float32 82GB dask.array<chunksize=(6000, 4500), meta=np.ndarray>
    rps_2011       (latitude, longitude) float32 82GB dask.array<chunksize=(6000, 4500), meta=np.ndarray>
    crps_scott     (latitude, longitude) float32 82GB dask.array<chunksize=(6000, 4500), meta=np.ndarray>
Attributes:
    version:          1.1.0
    provider:         CarbonPlan
    terms_of_access:  https://docs.carbonplan.org/ocr/en/latest/terms-of-data...
    data_sources:     https://docs.carbonplan.org/ocr/en/latest/reference/dat...
    license_name:     CC-BY-4.0
    license_url:      https://creativecommons.org/licenses/by/4.0/

Select a spatial subset#

Extract data for a specific geographic region using coordinate slicing:

# Example: Select data for California region
california_subset = ds.sel(
    latitude=slice(32, 42),  # Southern to Northern California
    longitude=slice(-125, -114),  # Western to Eastern California
)

california_subset
<xarray.Dataset> Size: 37GB
Dimensions:        (latitude: 32468, longitude: 35715)
Coordinates:
  * latitude       (latitude) float64 260kB 32.0 32.0 32.0 ... 42.0 42.0 42.0
  * longitude      (longitude) float64 286kB -125.0 -125.0 ... -114.0 -114.0
Data variables:
    bp_2047_riley  (latitude, longitude) float32 5GB dask.array<chunksize=(4922, 2501), meta=np.ndarray>
    bp_2011_riley  (latitude, longitude) float32 5GB dask.array<chunksize=(4922, 2501), meta=np.ndarray>
    bp_2047        (latitude, longitude) float32 5GB dask.array<chunksize=(4922, 2501), meta=np.ndarray>
    bp_2011        (latitude, longitude) float32 5GB dask.array<chunksize=(4922, 2501), meta=np.ndarray>
    rps_scott      (latitude, longitude) float32 5GB dask.array<chunksize=(4922, 2501), meta=np.ndarray>
    rps_2047       (latitude, longitude) float32 5GB dask.array<chunksize=(4922, 2501), meta=np.ndarray>
    rps_2011       (latitude, longitude) float32 5GB dask.array<chunksize=(4922, 2501), meta=np.ndarray>
    crps_scott     (latitude, longitude) float32 5GB dask.array<chunksize=(4922, 2501), meta=np.ndarray>
Attributes:
    version:          1.1.0
    provider:         CarbonPlan
    terms_of_access:  https://docs.carbonplan.org/ocr/en/latest/terms-of-data...
    data_sources:     https://docs.carbonplan.org/ocr/en/latest/reference/dat...
    license_name:     CC-BY-4.0
    license_url:      https://creativecommons.org/licenses/by/4.0/

Vector building dataset#

Next we will open and query the raster sampled building dataset stored in the geoparquet format.

Import required libraries#

Here we’ll import duckdb and load the spatial extension. The combination of duckdb spatial and geoparquet allows us to perform GIS queries that are beyond desktop GIS capabilities.

import duckdb

version = 'v1.1.0'

duckdb.sql(
    """INSTALL SPATIAL; LOAD SPATIAL; INSTALL HTTPFS; LOAD HTTPFS; SET s3_url_style='path';"""
)

dataset_uri = f's3://us-west-2.opendata.source.coop/carbonplan/carbonplan-ocr/output/fire-risk/vector/production/{version}/geoparquet/buildings.parquet/**/*.parquet'

Examine the dataset#

  • The SQL describe command shows us that the dataset contains raster sampled variables as well as geometry columns and regional identifiers.

duckdb.sql(f"""
DESCRIBE
SELECT
   *
FROM
   read_parquet('{dataset_uri}', hive_partitioning = TRUE)
""")
┌───────────────┬────────────────────────────────────────────────────────────┬─────────┬─────────┬─────────┬─────────┐
│  column_name  │                        column_type                         │  null   │   key   │ default │  extra  │
│    varchar    │                          varchar                           │ varchar │ varchar │ varchar │ varchar │
├───────────────┼────────────────────────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┤
│ rps_scott     │ FLOAT                                                      │ YES     │ NULL    │ NULL    │ NULL    │
│ rps_2011      │ FLOAT                                                      │ YES     │ NULL    │ NULL    │ NULL    │
│ rps_2047      │ FLOAT                                                      │ YES     │ NULL    │ NULL    │ NULL    │
│ bp_2011       │ FLOAT                                                      │ YES     │ NULL    │ NULL    │ NULL    │
│ bp_2047       │ FLOAT                                                      │ YES     │ NULL    │ NULL    │ NULL    │
│ crps_scott    │ FLOAT                                                      │ YES     │ NULL    │ NULL    │ NULL    │
│ bp_2011_riley │ FLOAT                                                      │ YES     │ NULL    │ NULL    │ NULL    │
│ bp_2047_riley │ FLOAT                                                      │ YES     │ NULL    │ NULL    │ NULL    │
│ GEOID         │ VARCHAR                                                    │ YES     │ NULL    │ NULL    │ NULL    │
│ state         │ VARCHAR                                                    │ YES     │ NULL    │ NULL    │ NULL    │
│ county        │ VARCHAR                                                    │ YES     │ NULL    │ NULL    │ NULL    │
│ geometry      │ GEOMETRY('OGC:CRS84')                                      │ YES     │ NULL    │ NULL    │ NULL    │
│ bbox          │ STRUCT(xmin DOUBLE, ymin DOUBLE, xmax DOUBLE, ymax DOUBLE) │ YES     │ NULL    │ NULL    │ NULL    │
│ county_fips   │ VARCHAR                                                    │ YES     │ NULL    │ NULL    │ NULL    │
│ state_fips    │ VARCHAR                                                    │ YES     │ NULL    │ NULL    │ NULL    │
└───────────────┴────────────────────────────────────────────────────────────┴─────────┴─────────┴─────────┴─────────┘
  15 rows                                                                                                  6 columns

Load the first few rows#

Using the SQL LIMIT command, we can get just the first few rows of the dataset.

duckdb.sql(f"""
SELECT
   *
FROM
   read_parquet('{dataset_uri}', hive_partitioning = TRUE) LIMIT 5""")
┌─────────────┬─────────────┬─────────────┬───────────────┬───────────────┬────────────┬───────────────┬───────────────┬─────────────────┬─────────┬────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────┬─────────────┬────────────┐
│  rps_scott  │  rps_2011   │  rps_2047   │    bp_2011    │    bp_2047    │ crps_scott │ bp_2011_riley │ bp_2047_riley │      GEOID      │  state  │     county     │                                                                                                                                    geometry                                                                                                                                     │                                        bbox                                        │ county_fips │ state_fips │
│    float    │    float    │    float    │     float     │     float     │   float    │     float     │     float     │     varchar     │ varchar │    varchar     │                                                                                                                              geometry('ogc:crs84')                                                                                                                              │             struct(xmin double, ymin double, xmax double, ymax double)             │   varchar   │  varchar   │
├─────────────┼─────────────┼─────────────┼───────────────┼───────────────┼────────────┼───────────────┼───────────────┼─────────────────┼─────────┼────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────┼─────────────┼────────────┤
│  0.01561356 │  0.01536985 │ 0.028080344 │ 0.00070872897 │  0.0012948307 │  21.686499 │        0.0007 │        0.0013 │ 010010209011009 │ AL      │ Autauga County │ POLYGON ((-86.506698 32.703009, -86.506684 32.702793, -86.506628 32.702795, -86.506641 32.703011, -86.506698 32.703009))                                                                                                                                                        │ {'xmin': -86.506698, 'ymin': 32.702793, 'xmax': -86.506628, 'ymax': 32.703011}     │ 001         │ 01         │
│ 0.010896941 │ 0.012863737 │ 0.009054147 │  0.0005428641 │  0.0003820951 │  23.696054 │           0.0 │           0.0 │ 010010208012010 │ AL      │ Autauga County │ POLYGON ((-86.5066661 32.4372473, -86.5066075 32.4372473, -86.5066056 32.4372776, -86.5065546 32.4372792, -86.506564 32.4377817, -86.5066207 32.4377817, -86.5066207 32.437753, -86.5066774 32.4377514, -86.5066661 32.4372473))                                                │ {'xmin': -86.5066774, 'ymin': 32.4372473, 'xmax': -86.5065546, 'ymax': 32.4377817} │ 001         │ 01         │
│ 0.015223199 │ 0.018747458 │ 0.020550849 │  0.0006739337 │ 0.00073876197 │  27.817957 │        0.0007 │        0.0008 │ 010010208031005 │ AL      │ Autauga County │ POLYGON ((-86.506633 32.521835, -86.506587 32.521778, -86.506524 32.521815, -86.50657 32.521871, -86.506633 32.521835))                                                                                                                                                         │ {'xmin': -86.506633, 'ymin': 32.521778, 'xmax': -86.506524, 'ymax': 32.521871}     │ 001         │ 01         │
│  0.01836023 │  0.02095544 │ 0.017821714 │  0.0008382176 │  0.0007128686 │       25.0 │        0.0009 │       0.00075 │ 010010209022023 │ AL      │ Autauga County │ POLYGON ((-86.5065922 32.631174, -86.5065333 32.6311723, -86.5065275 32.6313167, -86.5065221 32.6313166, -86.5065193 32.6313873, -86.5065783 32.631389, -86.5065831 32.6312663, -86.5066153 32.6312672, -86.5066166 32.6312334, -86.5065899 32.6312326, -86.5065922 32.631174)) │ {'xmin': -86.5066166, 'ymin': 32.6311723, 'xmax': -86.5065193, 'ymax': 32.631389}  │ 001         │ 01         │
│ 0.015343276 │ 0.018548166 │ 0.020756342 │ 0.00066440454 │ 0.00074350246 │  27.916977 │        0.0007 │        0.0008 │ 010010208031005 │ AL      │ Autauga County │ POLYGON ((-86.506646 32.521715, -86.506551 32.521617, -86.506508 32.521646, -86.506603 32.521745, -86.506646 32.521715))                                                                                                                                                        │ {'xmin': -86.506646, 'ymin': 32.521617, 'xmax': -86.506508, 'ymax': 32.521745}     │ 001         │ 01         │
└─────────────┴─────────────┴─────────────┴───────────────┴───────────────┴────────────┴───────────────┴───────────────┴─────────────────┴─────────┴────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────┴─────────────┴────────────┘

Subset by state and county#

This geoparquet is partitioned by state and county using FIPS codes.

Let’s select data in LA County in California.

CA_FIPS_CODE = '06'
LA_FIPS_CODE = '037'

Get a count of the number of records in LA County#

Using the COUNT SQL syntax, we can get the total number of entires in our query.

duckdb.sql(f"""
SELECT
   COUNT(*) AS LA_building_count
FROM
   read_parquet('{dataset_uri}', hive_partitioning = TRUE)
WHERE
   state_fips = '{CA_FIPS_CODE}'
   AND county_fips = '{LA_FIPS_CODE}'""")
┌───────────────────┐
│ LA_building_count │
│       int64       │
├───────────────────┤
│           3127513 │
└───────────────────┘

Subset by bounding box#

Looks like there are about 3 million building polygons in our query. Let’s subset that further.

We can get a bounding box (bbox) for an area around the Palisades fire.

palisades_bbox = (-118.761864, 34.026381, -118.466263, 34.152972)

palisades_query = duckdb.sql(f"""
SELECT
   rps_2011,
   CAST(geometry AS GEOMETRY) AS geometry
FROM
   read_parquet('{dataset_uri}', hive_partitioning = TRUE)
WHERE
   state_fips = '{CA_FIPS_CODE}'
   AND county_fips = '{LA_FIPS_CODE}'
   AND bbox.xmin BETWEEN {palisades_bbox[0]} AND {palisades_bbox[2]}
   AND bbox.ymin BETWEEN {palisades_bbox[1]} AND {palisades_bbox[3]}""")

Visualize our query#

Next we’ll use the python plotting library, lonboard to visualize the wind informed risk in an interactive map.

palisades_query
┌──────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│   rps_2011   │                                                                                                                                                                                                                                                                                                                                                  geometry                                                                                                                                                                                                                                                                                                                                                  │
│    float     │                                                                                                                                                                                                                                                                                                                                                  geometry                                                                                                                                                                                                                                                                                                                                                  │
├──────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  0.038971867 │ POLYGON ((-118.761861 34.0273726, -118.7618612 34.0272392, -118.7617965 34.0272391, -118.7617962 34.0273725, -118.761861 34.0273726))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      │
│  0.021255925 │ POLYGON ((-118.7617508 34.1305898, -118.7617664 34.1305852, -118.761752 34.1305517, -118.7617364 34.1305563, -118.7617508 34.1305898))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     │
│   0.02317695 │ POLYGON ((-118.7617345 34.1288515, -118.7617618 34.1288593, -118.7618259 34.1287042, -118.761813 34.1287005, -118.7618116 34.1286951, -118.7618063 34.128686, -118.7617994 34.1286787, -118.7617868 34.1286756, -118.7617688 34.1286761, -118.7617589 34.1286812, -118.7617571 34.1286856, -118.7617404 34.1286809, -118.7616767 34.128835, -118.7617045 34.1288429, -118.7617037 34.1288448, -118.7617337 34.1288534, -118.7617345 34.1288515))                                                                                                                                                                                                                                                           │
│  0.011166742 │ POLYGON ((-118.7616446 34.1516086, -118.7616652 34.1516078, -118.7616694 34.1516911, -118.7618271 34.1516856, -118.7618227 34.1515972, -118.7617275 34.1516005, -118.7617242 34.151534, -118.761641 34.1515369, -118.7616446 34.1516086))                                                                                                                                                                                                                                                                                                                                                                                                                                                                  │
│  0.012086318 │ POLYGON ((-118.761772 34.1519373, -118.7617792 34.1519209, -118.7616965 34.151896, -118.7616584 34.1519834, -118.7616558 34.1519826, -118.7616265 34.1520499, -118.7617078 34.1520744, -118.7617316 34.1520199, -118.7618016 34.152041, -118.7618382 34.1519572, -118.761772 34.1519373))                                                                                                                                                                                                                                                                                                                                                                                                                  │
│  0.013003107 │ POLYGON ((-118.7617166 34.1524848, -118.761761 34.1524985, -118.7618046 34.1524002, -118.7617752 34.1523912, -118.7617818 34.1523765, -118.7618105 34.1523853, -118.761825 34.1523526, -118.7617551 34.1523312, -118.7617595 34.1523212, -118.7616753 34.1522954, -118.761644 34.1523658, -118.7616509 34.1523679, -118.7616149 34.1524489, -118.7617184 34.1524806, -118.7617166 34.1524848))                                                                                                                                                                                                                                                                                                             │
│  0.013944229 │ POLYGON ((-118.7616866 34.1527457, -118.7617187 34.1527274, -118.7617903 34.1528141, -118.7618589 34.1527749, -118.7617929 34.1526952, -118.7617862 34.152699, -118.7617139 34.1526116, -118.7617044 34.152617, -118.7616908 34.1526006, -118.7616211 34.1526404, -118.7616136 34.1526314, -118.7615722 34.152655, -118.761581 34.1526657, -118.7615559 34.15268, -118.7616347 34.1527755, -118.7616467 34.1527686, -118.7616512 34.1527739, -118.7616911 34.1527511, -118.7616866 34.1527457))                                                                                                                                                                                                            │
│ 0.0072017857 │ POLYGON ((-118.7616541 34.1499052, -118.7617172 34.1499007, -118.7617033 34.149768, -118.7616082 34.1497748, -118.7616112 34.1498033, -118.7615532 34.1498075, -118.7615537 34.1498115, -118.7615495 34.1498118, -118.7615597 34.149909, -118.7615897 34.1499068, -118.7615903 34.1499129, -118.7616426 34.1499092, -118.7616419 34.1499033, -118.7616538 34.1499025, -118.7616541 34.1499052))                                                                                                                                                                                                                                                                                                            │
│ 0.0069796755 │ POLYGON ((-118.7616767 34.1493959, -118.7615242 34.1494217, -118.7615556 34.1495499, -118.761648 34.1495342, -118.7616413 34.1495071, -118.7616979 34.1494975, -118.7616968 34.1494931, -118.7617003 34.1494925, -118.7616767 34.1493959))                                                                                                                                                                                                                                                                                                                                                                                                                                                                 │
│  0.019504683 │ POLYGON ((-118.7615518 34.1045546, -118.7616368 34.1045531, -118.7616335 34.1044244, -118.7615478 34.104426, -118.7615494 34.104488, -118.7615353 34.1044882, -118.7615363 34.1045255, -118.7615511 34.1045252, -118.7615518 34.1045546))                                                                                                                                                                                                                                                                                                                                                                                                                                                                  │
│        ·     │                                                                                                                     ·                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      │
│        ·     │                                                                                                                     ·                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      │
│        ·     │                                                                                                                     ·                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      │
│   0.32596478 │ POLYGON ((-118.6484779 34.1332071, -118.6484644 34.1333223, -118.6485956 34.1333329, -118.6485991 34.1333034, -118.6486424 34.1333069, -118.6486393 34.1333327, -118.6486809 34.1333361, -118.6486841 34.1333094, -118.648676 34.1333087, -118.6486847 34.1332349, -118.6486666 34.1332334, -118.6486694 34.1332096, -118.6485838 34.1332026, -118.6485823 34.1332156, -118.6484779 34.1332071))                                                                                                                                                                                                                                                                                                           │
│   0.32596478 │ POLYGON ((-118.6484599 34.133418, -118.6484554 34.1334512, -118.6486036 34.1334652, -118.6486078 34.1334343, -118.6486711 34.1334403, -118.6486809 34.1333687, -118.648576 34.1333588, -118.6485776 34.133347, -118.6484663 34.1333364, -118.6484552 34.1334175, -118.6484599 34.133418))                                                                                                                                                                                                                                                                                                                                                                                                                  │
│   0.21512102 │ POLYGON ((-118.6485821 34.1359017, -118.6484649 34.1359117, -118.6484834 34.136125, -118.648531 34.136121, -118.6485386 34.1361824, -118.6486503 34.1361728, -118.6486177 34.1359082, -118.6485832 34.1359111, -118.6485821 34.1359017))                                                                                                                                                                                                                                                                                                                                                                                                                                                                   │
│   0.40630883 │ POLYGON ((-118.648824 34.0432396, -118.6487427 34.0432145, -118.6487302 34.0432424, -118.6486669 34.0432228, -118.6486421 34.0432784, -118.6486248 34.043273, -118.6486 34.0433286, -118.6485669 34.0433184, -118.648555 34.0433453, -118.6485402 34.0433407, -118.6485241 34.0433768, -118.6485064 34.0433713, -118.6484876 34.0434134, -118.6484837 34.0434122, -118.6484454 34.0434979, -118.6485201 34.0435211, -118.6485576 34.0434371, -118.6485869 34.0434462, -118.6485943 34.0434297, -118.6487204 34.0434688, -118.6487586 34.0433833, -118.6487461 34.0433795, -118.6487516 34.0433672, -118.6487791 34.0433758, -118.6488397 34.04324, -118.6488258 34.0432357, -118.648824 34.0432396))       │
│    0.0787495 │ POLYGON ((-118.6485807 34.1496375, -118.6486367 34.1496405, -118.6486502 34.1494671, -118.6485456 34.1494615, -118.6485435 34.1494885, -118.6485098 34.1494867, -118.6485063 34.1495319, -118.6484968 34.1495314, -118.6484976 34.1495211, -118.6484541 34.1495187, -118.6484533 34.1495286, -118.648443 34.1495281, -118.6484389 34.1495803, -118.6484518 34.149581, -118.6484514 34.1495866, -118.6484837 34.1495883, -118.6484801 34.1496346, -118.6485219 34.1496368, -118.6485212 34.1496466, -118.6485798 34.1496498, -118.6485807 34.1496375))                                                                                                                                                      │
│   0.42033193 │ POLYGON ((-118.6486999 34.0409481, -118.6487152 34.040955, -118.6487652 34.0408791, -118.6486765 34.0408366, -118.6487059 34.040794, -118.6486592 34.0407716, -118.6486339 34.0407789, -118.6486212 34.0407731, -118.6486377 34.0407481, -118.6485637 34.0407144, -118.6485604 34.0407194, -118.6485523 34.0407158, -118.6485398 34.0407347, -118.6485474 34.0407382, -118.6485342 34.0407583, -118.6485439 34.0407628, -118.648512 34.0408114, -118.6485164 34.0408134, -118.6484792 34.0408698, -118.6484714 34.0408663, -118.6484328 34.0409249, -118.6485051 34.0409579, -118.6485421 34.0409016, -118.6485643 34.0409117, -118.6485701 34.0409029, -118.6486928 34.0409588, -118.6486999 34.0409481)) │
│   0.54674155 │ POLYGON ((-118.6485419 34.0465916, -118.6484153 34.0466191, -118.648433 34.0466752, -118.6484782 34.0466655, -118.648509 34.0467632, -118.6485693 34.0467502, -118.6485791 34.0467814, -118.6486469 34.0467667, -118.6486108 34.0466523, -118.6485643 34.0466624, -118.6485419 34.0465916))                                                                                                                                                                                                                                                                                                                                                                                                                │
│   0.38396037 │ POLYGON ((-118.6486172 34.1322275, -118.6486112 34.1322248, -118.6486292 34.1321959, -118.6484863 34.1321341, -118.6484762 34.1321503, -118.6485039 34.1321622, -118.6484947 34.132177, -118.6484626 34.1321631, -118.6484266 34.1322207, -118.6484771 34.1322425, -118.6484644 34.1322628, -118.6485488 34.1322993, -118.648567 34.1322702, -118.6485855 34.1322782, -118.6486172 34.1322275))                                                                                                                                                                                                                                                                                                            │
│  0.085496895 │ POLYGON ((-118.6484034 34.1487198, -118.6484678 34.1487523, -118.6485081 34.1486971, -118.6484437 34.1486646, -118.6484034 34.1487198))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    │
│   0.10498777 │ POLYGON ((-118.6484145 34.1476821, -118.648417 34.1476811, -118.6484729 34.1477786, -118.6485242 34.1477583, -118.6485191 34.1477494, -118.6485411 34.1477407, -118.6485515 34.1477588, -118.6485876 34.1477445, -118.6485915 34.1477512, -118.6486432 34.1477306, -118.6486393 34.1477238, -118.6486518 34.1477188, -118.6485253 34.1474985, -118.6484425 34.1475313, -118.6484719 34.1475825, -118.6484189 34.1476035, -118.6484225 34.1476097, -118.6483864 34.147624, -118.6484077 34.1476612, -118.6484035 34.1476629, -118.6484145 34.1476821))                                                                                                                                                      │
└──────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
  ? rows (>9999 rows, 20 shown)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   2 columns
from lonboard import Map, PolygonLayer
from lonboard.colormap import apply_continuous_cmap
from matplotlib import colormaps

layer = PolygonLayer.from_duckdb(
    palisades_query,
    get_fill_color=apply_continuous_cmap(
        palisades_query.fetchdf()['rps_2011'], colormaps['YlOrRd']
    ),
    pickable=True,
)

m = Map(layer, show_tooltip=True)
m
/Users/nrhagen/Documents/carbonplan/OCR/ocr/.venv/lib/python3.13/site-packages/lonboard/_geoarrow/ops/reproject.py:40: UserWarning: No CRS exists on data. If no data is shown on the map, double check that your CRS is WGS84.
  warn(