To solve
ImportError: cannot import name 'types' from 'geoarrow' (unknown location),
install geoarrow-types
.
ibis may also need geoarrow-c
to work with geoparquet now.
import ibis | |
from ibis import _ | |
con = ibis.duckdb.connect() | |
# example query, could be anything | |
subset = (gbif | |
.filter(_["class"] == "Aves") | |
.rename(hex = "h8") | |
.group_by(_.hex) | |
.agg(n = _.count()) |
To solve
ImportError: cannot import name 'types' from 'geoarrow' (unknown location),
install geoarrow-types
.
ibis may also need geoarrow-c
to work with geoparquet now.
import os | |
from langchain_openai import ChatOpenAI | |
from langchain_core.prompts import ChatPromptTemplate | |
from langchain_core.runnables import ConfigurableField | |
from langchain_core.tools import tool | |
from langchain.agents import create_tool_calling_agent, AgentExecutor | |
@tool | |
def multiply(x: float, y: float) -> float: | |
"""Multiply 'x' times 'y'.""" | |
return x * y |
import ibis | |
con = ibis.duckdb.connect() | |
con.raw_sql(f''' | |
CREATE OR REPLACE SECRET secret ( | |
TYPE S3, | |
ENDPOINT 'sdsc.osn.xsede.org', | |
URL_STYLE 'path' | |
); |
import ibis | |
from ibis import _ | |
con = ibis.duckdb.connect(extensions=["spatial"]) | |
## Read a geospatial file other than parquet (via GDAL) | |
rivers_geojson = "https://data.source.coop/cboettig/us-rivers/nhd_flowline_national.geojson" | |
rivers = con.read_geo(rivers_geojson) | |
## Read geoparquet |
conn.sql(''' | |
SELECT * | |
FROM information_schema.columns | |
WHERE table_name = 'families'; | |
''' | |
) |
# Be sure to put a copy of the license file in "$HOME/gurobi.lic" for this to work!! | |
# Download the release | |
wget https://packages.gurobi.com/11.0/gurobi11.0.1_linux64.tar.gz # or path to most recent linux_64 download from https://www.gurobi.com/downloads/gurobi-software/ | |
# extract: | |
tar -xvf gurobi*_linux64.tar.gz | |
# Set environmental variables |
import xarray as xr | |
import rasterio | |
import rioxarray | |
import earthaccess | |
import os | |
from timebudget import timebudget | |
from pathlib import Path | |
# assumes we have a ~/.netrc created | |
cookies = os.path.expanduser("~/.urs_cookies") |
## Using Forecasts data, ~ 300+ GB in many very small partitions! | |
uri <- "s3://anonymous@bio230014-bucket01/neon4cast-forecasts/parquet/aquatics?endpoint_override=sdsc.osn.xsede.org" | |
bench::bench_time(df <- duckdbfs::open_dataset(uri)) | |
# process real | |
# 1.23m 4.91m | |
bench::bench_time( df <- arrow::open_dataset(uri)) | |
# process real | |
# 4.21m 32.46m |
## examples | |
# requires GDAL >= 3.6 | |
edl_set_token() | |
library(stars) | |
url <- "https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected/HLSL30.020/HLS.L30.T56JKT.2023246T235950.v2.0/HLS.L30.T56JKT.2023246T235950.v2.0.SAA.tif" | |
x <- read_stars(paste0("/vsicurl/",url)) | |
plot(x) |