Spaces:
Sleeping

dn commited on
Commit
5c7d98a
·
1 Parent(s): 34b8916

display stops

Browse files
.clinerules ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python Environment Rule
2
+ - Python environment is managed by uv
3
+ - NEVER run system `python` or `python3` commands directly
4
+ - ALWAYS use `uv run python` to execute scripts and test code
5
+ - ALWAYS use `uv run` for script execution and testing
6
+ - Package management must use `uv add` instead of `pip install`
7
+ - Use `uv pip list` or `uv run pip list` to view installed packages
8
+ - The virtual environment is located at ./venv/
9
+
10
+ # Windows Environment Rules
11
+ - Most dev is done in Windows environment
12
+ - WSL is available for any linux commands that need to be run
.gitignore CHANGED
@@ -2,6 +2,8 @@ _site/
2
  __marimo__
3
  test_output
4
 
 
 
5
  # Byte-compiled / optimized / DLL files
6
  __pycache__/
7
  *.py[cod]
 
2
  __marimo__
3
  test_output
4
 
5
+ .vscode/
6
+
7
  # Byte-compiled / optimized / DLL files
8
  __pycache__/
9
  *.py[cod]
.pre-commit-config.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.15.1
5
+ hooks:
6
+ # Run the linter.
7
+ - id: ruff-check
8
+ types_or: [ python, pyi ]
9
+ args: [ --fix ]
10
+ # Run the formatter.
11
+ - id: ruff-format
12
+ types_or: [ python, pyi ]
.python-version ADDED
@@ -0,0 +1 @@
 
 
1
+ 3.13
notebooks/fibonacci.py DELETED
@@ -1,49 +0,0 @@
1
- # /// script
2
- # requires-python = ">=3.12"
3
- # dependencies = [
4
- # "marimo==0.13.15",
5
- # ]
6
- # ///
7
- import marimo
8
-
9
- __generated_with = "0.10.6"
10
- app = marimo.App()
11
-
12
- with app.setup:
13
- import marimo as mo
14
-
15
- @app.cell
16
- def _():
17
- mo.md(
18
- r"""
19
- # Fibonacci Calculator
20
-
21
- Use the slider above to calculate the first {n.value} numbers in the Fibonacci sequence.
22
- """
23
- )
24
- return
25
-
26
-
27
- @app.cell
28
- def _():
29
- # Create an interactive slider
30
- n = mo.ui.slider(1, 100, value=50, label="Number of Fibonacci numbers")
31
- n
32
- return n
33
-
34
-
35
- @app.cell
36
- def _(n):
37
- fib = fibonacci(n.value)
38
- mo.md(", ".join([str(f) for f in fib]))
39
-
40
- @app.function
41
- def fibonacci(n):
42
- sequence = [0, 1]
43
- for i in range(2, n):
44
- sequence.append(sequence[i - 1] + sequence[i - 2])
45
- return sequence
46
-
47
-
48
- if __name__ == "__main__":
49
- app.run()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
notebooks/sb79_map.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "arcgis>=2.4.3",
5
+ # "folium>=0.20.0",
6
+ # "geopandas>=1.1.3",
7
+ # "marimo>=0.23.3",
8
+ # "pandas>=3.0.2",
9
+ # ]
10
+ # ///
11
+
12
+ import marimo
13
+
14
+ __generated_with = "0.23.4"
15
+ app = marimo.App()
16
+
17
+ with app.setup:
18
+ import marimo as mo
19
+ import geopandas as gpd
20
+ import folium
21
+ import arcgis
22
+ import json
23
+ from collections import defaultdict
24
+ import pandas as pd
25
+ from folium.plugins import MarkerCluster
26
+ STOPS_LAYER_ID = "d6fc47eca97e48b7890c8fb7c9b69688"
27
+
28
+
29
+ @app.cell
30
+ def _():
31
+ arc_api = arcgis.GIS()
32
+ stops = arc_api.content.get(STOPS_LAYER_ID).layers[0].query()
33
+ # Use from_features with GeoJSON instead of .sdf to avoid arcgis pandas import issues in sandbox
34
+ stops_df = gpd.GeoDataFrame.from_features(features=json.loads(stops.to_geojson))
35
+ stops_df = stops_df.set_crs("EPSG:3857")
36
+ stops_df = stops_df.to_crs("EPSG:4326")
37
+ stops_df
38
+ return (stops_df,)
39
+
40
+
41
+ @app.cell
42
+ def _(stops_df):
43
+ m = folium.Map(location=[34.0617140033952, -118.314146442073], tiles="CartoDB Positron", zoom_start=10)
44
+
45
+ cluster = MarkerCluster(disable_clustering_at_zoom=10).add_to(m)
46
+ for _, _row in stops_df.iterrows():
47
+ color = 'blue' if _row['Tier'] == 2 else 'red'
48
+ cluster.add_child(
49
+ folium.CircleMarker(
50
+ location=[_row.geometry.y, _row.geometry.x],
51
+ radius=5,
52
+ tooltip=folium.Tooltip(f"Stop Name: {_row['stop_name']}<br>Tier: {_row['Tier']}<br>Routes: {_row['route_ids_served']}<br>City: {_row['city']}<br>County: {_row['county']}<br>Route type: {_row['routetypes']}"),
53
+ color=color,
54
+ fill_color=color
55
+ ).add_to(m)
56
+ )
57
+ m
58
+ return
59
+
60
+
61
+ if __name__ == "__main__":
62
+ app.run()
pyproject.toml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "missing-metro"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ dependencies = [
8
+ "altair>=6.1.0",
9
+ "arcgis>=2.4.3",
10
+ "folium>=0.20.0",
11
+ "geopandas>=1.1.3",
12
+ "marimo[lsp,recommended]>=0.23.4",
13
+ "numpy>=2.4.4",
14
+ "pandas>=3.0.2",
15
+ "pre-commit>=4.6.0",
16
+ "requests>=2.33.1",
17
+ "ruff>=0.15.12",
18
+ ]
uv.lock ADDED
The diff for this file is too large to render. See raw diff