import%20marimo%0A%0A__generated_with%20%3D%20%220.23.9%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20Stormwater%20%26%20wastewater%20network%20%E2%80%94%20QA%20(SP0%20foundation)%0A%0A%20%20%20%20Confirms%20the%20ingested%20St-Pete%20drainage%20networks%20and%20the%20derived%20per-parcel%0A%20%20%20%20features%20are%20spatially%20sane%20before%20the%20analytical%20sub-projects%20build%20on%20them.%0A%20%20%20%20Read-only.%20No%20findings%20here%20%E2%80%94%20this%20is%20plumbing%20QA.%0A%0A%20%20%20%20**Teaser%20for%20SP2%20(compound%20flood)%3A**%20the%20outfall%20%60RIM%60%20elevation%20distribution%0A%20%20%20%20is%20plotted%20below.%20SP2%20will%20model%20how%20outfalls%20submerge%20and%20backflow%20during%20surge%0A%20%20%20%20once%20the%20RIM%20datum%20is%20confirmed%20against%20the%20data%20dictionary.%20**Note%3A%20the%20ingested%0A%20%20%20%20%60RIM%60%20values%20run%20~90%E2%80%93436%20ft%20(median%20~103%20ft)%20%E2%80%94%20the%20vertical%20datum%20is%20unconfirmed%0A%20%20%20%20and%20is%20NOT%20verified%20as%20NAVD88.%20The%20datum%20must%20be%20resolved%20in%20SP2%20before%20any%0A%20%20%20%20comparison%20to%20a%20surge-surface%20elevation%20is%20valid.**%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20sys%0A%20%20%20%20import%20pathlib%0A%0A%20%20%20%20_root%20%3D%20pathlib.Path(__file__).resolve().parents%5B1%5D%0A%20%20%20%20if%20str(_root)%20not%20in%20sys.path%3A%0A%20%20%20%20%20%20%20%20sys.path.insert(0%2C%20str(_root))%0A%0A%20%20%20%20import%20duckdb%0A%20%20%20%20import%20geopandas%20as%20gpd%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%20%20%20%20import%20pandas%20as%20pd%0A%0A%20%20%20%20con%20%3D%20duckdb.connect(str(_root%20%2F%20%22analytics.db%22)%2C%20read_only%3DTrue)%0A%20%20%20%20return%20con%2C%20gpd%2C%20mo%2C%20plt%0A%0A%0A%40app.cell%0Adef%20_(con)%3A%0A%20%20%20%20feats%20%3D%20con.execute(%22SELECT%20*%20FROM%20parcel_drainage_features%22).df()%0A%20%20%20%20feats%5B%5B%0A%20%20%20%20%20%20%20%20%22dist_to_nearest_outfall_ft%22%2C%20%22dist_to_nearest_inlet_ft%22%2C%0A%20%20%20%20%20%20%20%20%22inlets_within_500ft%22%2C%20%22dist_to_nearest_lift_station_ft%22%2C%0A%20%20%20%20%5D%5D.describe()%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(con%2C%20gpd%2C%20plt)%3A%0A%20%20%20%20%23%20Coverage%20map%3A%20inlets%20(small)%20%2B%20outfalls%20%2B%20lift%20stations%20over%20the%20city.%0A%20%20%20%20def%20_layer(table)%3A%0A%20%20%20%20%20%20%20%20df%20%3D%20con.execute(f%22SELECT%20geometry_wkt%20FROM%20%7Btable%7D%22).df()%0A%20%20%20%20%20%20%20%20return%20gpd.GeoSeries.from_wkt(df%5B%22geometry_wkt%22%5D%2C%20crs%3D%22EPSG%3A4326%22)%0A%0A%20%20%20%20_fig%2C%20_ax%20%3D%20plt.subplots(figsize%3D(8%2C%208))%0A%20%20%20%20_layer(%22stormwater_inlets%22).plot(ax%3D_ax%2C%20markersize%3D1%2C%20color%3D%22%239ecae1%22%2C%20label%3D%22inlets%22)%0A%20%20%20%20_layer(%22stormwater_outfalls%22).plot(ax%3D_ax%2C%20markersize%3D8%2C%20color%3D%22%2308519c%22%2C%20label%3D%22outfalls%22)%0A%20%20%20%20_layer(%22wastewater_lift_stations%22).plot(ax%3D_ax%2C%20markersize%3D20%2C%20marker%3D%22%5E%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20color%3D%22%23cb181d%22%2C%20label%3D%22lift%20stations%22)%0A%20%20%20%20_ax.set_title(%22St-Pete%20drainage%20network%20%E2%80%94%20coverage%22)%0A%20%20%20%20_ax.legend()%0A%20%20%20%20_fig%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(con%2C%20plt)%3A%0A%20%20%20%20%23%20SP2%20teaser%3A%20outfall%20RIM%20elevation%20distribution.%0A%20%20%20%20%23%20DATUM%20NOTE%3A%20ingested%20RIM%20values%20run%20~90%E2%80%93436%20ft%20(median%20~103%20ft).%20The%20vertical%0A%20%20%20%20%23%20datum%20is%20UNCONFIRMED%20%E2%80%94%20it%20is%20NOT%20verified%20as%20NAVD88.%20A%20surge-surface%20comparison%0A%20%20%20%20%23%20(e.g.%2C%20~8.5%20ft%20NAVD88%20for%20a%20cat-model%20surge%20event)%20is%20NOT%20plotted%20here%20because%0A%20%20%20%20%23%20it%20would%20be%20misleading%20against%20an%20unverified%20datum.%20Resolve%20the%20datum%20in%20the%0A%20%20%20%20%23%20SP2%20data-dictionary%20review%20before%20adding%20any%20threshold%20line.%0A%20%20%20%20rim%20%3D%20con.execute(%0A%20%20%20%20%20%20%20%20%22SELECT%20RIM%20FROM%20stormwater_outfalls%20WHERE%20RIM%20IS%20NOT%20NULL%22%0A%20%20%20%20).df()%0A%20%20%20%20_fig%2C%20_ax%20%3D%20plt.subplots(figsize%3D(7%2C%204))%0A%20%20%20%20_ax.hist(rim%5B%22RIM%22%5D%2C%20bins%3D40%2C%20color%3D%22%236baed6%22)%0A%20%20%20%20_ax.set_xlabel(%22Outfall%20RIM%20elevation%20(ft)%20%E2%80%94%20datum%20UNCONFIRMED%2C%20pending%20SP2%20data-dictionary%20review%22)%0A%20%20%20%20_ax.set_ylabel(%22outfalls%22)%0A%20%20%20%20_ax.set_title(%0A%20%20%20%20%20%20%20%20f%22Outfall%20RIM%20distribution%20(n%3D%7Blen(rim)%3A%2C%7D%20of%204%2C304%20non-null)%5Cn%22%0A%20%20%20%20%20%20%20%20%22Datum%20unconfirmed%3A%20do%20not%20compare%20to%20NAVD88%20surge-surface%20thresholds%20until%20resolved%22%0A%20%20%20%20)%0A%20%20%20%20_ax.text(%0A%20%20%20%20%20%20%20%200.97%2C%200.95%2C%0A%20%20%20%20%20%20%20%20%22Datum%20unconfirmed%5Cn(not%20verified%20NAVD88)%5CnSP2%20action%20required%22%2C%0A%20%20%20%20%20%20%20%20transform%3D_ax.transAxes%2C%0A%20%20%20%20%20%20%20%20ha%3D%22right%22%2C%20va%3D%22top%22%2C%0A%20%20%20%20%20%20%20%20fontsize%3D8%2C%0A%20%20%20%20%20%20%20%20color%3D%22%23cb181d%22%2C%0A%20%20%20%20%20%20%20%20bbox%3Ddict(boxstyle%3D%22round%2Cpad%3D0.3%22%2C%20fc%3D%22white%22%2C%20ec%3D%22%23cb181d%22%2C%20alpha%3D0.8)%2C%0A%20%20%20%20)%0A%20%20%20%20_fig%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
8de00bd33dd2809051ab5a144eb6ef63