Skip to content

Commit 492b74a

Browse files
committed
Fix add raster colormap bug
1 parent 5ef95b3 commit 492b74a

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

leafmap/foliumap.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ def add_raster(
568568
def add_remote_tile(
569569
self,
570570
source: str,
571-
band: Optional[int] = None,
572-
palette: Optional[str] = None,
571+
indexes: Optional[int] = None,
572+
colormap: Optional[str] = None,
573573
vmin: Optional[float] = None,
574574
vmax: Optional[float] = None,
575575
nodata: Optional[float] = None,
@@ -581,8 +581,8 @@ def add_remote_tile(
581581
582582
Args:
583583
source (str): The path to the remote Cloud Optimized GeoTIFF.
584-
band (int, optional): The band to use. Band indexing starts at 1. Defaults to None.
585-
palette (str, optional): The name of the color palette from `palettable` to use when plotting a single band. See https://jiffyclub.github.io/palettable. Default is greyscale
584+
indexes (int, optional): The band(s) to use. Band indexing starts at 1. Defaults to None.
585+
colormap (str, optional): The name of the colormap from `matplotlib` to use when plotting a single band. See https://matplotlib.org/stable/gallery/color/colormap_reference.html. Default is greyscale.
586586
vmin (float, optional): The minimum value to use when colormapping the palette when plotting a single band. Defaults to None.
587587
vmax (float, optional): The maximum value to use when colormapping the palette when plotting a single band. Defaults to None.
588588
nodata (float, optional): The value from the band to use to interpret as not valid data. Defaults to None.
@@ -592,8 +592,8 @@ def add_remote_tile(
592592
if isinstance(source, str) and source.startswith("http"):
593593
self.add_raster(
594594
source,
595-
band=band,
596-
palette=palette,
595+
indexes=indexes,
596+
colormap=colormap,
597597
vmin=vmin,
598598
vmax=vmax,
599599
nodata=nodata,

leafmap/leafmap.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -2170,8 +2170,8 @@ def toolbar_reset(self):
21702170
def add_raster(
21712171
self,
21722172
source,
2173-
band=None,
2174-
palette=None,
2173+
indexes=None,
2174+
colormap=None,
21752175
vmin=None,
21762176
vmax=None,
21772177
nodata=None,
@@ -2191,8 +2191,8 @@ def add_raster(
21912191
21922192
Args:
21932193
source (str): The path to the GeoTIFF file or the URL of the Cloud Optimized GeoTIFF.
2194-
band (int, optional): The band to use. Band indexing starts at 1. Defaults to None.
2195-
palette (str, optional): The name of the color palette from `palettable` to use when plotting a single band. See https://jiffyclub.github.io/palettable. Default is greyscale
2194+
indexes (int, optional): The band(s) to use. Band indexing starts at 1. Defaults to None.
2195+
colormap (str, optional): The name of the colormap from `matplotlib` to use when plotting a single band. See https://matplotlib.org/stable/gallery/color/colormap_reference.html. Default is greyscale.
21962196
vmin (float, optional): The minimum value to use when colormapping the palette when plotting a single band. Defaults to None.
21972197
vmax (float, optional): The maximum value to use when colormapping the palette when plotting a single band. Defaults to None.
21982198
nodata (float, optional): The value from the band to use to interpret as not valid data. Defaults to None.
@@ -2204,8 +2204,8 @@ def add_raster(
22042204

22052205
tile_layer, tile_client = get_local_tile_layer(
22062206
source,
2207-
band=band,
2208-
palette=palette,
2207+
indexes=indexes,
2208+
colormap=colormap,
22092209
vmin=vmin,
22102210
vmax=vmax,
22112211
nodata=nodata,
@@ -2237,7 +2237,7 @@ def add_raster(
22372237
params = {
22382238
"tile_layer": tile_layer,
22392239
"tile_client": tile_client,
2240-
"band": band,
2240+
"indexes": indexes,
22412241
"band_names": tile_client.band_names,
22422242
"bounds": bounds,
22432243
"type": "LOCAL",
@@ -3860,7 +3860,7 @@ def add_velocity(
38603860
max_velocity=20,
38613861
display_options={},
38623862
name="Velocity",
3863-
color_scale=None
3863+
color_scale=None,
38643864
):
38653865
"""Add a velocity layer to the map.
38663866
@@ -3913,7 +3913,7 @@ def add_velocity(
39133913
ds = ds.isel(drop=True, **params)
39143914

39153915
if color_scale is None:
3916-
color_scale=[
3916+
color_scale = [
39173917
"rgb(36,104, 180)",
39183918
"rgb(60,157, 194)",
39193919
"rgb(128,205,193)",
@@ -3928,7 +3928,7 @@ def add_velocity(
39283928
"rgb(245,64,32)",
39293929
"rgb(237,45,28)",
39303930
"rgb(220,24,32)",
3931-
"rgb(180,0,35)"
3931+
"rgb(180,0,35)",
39323932
]
39333933

39343934
wind = Velocity(

0 commit comments

Comments
 (0)