Coding

geoskill-frost-risk-mapping

Try it

霜冻风险制图:由日最低温时序与 DEM 做高程递减率、冷空气湖(TPI 洼地)与坡向地形修正,逐像元统计霜冻频率/霜冻日数、初霜日、终霜日与无霜期,并分级霜冻风险。Frost risk mapping: terrain-corrected min-temperature (lapse rate, cold-air pooling via TPI, aspect) with frost frequency, first/last frost date, frost-free period and risk classification. 输出霜冻风险/无霜期/频率 GeoTIFF + 统计 JSON。

What it does

霜冻风险制图:由日最低温时序与 DEM 做高程递减率、冷空气湖(TPI 洼地)与坡向地形修正,逐像元统计霜冻频率/霜冻日数、初霜日、终霜日与无霜期,并分级霜冻风险。Frost risk mapping: terrain-corrected min-temperature (lapse rate, cold-air pooling via TPI, aspect) with frost frequency, first/last frost date, frost-free period and risk classification. 输出霜冻风险/无霜期/频率 GeoTIFF + 统计 JSON。

The skill document

霜冻风险制图 | Frost Risk Mapping

Performs terrain correction and frost risk analysis on daily minimum temperature time-series rasters, for agricultural frost disaster warning, cropping system zoning, and ecological cold damage assessment. Core algorithm:

  • Terrain correction (apply_terrain_correction): corrects the minimum temperature from a reference surface to the actual per-pixel terrain — · Lapse rate (default 6.5 °C/km): T(z) = T_ref − Γ·(z − z_ref), higher elevation means colder; · Cold-air pooling: uses the Topographic Position Index TPI (pixel elevation − neighborhood mean) to identify depressions, where pooling of descending cold air causes additional cooling (capped at −6 °C), forming "frost hollows"; · Aspect effect: slope/aspect are derived from the DEM; in the northern hemisphere, south-facing slopes warm and north-facing slopes cool, with the effect strengthening as slope increases.
  • Frost statistics: per-pixel statistics of frost frequency (fraction of days with Tmin ≤ threshold), number of frost days, first frost date, last frost date, and frost-free period (longest consecutive run of days with Tmin > threshold).
  • Risk classification: frost frequency is classified into five levels — 0 none / 1 low / 2 moderate / 3 high / 4 severe.

--synthetic mode generates a DEM containing a ridge and a central depression (frost hollow), plus an elevation-influenced daily minimum temperature time series (flat reference surface + terrain correction), so the physical relationships — "temperature decreases with elevation", "high frost risk at high elevations / in depressions" — can be validated offline without network access or real data.

Dependencies / 依赖

pip install 'numpy' 'rasterio' 'scipy'

Usage / 使用方法

Basic usage (bbox only; auto-synthesized)

python geoskill-frost-risk-mapping.py --bbox 116.0 39.0 117.0 40.0 --output-dir ./out

Example 1: offline evaluation with synthetic data

python geoskill-frost-risk-mapping.py --bbox 116.0 39.0 117.0 40.0 --synthetic --n-dates 40 --output-dir ./out

Example 2: custom frost threshold (e.g. −2 °C light frost)

python geoskill-frost-risk-mapping.py --bbox 116.0 39.0 117.0 40.0 --synthetic --threshold -2 --output-dir ./light_frost

Example 3: real minimum-temperature time series + DEM

python geoskill-frost-risk-mapping.py --input tmin_ts.tif --dem dem.tif --threshold 0 --output-dir ./real

Example 4: no terrain correction (use raw temperatures directly)

python geoskill-frost-risk-mapping.py --input tmin_ts.tif --correction none --output-dir ./raw

Example 5: a different area

python geoskill-frost-risk-mapping.py --bbox 121.0 31.0 122.0 32.0 --synthetic --output-dir ./shanghai --quiet

Output / 输出

FileFormatDescription
frost_risk.tifGeoTIFF (float32)Frost risk level 0-4, EPSG:4326
frost_free_period.tifGeoTIFF (float32)Frost-free period (longest consecutive frost-free run, days)
frost_frequency.tifGeoTIFF (float32)Frost frequency (0-1)
frost_stats.jsonJSONThreshold/DEM range/mean frost statistics/risk distribution
output-manifest.jsonJSONRun manifest (inputs/outputs/QA/software versions)

Data Source / 数据源 / Source

  • Input: local multi-band daily minimum temperature time-series GeoTIFF (one day per band) + optional DEM GeoTIFF (meters); when the DEM is omitted, synthetic terrain is used
  • Synthetic mode: locally generated ridge+depression DEM and elevation-influenced minimum temperature field; no external data source
  • Methods: lapse rate, TPI-based cold-air pooling, and aspect-driven radiation are all classic microclimatological methods

Privacy / 隐私声明 / Privacy

  • Fully offline by default; no network requests are made
  • --synthetic mode reads no external data
  • All computation is performed locally; user data is never uploaded

License / License

MIT



name: geoskill-frost-risk-mapping description: '霜冻风险制图:由日最低温时序与 DEM 做高程递减率、冷空气湖(TPI 洼地)与坡向地形修正,逐像元统计霜冻频率/霜冻日数、初霜日、终霜日与无霜期,并分级霜冻风险。Frost risk mapping: terrain-corrected min-temperature (lapse rate, cold-air pooling via TPI, aspect) with frost frequency, first/last frost date, frost-free period and risk classification. 输出霜冻风险/无霜期/频率 GeoTIFF + 统计 JSON。'

霜冻风险制图 | Frost Risk Mapping

对日最低温时序栅格执行地形修正与霜冻风险分析,用于农业霜冻灾害预警、种植 制度区划与生态冷害评估。核心算法:

  • 地形修正apply_terrain_correction):把参考面上的最低温修正到逐像元 实际地形—— · 高程递减率(lapse rate,默认 6.5°C/km):T(z) = T_ref − Γ·(z − z_ref), 高程越高越冷; · 冷空气湖(cold-air pooling):用地形位置指数 TPI(像元高程 − 邻域均值) 识别洼地,洼地积聚下泄冷空气而额外降温(封顶 −6°C),形成"霜穴"; · 坡向效应(aspect):由 DEM 解算坡度/坡向,北半球南坡增温、北坡降温, 随坡度增大而增强。
  • 霜冻统计:逐像元统计霜冻频率(Tmin ≤ 阈值天数占比)、霜冻日数、初霜日、 终霜日与无霜期(最长连续 Tmin > 阈值天数)。
  • 风险分级:由霜冻频率分为 0 无 / 1 低 / 2 中 / 3 高 / 4 严重 五级。

支持 --synthetic 模式生成含山脊与中央洼地(霜穴)的 DEM,以及受高程影响的 日最低温时序(平坦参考面 + 地形修正),无需网络和真实数据即可离线验证 "温度随高程递减""高海拔/洼地霜冻风险高"等物理关系。

依赖

pip install 'numpy' 'rasterio' 'scipy'

使用方法

基本用法(仅给 bbox,自动合成)

python geoskill-frost-risk-mapping.py --bbox 116.0 39.0 117.0 40.0 --output-dir ./out

示例 1:合成数据离线评估

python geoskill-frost-risk-mapping.py --bbox 116.0 39.0 117.0 40.0 --synthetic --n-dates 40 --output-dir ./out

示例 2:自定义霜冻阈值(如 -2°C 轻霜)

python geoskill-frost-risk-mapping.py --bbox 116.0 39.0 117.0 40.0 --synthetic --threshold -2 --output-dir ./light_frost

示例 3:真实最低温时序 + DEM

python geoskill-frost-risk-mapping.py --input tmin_ts.tif --dem dem.tif --threshold 0 --output-dir ./real

示例 4:不做地形修正(直接用原始温度)

python geoskill-frost-risk-mapping.py --input tmin_ts.tif --correction none --output-dir ./raw

示例 5:不同区域

python geoskill-frost-risk-mapping.py --bbox 121.0 31.0 122.0 32.0 --synthetic --output-dir ./shanghai --quiet

输出

文件格式说明
frost_risk.tifGeoTIFF (float32)霜冻风险等级 0-4,EPSG:4326
frost_free_period.tifGeoTIFF (float32)无霜期(最长连续无霜天数)
frost_frequency.tifGeoTIFF (float32)霜冻频率(0-1)
frost_stats.jsonJSON阈值/DEM 范围/平均霜冻统计/风险分布
output-manifest.jsonJSON运行清单(输入/输出/QA/软件版本)

数据源 / Source

  • 输入:本地多波段日最低温时序 GeoTIFF(每波段一日)+ 可选 DEM GeoTIFF(米); 缺省 DEM 时用合成地形
  • 合成模式:本地生成山脊+洼地 DEM 与受高程影响的最低温场,无外部数据源
  • 方法:气温直减率、TPI 冷池与坡向辐射均为经典微气候学方法

隐私声明 / Privacy

  • 默认完全离线运行,不发起任何网络请求
  • --synthetic 模式不读取任何外部数据
  • 所有计算在本地完成,不上传用户数据

License

MIT

Related skills

计算温度距平(当期温度减多年同期气候态)与标准化距平,划分暖/冷异常等级,输出距平栅格、异常等级 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 installs

热浪影响评估:逐像元 P90 分位数阈值 + 连续≥3天连通域热浪检测,Stull/简化湿球温度健康风险分级,人口暴露与脆弱性制图。Heatwave impact assessment: per-pixel P90 threshold with connected-run detection, wet-bulb temperature health risk, population exposure and vulnerability mapping. 输出热浪日数/暴露人口/脆弱性/湿球风险 GeoTIFF + 事件清单 JSON。

度日因子法(DDF)融雪径流模拟,逐日累积融雪生成径流过程线与积雪面积曲线。Degree-day-factor snowmelt runoff modeling producing daily hydrograph and snow-cover depletion curve. 输出径流时序/积雪曲线 JSON + 径流深栅格。

1 installs

对温度/降水时序执行 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.

基于月均温与月降水栅格的气候区划,支持柯本-盖格(Köppen-Geiger)规则树与简化 Strahler 发生分类,输出气候类别码 GeoTIFF + 面积统计 JSON,可选双期变化检测。Climate zone classification from monthly temperature/precipitation rasters (Köppen-Geiger rule tree & simplified Strahler), with area statistics and optional change detection.

基于百分位阈值检测热浪、寒潮与暴雨等极端天气事件,统计强度、持续时间与空间范围,输出事件清单 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.