Skip to content

Commit 78fd1f2

Browse files
Basics_of_H3_in_Fused: cleanup_to_push_to_public (#1963)
Basics_of_H3_in_Fused: cleanup_to_push_to_public Made in [Fused Workbench](https://www.fused.io/workbench) Co-authored-by: max@fused.io <max@fused.io>
1 parent 9f8b7e4 commit 78fd1f2

File tree

232 files changed

+6684
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+6684
-0
lines changed

public/Basics_of_H3_in_Fused/H3_aggregation_methods/H3_aggregation_methods.py

Lines changed: 7 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<!--fused:readme-->
2+
Exported from Fused UDF Workbench
3+

public/Basics_of_H3_in_Fused/H3_aggregation_methods/meta.json

Lines changed: 71 additions & 0 deletions
Large diffs are not rendered by default.

public/Basics_of_H3_in_Fused/collection.json

Lines changed: 5 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!--fused:preview-->
2+
<p align="center"><img src="fused_uploaded_preview" width="600" alt="UDF preview image"></p>
3+
4+
<!--fused:readme-->
5+
Reading H3 Ingested Copernicus 30m DEM dataset
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@fused.udf
2+
def udf(
3+
# California
4+
bounds:fused.types.Bounds=[-125,32,-114,42],
5+
res: int = 6,
6+
):
7+
path = "s3://fused-asset/hex/copernicus-dem-90m/"
8+
9+
hex_reader = fused.load("https://github.com/fusedio/udfs/tree/8024b5c/community/joris/Read_H3_dataset/")
10+
df = hex_reader.read_h3_dataset(path, bounds, res=res)
11+
12+
return df
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"version": "0.0.3",
3+
"job_config": {
4+
"version": "0.0.3",
5+
"name": null,
6+
"steps": [
7+
{
8+
"type": "udf",
9+
"udf": {
10+
"type": "geopandas_v2",
11+
"name": "copdem_elevation",
12+
"entrypoint": "udf",
13+
"parameters": {},
14+
"metadata": {
15+
"fused:name": "copdem_elevation",
16+
"fused:slug": "copdem_elevation",
17+
"fused:vizConfig": {
18+
"tileLayer": {
19+
"@@type": "TileLayer",
20+
"minZoom": 0,
21+
"maxZoom": 19,
22+
"tileSize": 256
23+
},
24+
"hexLayer": {
25+
"@@type": "H3HexagonLayer",
26+
"stroked": false,
27+
"filled": true,
28+
"pickable": true,
29+
"extruded": false,
30+
"opacity": 1,
31+
"coverage": 0.9,
32+
"lineWidthMinPixels": 1,
33+
"getHexagon": "@@=properties.hex",
34+
"getFillColor": {
35+
"@@function": "colorContinuous",
36+
"attr": "data_avg",
37+
"domain": [
38+
0,
39+
1000
40+
],
41+
"steps": 20,
42+
"colors": "Earth"
43+
}
44+
}
45+
},
46+
"fused:udfType": "vector_tile"
47+
},
48+
"code": "@fused.udf\ndef udf(\n # California \n bounds:fused.types.Bounds=[-125,32,-114,42],\n res: int = 6, \n):\n path = \"s3://fused-asset/hex/copernicus-dem-90m/\"\n \n hex_reader = fused.load(\"https://github.com/fusedio/udfs/tree/8024b5c/community/joris/Read_H3_dataset/\")\n df = hex_reader.read_h3_dataset(path, bounds, res=res)\n\n return df",
49+
"headers": []
50+
}
51+
}
52+
],
53+
"metadata": null
54+
}
55+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<!--fused:readme-->
2+
Exported from Fused UDF Workbench
3+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
@fused.udf(cache_max_age=0)
2+
def udf(bounds:fused.types.Bounds=[-125,32,-114,42]):
3+
map_utils = fused.load("https://github.com/fusedio/udfs/tree/5c526cc/community/milind/map_utils/")
4+
5+
era5_udf = fused.load("copdem_elevation")
6+
data = era5_udf(bounds=bounds)
7+
8+
val_min = float(data["data_avg"].min())
9+
val_max = float(data["data_avg"].max())
10+
11+
# Layer config for Census population data
12+
config_census = {
13+
"style": {
14+
"fillColor": {
15+
"type": "continuous",
16+
"attr": "data_avg",
17+
"domain": [val_min, val_max],
18+
"steps": 20,
19+
"palette": "Earth",
20+
},
21+
"filled": True,
22+
"stroked": False,
23+
"opacity": 0.9,
24+
},
25+
"tooltip": ["hex", "data_avg"],
26+
}
27+
28+
widgets = {
29+
"controls": "bottom-right",
30+
"scale": "bottom-left",
31+
"basemap": "bottom-right",
32+
"layers": {"position": "top-right", "expanded": False},
33+
"legend": {"position": "top-right", "expanded": True},
34+
}
35+
36+
html = map_utils.deckgl_layers(
37+
layers=[
38+
{
39+
"type": "hex",
40+
"data": data,
41+
"config": config_census,
42+
"visible": True,
43+
"name": "Elevation",
44+
}
45+
],
46+
basemap="dark",
47+
theme="dark",
48+
initialViewState=None,
49+
widgets=widgets,
50+
debug=False,
51+
)
52+
return html
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"version": "0.0.3",
3+
"job_config": {
4+
"version": "0.0.3",
5+
"name": null,
6+
"steps": [
7+
{
8+
"type": "udf",
9+
"udf": {
10+
"type": "geopandas_v2",
11+
"name": "copdem_elevation_map_2",
12+
"entrypoint": "udf",
13+
"parameters": {},
14+
"metadata": {
15+
"fused:name": "copdem_elevation_map_2",
16+
"fused:slug": "copdem_elevation_map_2",
17+
"fused:vizConfig": {
18+
"tileLayer": {
19+
"@@type": "TileLayer",
20+
"minZoom": 0,
21+
"maxZoom": 19,
22+
"tileSize": 256
23+
},
24+
"rasterLayer": {
25+
"@@type": "BitmapLayer",
26+
"pickable": true
27+
},
28+
"vectorLayer": {
29+
"@@type": "GeoJsonLayer",
30+
"stroked": true,
31+
"filled": false,
32+
"pickable": true,
33+
"lineWidthMinPixels": 1,
34+
"pointRadiusMinPixels": 1,
35+
"getLineColor": {
36+
"@@function": "colorContinuous",
37+
"attr": "value",
38+
"domain": [
39+
0,
40+
10
41+
],
42+
"steps": 20,
43+
"colors": "OrYel",
44+
"nullColor": [
45+
184,
46+
184,
47+
184
48+
]
49+
},
50+
"getFillColor": [
51+
208,
52+
208,
53+
208,
54+
40
55+
]
56+
}
57+
},
58+
"fused:udfType": "auto"
59+
},
60+
"code": "@fused.udf(cache_max_age=0)\ndef udf(bounds:fused.types.Bounds=[-125,32,-114,42]):\n map_utils = fused.load(\"https://github.com/fusedio/udfs/tree/5c526cc/community/milind/map_utils/\")\n\n era5_udf = fused.load(\"copdem_elevation\")\n data = era5_udf(bounds=bounds)\n \n val_min = float(data[\"data_avg\"].min())\n val_max = float(data[\"data_avg\"].max())\n\n # Layer config for Census population data\n config_census = {\n \"style\": {\n \"fillColor\": {\n \"type\": \"continuous\",\n \"attr\": \"data_avg\",\n \"domain\": [val_min, val_max],\n \"steps\": 20,\n \"palette\": \"Earth\",\n },\n \"filled\": True,\n \"stroked\": False,\n \"opacity\": 0.9,\n },\n \"tooltip\": [\"hex\", \"data_avg\"],\n }\n\n widgets = {\n \"controls\": \"bottom-right\",\n \"scale\": \"bottom-left\",\n \"basemap\": \"bottom-right\",\n \"layers\": {\"position\": \"top-right\", \"expanded\": False},\n \"legend\": {\"position\": \"top-right\", \"expanded\": True},\n }\n\n html = map_utils.deckgl_layers(\n layers=[\n {\n \"type\": \"hex\",\n \"data\": data,\n \"config\": config_census,\n \"visible\": True,\n \"name\": \"Elevation\",\n }\n ],\n basemap=\"dark\",\n theme=\"dark\",\n initialViewState=None,\n widgets=widgets,\n debug=False,\n )\n return html",
61+
"headers": []
62+
}
63+
}
64+
],
65+
"metadata": null
66+
}
67+
}

0 commit comments

Comments
 (0)