Spaces:
Sleeping
Sleeping
Added hurricane app #46
Browse files- app.py +2 -0
- apps/hurricane.py +51 -0
- requirements.txt +1 -0
app.py
CHANGED
@@ -11,6 +11,7 @@ from apps import (
|
|
11 |
heatmap,
|
12 |
home,
|
13 |
housing,
|
|
|
14 |
plotly_maps,
|
15 |
raster,
|
16 |
timelapse,
|
@@ -28,6 +29,7 @@ apps = MultiApp()
|
|
28 |
|
29 |
apps.add_app("Home", home.app)
|
30 |
apps.add_app("Create Timelapse", timelapse.app)
|
|
|
31 |
apps.add_app("U.S. Real Estate Data", housing.app)
|
32 |
apps.add_app("U.S. Census Data", census.app)
|
33 |
apps.add_app("Visualize Raster Data", raster.app)
|
|
|
11 |
heatmap,
|
12 |
home,
|
13 |
housing,
|
14 |
+
hurricane,
|
15 |
plotly_maps,
|
16 |
raster,
|
17 |
timelapse,
|
|
|
29 |
|
30 |
apps.add_app("Home", home.app)
|
31 |
apps.add_app("Create Timelapse", timelapse.app)
|
32 |
+
apps.add_app("Hurricane Mapping", hurricane.app)
|
33 |
apps.add_app("U.S. Real Estate Data", housing.app)
|
34 |
apps.add_app("U.S. Census Data", census.app)
|
35 |
apps.add_app("Visualize Raster Data", raster.app)
|
apps/hurricane.py
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import tropycal.tracks as tracks
|
3 |
+
|
4 |
+
|
5 |
+
@st.cache
|
6 |
+
def read_data(basin='north_atlantic',source='hurdat',include_btk=False):
|
7 |
+
return tracks.TrackDataset(basin=basin,source=source,include_btk=include_btk)
|
8 |
+
|
9 |
+
def app():
|
10 |
+
|
11 |
+
st.title("Hurricane Mapping")
|
12 |
+
|
13 |
+
row1_col1, row1_col2 = st.columns([3, 1])
|
14 |
+
|
15 |
+
with row1_col1:
|
16 |
+
empty = st.empty()
|
17 |
+
empty.image("https://i.imgur.com/Ec7qsR0.png")
|
18 |
+
|
19 |
+
with row1_col2:
|
20 |
+
|
21 |
+
checkbox = st.checkbox("Select from a list of hurricanes", value=False)
|
22 |
+
if checkbox:
|
23 |
+
if st.session_state.get('hurricane') is None:
|
24 |
+
st.session_state['hurricane'] = read_data()
|
25 |
+
|
26 |
+
years = st.slider('Select a year', min_value=1950, max_value=2022, value=(2000, 2010))
|
27 |
+
storms = st.session_state['hurricane'].filter_storms(year_range=years)
|
28 |
+
selected = st.selectbox('Select a storm', storms)
|
29 |
+
storm = st.session_state['hurricane'].get_storm(selected)
|
30 |
+
ax = storm.plot()
|
31 |
+
fig = ax.get_figure()
|
32 |
+
empty.pyplot(fig)
|
33 |
+
else:
|
34 |
+
|
35 |
+
name = st.text_input("Or enter a storm Name", "michael")
|
36 |
+
if name:
|
37 |
+
if st.session_state.get('hurricane') is None:
|
38 |
+
st.session_state['hurricane'] = read_data()
|
39 |
+
basin = st.session_state['hurricane']
|
40 |
+
years = basin.search_name(name)
|
41 |
+
if len(years) > 0:
|
42 |
+
year = st.selectbox("Select a year", years)
|
43 |
+
storm = basin.get_storm((name,year))
|
44 |
+
ax = storm.plot()
|
45 |
+
fig = ax.get_figure()
|
46 |
+
empty.pyplot(fig)
|
47 |
+
else:
|
48 |
+
empty.text("No storms found")
|
49 |
+
st.write("No storms found")
|
50 |
+
|
51 |
+
|
requirements.txt
CHANGED
@@ -9,6 +9,7 @@ streamlit
|
|
9 |
streamlit-folium
|
10 |
streamlit-keplergl
|
11 |
streamlit-bokeh-events
|
|
|
12 |
# leafmap
|
13 |
# geemap
|
14 |
git+https://github.com/giswqs/leafmap
|
|
|
9 |
streamlit-folium
|
10 |
streamlit-keplergl
|
11 |
streamlit-bokeh-events
|
12 |
+
tropycal
|
13 |
# leafmap
|
14 |
# geemap
|
15 |
git+https://github.com/giswqs/leafmap
|