编程

geoskill-ai-time-series-forecast

试用

LSTM 时序预测网络(torch+CUDA,默认) + 经典线性/多项式/AR(p) 解释基线:多步外推 + 留出 MAE/RMSE 验证 + 逐像元栅格输出

它能做什么

LSTM 时序预测网络(torch+CUDA,默认) + 经典线性/多项式/AR(p) 解释基线:多步外推 + 留出 MAE/RMSE 验证 + 逐像元栅格输出

技能文档

AI时序预测 | AI Time Series Forecast

Performs multi-step extrapolation of remote sensing time series (per-pixel NDVI/temperature/backscatter) with a single-layer LSTM, validates on a held-out period (MAE/RMSE), and outputs forecast rasters for each future step plus a per-pixel validation RMSE map.

Core model: single-layer LSTM (many-to-one + recursive extrapolation), trained/inferred by default on torch + CUDA; the skill ships with pretrained weights ts_lstm_weights.pt (automatically trained on GPU and persisted at first run when missing). Three interpretable classical baselines (--method linear|poly|ar) are also retained for comparison and GPU-free environments. The fitting accuracy of each model class, AR coefficient recovery, and held-out MAE/RMSE all have unit tests against hand-computed baselines.

Dependencies / 依赖

pip install numpy rasterio scipy torch --index-url https://download.pytorch.org/whl/cu121

Classical baseline methods (--method linear|poly|ar) do not require torch.

Usage / 使用方法

Example 1 (Synthetic Data, Offline)

python geoskill-ai-time-series-forecast.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out

Example 2: Synthetic Time-Series Forecast (Offline)

python geoskill-ai-time-series-forecast.py --bbox 116.0 39.0 117.0 40.0 --synthetic --method linear --horizon 4 --output-dir ./out

Example 3: Polynomial Trend Extrapolation

python geoskill-ai-time-series-forecast.py --bbox 116.0 39.0 117.0 40.0 --synthetic --method poly --degree 2 --horizon 6 --output-dir ./out

Example 4: Autoregressive Model

python geoskill-ai-time-series-forecast.py --input series.tif --method ar --order 3 --horizon 3 --output-dir ./out

Output / 输出

FileFormatDescription
forecast.tifGeoTIFFForecasts for the next horizon steps (one band per step)
validation_rmse.tifGeoTIFFPer-pixel held-out validation RMSE
forecast_report.jsonJSONGlobal/center-pixel forecasts and error metrics
output-manifest.jsonJSONRun manifest (inputs/outputs/QA/exit code)

Data Source / 数据源 / Source

Local multi-band GeoTIFF (bands = time steps), or --synthetic (NDVI-like cube of trend + annual cycle + noise).

Privacy / 隐私声明 / Privacy

  • Runs offline by default; --synthetic mode requires no network at all.
  • All processing is done locally; no user data is ever uploaded.

License / License

MIT



name: geoskill-ai-time-series-forecast description: 'LSTM 时序预测网络(torch+CUDA,默认) + 经典线性/多项式/AR(p) 解释基线:多步外推 + 留出 MAE/RMSE 验证 + 逐像元栅格输出'

AI时序预测 | AI Time Series Forecast

对遥感时序(逐像元 NDVI/温度/后向散射)做单层 LSTM 多步外推,并在留出时段上验证(MAE/RMSE),输出未来各步预测栅格与逐像元验证 RMSE 图。

核心模型:单层 LSTM(many-to-one + 递归外推),默认在 torch + CUDA 上训练/推理;随 skill 附带预训练权重 ts_lstm_weights.pt(缺失时在首次运行时在 GPU 上自动训练并落盘)。同时保留三套可解释经典基线(--method linear|poly|ar)用于对比与无 GPU 环境。每一类模型的拟合精度、AR 系数恢复、留出 MAE/RMSE 均有手算基准的单元测试。

依赖

pip install numpy rasterio scipy torch --index-url https://download.pytorch.org/whl/cu121

如要跑经典基线方法(--method linear|poly|ar)无需 torch。

使用方法

示例 1(合成数据,离线)

python geoskill-ai-time-series-forecast.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out

示例 2:合成时序预测(离线)

python geoskill-ai-time-series-forecast.py --bbox 116.0 39.0 117.0 40.0 --synthetic --method linear --horizon 4 --output-dir ./out

示例 3:多项式趋势外推

python geoskill-ai-time-series-forecast.py --bbox 116.0 39.0 117.0 40.0 --synthetic --method poly --degree 2 --horizon 6 --output-dir ./out

示例 4:自回归模型

python geoskill-ai-time-series-forecast.py --input series.tif --method ar --order 3 --horizon 3 --output-dir ./out

输出

文件格式说明
forecast.tifGeoTIFF未来 horizon 步预测(每步一个波段)
validation_rmse.tifGeoTIFF逐像元留出验证 RMSE
forecast_report.jsonJSON全局/中心像元预测与误差指标
output-manifest.jsonJSON运行清单(输入/输出/QA/退出码)

数据源 / Source

本地多波段 GeoTIFF(波段 = 时间步),或 --synthetic(趋势 + 年周期 + 噪声的 NDVI 式立方体)。

隐私声明 / Privacy

  • 默认离线运行,--synthetic 模式完全无网络。
  • 所有处理在本地完成,不上传任何用户数据。

License

MIT

相关技能

对温度/降水时序执行 Mann-Kendall 趋势检验与 Sen 斜率(Sen slope)估计,输出趋势斜率栅格、显著性(p 值)栅格与时序统计 JSON。Mann-Kendall trend test and Sen slope estimator for temperature/precipitation time series, outputting slope raster, significance (p-value) raster, and time-series JSON.

基于 SRCNN(Dong 2014)卷积神经网络的 2x/3x/4x 影像超分辨率,在 CUDA GPU 上训练与推理,输出高分辨率栅格与 PSNR/SSIM 评估

1 次安装

基于百分位阈值检测热浪、寒潮与暴雨等极端天气事件,统计强度、持续时间与空间范围,输出事件清单 JSON 与空间分布栅格。Percentile-threshold detection of heatwaves, cold spells, and heavy rainfall, reporting intensity, duration, and spatial extent with an event-list JSON and spatial raster.

计算温度距平(当期温度减多年同期气候态)与标准化距平,划分暖/冷异常等级,输出距平栅格、异常等级 GeoTIFF 与时序 JSON。Temperature anomaly mapping: current minus multi-year climatology, standardized anomalies, and warm/cold anomaly classes, outputting anomaly rasters, a class GeoTIFF, and a time-series JSON.

1 次安装