jordancaraballo commited on
Commit
5f0a394
β€’
1 Parent(s): c00748e

Fixing PEP8 compliance

Browse files
pages/pages/1_⚑_Alaskan_Tundra_Lightning.py CHANGED
@@ -1,4 +1,7 @@
 
1
  import streamlit as st
 
 
2
 
3
  st.set_page_config(
4
  page_title="streamlit-folium documentation: Draw Support",
@@ -9,21 +12,10 @@ st.set_page_config(
9
  """
10
  # streamlit-folium: Draw Support
11
 
12
- Folium supports some of the [most popular leaflet plugins](https://python-visualization.github.io/folium/plugins.html). In this example,
13
- we can add the [`Draw`](https://python-visualization.github.io/folium/plugins.html#folium.plugins.Draw) plugin to our map, which allows for drawing geometric shapes on the map.
14
-
15
- When a shape is drawn on the map, the coordinates that represent that shape are passed back as a geojson feature via
16
- the `all_drawings` and `last_active_drawing` data fields.
17
-
18
  Draw something below to see the return value back to Streamlit!
19
  """
20
 
21
  with st.echo(code_location="below"):
22
- import folium
23
- import streamlit as st
24
- from folium.plugins import Draw
25
-
26
- from streamlit_folium import st_folium
27
 
28
  m = folium.Map(location=[39.949610, -75.150282], zoom_start=5)
29
  Draw(export=True).add_to(m)
 
1
+ import folium
2
  import streamlit as st
3
+ from folium.plugins import Draw
4
+ from streamlit_folium import st_folium
5
 
6
  st.set_page_config(
7
  page_title="streamlit-folium documentation: Draw Support",
 
12
  """
13
  # streamlit-folium: Draw Support
14
 
 
 
 
 
 
 
15
  Draw something below to see the return value back to Streamlit!
16
  """
17
 
18
  with st.echo(code_location="below"):
 
 
 
 
 
19
 
20
  m = folium.Map(location=[39.949610, -75.150282], zoom_start=5)
21
  Draw(export=True).add_to(m)
pages/pages/2_🌍_Alaska_WRF.py CHANGED
@@ -1,4 +1,7 @@
 
1
  import streamlit as st
 
 
2
 
3
  st.set_page_config(
4
  page_title="streamlit-folium documentation: Draw Support",
@@ -9,21 +12,10 @@ st.set_page_config(
9
  """
10
  # streamlit-folium: Draw Support
11
 
12
- Folium supports some of the [most popular leaflet plugins](https://python-visualization.github.io/folium/plugins.html). In this example,
13
- we can add the [`Draw`](https://python-visualization.github.io/folium/plugins.html#folium.plugins.Draw) plugin to our map, which allows for drawing geometric shapes on the map.
14
-
15
- When a shape is drawn on the map, the coordinates that represent that shape are passed back as a geojson feature via
16
- the `all_drawings` and `last_active_drawing` data fields.
17
-
18
  Draw something below to see the return value back to Streamlit!
19
  """
20
 
21
  with st.echo(code_location="below"):
22
- import folium
23
- import streamlit as st
24
- from folium.plugins import Draw
25
-
26
- from streamlit_folium import st_folium
27
 
28
  m = folium.Map(location=[39.949610, -75.150282], zoom_start=5)
29
  Draw(export=True).add_to(m)
 
1
+ import folium
2
  import streamlit as st
3
+ from folium.plugins import Draw
4
+ from streamlit_folium import st_folium
5
 
6
  st.set_page_config(
7
  page_title="streamlit-folium documentation: Draw Support",
 
12
  """
13
  # streamlit-folium: Draw Support
14
 
 
 
 
 
 
 
15
  Draw something below to see the return value back to Streamlit!
16
  """
17
 
18
  with st.echo(code_location="below"):
 
 
 
 
 
19
 
20
  m = folium.Map(location=[39.949610, -75.150282], zoom_start=5)
21
  Draw(export=True).add_to(m)
pages/pages/3_x_geemap.py ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ee
2
+ import geemap.foliumap as geemap
3
+ import geemap.colormaps as cm
4
+ import geopandas as gpd
5
+ import streamlit as st
6
+
7
+
8
+ @st.cache
9
+ def uploaded_file_to_gdf(data):
10
+ import tempfile
11
+ import os
12
+ import uuid
13
+
14
+ _, file_extension = os.path.splitext(data.name)
15
+ file_id = str(uuid.uuid4())
16
+ file_path = os.path.join(tempfile.gettempdir(), f"{file_id}{file_extension}")
17
+
18
+ with open(file_path, "wb") as file:
19
+ file.write(data.getbuffer())
20
+
21
+ if file_path.lower().endswith(".kml"):
22
+ gpd.io.file.fiona.drvsupport.supported_drivers["KML"] = "rw"
23
+ gdf = gpd.read_file(file_path, driver="KML")
24
+ else:
25
+ gdf = gpd.read_file(file_path)
26
+
27
+ return gdf
28
+
29
+
30
+ def app():
31
+
32
+ st.title("Global Surface Water Datasets")
33
+
34
+ with st.expander("How to use this app"):
35
+
36
+ markdown = """
37
+ This interactive app allows you to explore and compare different datasets of Global Surface Water Extent (GSWE). How to use this web app?
38
+ - **Step 1:** Select a basemap from the dropdown menu on the right. The default basemap is `HYBRID`, a Google Satellite basemap with labels.
39
+ - **Step 2:** Select a region of interest (ROI) from the country dropdown menu or upload an ROI. The default ROI is the entire globe.
40
+ - **Step 3:** Select surface water datasets from the dropdown menu. You can select multiple datasets to display on the map.
41
+ """
42
+ st.markdown(markdown)
43
+
44
+ col1, col2 = st.columns([3, 1])
45
+
46
+ Map = geemap.Map(Draw_export=False, locate_control=True, plugin_LatLngPopup=True)
47
+
48
+ roi = ee.FeatureCollection("users/giswqs/public/countries")
49
+ # countries = roi.aggregate_array("name").getInfo()
50
+ # countries.sort()
51
+ countries = ["United States of America"]
52
+
53
+ lc_basemaps = [
54
+ "ESA Global Land Cover 2020",
55
+ "ESRI Global Land Cover 2020",
56
+ "JRC Global Surface Water",
57
+ "USDA NASS Cropland 2020",
58
+ "US NLCD 2019",
59
+ ]
60
+
61
+ google_basemaps = ["OpenStreetMap"] + [
62
+ "Google " + b for b in list(geemap.basemaps.keys())[1:5]
63
+ ]
64
+ basemaps = google_basemaps + lc_basemaps
65
+ with col2:
66
+
67
+ latitude = st.number_input("Map center latitude", -90.0, 90.0, 40.0, step=0.5)
68
+ longitude = st.number_input(
69
+ "Map center longitude", -180.0, 180.0, -100.0, step=0.5
70
+ )
71
+ zoom = st.slider("Map zoom level", 1, 22, 4)
72
+
73
+ select = st.checkbox("Select a country")
74
+ if select:
75
+ country = st.selectbox(
76
+ "Select a country from dropdown list",
77
+ countries,
78
+ index=countries.index("United States of America"),
79
+ )
80
+ st.session_state["ROI"] = roi.filter(ee.Filter.eq("name", country))
81
+ else:
82
+
83
+ with st.expander("Click here to upload an ROI", False):
84
+ upload = st.file_uploader(
85
+ "Upload a GeoJSON, KML or Shapefile (as a zif file) to use as an ROI. πŸ˜‡πŸ‘‡",
86
+ type=["geojson", "kml", "zip"],
87
+ )
88
+
89
+ if upload:
90
+ gdf = uploaded_file_to_gdf(upload)
91
+ st.session_state["ROI"] = geemap.gdf_to_ee(gdf, geodesic=False)
92
+ # Map.add_gdf(gdf, "ROI")
93
+ else:
94
+ st.session_state["ROI"] = roi
95
+
96
+ basemap = st.selectbox(
97
+ "Select a basemap",
98
+ basemaps,
99
+ index=basemaps.index("Google HYBRID"),
100
+ )
101
+ if basemap in google_basemaps:
102
+ Map.add_basemap(basemap.replace("Google ", ""))
103
+ elif basemap in lc_basemaps:
104
+
105
+ if basemap == "ESA Global Land Cover 2020":
106
+ dataset = ee.ImageCollection("ESA/WorldCover/v100").first()
107
+ if st.session_state["ROI"] is not None:
108
+ dataset = dataset.clipToCollection(st.session_state["ROI"])
109
+
110
+ Map.addLayer(dataset, {}, "ESA Landcover")
111
+ Map.add_legend(title="ESA Landcover", builtin_legend="ESA_WorldCover")
112
+ elif basemap == "ESRI Global Land Cover 2020":
113
+
114
+ esri_lulc10 = ee.ImageCollection(
115
+ "projects/sat-io/open-datasets/landcover/ESRI_Global-LULC_10m"
116
+ )
117
+ legend_dict = {
118
+ "names": [
119
+ "Water",
120
+ "Trees",
121
+ "Grass",
122
+ "Flooded Vegetation",
123
+ "Crops",
124
+ "Scrub/Shrub",
125
+ "Built Area",
126
+ "Bare Ground",
127
+ "Snow/Ice",
128
+ "Clouds",
129
+ ],
130
+ "colors": [
131
+ "#1A5BAB",
132
+ "#358221",
133
+ "#A7D282",
134
+ "#87D19E",
135
+ "#FFDB5C",
136
+ "#EECFA8",
137
+ "#ED022A",
138
+ "#EDE9E4",
139
+ "#F2FAFF",
140
+ "#C8C8C8",
141
+ ],
142
+ }
143
+
144
+ vis_params = {"min": 1, "max": 10, "palette": legend_dict["colors"]}
145
+ esri_lulc10 = esri_lulc10.mosaic()
146
+
147
+ if st.session_state["ROI"] is not None:
148
+ esri_lulc10 = esri_lulc10.clipToCollection(st.session_state["ROI"])
149
+ Map.addLayer(esri_lulc10, vis_params, "ESRI Global Land Cover")
150
+ Map.add_legend(title="ESRI Landcover", builtin_legend="ESRI_LandCover")
151
+
152
+ elif basemap == "US NLCD 2019":
153
+ nlcd = ee.Image("USGS/NLCD_RELEASES/2019_REL/NLCD/2019").select(
154
+ "landcover"
155
+ )
156
+ if st.session_state["ROI"] is not None:
157
+ nlcd = nlcd.clipToCollection(st.session_state["ROI"])
158
+ Map.addLayer(nlcd, {}, "US NLCD 2019")
159
+ Map.add_legend(title="NLCD Land Cover", builtin_legend="NLCD")
160
+
161
+ elif basemap == "USDA NASS Cropland 2020":
162
+ cropland = (
163
+ ee.ImageCollection("USDA/NASS/CDL")
164
+ .filterDate("2010-01-01", "2020-01-01")
165
+ .first()
166
+ .select("cropland")
167
+ )
168
+
169
+ if st.session_state["ROI"] is not None:
170
+ cropland = cropland.clipToCollection(st.session_state["ROI"])
171
+
172
+ Map.addLayer(cropland, {}, "USDA NASS Cropland 2020")
173
+
174
+ # elif "HydroSHEDS" in datasets:
175
+ # hydrolakes = ee.FeatureCollection(
176
+ # "projects/sat-io/open-datasets/HydroLakes/lake_poly_v10"
177
+ # )
178
+ # if st.session_state["ROI"] is not None:
179
+ # hydrolakes = hydrolakes.filterBounds(st.session_state["ROI"])
180
+ # Map.addLayer(hydrolakes, {"color": "#00008B"}, "HydroSHEDS - HydroLAKES")
181
+
182
+ # roi = ee.FeatureCollection("users/giswqs/MRB/NWI_HU8_Boundary_Simplify")
183
+ style = {
184
+ "color": "000000ff",
185
+ "width": 1,
186
+ "lineType": "solid",
187
+ "fillColor": "00000000",
188
+ }
189
+
190
+ # select_holder = col2.empty()
191
+ with col2:
192
+ datasets = st.multiselect(
193
+ "Select surface water datasets",
194
+ [
195
+ "ESA Land Use",
196
+ "JRC Max Water Extent",
197
+ "OpenStreetMap",
198
+ "HydroLakes",
199
+ "LAGOS",
200
+ "US NED Depressions",
201
+ "Global River Width",
202
+ ],
203
+ )
204
+
205
+ # styles = {
206
+ # "ESA Land Use": {
207
+ # "color": "dca0dcff",
208
+ # "width": width,
209
+ # "fillColor": "e4bbe4ff",
210
+ # },
211
+ # "JRC Max Water Extent": {
212
+ # "color": "ffc2cbff",
213
+ # "width": width,
214
+ # "fillColor": "fdd1d8ff",
215
+ # },
216
+ # "OpenStreetMap": {
217
+ # "color": "bf03bfff",
218
+ # "width": width,
219
+ # "fillColor": "ebb2ebff",
220
+ # },
221
+ # "HydroLakes": {
222
+ # "color": "4e0583ff",
223
+ # "width": width,
224
+ # "fillColor": "a47fbfff",
225
+ # },
226
+ # "LAGOS": {
227
+ # "color": "8f228fff",
228
+ # "width": width,
229
+ # "fillColor": "cb99cbff",
230
+ # },
231
+ # "US NED Depressions": {
232
+ # "color": "8d32e2ff",
233
+ # "width": width,
234
+ # "fillColor": "c394efff",
235
+ # },
236
+ # }
237
+
238
+ width = 1
239
+ styles = {
240
+ "ESA Land Use": {
241
+ "color": "000000ff",
242
+ "width": width,
243
+ "fillColor": "dca0dcff",
244
+ },
245
+ "JRC Max Water Extent": {
246
+ "color": "000000ff",
247
+ "width": width,
248
+ "fillColor": "ffc2cbff",
249
+ },
250
+ "OpenStreetMap": {
251
+ "color": "000000ff",
252
+ "width": width,
253
+ "fillColor": "bf03bfff",
254
+ },
255
+ "HydroLakes": {
256
+ "color": "000000ff",
257
+ "width": width,
258
+ "fillColor": "4e0583ff",
259
+ },
260
+ "LAGOS": {
261
+ "color": "000000ff",
262
+ "width": width,
263
+ "fillColor": "8f228fff",
264
+ },
265
+ "US NED Depressions": {
266
+ "color": "000000ff",
267
+ "width": width,
268
+ "fillColor": "8d32e2ff",
269
+ },
270
+ "Global River Width": {
271
+ "color": "000000ff",
272
+ "width": width,
273
+ "fillColor": "0000ffff",
274
+ },
275
+ }
276
+
277
+ if "ESA Land Use" in datasets:
278
+ dataset = ee.FeatureCollection("users/giswqs/MRB/ESA_entireUS")
279
+ Map.addLayer(dataset.style(**styles["ESA Land Use"]), {}, "ESA Land Use")
280
+
281
+ if "JRC Max Water Extent" in datasets:
282
+ dataset = ee.FeatureCollection("users/giswqs/MRB/JRC_entireUS")
283
+ Map.addLayer(
284
+ dataset.style(**styles["JRC Max Water Extent"]), {}, "JRC Max Water Extent"
285
+ )
286
+
287
+ if "OpenStreetMap" in datasets:
288
+ dataset = ee.FeatureCollection("users/giswqs/MRB/OSM_entireUS")
289
+ Map.addLayer(dataset.style(**styles["OpenStreetMap"]), {}, "OpenStreetMap")
290
+
291
+ if "HydroLakes" in datasets:
292
+ dataset = ee.FeatureCollection("users/giswqs/MRB/HL_entireUS")
293
+ Map.addLayer(dataset.style(**styles["HydroLakes"]), {}, "HydroLakes")
294
+
295
+ if "LAGOS" in datasets:
296
+ dataset = ee.FeatureCollection("users/giswqs/MRB/LAGOS_entireUS")
297
+ Map.addLayer(dataset.style(**styles["LAGOS"]), {}, "LAGOS")
298
+
299
+ if "US NED Depressions" in datasets:
300
+ depressions = ee.FeatureCollection("users/giswqs/MRB/US_depressions")
301
+ Map.addLayer(
302
+ depressions.style(**styles["US NED Depressions"]), {}, "US NED Depressions"
303
+ )
304
+
305
+ if datasets:
306
+ legend_datasets = datasets[:]
307
+ # if "Global River Width" in legend_datasets:
308
+ # legend_datasets.remove("Global River Width")
309
+ legend_dict = {}
310
+ for dataset in legend_datasets:
311
+ legend_dict[dataset] = styles[dataset]["fillColor"][:6]
312
+
313
+ if len(legend_datasets) > 0:
314
+
315
+ Map.add_legend(title="Surface Water", legend_dict=legend_dict)
316
+
317
+ # if "JRC Global Surface Water" in datasets:
318
+ # jrc = ee.Image("JRC/GSW1_3/GlobalSurfaceWater")
319
+ # vis = {
320
+ # "bands": ["occurrence"],
321
+ # "min": 0.0,
322
+ # "max": 100.0,
323
+ # "palette": cm.palettes.coolwarm_r,
324
+ # }
325
+ # Map.addLayer(jrc, vis, "JRC Global Surface Water")
326
+ # Map.add_colorbar(vis, label="Surface water occurrence (%)")
327
+
328
+ if "Global River Width" in datasets:
329
+ water_mask = ee.ImageCollection(
330
+ "projects/sat-io/open-datasets/GRWL/water_mask_v01_01"
331
+ ).median()
332
+
333
+ grwl_summary = ee.FeatureCollection(
334
+ "projects/sat-io/open-datasets/GRWL/grwl_SummaryStats_v01_01"
335
+ )
336
+ grwl_water_vector = ee.FeatureCollection(
337
+ "projects/sat-io/open-datasets/GRWL/water_vector_v01_01"
338
+ )
339
+
340
+ if st.session_state["ROI"] is not None:
341
+ water_mask = water_mask.clipToCollection(st.session_state["ROI"])
342
+ grwl_summary = grwl_summary.filterBounds(st.session_state["ROI"])
343
+
344
+ Map.addLayer(water_mask, {"palette": "blue"}, "GRWL RIver Mask")
345
+ Map.addLayer(
346
+ grwl_water_vector.style(**{"fillColor": "00000000", "color": "FF5500"}),
347
+ {},
348
+ "GRWL Centerline",
349
+ False,
350
+ )
351
+ Map.addLayer(
352
+ grwl_summary.style(**{"fillColor": "00000000", "color": "EE5500"}),
353
+ {},
354
+ "GRWL Centerline Simplified",
355
+ )
356
+
357
+ show = False
358
+ if select and country is not None:
359
+ name = country
360
+ style["color"] = "#000000"
361
+ style["width"] = 2
362
+ show = True
363
+ elif upload:
364
+ name = "ROI"
365
+ style["color"] = "#FFFF00"
366
+ style["width"] = 2
367
+ show = True
368
+ else:
369
+ name = "World"
370
+
371
+ Map.addLayer(st.session_state["ROI"].style(**style), {}, name, show)
372
+ Map.centerObject(st.session_state["ROI"])
373
+
374
+ with col2:
375
+ wbds = [
376
+ "NHD-HUC2",
377
+ "NHD-HUC4",
378
+ "NHD-HUC6",
379
+ "NHD-HUC8",
380
+ "NHD-HUC10",
381
+ ]
382
+ wbd = st.multiselect("Select watershed boundaries", wbds)
383
+
384
+ if "NHD-HUC2" in wbd:
385
+ huc2 = ee.FeatureCollection("USGS/WBD/2017/HUC02")
386
+ Map.addLayer(huc2.style(**{"fillColor": "00000000"}), {}, "NHD-HUC2")
387
+
388
+ if "NHD-HUC4" in wbd:
389
+ huc4 = ee.FeatureCollection("USGS/WBD/2017/HUC04")
390
+ Map.addLayer(huc4.style(**{"fillColor": "00000000"}), {}, "NHD-HUC4")
391
+
392
+ if "NHD-HUC6" in wbd:
393
+ huc6 = ee.FeatureCollection("USGS/WBD/2017/HUC06")
394
+ Map.addLayer(huc6.style(**{"fillColor": "00000000"}), {}, "NHD-HUC6")
395
+
396
+ if "NHD-HUC8" in wbd:
397
+ huc8 = ee.FeatureCollection("USGS/WBD/2017/HUC08")
398
+ Map.addLayer(huc8.style(**{"fillColor": "00000000"}), {}, "NHD-HUC8")
399
+
400
+ if "NHD-HUC10" in wbd:
401
+ huc10 = ee.FeatureCollection("USGS/WBD/2017/HUC10")
402
+ Map.addLayer(huc10.style(**{"fillColor": "00000000"}), {}, "NHD-HUC10")
403
+
404
+ with col1:
405
+ Map.set_center(longitude, latitude, zoom)
406
+ Map.to_streamlit(height=680)
407
+
408
+ with col2:
409
+ with st.expander("Data Sources"):
410
+
411
+ desc = """
412
+ - [ESA Global Land Cover](https://developers.google.com/earth-engine/datasets/catalog/ESA_WorldCover_v100?hl=en)
413
+ - [ESRI Global Land Cover](https://samapriya.github.io/awesome-gee-community-datasets/projects/esrilc2020/)
414
+ - [Global River Width Dataset](https://samapriya.github.io/awesome-gee-community-datasets/projects/grwl/)
415
+ - [JRC Global Surface Water](https://developers.google.com/earth-engine/datasets/catalog/JRC_GSW1_3_GlobalSurfaceWater)
416
+ - [HydroSHEDS - HydroLAKES](https://samapriya.github.io/awesome-gee-community-datasets/projects/hydrolakes/)
417
+ - [OSM Global Surface Water](https://samapriya.github.io/awesome-gee-community-datasets/projects/osm_water/)
418
+ - [US NLCD](https://developers.google.com/earth-engine/datasets/catalog/USGS_NLCD_RELEASES_2019_REL_NLCD)
419
+ - [US NED Depressions (10m)](https://developers.google.com/earth-engine/datasets/catalog/USGS_3DEP_10m)
420
+ - [USDA NASS Cropland](https://developers.google.com/earth-engine/datasets/catalog/USDA_NASS_CDL)
421
+ - [NHD Waterboday](https://samapriya.github.io/awesome-gee-community-datasets/projects/nhd)
422
+ - [NHD-HUC2](https://developers.google.com/earth-engine/datasets/catalog/USGS_WBD_2017_HUC02)
423
+ - [NHD-HUC4](https://developers.google.com/earth-engine/datasets/catalog/USGS_WBD_2017_HUC04)
424
+ - [NHD-HUC6](https://developers.google.com/earth-engine/datasets/catalog/USGS_WBD_2017_HUC06)
425
+ - [NHD-HUC8](https://developers.google.com/earth-engine/datasets/catalog/USGS_WBD_2017_HUC08)
426
+ - [NHD-HUC10](https://developers.google.com/earth-engine/datasets/catalog/USGS_WBD_2017_HUC10)
427
+ """
428
+ st.markdown(desc)
wildfire_occurrence/model/analysis/wrf_analysis.py CHANGED
@@ -468,7 +468,8 @@ if __name__ == "__main__":
468
  output_dir = 'output' # os.path.dirname(os.path.abspath(filename))
469
 
470
  # TODO: make this for loop parallel later
471
- for t_idx, delta_time in enumerate(wrf_analysis.wrf_dataset.Times.values):
 
472
 
473
  logging.info(f'Processing t_idx: {t_idx}, timestamp: {delta_time}')
474
  output_filename = os.path.join(
 
468
  output_dir = 'output' # os.path.dirname(os.path.abspath(filename))
469
 
470
  # TODO: make this for loop parallel later
471
+ for t_idx, delta_time in enumerate(
472
+ wrf_analysis.wrf_dataset.Times.values):
473
 
474
  logging.info(f'Processing t_idx: {t_idx}, timestamp: {delta_time}')
475
  output_filename = os.path.join(
wildfire_occurrence/model/data_download/ncep_fnl.py CHANGED
@@ -234,9 +234,9 @@ class NCEP_FNL(object):
234
  if __name__ == "__main__":
235
 
236
  dates = [
237
- #'2003-06-23',
238
- #'2005-06-11',
239
- #'2023-06-04'
240
  '2023-06-23'
241
  ]
242
 
 
234
  if __name__ == "__main__":
235
 
236
  dates = [
237
+ # '2003-06-23',
238
+ # '2005-06-11',
239
+ # '2023-06-04'
240
  '2023-06-23'
241
  ]
242
 
wildfire_occurrence/model/pipelines/wrf_pipeline.py CHANGED
@@ -5,9 +5,9 @@ import logging
5
  import datetime
6
  from glob import glob
7
  from pathlib import Path
8
- from itertools import repeat
9
  from omegaconf import OmegaConf
10
- from multiprocessing import Pool, cpu_count
11
  from jinja2 import Environment, PackageLoader, select_autoescape
12
 
13
  from wildfire_occurrence.model.config import Config
@@ -61,7 +61,8 @@ class WRFPipeline(object):
61
  self.local_wps_path = os.path.join(self.simulation_dir, 'WPS')
62
  self.local_wrf_path = os.path.join(self.simulation_dir, 'em_real')
63
  self.local_wrf_output = os.path.join(self.simulation_dir, 'output')
64
- self.local_wrf_output_vars = os.path.join(self.simulation_dir, 'variables')
 
65
 
66
  # Setup configuration filenames
67
  self.wps_conf_filename = os.path.join(self.conf_dir, 'namelist.wps')
@@ -134,11 +135,10 @@ class WRFPipeline(object):
134
  f'{self.conf.container_path} ' + \
135
  f'mpirun -np {cpu_count()} --oversubscribe ./geogrid.exe'
136
  else:
137
- geodrid_cmd = 'bash /panfs/ccds02/nobackup/projects/ilab/projects/LobodaTFO/operations/2015-07-23_2015-08-02/WPS/run_geogrid.sh'
138
- #'mpirun -np 40 --host gpu016 --oversubscribe singularity exec -B /explore/nobackup/projects/ilab,' + \
139
- #'$NOBACKUP,/lscratch,/panfs/ccds02/nobackup/projects/ilab ' + \
140
- #f'{self.conf.container_path} ' + \
141
- #'bash /panfs/ccds02/nobackup/projects/ilab/projects/LobodaTFO/operations/2015-07-23_2015-08-02/WPS/run_geogrid.sh'
142
 
143
  # run geogrid command
144
  os.system(geodrid_cmd)
@@ -186,7 +186,8 @@ class WRFPipeline(object):
186
  f'{self.conf.container_path} ./ungrib.exe'
187
  else:
188
  ungrib_cmd = \
189
- 'srun --mpi=pmix -N 1 -n 1 singularity exec -B /explore/nobackup/projects/ilab,' + \
 
190
  '$NOBACKUP,/panfs/ccds02/nobackup/projects/ilab ' + \
191
  f'{self.conf.container_path} ' + \
192
  './ungrib.exe'
@@ -220,7 +221,8 @@ class WRFPipeline(object):
220
  f'mpirun -np {cpu_count()} --oversubscribe ./metgrid.exe'
221
  else:
222
  metgrid_cmd = \
223
- f'srun --mpi=pmix -N 1 -n {cpu_count()} singularity exec -B /explore/nobackup/projects/ilab,' + \
 
224
  '$NOBACKUP,/panfs/ccds02/nobackup/projects/ilab ' + \
225
  f'{self.conf.container_path} ' + \
226
  './metgrid.exe'
@@ -267,7 +269,8 @@ class WRFPipeline(object):
267
  f'mpirun -np {cpu_count()} --oversubscribe ./real.exe'
268
  else:
269
  real_cmd = \
270
- 'srun --mpi=pmix -N 2 -n 80 singularity exec -B /explore/nobackup/projects/ilab,' + \
 
271
  '$NOBACKUP,/panfs/ccds02/nobackup/projects/ilab ' + \
272
  f'{self.conf.container_path} ' + \
273
  './real.exe'
@@ -301,7 +304,8 @@ class WRFPipeline(object):
301
  f'mpirun -np {cpu_count()} --oversubscribe ./wrf.exe'
302
  else:
303
  wrf_cmd = \
304
- 'srun --mpi=pmix -N 2 -n 80 singularity exec -B /explore/nobackup/projects/ilab,' + \
 
305
  '$NOBACKUP,/panfs/ccds02/nobackup/projects/ilab ' + \
306
  f'{self.conf.container_path} ' + \
307
  './wrf.exe'
 
5
  import datetime
6
  from glob import glob
7
  from pathlib import Path
8
+ # from itertools import repeat
9
  from omegaconf import OmegaConf
10
+ from multiprocessing import cpu_count # , Pool
11
  from jinja2 import Environment, PackageLoader, select_autoescape
12
 
13
  from wildfire_occurrence.model.config import Config
 
61
  self.local_wps_path = os.path.join(self.simulation_dir, 'WPS')
62
  self.local_wrf_path = os.path.join(self.simulation_dir, 'em_real')
63
  self.local_wrf_output = os.path.join(self.simulation_dir, 'output')
64
+ self.local_wrf_output_vars = os.path.join(
65
+ self.simulation_dir, 'variables')
66
 
67
  # Setup configuration filenames
68
  self.wps_conf_filename = os.path.join(self.conf_dir, 'namelist.wps')
 
135
  f'{self.conf.container_path} ' + \
136
  f'mpirun -np {cpu_count()} --oversubscribe ./geogrid.exe'
137
  else:
138
+ geodrid_cmd = 'mpirun -np 40 --host gpu016 --oversubscribe' + \
139
+ 'singularity exec -B /explore/nobackup/projects/ilab,' + \
140
+ '$NOBACKUP,/lscratch,/panfs/ccds02/nobackup/projects/ilab ' + \
141
+ f'{self.conf.container_path} ./geogrid.exe'
 
142
 
143
  # run geogrid command
144
  os.system(geodrid_cmd)
 
186
  f'{self.conf.container_path} ./ungrib.exe'
187
  else:
188
  ungrib_cmd = \
189
+ 'srun --mpi=pmix -N 1 -n 1 singularity exec -B ' + \
190
+ '/explore/nobackup/projects/ilab,' + \
191
  '$NOBACKUP,/panfs/ccds02/nobackup/projects/ilab ' + \
192
  f'{self.conf.container_path} ' + \
193
  './ungrib.exe'
 
221
  f'mpirun -np {cpu_count()} --oversubscribe ./metgrid.exe'
222
  else:
223
  metgrid_cmd = \
224
+ f'srun --mpi=pmix -N 1 -n {cpu_count()} singularity ' + \
225
+ 'exec -B /explore/nobackup/projects/ilab,' + \
226
  '$NOBACKUP,/panfs/ccds02/nobackup/projects/ilab ' + \
227
  f'{self.conf.container_path} ' + \
228
  './metgrid.exe'
 
269
  f'mpirun -np {cpu_count()} --oversubscribe ./real.exe'
270
  else:
271
  real_cmd = \
272
+ 'srun --mpi=pmix -N 2 -n 80 singularity ' + \
273
+ 'exec -B /explore/nobackup/projects/ilab,' + \
274
  '$NOBACKUP,/panfs/ccds02/nobackup/projects/ilab ' + \
275
  f'{self.conf.container_path} ' + \
276
  './real.exe'
 
304
  f'mpirun -np {cpu_count()} --oversubscribe ./wrf.exe'
305
  else:
306
  wrf_cmd = \
307
+ 'srun --mpi=pmix -N 2 -n 80 singularity ' + \
308
+ 'exec -B /explore/nobackup/projects/ilab,' + \
309
  '$NOBACKUP,/panfs/ccds02/nobackup/projects/ilab ' + \
310
  f'{self.conf.container_path} ' + \
311
  './wrf.exe'