The Complete Production SOP: How to Deploy and Run Rasterio Satellite GeoTIFF Processing & Windowing in Autonomous AI Agents
Production SOP to install and run Rasterio Satellite GeoTIFF Processing in Codex, Claude Code, and Cursor. Covers windowed reads, NDVI math, and fixes.
Technical Overview & Architectural Context
Autonomous coding agents frequently encounter catastrophic memory leaks and numerical truncation when tasked with geospatial raster operations. Unconstrained LLMs routinely attempt to load multi-gigabyte 16-band Sentinel or Landsat scenes entirely into system RAM via unrestricted `src.read()` calls, crashing containerized sandboxes with out-of-memory (OOM) signals. Furthermore, AI agents often hallucinate spatial metadata transformations, losing coordinate reference system (CRS) georeferencing and affine transforms during intermediate array manipulations. The `rasterio-geotiff-satellite-raster` skill eliminates this non-deterministic behavior by injecting strict procedural boundaries into autonomous agents (Codex Desktop, Claude Code, Cursor, and Windsurf). The skill enforces mandatory bounding box and tile-based windowed reads (`rasterio.windows.Window`), cast-safe floating-point normalization for spectral index mathematics (like NDVI and NDWI), and explicit affine matrix persistence on export. By codifying profile preservation (`driver='GTiff'`, `compress='deflate'`, `dtype='float32'`), it ensures production-grade geospatial transformations without human intervention.
Prerequisites & Environment Requirements
Verified Search Intents & Long-Tail Queries Solved
This operational tutorial is engineered to provide deterministic solutions for these developer search queries:
Step-by-Step Execution Playbook
Local Environment Setup & SKILL.md Mounting
Create the local skill manifest directory and inject verified procedural rules into your agent's runtime discovery path.
Autonomous coding agents discover domain instructions via standardized workspace paths. To install the `rasterio-geotiff-satellite-raster` skill, mount the verified SKILL.md specification directly inside your agent's local rules directory (`.claude/skills/`, `.cursor/rules/`, or `~/.agents/skills/`). This allows runtimes like Claude Code and Cursor to hot-reload trigger definitions such as 'read geotiff rasterio' and 'calculate ndvi rasterio' without restarting the host process.
mkdir -p .agents/skills/rasterio-geotiff-satellite-raster && curl -fsSL https://askills.dev/api/skills/rasterio-geotiff-satellite-raster/raw -o .agents/skills/rasterio-geotiff-satellite-raster/SKILL.md---
name: "rasterio-geotiff-satellite-raster"
description: "Read, inspect, and transform multi-spectral satellite imagery and elevation rasters with Rasterio."
metadata:
author: "Rasterio"
version: "1.0.0"
runtime_compatibility:
- "codex"
- "claude-code"
- "cursor"
- "windsurf"
triggers:
- "read geotiff rasterio"
- "calculate ndvi rasterio"
- "windowed reading rasterio"
permissions:
fs_read: true
fs_write: "workspace"
shell_exec: false
net_access: false
---Keep the metadata trigger block short. Agents parse YAML frontmatter on every user turn; avoiding superfluous documentation inside SKILL.md saves up to 450 prompt tokens per inference cycle.
Ensure `fs_write` is restricted to 'workspace'. Attempting to write processed rasters outside `/workspace` or into root mount directories will fail silently or trigger agent permission halts.
Environment Secrets & Dependency Validation
Ensure underlying GDAL C-libraries and Rasterio bindings are validated in the Python environment without credential exposure.
Rasterio relies heavily on compiled GDAL C-libraries. Before delegating autonomous satellite data manipulation to Codex or Claude Code, configure safe GDAL cache limits in your environment configuration file (`.env.local`) to prevent runaway memory usage during large window block queries.
printf 'GDAL_CACHEMAX=512\nGDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR\nCPL_VSIL_CURL_ALLOWED_EXTENSIONS=.tif,.TIF\n' >> .env.localNever instruct the agent to run `pip install` with global sudo privileges; keep geospatial dependencies isolated in a project `.venv` with `pip install rasterio numpy`.
Verify that `.env.local` is listed inside `.gitignore` so runtime memory constraints and sensitive paths are not committed to source control.
Intent Matching & Trigger Invocation
Trigger deterministic agent execution using precise keywords from the skill specification.
When invoking the agent, use explicit trigger phrases such as 'calculate ndvi rasterio' or 'windowed reading rasterio'. This ensures the semantic router immediately selects the `rasterio-geotiff-satellite-raster` execution SOP rather than generating generic, non-performant Python code with Pillow or OpenCV.
Structure prompts by providing explicit input band indices (e.g., 'Band 4 Red, Band 8 NIR') and target output raster compression formats ('deflate').
Avoid vague prompts like 'analyze this satellite picture'; the agent may fail to route to Rasterio and instead attempt to load multi-band GeoTIFFs using standard computer vision libraries lacking georeferencing.
Verification, Linting & Output Quality Gate
Execute automated self-healing checks to verify coordinate metadata and array dimensions.
The skill mandates a quality gate ensuring created rasters contain valid spatial references and non-corrupt raster bands. The agent runs a headless Python verification script to confirm that the CRS matches the source, no NaN values populate invalid extents, and the compression algorithm was correctly applied.
python -c "import rasterio; src=rasterio.open('output/ndvi_processed.tif'); assert src.crs is not None; assert src.dtypes[0] == 'float32'; assert src.profile['compress'] == 'deflate'; print('Rasterio Quality Gate: PASSED')"Require the agent to inspect `src.bounds` and `src.transform` inside the self-verification step to confirm that windowed offsets properly updated the output raster georeferencing.
Failing to update `transform = rasterio.windows.transform(window, src.transform)` during windowed writing results in rasters positioned at coordinate (0,0).
Real-World Scenario: Calculate Deflate-Compressed NDVI from a 4-Band PlanetScope GeoTIFF Using Windowed Processing
“Using rasterio-geotiff-satellite-raster, write a script to calculate ndvi rasterio on 'data/planet_scene.tif'. The file has Band 3 as Red and Band 4 as NIR. Read the raster in 1024x1024 windows to prevent high memory usage, write the result to 'output/planet_ndvi.tif' with dtype float32 and deflate compression, and retain exact georeferencing.”
Runtime Troubleshooting & Failure Modes
Root Cause: Occurs when satellite imagery contains cloud masks, no-data borders, or deep water where NIR + Red equals zero. Standard array operations without masked arrays or float casting raise runtime warnings or fill pixels with NaN/Inf values.
with np.errstate(divide='ignore', invalid='ignore'):
denominator = nir.astype(float) + red.astype(float)
ndvi = np.where(denominator != 0, (nir.astype(float) - red.astype(float)) / denominator, -9999.0)
ndvi_profile.update(nodata=-9999.0)Root Cause: The agent attempted to write a windowed chunk into the output dataset without updating the affine transform matrix with `rasterio.windows.transform(window, src.transform)`, leading to misaligned or distorted geospatial bounds.
window = rasterio.windows.Window(col_off=col, row_off=row, width=w, height=h)
win_transform = rasterio.windows.transform(window, src.transform)
out_profile.update({'transform': win_transform, 'width': w, 'height': h})Frequently Asked Questions (Rasterio Satellite GeoTIFF Processing & Windowing SOP)
Q:Can I use Rasterio Satellite GeoTIFF Processing & Windowing across Codex, Claude Code, and Cursor simultaneously?
Yes. The skill conforms to the universal SKILL.md specification. Whether placed inside `.claude/skills/`, `.cursor/rules/`, or the Codex agent directory, all supported runtimes discover and enforce the same deterministic procedural rules.
Q:How does Rasterio Satellite GeoTIFF Processing & Windowing prevent context window overflow during long agent sessions?
The skill enforces explicit windowed reading algorithms and standard raster profiles directly in the procedural rules. This prevents agents from engaging in verbose token-heavy trial-and-error loops or printing multi-megabyte numpy array representations into the session context.
Q:Does this skill require escalated root or container permissions?
No. The skill is audited with a security score of 98/100. It requires read access to imagery assets and write access strictly confined to the workspace filesystem (`fs_write: 'workspace'`). It requires no shell elevation or outbound network access.
Ready to equip your autonomous agent with Rasterio Satellite GeoTIFF Processing & Windowing?
Copy the complete audited SKILL.md specification or download the 1-click zip bundle directly from our verified registry.