Skip to content

Commit

Permalink
Better name for the tif_raster variable
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiodsf committed Jan 27, 2025
1 parent 8647249 commit f0b3d5a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sourcespec/ssp_plot_stations.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ def _read_geotiff(tif_file, grayscale=False):
tif_bbox = (lonmin, lonmax, latmin, latmax)
# Read the raster as a 3D array (bands, rows, columns)
if not grayscale and src.count >= 3:
basemap = src.read([1, 2, 3]) # Read the first three bands (RGB)
tif_raster = src.read([1, 2, 3]) # Read the first three bands (RGB)
# Transpose to (rows, columns, bands) for plotting
basemap = basemap.transpose((1, 2, 0))
tif_raster = tif_raster.transpose((1, 2, 0))
else:
basemap = src.read(1)
return basemap, tif_bbox
tif_raster = src.read(1)
return tif_raster, tif_bbox


def _add_geotiff(config, ax):
Expand All @@ -330,7 +330,7 @@ def _add_geotiff(config, ax):
# pylint: disable=import-outside-toplevel
from rasterio.errors import RasterioError
try:
basemap, tif_bbox = _read_geotiff(tif_file, grayscale)
tif_raster, tif_bbox = _read_geotiff(tif_file, grayscale)
except (RasterioError, OSError) as msg:
logger.warning(
f'Error reading GeoTIFF file "{tif_file}": {msg}. '
Expand All @@ -339,11 +339,11 @@ def _add_geotiff(config, ax):
# Plot the raster
if grayscale:
ax.imshow(
basemap, extent=tif_bbox, origin='upper', cmap='gray',
tif_raster, extent=tif_bbox, origin='upper', cmap='gray',
transform=ccrs.PlateCarree(), zorder=ZORDER_BASEMAP)
else:
ax.imshow(
basemap, extent=tif_bbox, origin='upper',
tif_raster, extent=tif_bbox, origin='upper',
transform=ccrs.PlateCarree(), zorder=ZORDER_BASEMAP)


Expand Down

0 comments on commit f0b3d5a

Please sign in to comment.