iamsuman commited on
Commit
2dc4a78
·
1 Parent(s): e829150

show fire maps

Browse files
Dockerfile CHANGED
@@ -4,16 +4,13 @@ RUN mamba install -c conda-forge leafmap geopandas localtileserver -y && \
4
  fix-permissions "${CONDA_DIR}" && \
5
  fix-permissions "/home/${NB_USER}"
6
 
7
-
8
-
9
  COPY requirements.txt .
10
  RUN pip install -r requirements.txt
11
 
12
- RUN conda install "jupyterlab>=3" "ipywidgets>=7.6" -c conda-forge -y
13
-
14
  RUN mkdir ./pages
15
  COPY /pages ./pages
16
  COPY /data ./data
 
17
 
18
  ENV PROJ_LIB='/opt/conda/share/proj'
19
 
 
4
  fix-permissions "${CONDA_DIR}" && \
5
  fix-permissions "/home/${NB_USER}"
6
 
 
 
7
  COPY requirements.txt .
8
  RUN pip install -r requirements.txt
9
 
 
 
10
  RUN mkdir ./pages
11
  COPY /pages ./pages
12
  COPY /data ./data
13
+ COPY /public ./public
14
 
15
  ENV PROJ_LIB='/opt/conda/share/proj'
16
 
pages/00_home.py CHANGED
@@ -2,9 +2,6 @@ import ee
2
  import geemap
3
  import solara
4
 
5
- import IPython.display
6
- # make solara use a real cdn, since the solara cdn proxy is not available
7
- display(IPython.display.Javascript("solara_cdn = 'https://cdn.jsdelivr.net/npm/'"))
8
 
9
  class Map(geemap.Map):
10
  def __init__(self, **kwargs):
@@ -12,6 +9,7 @@ class Map(geemap.Map):
12
  self.dataset = ee.Image("UMD/hansen/global_forest_change_2023_v1_11")
13
  self.add_forest_loss_gain_data()
14
  self.add_plot_gui()
 
15
 
16
  def add_forest_loss_gain_data(self):
17
  self.add_basemap("Esri.WorldImagery")
@@ -36,6 +34,17 @@ class Map(geemap.Map):
36
  denominator=1e6,
37
  scale=1000,
38
  )
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  class PieChartPlotter:
41
  def __init__(self, map_object):
@@ -105,7 +114,9 @@ def Page():
105
 
106
  solara.Markdown(markdown)
107
  with solara.Column(style={"min-width": "500px"}):
108
- plotter = PieChartPlotter(map_instance)
 
 
109
 
110
  with solara.Column(align="center"):
111
  markdown = """
@@ -122,20 +133,55 @@ def Page():
122
 
123
  solara.Markdown(markdown)
124
  with solara.Column(style={"min-width": "500px"}):
125
- bar_chart_plotter = BarChartPlotter(map_instance)
 
 
126
 
127
- with solara.Column(align="center"):
128
- markdown = """
 
 
129
 
130
- **Now we can calculate the forest loss area by country and plot it**
 
131
 
132
  ```python
133
- treeloss_year = dataset.select(["lossyear"])
134
-
135
- geemap.zonal_stats( treeloss.gt(0), countries, "treeloss.csv", stat_type="SUM", denominator=1e6, scale=1000,)
136
-
137
- geemap.bar_chart( "treeloss.csv", x="NAME", y="sum", max_rows=20, x_label="Country", y_label="Forest loss area (km2)",).show()
 
 
 
 
 
138
  ```
139
- """
140
- solara.Markdown(markdown)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
 
2
  import geemap
3
  import solara
4
 
 
 
 
5
 
6
  class Map(geemap.Map):
7
  def __init__(self, **kwargs):
 
9
  self.dataset = ee.Image("UMD/hansen/global_forest_change_2023_v1_11")
10
  self.add_forest_loss_gain_data()
11
  self.add_plot_gui()
12
+ # self.show_fire_map()
13
 
14
  def add_forest_loss_gain_data(self):
15
  self.add_basemap("Esri.WorldImagery")
 
34
  denominator=1e6,
35
  scale=1000,
36
  )
37
+ def show_fire_map(self):
38
+ roi = ee.Geometry.BBox(-121.0034, 36.8488, -117.9052, 39.0490)
39
+ start_date = "2020-09-05T15:00:00"
40
+ end_date = "2020-09-06T02:00:00"
41
+ data = "GOES-17"
42
+ scan = "full_disk"
43
+
44
+ timelapse = geemap.goes_fire_timelapse(
45
+ roi, "fire.gif", start_date, end_date, data, scan, framesPerSecond=5
46
+ )
47
+ # geemap.show_image(timelapse)
48
 
49
  class PieChartPlotter:
50
  def __init__(self, map_object):
 
114
 
115
  solara.Markdown(markdown)
116
  with solara.Column(style={"min-width": "500px"}):
117
+ forest_piechart_image_url = "/static/public/forest_pie_chart.png"
118
+ solara.Image(forest_piechart_image_url)
119
+ # plotter = PieChartPlotter(map_instance)
120
 
121
  with solara.Column(align="center"):
122
  markdown = """
 
133
 
134
  solara.Markdown(markdown)
135
  with solara.Column(style={"min-width": "500px"}):
136
+ forest_barchart_image_url = "/static/public/forest_bar_chart.png"
137
+ solara.Image(forest_barchart_image_url)
138
+ # bar_chart_plotter = BarChartPlotter(map_instance)
139
 
140
+ with solara.Column(align="center"):
141
+ markdown = """
142
+
143
+ ### Wildfire mapping
144
 
145
+ **Deforestation, caused by farming, cutting down trees, building roads and cities, mining, and fires, is turning forests into farmland, grazing areas, and urban spaces. Let's visualize the fire provided by [GOES satellite](https://science.nasa.gov/mission/goes/) network.
146
+ We will be using northen clafornia region as our Region of Interest (ROI)**
147
 
148
  ```python
149
+ roi = ee.Geometry.BBox(-121.0034, 36.8488, -117.9052, 39.0490)
150
+ start_date = "2020-09-05T15:00:00"
151
+ end_date = "2020-09-06T02:00:00"
152
+ data = "GOES-17"
153
+ scan = "full_disk"
154
+
155
+ timelapse = geemap.goes_fire_timelapse(
156
+ roi, "fire.gif", start_date, end_date, data, scan, framesPerSecond=5
157
+ )
158
+ geemap.show_image(timelapse)
159
  ```
160
+ """
161
+ solara.Markdown(markdown)
162
+
163
+ with solara.Column(align="center", style={"min-width": "500px"}):
164
+ forest_fire_image_url = "/static/public/fire.gif"
165
+ solara.Image(forest_fire_image_url)
166
+
167
+
168
+ # with solara.Column(align="center"):
169
+ # markdown = """
170
+
171
+ # **Deforestation, caused by farming, cutting down trees, building roads and cities, mining, and fires, is turning forests into farmland, grazing areas, and urban spaces. Let's visualize the fire provided by [GOES satellite](https://science.nasa.gov/mission/goes/) network.**
172
+
173
+ # ```python
174
+ # roi = ee.Geometry.BBox(-121.0034, 36.8488, -117.9052, 39.0490)
175
+ # start_date = "2020-09-05T15:00:00"
176
+ # end_date = "2020-09-06T02:00:00"
177
+ # data = "GOES-17"
178
+ # scan = "full_disk"
179
+
180
+ # timelapse = geemap.goes_fire_timelapse(
181
+ # roi, "fire.gif", start_date, end_date, data, scan, framesPerSecond=5
182
+ # )
183
+ # geemap.show_image(timelapse)
184
+ # ```
185
+ # """
186
+ # solara.Markdown(markdown)
187
 
pages/{04_split_map.py → 04_LULC_split_map.py} RENAMED
File without changes
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
  geemap
2
  solara
3
  geopandas
4
- pydantic< 2.0
 
1
  geemap
2
  solara
3
  geopandas
4
+ pydantic< 2.0