giswqs commited on
Commit
6544bbb
·
1 Parent(s): 8dec861

Add DW dataset

Browse files
Files changed (3) hide show
  1. pages/00_home.py +1 -0
  2. pages/01_datasets.py +15 -2
  3. pages/02_explore.py +78 -27
pages/00_home.py CHANGED
@@ -15,6 +15,7 @@ def Page():
15
 
16
  - Rajib et al. 2023. A call for consistency and integration in global surface water estimates. *Environmental Research Letters*. <https://doi.org/10.1088/1748-9326/ad1722 >
17
  - Rajib A, Khare A, Wu Q and Gupta B. 2023. Global Surface Water Information System (GSWIS). Available at: <https://gswis.gishub.org>
 
18
 
19
  ### Acknowledgements
20
 
 
15
 
16
  - Rajib et al. 2023. A call for consistency and integration in global surface water estimates. *Environmental Research Letters*. <https://doi.org/10.1088/1748-9326/ad1722 >
17
  - Rajib A, Khare A, Wu Q and Gupta B. 2023. Global Surface Water Information System (GSWIS). Available at: <https://gswis.gishub.org>
18
+ - Rajib A and Khare A, 2024. <https://doi.org/10.4211/hs.9d60389f55b648149a788a2ff7bc3766>
19
 
20
  ### Acknowledgements
21
 
pages/01_datasets.py CHANGED
@@ -6,7 +6,12 @@ def Page():
6
  with solara.Column(align="center"):
7
  markdown = """
8
 
9
- GSWIS currently houses five global surface water datasets used to generate a processed, multi-band gridded dataset at 10-meter spatial resolution, with each band corresponding to one of the five datasets used. **Click on the Explore tab above to visualize the datasets interactively.**
 
 
 
 
 
10
 
11
  ### Datasets
12
 
@@ -41,10 +46,18 @@ def Page():
41
  #### HydroLakes
42
  - **Description:** HydroLAKES is vector global lake dataset derived from merged hydrography
43
  - **Website:** <https://www.hydrosheds.org/products/hydrolakes>
44
- - **Reference**: Messager et al 2016. <https://doi.org/10.1038/ncomms13603 >
45
  - **Year used in GSWIS:** HydroLAKES is not associated with any specific time or year
46
  - **Water Classes used in GSWIS:** Global Lakes with size of at least 10 ha
47
 
 
 
 
 
 
 
 
 
48
  **Note: Numbers indicate the class ID in the original dataset**
49
 
50
  """
 
6
  with solara.Column(align="center"):
7
  markdown = """
8
 
9
+ GSWIS currently houses five global surface water datasets used to generate a processed,
10
+ multi-band gridded dataset at 10-meter spatial resolution, with each band corresponding
11
+ to one of the five datasets used. It also hosts a 10-meter spatial resolution multi-band
12
+ gridded global composite of surface water occurrence, permanent and seasonal surface water
13
+ extent, and surface water variability, derived from Dynamic World Land Cover product.
14
+ **Click on the Explore tab above to visualize the datasets interactively.**
15
 
16
  ### Datasets
17
 
 
46
  #### HydroLakes
47
  - **Description:** HydroLAKES is vector global lake dataset derived from merged hydrography
48
  - **Website:** <https://www.hydrosheds.org/products/hydrolakes>
49
+ - **Reference**: Messager et al 2016. <https://doi.org/10.1038/ncomms13603>
50
  - **Year used in GSWIS:** HydroLAKES is not associated with any specific time or year
51
  - **Water Classes used in GSWIS:** Global Lakes with size of at least 10 ha
52
 
53
+ #### Dynamic World (DW) based global surface water (GSW) dataset
54
+ - **Description:** DW based GSW dataset is a 10-m gridded multi-band global composite derived from Sentinel-2 based Dynamic World Land cover product ([Brown et al., 2022](https://doi.org/10.1038/s41597-022-01307-4))
55
+ - **Website:** <https://dynamicworld.app>
56
+ - **Reference**: Rajib and Khare, 2024. <https://doi.org/10.4211/hs.9d60389f55b648149a788a2ff7bc3766>
57
+ - **Year used in GSWIS:** 2015-2023
58
+ - **Water Classes used in GSWIS:** Surface water occurrence, Permanent and Seasonal surface water extent, Surface water variability
59
+
60
+
61
  **Note: Numbers indicate the class ID in the original dataset**
62
 
63
  """
pages/02_explore.py CHANGED
@@ -24,7 +24,7 @@ def zonal_stats_chart(image, vector, **kwargs):
24
  df = geemap.ee_to_df(result).T
25
  df.reset_index(inplace=True)
26
  df.columns = ["Type", "Area"]
27
- chart = geemap.bar_chart(df, "Type", "Area", x_label='', y_label="Area (m2)")
28
  chart.update_layout(
29
  margin=dict(l=0, r=0, t=10, b=0),
30
  height=280,
@@ -33,7 +33,7 @@ def zonal_stats_chart(image, vector, **kwargs):
33
  return chart
34
 
35
 
36
- def add_analysis_gui(m=None, position='topright', opened=True):
37
  """Create a toolbar widget.
38
 
39
  Args:
@@ -41,8 +41,8 @@ def add_analysis_gui(m=None, position='topright', opened=True):
41
  opened (bool, optional): Whether to open the toolbar. Defaults to True.
42
  """
43
 
44
- fc = ee.FeatureCollection('users/giswqs/public/countries')
45
- countries = fc.aggregate_array('NAME').getInfo()
46
  countries.sort()
47
  gswe = ee.ImageCollection("users/h2i_lab/gswe/gswe_datasets")
48
  image = gswe.mosaic()
@@ -117,9 +117,9 @@ def add_analysis_gui(m=None, position='topright', opened=True):
117
  def change_country(change):
118
  if change["new"]:
119
  country_name = country.value
120
- country_fc = fc.filter(ee.Filter.eq('NAME', country_name))
121
- vec_style = {'color': '000000ff', 'width': 3, 'fillColor': '00000000'}
122
- m.addLayer(country_fc.style(**vec_style), {}, 'Selected Country')
123
  m.centerObject(country_fc)
124
  m.selected_country = country_fc
125
  toolbar_footer.children = [radio, country, buttons]
@@ -207,14 +207,14 @@ def add_analysis_gui(m=None, position='topright', opened=True):
207
  class Map(geemap.Map):
208
  def __init__(self, **kwargs):
209
  super().__init__(**kwargs)
210
- self.add_basemap('SATELLITE', show=False)
211
  self.add_ee_data()
212
  self.add_layer_manager()
213
- add_analysis_gui(self)
214
  # self.add_inspector()
215
 
216
  def add_ee_data(self):
217
- # gswe = ee.ImageCollection("users/h2i_lab/gswe/gswe_datasets")
218
  # self.addLayer(gswe.select("esa"), {'palette': ['red']}, "ESA")
219
  # self.addLayer(gswe.select("esri"), {'palette': ['yellow']}, "ESRI")
220
  # self.addLayer(gswe.select("jrc"), {'palette': ['blue']}, "JRC")
@@ -223,25 +223,76 @@ class Map(geemap.Map):
223
 
224
  gswe = ee.ImageCollection("users/h2i_lab/gswe/datasets")
225
  gswe = gswe.select(
226
- ["b1", "b2", "b3", "b4", "b5"],
227
- ['esa', 'esri', 'osm', 'jrc', 'hydrolakes']
228
- )
229
- self.addLayer(gswe.select("esa"), {'palette': ['red']}, "ESA")
230
- self.addLayer(gswe.select("osm"), {'palette': ['green']}, "OSM")
231
- self.addLayer(gswe.select("jrc"), {'palette': ['blue']}, "JRC")
232
- self.addLayer(gswe.select("esri"), {'palette': ['yellow']}, "ESRI")
233
- self.addLayer(gswe.select("hydrolakes"), {'palette': ['purple']}, "Hydrolakes")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  legend_dict = {
235
- 'ESA': 'ff0000',
236
- 'ESRI': 'ffff00',
237
- 'JRC': '0000ff',
238
- 'OSM': '00ff00',
239
- 'Hydrolakes': '800080',
240
  }
241
  # self.add_legend(legend_dict=legend_dict, position='bottomleft')
242
- fc = ee.FeatureCollection('users/giswqs/public/countries')
243
- style = {'color': '000000ff', 'width': 1, 'fillColor': '00000000'}
244
- self.addLayer(fc.style(**style), {}, 'Countries', False)
245
 
246
 
247
  @solara.component
@@ -253,7 +304,7 @@ def Page():
253
  center=center.value,
254
  on_center=center.set,
255
  scroll_wheel_zoom=True,
256
- add_google_map=True,
257
  height="800px",
258
  data_ctrl=False,
259
  )
 
24
  df = geemap.ee_to_df(result).T
25
  df.reset_index(inplace=True)
26
  df.columns = ["Type", "Area"]
27
+ chart = geemap.bar_chart(df, "Type", "Area", x_label="", y_label="Area (m2)")
28
  chart.update_layout(
29
  margin=dict(l=0, r=0, t=10, b=0),
30
  height=280,
 
33
  return chart
34
 
35
 
36
+ def add_analysis_gui(m=None, position="topright", opened=True):
37
  """Create a toolbar widget.
38
 
39
  Args:
 
41
  opened (bool, optional): Whether to open the toolbar. Defaults to True.
42
  """
43
 
44
+ fc = ee.FeatureCollection("users/giswqs/public/countries")
45
+ countries = fc.aggregate_array("NAME").getInfo()
46
  countries.sort()
47
  gswe = ee.ImageCollection("users/h2i_lab/gswe/gswe_datasets")
48
  image = gswe.mosaic()
 
117
  def change_country(change):
118
  if change["new"]:
119
  country_name = country.value
120
+ country_fc = fc.filter(ee.Filter.eq("NAME", country_name))
121
+ vec_style = {"color": "000000ff", "width": 3, "fillColor": "00000000"}
122
+ m.addLayer(country_fc.style(**vec_style), {}, "Selected Country")
123
  m.centerObject(country_fc)
124
  m.selected_country = country_fc
125
  toolbar_footer.children = [radio, country, buttons]
 
207
  class Map(geemap.Map):
208
  def __init__(self, **kwargs):
209
  super().__init__(**kwargs)
210
+ self.add_basemap("SATELLITE", show=False)
211
  self.add_ee_data()
212
  self.add_layer_manager()
213
+ # add_analysis_gui(self)
214
  # self.add_inspector()
215
 
216
  def add_ee_data(self):
217
+ # gswe = ee.ImageCollection("users/h2i_lab/gswe/gswe_datasets")
218
  # self.addLayer(gswe.select("esa"), {'palette': ['red']}, "ESA")
219
  # self.addLayer(gswe.select("esri"), {'palette': ['yellow']}, "ESRI")
220
  # self.addLayer(gswe.select("jrc"), {'palette': ['blue']}, "JRC")
 
223
 
224
  gswe = ee.ImageCollection("users/h2i_lab/gswe/datasets")
225
  gswe = gswe.select(
226
+ ["b1", "b2", "b3", "b4", "b5"], ["esa", "esri", "osm", "jrc", "hydrolakes"]
227
+ )
228
+ self.addLayer(gswe.select("esa"), {"palette": ["red"]}, "ESA")
229
+ self.addLayer(gswe.select("osm"), {"palette": ["green"]}, "OSM")
230
+ self.addLayer(gswe.select("jrc"), {"palette": ["blue"]}, "JRC")
231
+ self.addLayer(gswe.select("esri"), {"palette": ["yellow"]}, "ESRI")
232
+ self.addLayer(gswe.select("hydrolakes"), {"palette": ["purple"]}, "Hydrolakes")
233
+
234
+ water_grids = ee.ImageCollection(
235
+ "projects/h2i-lab/assets/DynamicWorld_v1/Main/GlobalGrids_10m"
236
+ )
237
+ water_classVis = {"min": 1, "max": 3, "palette": ["blue", "yellow", "red"]}
238
+
239
+ water_occurrence_vis = {
240
+ "min": 0,
241
+ "max": 100,
242
+ "palette": ["red", "yellow", "green", "blue"],
243
+ }
244
+ water_variability_vis = {
245
+ "min": 0,
246
+ "max": 100,
247
+ "palette": ["blue", "green", "yellow", "red"],
248
+ }
249
+
250
+ self.addLayer(
251
+ water_grids.select("b3"),
252
+ water_variability_vis,
253
+ "DW Water Variability",
254
+ False,
255
+ )
256
+ self.addLayer(
257
+ water_grids.select("b2"), water_occurrence_vis, "DW Water Occurrence", False
258
+ )
259
+ self.addLayer(water_grids.select("b1"), water_classVis, "DW Water Class", False)
260
+
261
+ self.add_colorbar(
262
+ vis_params=water_variability_vis,
263
+ label="DW Water Variability (%)",
264
+ orientation="horizontal",
265
+ layer_name="DW Water Variability",
266
+ )
267
+ self.add_colorbar(
268
+ vis_params=water_occurrence_vis,
269
+ label="DW Water Occurrence (%)",
270
+ orientation="horizontal",
271
+ layer_name="DW Water Occurrence",
272
+ )
273
+
274
+ waterclass_dict = {
275
+ "Permanent": "0000FF",
276
+ "Seasonal": "FFFF00",
277
+ "Land": "FF0000",
278
+ }
279
+ self.add_legend(
280
+ legend_dict=waterclass_dict,
281
+ title="DW Water Class",
282
+ layer_name="DW Water Class",
283
+ )
284
+
285
  legend_dict = {
286
+ "ESA": "ff0000",
287
+ "ESRI": "ffff00",
288
+ "JRC": "0000ff",
289
+ "OSM": "00ff00",
290
+ "Hydrolakes": "800080",
291
  }
292
  # self.add_legend(legend_dict=legend_dict, position='bottomleft')
293
+ fc = ee.FeatureCollection("users/giswqs/public/countries")
294
+ style = {"color": "000000ff", "width": 1, "fillColor": "00000000"}
295
+ self.addLayer(fc.style(**style), {}, "Countries", False)
296
 
297
 
298
  @solara.component
 
304
  center=center.value,
305
  on_center=center.set,
306
  scroll_wheel_zoom=True,
307
+ add_google_map=False,
308
  height="800px",
309
  data_ctrl=False,
310
  )