基于多时相 SAR 后向散射时序的农作物分类:逐像元时序/统计/物候特征 + 随机森林。SAR crop classification from multi-temporal backscatter time series using per-pixel phenological features and Random Forest. 合成模式生成水稻/小麦/玉米三类时序真值并评估精度,输出分类 GeoTIFF + 面积统计 + 混淆矩阵 JSON。
设计与多媒体
Geoskill: Crop Type Mapping
试用Identify major crop types from multi-temporal optical/SAR imagery using phenological features. Produces pixel/field-level classification, area statistics, and confidence maps. Use when mapping crop distributions, estimating planted areas, or generating agricultural intelligence from remote sensing data.
它能做什么
Identify major crop types from multi-temporal optical/SAR imagery using phenological features. Produces pixel/field-level classification, area statistics, and confidence maps. Use when mapping crop distributions, estimating planted areas, or generating agricultural intelligence from remote sensing data.
技能文档
Prerequisites / 先准备 X 文件
⚠️ 必读 — 本 skill 不属于即用型,需要先准备特定文件才能跑。
本 skill 需要 bbox/AOI + 年份/日期范围。时序影像自动下载,但 训练标签和物候 schema 是可选的——内置 4 种作物(水稻/小麦/玉米/大豆)够用。
👉 完整教程见仓库根目录 PREREQUISITES.md 1.2 节。
先准备 X 文件:自动下载 + 内置物候 = 1 行命令可跑通。
快速试跑命令:
python crop_type_mapping.py --bbox 113.0,29.5,114.5,31.0 --year 2024 --output-dir ./ctm
Crop Type Mapping
Identifies major crop types (rice, wheat, corn, etc.) from multi-temporal satellite imagery using phenological curve matching and spectral indices.
Trigger
Use when the user wants to:
- Map crop type distribution for a region (e.g., "identify rice/wheat/corn in Henan 2024")
- Estimate planted area by crop type with confidence intervals
- Generate crop classification maps from Sentinel-2/Landsat time series
- Compare crop patterns across years or regions
- Produce agricultural intelligence reports for government or insurance
CLI Usage
# Basic: classify crops in a bounding box for a given year
python scripts/crop_type_mapping.py \
--bbox 113.0,29.5,114.5,31.0 \
--year 2024
# Using a place name
python scripts/crop_type_mapping.py \
--place beijing \
--year 2024
# With custom date range and output directory
python scripts/crop_type_mapping.py \
--bbox 115.0,30.0,116.0,31.0 \
--start-date 2024-04-01 \
--end-date 2024-10-31 \
--output-dir ./ctm-output
# With custom crop schema and method
python scripts/crop_type_mapping.py \
--aoi-file region.geojson \
--year 2024 \
--crop-schema references/crop_phenology.json \
--method rule \
--min-patch-area 9
Parameters
| Parameter | Default | Description |
|---|---|---|
--place | — | Place name (e.g., 'beijing', 'shanghai') |
--bbox | — | Bounding box: 'xmin,ymin,xmax,ymax' (WGS84) |
--aoi-file | — | AOI file (GeoJSON or Shapefile) |
--year | current | Year for analysis (2015-2030) |
--start-date | — | Start date (YYYY-MM-DD), mutually exclusive with --year |
--end-date | — | End date (YYYY-MM-DD) |
--crop-schema | built-in | Custom crop phenology schema JSON |
--labels | — | Training/validation labels (GeoJSON) |
--method | rule | Classification method: rule, rf, xgboost |
--min-observations | 5 | Minimum valid observations per pixel |
--field-boundaries | — | Field boundary polygons (GeoJSON) |
--min-patch-area | 4 | Minimum patch area in pixels (post-processing) |
--output-dir | ./ctm-output | Output directory |
Note: --place, --bbox, and --aoi-file are mutually exclusive.
Output
| File | Description |
|---|---|
crop_classes.tif | Crop classification raster (class codes) |
crop_confidence.tif | Per-pixel classification confidence (0-1) |
crop_polygons.geojson | Vector polygons per crop region |
area_by_admin.csv | Area statistics per crop class (ha, km², %) |
accuracy.json | Confusion matrix, overall accuracy, per-class F1 |
request.json | Input parameters and AOI metadata |
dataset-manifest.json | Data source and observation metadata |
output-manifest.json | Output file inventory and summary |
qa.json | Quality assurance checks and status |
run.log | Execution log |
Crop Types (Default Schema)
| Crop | Code | Peak DOY | Description |
|---|---|---|---|
| Rice | 1 | 220 (Aug) | Single-season late rice |
| Wheat | 2 | 120 (Apr) | Winter wheat |
| Corn | 3 | 200 (Jul) | Summer corn |
Classification Methods
| Method | Description |
|---|---|
rule | Phenological curve matching using peak DOY and amplitude |
rf | Random Forest (requires sklearn, falls back to rule) |
xgboost | XGBoost (requires sklearn, falls back to rule) |
Workflow
- AOI parsing — resolve place/bbox/aoi-file to WGS84 bounding box
- Time range — parse year or custom date range
- Data preparation — search/acquire Sentinel-2/Landsat time series
- Feature extraction — compute NDVI, EVI, LSWI + phenological features
- Classification — rule-based or ML classification per pixel
- Post-processing — small patch removal, spatial smoothing
- Accuracy assessment — confusion matrix, per-class metrics
- Area statistics — pixel-counting with spherical area correction
- Output — GeoTIFF, GeoJSON, CSV, JSON reports
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 2 | Argument error |
| 3 | Dependency missing |
| 6 | Data validation failure |
| 7 | Processing failure |
Limitations
- Classification is remote-sensing-based estimation, not ground truth
- Accuracy depends on cloud-free observation count and timing
- Crop schema defaults are tuned for major grain regions (North China Plain)
- Double-cropping regions may require custom schema
- Results should be validated with ground truth before operational use
数据下载
本 skill 可自动从 Microsoft Planetary Computer 下载数据 (无需 API key):
python crop_type_mapping.py --bbox 116,39,117,40 --date-range 2024-06-01,2024-06-30 --output-dir
--bbox W,S,E,N: WGS-84 边界框 (西, 南, 东, 北)--date-range START,END: 日期范围 (YYYY-MM-DD,YYYY-MM-DD)--aoi-file: 替代 --bbox 的 GeoJSON 多边形--cache-dir: 缓存目录 (默认 ~/.geoskill_cache)
当用户只给 --bbox + --date-range (没有 --image) 时,skill 自动下载数据。
当用户给 --image 时,走原文件路径 (向后兼容)。
相关技能
Multi-year cropland abandonment detection using NDVI time series. Identifies suspected abandoned cropland based on consecutive years without cultivation signals. Use when screening for abandoned fields, generating field verification lists, or monitoring cultivation continuity.
Detect and classify cropland changes from before/after NDVI rasters. Identifies suspected construction, water, forest, and bare soil changes and generates compliance investigation materials. Use when the user wants to check farmland for unauthorized changes, monitor cropland conversion, or generate compliance reports.
Assess crop health from NDVI time series. Use when the user wants to analyze changes, detect hazards, or generate assessment reports.
多年度分类编码轮作序列,识别轮作模式并统计频率。Detects crop rotation by encoding multi-year classifications into sequences, recognizing patterns and counting frequencies.
高分辨率作物识别叠加申报地块做差异检测,核查补贴合规性。Verifies subsidy compliance by overlaying high-resolution crop classification on declared parcels for difference detection.