Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix add raster colormap bug #674

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions leafmap/foliumap.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ def add_raster(
def add_remote_tile(
self,
source: str,
band: Optional[int] = None,
palette: Optional[str] = None,
indexes: Optional[int] = None,
colormap: Optional[str] = None,
vmin: Optional[float] = None,
vmax: Optional[float] = None,
nodata: Optional[float] = None,
Expand All @@ -581,8 +581,8 @@ def add_remote_tile(

Args:
source (str): The path to the remote Cloud Optimized GeoTIFF.
band (int, optional): The band to use. Band indexing starts at 1. Defaults to None.
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
indexes (int, optional): The band(s) to use. Band indexing starts at 1. Defaults to None.
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.
vmin (float, optional): The minimum value to use when colormapping the palette when plotting a single band. Defaults to None.
vmax (float, optional): The maximum value to use when colormapping the palette when plotting a single band. Defaults to None.
nodata (float, optional): The value from the band to use to interpret as not valid data. Defaults to None.
Expand All @@ -592,8 +592,8 @@ def add_remote_tile(
if isinstance(source, str) and source.startswith("http"):
self.add_raster(
source,
band=band,
palette=palette,
indexes=indexes,
colormap=colormap,
vmin=vmin,
vmax=vmax,
nodata=nodata,
Expand Down
20 changes: 10 additions & 10 deletions leafmap/leafmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2170,8 +2170,8 @@ def toolbar_reset(self):
def add_raster(
self,
source,
band=None,
palette=None,
indexes=None,
colormap=None,
vmin=None,
vmax=None,
nodata=None,
Expand All @@ -2191,8 +2191,8 @@ def add_raster(

Args:
source (str): The path to the GeoTIFF file or the URL of the Cloud Optimized GeoTIFF.
band (int, optional): The band to use. Band indexing starts at 1. Defaults to None.
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
indexes (int, optional): The band(s) to use. Band indexing starts at 1. Defaults to None.
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.
vmin (float, optional): The minimum value to use when colormapping the palette when plotting a single band. Defaults to None.
vmax (float, optional): The maximum value to use when colormapping the palette when plotting a single band. Defaults to None.
nodata (float, optional): The value from the band to use to interpret as not valid data. Defaults to None.
Expand All @@ -2204,8 +2204,8 @@ def add_raster(

tile_layer, tile_client = get_local_tile_layer(
source,
band=band,
palette=palette,
indexes=indexes,
colormap=colormap,
vmin=vmin,
vmax=vmax,
nodata=nodata,
Expand Down Expand Up @@ -2237,7 +2237,7 @@ def add_raster(
params = {
"tile_layer": tile_layer,
"tile_client": tile_client,
"band": band,
"indexes": indexes,
"band_names": tile_client.band_names,
"bounds": bounds,
"type": "LOCAL",
Expand Down Expand Up @@ -3860,7 +3860,7 @@ def add_velocity(
max_velocity=20,
display_options={},
name="Velocity",
color_scale=None
color_scale=None,
):
"""Add a velocity layer to the map.

Expand Down Expand Up @@ -3913,7 +3913,7 @@ def add_velocity(
ds = ds.isel(drop=True, **params)

if color_scale is None:
color_scale=[
color_scale = [
"rgb(36,104, 180)",
"rgb(60,157, 194)",
"rgb(128,205,193)",
Expand All @@ -3928,7 +3928,7 @@ def add_velocity(
"rgb(245,64,32)",
"rgb(237,45,28)",
"rgb(220,24,32)",
"rgb(180,0,35)"
"rgb(180,0,35)",
]

wind = Velocity(
Expand Down
Loading