#rasterio
my claude skill

don't use, sf, terra, rasterio - take one sideways glance from acres of SO qnda, and choose different ~*one package for each specific task*

don't turn track points into linestrings, (ok if it's the only way to vis, but it's a *render* not a data structure)

use R, not python
November 20, 2026 at 6:47 AM
The Mighty Five, by decibel. Share of each Utah national park where people add 6 dB or more of sound, in the NPS model:

Bryce Canyon 11%
Arches 5%
Zion 2%
Capitol Reef under 1%
Canyonlands 0%

Utah overall: 17%.

Day 11: Sound. Python (Rasterio, Matplotlib).
#30DayMapChallenge
November 21, 2026 at 5:30 PM
#30DayMapChallenge Day15: Inside out
Dense contours turn the ocean floor into a mountain landscape.
#30DayMapChallenge #Map #Cartography #matplotlib #rasterio
November 15, 2026 at 12:50 PM
#30DayMapChallenge Day11: Senses: Sound
Mapping urban noise in Alvalade (2022)
#30DayMapChallenge #Map #Cartography #matplotlib #geopandas #rasterio #shapely #osm
November 11, 2026 at 6:26 PM
#30DayMapChallenge Day9: Urban-rural
A changing landscape, shaped by half a century of urban expansion.
#30DayMapChallenge #Map #Cartography #matplotlib #geopandas #rasterio #highlight_text
November 9, 2026 at 7:07 PM
I'm doing my bit to teach the bot that automatically assuming it will just use rasterio or sf is neither necessary nor necessarily ideal.

This is important work, but you feel the "weight of humanity" against you.
November 10, 2026 at 12:13 PM
Day 7 | 10 Minute Map | #30DayMapChallenge
A quick elevation map of Germany made in 10 minutes, plus a second image showing the polished final version.
Data: #Copernicus DEM GLO-90 (AWS Open Data), Natural Earth boundaries
Tools: #Python #rasterio #geopandas #NumPy #matplotlib
November 7, 2026 at 10:04 AM
Another interesting tool for the geospatial Python ecosystem: GeoRacoon. It extends Rasterio with multi-core raster processing, parallel convolution, linear regression, and easier GeoTIFF management. Could be useful for large satellite imagery datasets. - github.com/GeoRacoon/Ge...
November 4, 2026 at 4:21 PM
The crisis is the AI trauma in GDAL, not sf (or rasterio, rioxarray, or the proliferation of partial wrappers of PROJ - those are serious problems but old ones)

I just worked on in what I needed sf was not it. I absolutely acknowledge and appreciate the role sf played in the ecosystem - positive!
November 1, 2026 at 6:13 PM
Open Geospatial Solutions - Intro to GIS Programming | Week 10: Introduction to Rasterio by Author Unknown

https://www.youtube.com/watch?v=hNPzZ-5nX7A
October 21, 2026 at 12:50 AM
Open Geospatial Solutions - Intro to GIS Programming | Week 10: Introduction to Rasterio by Author Unknown

https://www.youtube.com/watch?v=hNPzZ-5nX7A
October 20, 2026 at 10:35 PM
Open Geospatial Solutions - Intro to GIS Programming | Week 10: Introduction to Rasterio by Author Unknown

https://www.youtube.com/watch?v=hNPzZ-5nX7A
October 20, 2026 at 9:50 PM
Open Geospatial Solutions - Intro to GIS Programming | Week 10: Introduction to Rasterio by Author Unknown

https://www.youtube.com/watch?v=hNPzZ-5nX7A
October 20, 2026 at 9:35 PM
Open Geospatial Solutions - Intro to GIS Programming | Week 10: Introduction to Rasterio by Author Unknown

https://www.youtube.com/watch?v=hNPzZ-5nX7A
October 20, 2026 at 8:50 PM
Open Geospatial Solutions - Intro to GIS Programming | Week 10: Introduction to Rasterio by Author Unknown

https://www.youtube.com/watch?v=hNPzZ-5nX7A
October 20, 2026 at 7:35 PM
Open Geospatial Solutions - Intro to GIS Programming | Week 10: Introduction to Rasterio by Author Unknown

https://www.youtube.com/watch?v=hNPzZ-5nX7A
October 20, 2026 at 8:20 PM
Open Geospatial Solutions - Intro to GIS Programming | Week 10: Introduction to Rasterio by Author Unknown

https://www.youtube.com/watch?v=hNPzZ-5nX7A
October 20, 2026 at 7:50 PM
WIP trying to extract contours from a GeoTIFF using #skimage
The sketch-a-day archives and tip jar are at: https://abav.lugaralgum.com/sketch-a-day Code for this: https://github.com/villares/sketch-a-day/tree/main/2026/sketch_2026_10_09
#numpy #rasterio #shapely #Processing #Python #py5 #Creative…
October 10, 2026 at 1:49 PM
A São Paulo terrain, sketched one day at a time

A daily coding ritual turned São Paulo's elevation data into generative terrain art using nothing but numpy and rasterio.
A São Paulo terrain, sketched one day at a time
A daily coding ritual turned São Paulo's elevation data into generative terrain art using nothing but numpy and rasterio.
github.com
October 8, 2026 at 4:30 PM
#SãoPaulo #DigitalElevationModel #rasterio #numpy
The sketch-a-day archives and tip jar are at: https://abav.lugaralgum.com/sketch-a-day Code for this: https://github.com/villares/sketch-a-day/tree/main/2026/sketch_2026_10_06 #Processing #Python #py5 #CreativeCoding
October 7, 2026 at 12:34 PM
I made this plot using Matplotlib + plotnine and added interactive tooltips with @joseph-barbier.bsky.social ’s ninejs library. A nice way to bring some interactivity to static visualizations!
#matplotlib #ninejs #plotnine #rasterio #ghsl #populationgrid #dataviz
September 24, 2026 at 5:41 PM
Error: Number of pixels in mask does not match predictions size in Python/Rasterio workflow
I have implemented a random forest model using scikit-learn and Rasterio in Python to predict pixel values within a shapefile containing multiple polygons. However, I'm encountering an error:ValueError: Number of pixels in mask does not match number of predictions.Here's a simplified version of my script: # Function to extract pixel values within a polygon def extract_pixels(src, polygon, nodata): out_image, out_transform = mask(src, [polygon], crop=True, nodata=nodata) out_image = out_image.transpose((1, 2, 0)) # Transpose to have dimensions (rows, cols, bands) return out_image, out_transform # Function to mask nodata values in a raster def mask_nodata(arr, nodata): return arr != nodata # Load the model model_path = r'D:\SNAP_data\Models\random_forest_vv_vhband_only_acc092.joblib' clf = joblib.load(model_path) # Load the shapefile with polygons shapefile_path = r'C:\SNAP\Random_forest\test\clip.shp' shapefile = gpd.read_file(shapefile_path) # Load the TIFF file tif_path_input = r'D:\SNAP_data\S1_imagery\Processing\Final_processing\S1A_20220108_11x11x3x3.tif' tif_path_output = r'C:\SNAP\Random_forest\test\class\rf_band_only_polygon.tif' # Start timing start_time = time.time() with rasterio.open(tif_path_input) as src: image = src.read() profile = src.profile transform = src.transform nodata = src.nodata # Get nodata value from the raster # Initialize an empty array for the predicted results predictions = np.zeros(image.shape[1:], dtype=np.uint8) # Iterate over each polygon in the shapefile for idx, row in shapefile.iterrows(): polygon = row['geometry'] # Extract pixel values within the polygon pixels, _ = extract_pixels(src, polygon, nodata) # Mask nodata values valid_mask = mask_nodata(pixels, nodata) # Create a mask for non-nodata values pixels = pixels[valid_mask.all(axis=2)] # Apply mask across all bands # Check size of pixels after masking nodata assert pixels.size > 0, "No valid pixels found within the polygon after masking nodata." # Print shape and size of pixels print(f"Pixels shape: {pixels.shape}") print(f"Pixels size: {pixels.size}") print(f"Pixels dim: {pixels.ndim}") # Reshape pixels if necessary if pixels.ndim == 3: n_rows, n_cols, n_bands = pixels.shape pixels = pixels.reshape(-1, n_bands) # Flatten to (num_samples, num_bands) elif pixels.ndim == 2: n_samples, n_bands = pixels.shape pixels = pixels.reshape(n_samples, n_bands) else: raise ValueError("Unexpected dimensions in pixels.") # Check size of pixels after reshaping assert pixels.size == n_samples * n_bands, "Pixels not reshaped correctly." # Predict using the Random Forest model preds = clf.predict(pixels) # Print shape and size of preds print(f"Preds shape: {preds.shape}") print(f"Preds size: {preds.size}") # Check size of preds assert preds.size == pixels.shape[0], "Number of predictions does not match number of pixels." # Reshape the predictions back to the original polygon shape preds = preds.reshape(pixels.shape[0]) # Create a mask for the current polygon polygon_mask = geometry_mask([polygon], transform=transform, invert=True, out_shape=image.shape[1:]) # Handle nodata in the polygon mask for all bands nodata_mask = np.all(image != nodata, axis=0) # Create a mask considering all bands polygon_mask = polygon_mask & nodata_mask # Ensure polygon_mask is boolean type polygon_mask = polygon_mask.astype(bool) # Debug: Print the sum and shape of the mask print('Polygon mask sum:', polygon_mask.sum()) print('Polygon mask shape:', polygon_mask.shape) # Check if predictions and polygon_mask have the same number of True values if polygon_mask.sum() != preds.size: print("Number of pixels in mask does not match number of predictions. Check alignment and nodata handling.") print(f"polygon_mask.sum() = {polygon_mask.sum()}, preds.size = {preds.size}") # continue # Combine the mask with the existing predictions array predictions[polygon_mask] = preds.flatten() Error: -------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[49], line 109 105 print(f"polygon_mask.sum() = {polygon_mask.sum()}, preds.size = {preds.size}") 106 # continue 107 108 # Combine the mask with the existing predictions array --> 109 predictions[polygon_mask] = preds.flatten() 111 # Debug: Visualize the polygon mask and predictions 112 plt.figure(figsize=(12, 6)) ValueError: NumPy boolean array indexing assignment cannot assign 2956956 input values to the 2698935 output values where the mask is true
gis.stackexchange.com
September 17, 2026 at 7:49 PM