-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set h3 index type to
string
in IPC table (#69)
* Notebook to convert grid csv to arrow files * Cast IPC table to string * Fix python docker image no longer ships with libexpat a requirement for fiona and gdal * remove test router
- Loading branch information
Showing
4 changed files
with
97 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
FROM python:3.11-slim as base | ||
LABEL maintainer="[email protected]" | ||
|
||
# Requirement of fiona and gdal. | ||
RUN set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends libexpat1; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
FROM base as production | ||
ENV NAME api | ||
ENV APP_HOME /opt/$NAME | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "0", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import polars as pl\n", | ||
"from h3ronpy.polars.vector import cells_to_wkb_points\n", | ||
"from shapely import wkb" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"df = pl.read_csv(\"../data/processed/grid_table.csv\")\n", | ||
"\n", | ||
"df = df.with_columns(\n", | ||
" pl.col(\"cell\").cast(pl.UInt64).h3.cells_to_string(),\n", | ||
" pl.col(\"tile_id\").cast(pl.UInt64).h3.cells_to_string(),\n", | ||
" point=cells_to_wkb_points(df.select(pl.col(\"cell\").cast(pl.UInt64)).to_series()),\n", | ||
")\n", | ||
"df = df.with_columns(\n", | ||
" lat=pl.col(\"point\").map_elements(lambda p: wkb.loads(p).x, return_dtype=pl.Float64),\n", | ||
" lon=pl.col(\"point\").map_elements(lambda p: wkb.loads(p).y, return_dtype=pl.Float64),\n", | ||
")\n", | ||
"\n", | ||
"df = df.drop(\"point\")\n", | ||
"df.head()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"df.write_csv(\"../data/processed/grid_table_geom.csv\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |