Spaces:
Build error
Build error
jordancaraballo
commited on
Commit
·
dffbe14
1
Parent(s):
e822433
Testing solara deployment
Browse files- .github/workflows/sync-hf.yml +20 -0
- Dockerfile +21 -0
- README.md +69 -0
- pages/00_home.py +14 -0
- pages/01_ipyleaflet.py +44 -0
- requirements.txt +5 -0
- requirements/Dockerfile.Python +1 -1
.github/workflows/sync-hf.yml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Sync to Hugging Face hub
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
branches: [main]
|
5 |
+
|
6 |
+
# to run this workflow manually from the Actions tab
|
7 |
+
workflow_dispatch:
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
sync-to-hub:
|
11 |
+
runs-on: ubuntu-latest
|
12 |
+
steps:
|
13 |
+
- uses: actions/checkout@v3
|
14 |
+
with:
|
15 |
+
fetch-depth: 0
|
16 |
+
lfs: true
|
17 |
+
- name: Push to hub
|
18 |
+
env:
|
19 |
+
HF_TOKEN: ${{ secrets.HF_DEPLOY_TOKEN }}
|
20 |
+
run: git push --force https://jordancaraballo:[email protected]/spaces/jordancaraballo/alaska-wildfire-occurrence main
|
Dockerfile
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM jupyter/base-notebook:latest
|
2 |
+
|
3 |
+
RUN mamba install -c conda-forge leafmap geopandas localtileserver -y && \
|
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 |
+
|
13 |
+
ENV PROJ_LIB='/opt/conda/share/proj'
|
14 |
+
|
15 |
+
USER root
|
16 |
+
RUN chown -R ${NB_UID} ${HOME}
|
17 |
+
USER ${NB_USER}
|
18 |
+
|
19 |
+
EXPOSE 8765
|
20 |
+
|
21 |
+
CMD ["solara", "run", "./pages", "--host=0.0.0.0"]
|
README.md
CHANGED
@@ -1,3 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# wildfire-occurrence
|
2 |
|
3 |
Wildfire occurrence modeling using Terrestrial Ecosystem Models and Artificial Intelligence
|
@@ -10,6 +21,64 @@ Wildfire occurrence modeling using Terrestrial Ecosystem Models and Artificial I
|
|
10 |
- 30m local Alaska models, 1km circumpolar models
|
11 |
- Integration of precipitation, temperature and lightning datasets
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
## Contributors
|
14 |
|
15 |
- Jordan Alexis Caraballo-Vega, [email protected]
|
|
|
1 |
+
---
|
2 |
+
title: Alaska Wildfire Occurrence
|
3 |
+
emoji: 🔥
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: red
|
6 |
+
sdk: docker
|
7 |
+
pinned: false
|
8 |
+
license: apache
|
9 |
+
app_port: 7860
|
10 |
+
---
|
11 |
+
|
12 |
# wildfire-occurrence
|
13 |
|
14 |
Wildfire occurrence modeling using Terrestrial Ecosystem Models and Artificial Intelligence
|
|
|
21 |
- 30m local Alaska models, 1km circumpolar models
|
22 |
- Integration of precipitation, temperature and lightning datasets
|
23 |
|
24 |
+
## Datasets
|
25 |
+
|
26 |
+
1. Daily Fire Ignition Points
|
27 |
+
|
28 |
+
```bash
|
29 |
+
```
|
30 |
+
|
31 |
+
2. Daily Area Burned
|
32 |
+
|
33 |
+
The dataset comes from https://daac.ornl.gov/cgi-bin/dsviewer.pl?ds_id=1559 for 2001-2019. This dataset
|
34 |
+
will be extended for 2020-2025. Dataset is located under /explore/nobackup/projects/ilab/projects/LobodaTFO/data/raw_data/ABoVE_DoB.
|
35 |
+
|
36 |
+
```bash
|
37 |
+
python DAACDataDownload.py -dir /explore/nobackup/projects/ilab/projects/LobodaTFO/data/raw_data/ABoVE_DoB -f URL_FROM_ORDER
|
38 |
+
```
|
39 |
+
|
40 |
+
3. Annual Fuel Composition
|
41 |
+
|
42 |
+
```bash
|
43 |
+
```
|
44 |
+
|
45 |
+
4. Human Accesibility
|
46 |
+
|
47 |
+
```bash
|
48 |
+
```
|
49 |
+
|
50 |
+
5. Topographic Influence
|
51 |
+
|
52 |
+
```bash
|
53 |
+
```
|
54 |
+
|
55 |
+
All datasets described above will be delivered in the 1 km modeling grid for tundra ecoregions.
|
56 |
+
|
57 |
+
## Containers
|
58 |
+
|
59 |
+
### Python Container
|
60 |
+
|
61 |
+
```bash
|
62 |
+
module load singularity
|
63 |
+
singularity build --sandbox /lscratch/$USER/container/wildfire-occurrence docker://nasanccs/wildfire-occurrence:latest
|
64 |
+
```
|
65 |
+
|
66 |
+
## Extracting variables from WRF
|
67 |
+
|
68 |
+
```bash
|
69 |
+
singularity shell --nv -B /explore/nobackup/projects/ilab,/explore/nobackup/projects/3sl,$NOBACKUP,/lscratch,/explore/nobackup/people /lscratch/jacaraba/container/wildfire-occurrence/
|
70 |
+
python wrf_analysis.py
|
71 |
+
```
|
72 |
+
|
73 |
+
## Dataset Generation and Training
|
74 |
+
|
75 |
+
```bash
|
76 |
+
singularity exec --env PYTHONPATH="/explore/nobackup/people/jacaraba/development/wildfire-occurrence" --nv -B /explore/nobackup/projects/ilab,/explore/nobackup/projects/3sl,$NOBACKUP,/lscratch,/explore/nobackup/people /lscratch/jacaraba/container/wildfire-occurrence python /explore/nobackup/people/jacaraba/development/wildfire-occurrence/wildfire_occurrence/model/lightning/lightning_model.py
|
77 |
+
```
|
78 |
+
|
79 |
+
(base) [jacaraba@gpu021 ~]$ singularity exec --env PYTHONPATH="/explore/nobackup/people/jacaraba/development/wildfire-occurrence" --nv -B /explore/nobackup/projects/ilab,/explore/nobackup/projects/3sl,$NOBACKUP,/lscratch,/explore/nobackup/people /lscratch/jacaraba/container/wildfire-occurrence python /explore/nobackup/people/jacaraba/development/wildfire-occurrence/wildfire_occurrence/model/lightning/lightning_model.py
|
80 |
+
|
81 |
+
|
82 |
## Contributors
|
83 |
|
84 |
- Jordan Alexis Caraballo-Vega, [email protected]
|
pages/00_home.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import solara
|
2 |
+
|
3 |
+
@solara.component
|
4 |
+
def Page():
|
5 |
+
|
6 |
+
markdown = """
|
7 |
+
## Alpha Version - Alaskan Tundra 10-day Lightning Forecast
|
8 |
+
|
9 |
+
Cloud to ground lightning 10-day lightning forecast for the Alaskan tundra.
|
10 |
+
This is still work in progress and under development.
|
11 |
+
|
12 |
+
"""
|
13 |
+
|
14 |
+
solara.Markdown(markdown)
|
pages/01_ipyleaflet.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import ipyleaflet
|
2 |
+
import solara
|
3 |
+
import ipywidgets as widgets
|
4 |
+
|
5 |
+
zoom = solara.reactive(2)
|
6 |
+
center = solara.reactive((20, 0))
|
7 |
+
|
8 |
+
|
9 |
+
class Map(ipyleaflet.Map):
|
10 |
+
def __init__(self, **kwargs):
|
11 |
+
super().__init__(**kwargs)
|
12 |
+
self.layout.height = '600px'
|
13 |
+
# Add what you want below
|
14 |
+
|
15 |
+
label = widgets.Label('Clicked location')
|
16 |
+
output = widgets.Output()
|
17 |
+
widget = widgets.VBox([label, output])
|
18 |
+
control = ipyleaflet.WidgetControl(widget=widget, position='bottomright')
|
19 |
+
self.add_control(control)
|
20 |
+
|
21 |
+
def handle_interaction(**kwargs):
|
22 |
+
latlon = kwargs.get("coordinates")
|
23 |
+
if kwargs.get("type") == "click":
|
24 |
+
with output:
|
25 |
+
output.clear_output()
|
26 |
+
print(latlon)
|
27 |
+
|
28 |
+
self.on_interaction(handle_interaction)
|
29 |
+
|
30 |
+
|
31 |
+
@solara.component
|
32 |
+
def Page():
|
33 |
+
with solara.Column(style={"min-width": "500px"}):
|
34 |
+
solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
|
35 |
+
Map.element(
|
36 |
+
zoom=zoom.value,
|
37 |
+
on_zoom=zoom.set,
|
38 |
+
center=center.value,
|
39 |
+
on_center=center.set,
|
40 |
+
scroll_wheel_zoom=True,
|
41 |
+
|
42 |
+
)
|
43 |
+
solara.Text(f"Zoom: {zoom.value}")
|
44 |
+
solara.Text(f"Center: {center.value}")
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
geemap>=0.21.0
|
2 |
+
leafmap
|
3 |
+
mapwidget
|
4 |
+
solara
|
5 |
+
geopandas
|
requirements/Dockerfile.Python
CHANGED
@@ -4,7 +4,7 @@ LABEL maintainer="[email protected]"
|
|
4 |
ENV TFC_VERSION=0.1.1
|
5 |
ENV VHR_CNN_CHM_VERSION=main
|
6 |
|
7 |
-
RUN pip install wrf-python xwrf netCDF4
|
8 |
|
9 |
HEALTHCHECK NONE
|
10 |
ENTRYPOINT [""]
|
|
|
4 |
ENV TFC_VERSION=0.1.1
|
5 |
ENV VHR_CNN_CHM_VERSION=main
|
6 |
|
7 |
+
RUN pip install wrf-python xwrf netCDF4 metpy
|
8 |
|
9 |
HEALTHCHECK NONE
|
10 |
ENTRYPOINT [""]
|