Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
895 changes: 895 additions & 0 deletions docs/IPYNB_USAGE.md

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions docs/examples/notebooks/example1-notebook.ipynb

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions docs/examples/notebooks/example10-notebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"cells": [
{
"cell_type": "code",
"source": "__trill_node__ = {\n \"id\": \"82537c44-8195-4cd3-a5fa-8a049d53d96e\",\n \"type\": \"DATA_LOADING\",\n \"in\": \"DEFAULT\",\n \"out\": \"DEFAULT\"\n}\n\n__trill_connections__ = {\n \"inputs\": [],\n \"outputs\": [\n {\n \"source\": \"82537c44-8195-4cd3-a5fa-8a049d53d96e\",\n \"target\": \"e5e7e21f-609d-496b-b231-659ee91ff9af\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ]\n}\n\ndef _curio_node():\n\n import pandas as pd\n\n df = pd.read_csv(\"data/Green_Roofs.csv\")\n return df\n\n_curio_output = _curio_node()\n\ntry:\n data_82537c44_8195_4cd3_a5fa_8a049d53d96e = _curio_output\nexcept NameError:\n data_82537c44_8195_4cd3_a5fa_8a049d53d96e = None\n",
"metadata": {
"id": "82537c44-8195-4cd3-a5fa-8a049d53d96e",
"language": "python"
}
},
{
"cell_type": "code",
"source": "__trill_node__ = {\n \"id\": \"e5e7e21f-609d-496b-b231-659ee91ff9af\",\n \"type\": \"DATA_CLEANING\",\n \"in\": \"DEFAULT\",\n \"out\": \"DEFAULT\"\n}\n\n__trill_connections__ = {\n \"inputs\": [\n {\n \"source\": \"82537c44-8195-4cd3-a5fa-8a049d53d96e\",\n \"target\": \"e5e7e21f-609d-496b-b231-659ee91ff9af\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ],\n \"outputs\": [\n {\n \"source\": \"e5e7e21f-609d-496b-b231-659ee91ff9af\",\n \"target\": \"4226b7ed-c8e7-4acf-873b-2d835d9c4a07\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ]\n}\n\ndef _curio_node():\n\n input_0 = data_82537c44_8195_4cd3_a5fa_8a049d53d96e\n arg = input_0\n\n import pandas as pd\n\n df = arg\n df.fillna(0, inplace=True)\n\n return df\n\n\n_curio_output = _curio_node()\n\ntry:\n result_e5e7e21f_609d_496b_b231_659ee91ff9af = _curio_output\nexcept NameError:\n result_e5e7e21f_609d_496b_b231_659ee91ff9af = None\n",
"metadata": {
"id": "e5e7e21f-609d-496b-b231-659ee91ff9af",
"language": "python"
}
},
{
"cell_type": "code",
"source": "__trill_node__ = {\n \"id\": \"4226b7ed-c8e7-4acf-873b-2d835d9c4a07\",\n \"type\": \"VIS_VEGA\",\n \"in\": \"DEFAULT\",\n \"out\": \"DEFAULT\"\n}\n\n__trill_connections__ = {\n \"inputs\": [\n {\n \"source\": \"e5e7e21f-609d-496b-b231-659ee91ff9af\",\n \"target\": \"4226b7ed-c8e7-4acf-873b-2d835d9c4a07\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ],\n \"outputs\": []\n}\n\ndef _curio_node():\n\n\n input_data = result_e5e7e21f_609d_496b_b231_659ee91ff9af\n\n spec = {\n \"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\",\n \"description\": \"Histogram of Total Roof Size of Buildings in Chicago (log-scaled)\",\n \"data\": {\n \"name\": \"data\"\n },\n \"transform\": [\n { \"filter\": \"datum.TOTAL_ROOF_SQFT > 0\" },\n {\n \"calculate\": \"log(datum.TOTAL_ROOF_SQFT) / log(10)\",\n \"as\": \"log_roof_size\"\n }\n ],\n \"mark\": \"bar\",\n \"encoding\": {\n \"x\": {\n \"field\": \"log_roof_size\",\n \"bin\": { \"maxbins\": 30 },\n \"axis\": {\n \"title\": \"Total Roof Size (sqft)\",\n \"values\": [3, 4, 5, 6],\n \"labelExpr\": \"'10^' + datum.value\"\n }\n },\n \"y\": {\n \"aggregate\": \"count\",\n \"type\": \"quantitative\",\n \"axis\": {\n \"title\": \"Number of Buildings\"\n }\n }\n }\n }\n\n values = input_data\n if hasattr(input_data, \"to_dict\"):\n values = input_data.to_dict(orient=\"records\")\n\n if isinstance(spec, dict):\n spec[\"data\"] = {\"values\": values}\n\n from IPython.display import display\n display({\"application/vnd.vegalite.v5+json\": spec, \"text/plain\": spec}, raw=True)\n\n return input_data\n\n\n_curio_output = _curio_node()\n\ntry:\n result_4226b7ed_c8e7_4acf_873b_2d835d9c4a07 = _curio_output\nexcept NameError:\n result_4226b7ed_c8e7_4acf_873b_2d835d9c4a07 = None\n",
"metadata": {
"id": "4226b7ed-c8e7-4acf-873b-2d835d9c4a07",
"language": "python"
}
},
{
"cell_type": "code",
"source": "__trill_node__ = {\n \"id\": \"92717c5a-2e65-4ca3-9818-d5f73c89f0a9\",\n \"type\": \"DATA_LOADING\",\n \"in\": \"DEFAULT\",\n \"out\": \"DEFAULT\"\n}\n\n__trill_connections__ = {\n \"inputs\": [],\n \"outputs\": [\n {\n \"source\": \"92717c5a-2e65-4ca3-9818-d5f73c89f0a9\",\n \"target\": \"c528f5bc-5d28-4c72-9158-dfb4282c504f\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ]\n}\n\ndef _curio_node():\n\n import geopandas as gpd\n import pandas as pd\n from shapely.geometry import Point\n # Read the green roofs dataset\n green_roofs_df = pd.read_csv('data/Green_Roofs.csv')\n\n # Create the dataset into geo dataframe using latitude and longitude columns\n geometry = [Point(xy) for xy in zip(green_roofs_df['LONGITUDE'], green_roofs_df['LATITUDE'])]\n green_roofs_df = gpd.GeoDataFrame(green_roofs_df, geometry=geometry, crs=4326)\n chicago = gpd.read_file(\"data/chicago.geojson\")\n\n # Joining the green roofs dataset with the chicago neighborhood geojson file\n joined = gpd.sjoin(green_roofs_df, chicago, predicate='within')\n return joined\n\n_curio_output = _curio_node()\n\ntry:\n data_92717c5a_2e65_4ca3_9818_d5f73c89f0a9 = _curio_output\nexcept NameError:\n data_92717c5a_2e65_4ca3_9818_d5f73c89f0a9 = None\n",
"metadata": {
"id": "92717c5a-2e65-4ca3-9818-d5f73c89f0a9",
"language": "python"
}
},
{
"cell_type": "code",
"source": "__trill_node__ = {\n \"id\": \"c528f5bc-5d28-4c72-9158-dfb4282c504f\",\n \"type\": \"DATA_POOL\",\n \"in\": \"DEFAULT\",\n \"out\": \"DEFAULT\"\n}\n\n__trill_connections__ = {\n \"inputs\": [\n {\n \"source\": \"92717c5a-2e65-4ca3-9818-d5f73c89f0a9\",\n \"target\": \"c528f5bc-5d28-4c72-9158-dfb4282c504f\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ],\n \"outputs\": [\n {\n \"source\": \"c528f5bc-5d28-4c72-9158-dfb4282c504f\",\n \"target\": \"5c11ed5f-c993-4940-89d0-08d186e903f9\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n },\n {\n \"source\": \"c528f5bc-5d28-4c72-9158-dfb4282c504f\",\n \"target\": \"a9995883-f2ea-4b42-b74d-59ebc727afc6\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ]\n}\n\ndef _curio_node():\n\n\n return data_92717c5a_2e65_4ca3_9818_d5f73c89f0a9\n\n\n_curio_output = _curio_node()\n\ntry:\n pool_c528f5bc_5d28_4c72_9158_dfb4282c504f = _curio_output\nexcept NameError:\n pool_c528f5bc_5d28_4c72_9158_dfb4282c504f = None\n",
"metadata": {
"id": "c528f5bc-5d28-4c72-9158-dfb4282c504f",
"language": "python"
}
},
{
"cell_type": "code",
"source": "__trill_node__ = {\n \"id\": \"5c11ed5f-c993-4940-89d0-08d186e903f9\",\n \"type\": \"VIS_VEGA\",\n \"in\": \"DEFAULT\",\n \"out\": \"DEFAULT\"\n}\n\n__trill_connections__ = {\n \"inputs\": [\n {\n \"source\": \"c528f5bc-5d28-4c72-9158-dfb4282c504f\",\n \"target\": \"5c11ed5f-c993-4940-89d0-08d186e903f9\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ],\n \"outputs\": []\n}\n\ndef _curio_node():\n\n\n input_data = pool_c528f5bc_5d28_4c72_9158_dfb4282c504f\n\n spec = {\n \"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\",\n \"description\": \"Dot Density Map of Green Roof Locations in Chicago with Zoom & Pan\",\n \"width\": 500,\n \"height\": 600,\n \"title\": \"Green Roof Locations in Chicago\",\n \"mark\": \"circle\",\n \"selection\": {\n \"grid\": {\n \"type\": \"interval\",\n \"bind\": \"scales\"\n }\n },\n \"encoding\": {\n \"x\": {\n \"field\": \"LONGITUDE\",\n \"type\": \"quantitative\",\n \"scale\": { \"domain\": [-88.0, -87.5] },\n \"axis\": { \"title\": \"Longitude\" }\n },\n \"y\": {\n \"field\": \"LATITUDE\",\n \"type\": \"quantitative\",\n \"scale\": { \"domain\": [41.6, 42.1] },\n \"axis\": { \"title\": \"Latitude\" }\n },\n \"size\": {\n \"field\": \"VEGETATED_SQFT\",\n \"type\": \"quantitative\",\n \"legend\": { \"title\": \"Vegetated Sqft\" }\n },\n \"tooltip\": [\n { \"field\": \"VEGETATED_SQFT\", \"type\": \"quantitative\" },\n { \"field\": \"TOTAL_ROOF_SQFT\", \"type\": \"quantitative\" },\n { \"field\": \"zip\", \"type\": \"nominal\" }\n ]\n },\n \"config\": {\n \"view\": { \"stroke\": \"transparent\" }\n }\n }\n\n values = input_data\n if hasattr(input_data, \"to_dict\"):\n values = input_data.to_dict(orient=\"records\")\n\n if isinstance(spec, dict):\n spec[\"data\"] = {\"values\": values}\n\n from IPython.display import display\n display({\"application/vnd.vegalite.v5+json\": spec, \"text/plain\": spec}, raw=True)\n\n return input_data\n\n\n_curio_output = _curio_node()\n\ntry:\n result_5c11ed5f_c993_4940_89d0_08d186e903f9 = _curio_output\nexcept NameError:\n result_5c11ed5f_c993_4940_89d0_08d186e903f9 = None\n",
"metadata": {
"id": "5c11ed5f-c993-4940-89d0-08d186e903f9",
"language": "python"
}
},
{
"cell_type": "code",
"source": "__trill_node__ = {\n \"id\": \"a9995883-f2ea-4b42-b74d-59ebc727afc6\",\n \"type\": \"DATA_TRANSFORMATION\",\n \"in\": \"DEFAULT\",\n \"out\": \"DEFAULT\"\n}\n\n__trill_connections__ = {\n \"inputs\": [\n {\n \"source\": \"c528f5bc-5d28-4c72-9158-dfb4282c504f\",\n \"target\": \"a9995883-f2ea-4b42-b74d-59ebc727afc6\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ],\n \"outputs\": [\n {\n \"source\": \"a9995883-f2ea-4b42-b74d-59ebc727afc6\",\n \"target\": \"d23e2587-57bf-4db4-84fe-cdb7c2de638d\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ]\n}\n\ndef _curio_node():\n\n input_0 = pool_c528f5bc_5d28_4c72_9158_dfb4282c504f\n arg = input_0\n\n import geopandas as gpd\n\n joined = arg\n\n # filter out the top 10 zip codes from the joined dataframe on 'zip' by square feet\n top_10_largest = joined.groupby('zip')['VEGETATED_SQFT'].sum().reset_index().sort_values(by='VEGETATED_SQFT', ascending=False).head(10)\n\n return top_10_largest\n\n\n_curio_output = _curio_node()\n\ntry:\n result_a9995883_f2ea_4b42_b74d_59ebc727afc6 = _curio_output\nexcept NameError:\n result_a9995883_f2ea_4b42_b74d_59ebc727afc6 = None\n",
"metadata": {
"id": "a9995883-f2ea-4b42-b74d-59ebc727afc6",
"language": "python"
}
},
{
"cell_type": "code",
"source": "__trill_node__ = {\n \"id\": \"d23e2587-57bf-4db4-84fe-cdb7c2de638d\",\n \"type\": \"VIS_VEGA\",\n \"in\": \"DEFAULT\",\n \"out\": \"DEFAULT\"\n}\n\n__trill_connections__ = {\n \"inputs\": [\n {\n \"source\": \"a9995883-f2ea-4b42-b74d-59ebc727afc6\",\n \"target\": \"d23e2587-57bf-4db4-84fe-cdb7c2de638d\",\n \"sourceHandle\": \"out\",\n \"targetHandle\": \"in\"\n }\n ],\n \"outputs\": []\n}\n\ndef _curio_node():\n\n\n input_data = result_a9995883_f2ea_4b42_b74d_59ebc727afc6\n\n spec = {\n \"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\",\n \"description\": \"Top 10 largest zip codes by green roof area\",\n \"width\": 400,\n \"height\": 200,\n \"selection\": {\n \"zip_select\": {\n \"type\": \"multi\",\n \"fields\": [\"zip\"],\n \"toggle\": \"event.shiftKey\"\n }\n },\n \"mark\": { \"type\": \"bar\", \"stroke\": \"black\", \"color\": \"green\" },\n \"encoding\": {\n \"x\": {\n \"field\": \"VEGETATED_SQFT\",\n \"type\": \"quantitative\",\n \"axis\": {\n \"title\": \"Total Vegetated Roof Size (sqft)\",\n \"values\": [100000, 250000, 500000, 1000000],\n \"format\": \",d\"\n }\n },\n \"y\": {\n \"field\": \"zip\",\n \"type\": \"nominal\",\n \"sort\": \"-x\",\n \"axis\": { \"title\": \"Zip Code\" }\n },\n \"color\": {\n \"field\": \"zip\",\n \"type\": \"nominal\",\n \"scale\": { \"scheme\": \"category20\" }\n },\n \"opacity\": {\n \"condition\": { \"selection\": \"zip_select\", \"value\": 1 },\n \"value\": 0.3\n },\n \"tooltip\": [\n { \"field\": \"zip\", \"type\": \"nominal\" },\n { \"field\": \"VEGETATED_SQFT\", \"type\": \"quantitative\" }\n ]\n }\n }\n\n values = input_data\n if hasattr(input_data, \"to_dict\"):\n values = input_data.to_dict(orient=\"records\")\n\n if isinstance(spec, dict):\n spec[\"data\"] = {\"values\": values}\n\n from IPython.display import display\n display({\"application/vnd.vegalite.v5+json\": spec, \"text/plain\": spec}, raw=True)\n\n return input_data\n\n\n_curio_output = _curio_node()\n\ntry:\n result_d23e2587_57bf_4db4_84fe_cdb7c2de638d = _curio_output\nexcept NameError:\n result_d23e2587_57bf_4db4_84fe_cdb7c2de638d = None\n",
"metadata": {
"id": "d23e2587-57bf-4db4-84fe-cdb7c2de638d",
"language": "python"
}
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading