Skip to content

Instantly share code, notes, and snippets.

View kylebarron's full-sized avatar

Kyle Barron kylebarron

View GitHub Profile
@kylebarron
kylebarron / pydantic.py
Created October 4, 2021 17:30 — forked from danielhfrank/pydantic.py
Pydantic with Numpy
from typing import Generic, TypeVar
import numpy as np
from pydantic.fields import ModelField
JSON_ENCODERS = {
np.ndarray: lambda arr: arr.tolist()
}
DType = TypeVar('DType')
@kylebarron
kylebarron / image.png
Last active May 23, 2025 17:57
obstore zarr planetary computer example
image.png
@kylebarron
kylebarron / create_async_tiff_graph.py
Last active April 26, 2025 18:01
Creating graph for Cloud Native Geo Conference 2025 to test async-tiff and rasterio
import altair as alt
import pandas as pd
recv_bytes_per_second_mean = pd.DataFrame(
{
"Group": ["rasterio", "async-tiff"],
"Throughput (bytes/s)": [972102.34, 24319246.71],
},
)
@kylebarron
kylebarron / convert.py
Last active August 31, 2024 04:55
preprocessing script for geoparquet on the web demo (https://observablehq.com/@kylebarron/geoparquet-on-the-web)
import geopandas as gpd
import pandas as pd
import pyarrow as pa
import pyarrow.feather as feather
import pyarrow.parquet as pq
import pygeos
import pyogrio
# https://ookla-open-data.s3.us-west-2.amazonaws.com/parquet/performance/type=mobile/year=2019/quarter=1/2019-01-01_performance_mobile_tiles.parquet
#! /usr/bin/env python3
"""
---------------------------------------------------------------------
Program: hcpcs_scrape.py
Author: Kyle Barron <barronk@mit.edu>
Created: 2/5/2018
Updated: 2/5/2018
Purpose: Scrape HCPCS codes from the internet
"""
# Old
m = leafmap.Map()
m.add_vector(broad_station_gdf, get_fill_color="blue")
m.add_vector(sts_near_broad_gdf, get_color="red", opacity=0.5)
m.add_vector(streets_gdf, get_color="grey", zoom_to_layer=False, opacity=0.3)
m
# New: simple method, just want to see my data:
@kylebarron
kylebarron / requirements.txt
Created October 4, 2023 18:11
binder requirements
lonboard==0.1.0-beta.2
geopandas
shapely
@kylebarron
kylebarron / .gitattributes
Last active September 1, 2023 18:22
Flatgeobuf - pyogrio spatial index perf benchmark
# GitHub syntax highlighting
pixi.lock linguist-language=YAML
@kylebarron
kylebarron / poetry.lock
Created October 12, 2022 21:07
for titiler discussion #522
[[package]]
name = "affine"
version = "2.3.1"
description = "Matrices describing affine transformation of the plane."
category = "main"
optional = false
python-versions = "*"
[package.extras]
test = ["coveralls", "flake8", "pydocstyle", "pytest (>=4.6)", "pytest-cov"]
@kylebarron
kylebarron / README.md
Last active September 4, 2022 10:52
Preprocessing for example of ADSB data in deck.gl

todo