Skip to content

Commit

Permalink
Fix pre-commit error
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Jul 18, 2024
1 parent 2cd1e07 commit 1ba1782
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 28 deletions.
4 changes: 2 additions & 2 deletions pages/00_home.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def Page():
with solara.Column(align="center"):
markdown = """
## Earth Engine Web Apps
### Introduction
**A collection of Earth Engine web apps developed using [Solara](https://github.com/widgetti/solara) and geemap**
Expand All @@ -15,7 +15,7 @@ def Page():
- GitHub: <https://github.com/opengeos/solara-geemap>
- Hugging Face: <https://huggingface.co/spaces/giswqs/solara-geemap>
### How to deploy this app on Hugging Face Spaces
1. Go to <https://huggingface.co/spaces/giswqs/solara-geemap/tree/main> and duplicate the space to your own space.
Expand Down
18 changes: 9 additions & 9 deletions pages/02_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ def __init__(self, **kwargs):

def add_ee_data(self):
# Add Earth Engine dataset
dem = ee.Image('USGS/SRTMGL1_003')
landsat7 = ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003').select(
['B1', 'B2', 'B3', 'B4', 'B5', 'B7']
dem = ee.Image("USGS/SRTMGL1_003")
landsat7 = ee.Image("LANDSAT/LE7_TOA_5YEAR/1999_2003").select(
["B1", "B2", "B3", "B4", "B5", "B7"]
)
states = ee.FeatureCollection("TIGER/2018/States")

# Set visualization parameters.
vis_params = {
'min': 0,
'max': 4000,
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5'],
"min": 0,
"max": 4000,
"palette": ["006633", "E5FFCC", "662A00", "D8D8D8", "F5F5F5"],
}

# Add Earth Engine layers to Map
self.addLayer(
landsat7,
{'bands': ['B4', 'B3', 'B2'], 'min': 20, 'max': 200, 'gamma': 2.0},
'Landsat 7',
{"bands": ["B4", "B3", "B2"], "min": 20, "max": 200, "gamma": 2.0},
"Landsat 7",
True,
)
self.addLayer(dem, vis_params, 'SRTM DEM', True, 1)
self.addLayer(dem, vis_params, "SRTM DEM", True, 1)
self.addLayer(states, {}, "US States")


Expand Down
18 changes: 9 additions & 9 deletions pages/03_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ def __init__(self, **kwargs):
self.add_plot_gui()

def add_ee_data(self):
landsat7 = ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003').select(
['B1', 'B2', 'B3', 'B4', 'B5', 'B7']
landsat7 = ee.Image("LANDSAT/LE7_TOA_5YEAR/1999_2003").select(
["B1", "B2", "B3", "B4", "B5", "B7"]
)

landsat_vis = {'bands': ['B4', 'B3', 'B2'], 'gamma': 1.4}
landsat_vis = {"bands": ["B4", "B3", "B2"], "gamma": 1.4}
self.addLayer(landsat7, landsat_vis, "Landsat")

hyperion = ee.ImageCollection('EO1/HYPERION').filter(
ee.Filter.date('2016-01-01', '2017-03-01')
hyperion = ee.ImageCollection("EO1/HYPERION").filter(
ee.Filter.date("2016-01-01", "2017-03-01")
)

hyperion_vis = {
'min': 1000.0,
'max': 14000.0,
'gamma': 2.5,
"min": 1000.0,
"max": 14000.0,
"gamma": 2.5,
}
self.addLayer(hyperion, hyperion_vis, 'Hyperion')
self.addLayer(hyperion, hyperion_vis, "Hyperion")


@solara.component
Expand Down
15 changes: 9 additions & 6 deletions pages/04_split_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ def __init__(self, **kwargs):

def add_ee_data(self):
# Select the eight NLCD epochs after 2000.
years = ['2001', '2004', '2006', '2008', '2011', '2013', '2016', '2019']
years = ["2001", "2004", "2006", "2008", "2011", "2013", "2016", "2019"]

# Get an NLCD image by year.
def getNLCD(year):
# Import the NLCD collection.
dataset = ee.ImageCollection('USGS/NLCD_RELEASES/2019_REL/NLCD')
dataset = ee.ImageCollection("USGS/NLCD_RELEASES/2019_REL/NLCD")

# Filter the collection by year.
nlcd = dataset.filter(ee.Filter.eq('system:index', year)).first()
nlcd = dataset.filter(ee.Filter.eq("system:index", year)).first()

# Select the land cover band.
landcover = nlcd.select('landcover')
landcover = nlcd.select("landcover")
return landcover

## Create an NLCD image collection for the selected years.
collection = ee.ImageCollection(ee.List(years).map(lambda year: getNLCD(year)))

# Create a list of labels to populate the dropdown list.
labels = [f'NLCD {year}' for year in years]
labels = [f"NLCD {year}" for year in years]

# Add a split-panel map for visualizing NLCD land cover change.
self.ts_inspector(
Expand All @@ -41,7 +41,10 @@ def getNLCD(year):

# Add the NLCD legend to the map.
self.add_legend(
title='NLCD Land Cover Type', builtin_legend='NLCD', height="460px", add_header=False
title="NLCD Land Cover Type",
builtin_legend="NLCD",
height="460px",
add_header=False,
)


Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
geemap
solara
geopandas
pydantic< 2.0
pydantic< 2.0
solara

0 comments on commit 1ba1782

Please sign in to comment.