Who it is forA researcher building a crop type segmentation model.
The problemAligning large rasters from different sensors and labels by hand is error prone.
The outcomeA PyTorch DataLoader of image and mask patches drawn only where both sources exist.
What you need first
- Python with `pip install torchgeo` (or `uv add torchgeo`)
- Enough disk space for the satellite datasets you download
- A GPU for training, as with any PyTorch project
Steps
- Install with
pip install torchgeo - Create Landsat7 and Landsat8 datasets from your files and join them with the | operator
- Load CDL with download=True and checksum=True, and intersect with & so samples need both
- Wrap it with RandomPatchSampler(size=256, length=10000) and a DataLoader using stack_samples, then iterate batches of image and mask
Prompt for your agent
With torchgeo/torchgeo, write a script that unions my Landsat 7 and 8 scenes in <data folder>, intersects them with CDL, and prints the shapes of the first batch from a RandomPatchSampler DataLoader.
Caveat. The README notes CDL is a single image covering the continental United States, so the download is large.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for torchgeo/torchgeo and "Build a crop mapping dataset from Landsat and CDL"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer