Initial commit
This commit is contained in:
12
.claude-plugin/plugin.json
Normal file
12
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "Hydrology",
|
||||
"description": "水文学研究SKILLs",
|
||||
"version": "0.0.0-2025.11.28",
|
||||
"author": {
|
||||
"name": "Dongdong Kong",
|
||||
"email": "kongdd.sysu@gmail.com"
|
||||
},
|
||||
"skills": [
|
||||
"./skills/hydro-forecast"
|
||||
]
|
||||
}
|
||||
48
plugin.lock.json
Normal file
48
plugin.lock.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:kongdd/Skills_for_Your_AI_Student:hydrology",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "a9f0b3f9657e68543b463ba8b22395ac0a791141",
|
||||
"treeHash": "0eeb6497b4536ed66cd3fd541632163de017b2ae4b73bcf738bcef3791ddb332",
|
||||
"generatedAt": "2025-11-28T10:19:55.420120Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "Hydrology",
|
||||
"description": "水文学研究SKILLs"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "4b3f6fb3334be58ff87e354f79cd3d24c89ce33c2b3d970cba15eadb743423fa"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "350d3093230a5710bf22a6e34be823758a740d18e765e86ab50a2148a6b23284"
|
||||
},
|
||||
{
|
||||
"path": "skills/hydro-forecast/examples.jl",
|
||||
"sha256": "2962c429ca92208da63123ab7234245e19b7710d58fca256f364a741b19fac05"
|
||||
},
|
||||
{
|
||||
"path": "skills/hydro-forecast/SKILL.md",
|
||||
"sha256": "8d38eb768b6bb886729500af7c9e92a951f7edd26186bd91dc62b7c9e3396506"
|
||||
}
|
||||
],
|
||||
"dirSha256": "0eeb6497b4536ed66cd3fd541632163de017b2ae4b73bcf738bcef3791ddb332"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
125
skills/hydro-forecast/SKILL.md
Normal file
125
skills/hydro-forecast/SKILL.md
Normal file
@@ -0,0 +1,125 @@
|
||||
---
|
||||
name: hydro-forecast
|
||||
description:
|
||||
---
|
||||
|
||||
# 1 运行环境说明
|
||||
|
||||
- 在Julia中运行
|
||||
|
||||
- 在julia中首先加载包,`using HydroTools`
|
||||
|
||||
- 若没有包加载出错,则安装之,`using Pkg; Pkg.add("HydroTools")`
|
||||
|
||||
|
||||
## 说明
|
||||
|
||||
先不要立即执行该skills,提醒用户输入的数据的格式。用户需要整理好的数据路径即可。
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
`model`模型选择
|
||||
|
||||
+ MarrMot
|
||||
+ XAJ
|
||||
+ TCN
|
||||
+ LSTM
|
||||
+ KAN
|
||||
|
||||
如果复杂、参数比较多的模型:要求用户输入模型参数`json`文件。
|
||||
按照如下示例
|
||||
|
||||
```json
|
||||
{
|
||||
"clumping_index": 0.62,
|
||||
"LAI_max_o": 4.5,
|
||||
"LAI_max_u": 2.4,
|
||||
"z00": 1.33,
|
||||
"mass_overstory": 35,
|
||||
"mass_understory": 10,
|
||||
"root_depth": 0.6,
|
||||
"α_canopy_vis": 0.035,
|
||||
"α_canopy_nir": 0.23,
|
||||
"r_root_decay": 0.95,
|
||||
"minimum_stomatal_resistance": 150,
|
||||
"z_canopy_o": 20,
|
||||
"z_canopy_u": 3,
|
||||
"g1_w": 8,
|
||||
"VCmax25": 62.5,
|
||||
"leaf_resp_co": 0.0015,
|
||||
"stem_resp_co": 0.0020,
|
||||
"root_resp_co": 0.0020,
|
||||
"fine_root_resp_co": 0.003,
|
||||
"N_leaf": 4.45,
|
||||
"slope_Vc": 0.33152
|
||||
}
|
||||
```
|
||||
|
||||
## 1.1 任务说明
|
||||
|
||||
### 1.1.1 `framework`:
|
||||
|
||||
```julia
|
||||
|
||||
function hydro_forecast(f; model, outdir)
|
||||
res = ...
|
||||
|
||||
fwrite(res.output, ...)
|
||||
fwrite(res.gof, ...)
|
||||
fwrite(res.info_flood, ...)
|
||||
fwrite(res.dat_flood, ...)
|
||||
fwrite(res.evaluation, ...)
|
||||
end
|
||||
|
||||
function hydro_forecast(X::AbstractArray, Y::AbstractArray; model::Function, outdir = "OUTPUT")
|
||||
mkpath(outdir)
|
||||
res; # return a NamedTuple
|
||||
end
|
||||
```
|
||||
|
||||
**输入**:X, Y, model
|
||||
|
||||
**输出**:Qsim, GOF, Pass_rate
|
||||
|
||||
+ `output`: 三类数据集的输出,A DataFrame with columns of `date`, `Qsim`,
|
||||
+ `gof`: 三类数据的拟合优度
|
||||
+ `info_flood`: 洪水场次信息,`id`, `time_beg`, `time_end`, `duration`, `Q_peak`, `Q_min`
|
||||
+ `dat_flood`:洪水场次的驱动数据,
|
||||
+ `evaluation`: 每个洪水场次上的模拟优度, csv
|
||||
|
||||
**绘图**:
|
||||
|
||||
+ 交给他绘图的函数,数据
|
||||
|
||||
**总结**:
|
||||
|
||||
+ `evaluation`总结模型预报精度 (`AI执行`)
|
||||
|
||||
|
||||
**内部模块设计**:
|
||||
|
||||
+ `flood_division`: 采用R语言,划分洪水场次
|
||||
|
||||
+ `划分数据集`:train, test, valid
|
||||
|
||||
+ `loss`: 根据拟合优度指标去设计loss,例如KGE, NSE, RMSE,注意loss越小越优。根据loss去优选模型参数。
|
||||
|
||||
+ `evaluation`: 在三种数据集,train, test, valid。每个洪水场次的洪峰、峰现时间合格率。
|
||||
|
||||
|
||||
### 1.1.2 `model`:水文模型、LSTM、TCN、KAN
|
||||
|
||||
```julia
|
||||
Ysim = Model(X, Y; params, state) # Lux的设计哲学
|
||||
```
|
||||
|
||||
### 1.1.3 文件保存
|
||||
|
||||
文件保存采用Julia包`DataFrames`,`RTableTools`
|
||||
|
||||
```julia
|
||||
using RTableTools
|
||||
fwrite(df, "out.csv") # df is a DataFrame
|
||||
```
|
||||
22
skills/hydro-forecast/examples.jl
Normal file
22
skills/hydro-forecast/examples.jl
Normal file
@@ -0,0 +1,22 @@
|
||||
using HydroTools
|
||||
using Dates
|
||||
|
||||
lat = 20.0
|
||||
doy = 120
|
||||
|
||||
ws = HourAngleSunSet(lat, doy)
|
||||
# doy
|
||||
cal_Rsi_toa(lat, doy)
|
||||
|
||||
# date
|
||||
date = Date(2010, 6, 12)
|
||||
doy = dayofyear(date)
|
||||
cal_Rsi_toa(lat, doy)
|
||||
|
||||
# datetime
|
||||
time = DateTime(2010, 6, 12)
|
||||
doy = dayofyear(date)
|
||||
Rsi = cal_Rsi_toa(lat, doy) # [MJ d-1 m-2]
|
||||
|
||||
|
||||
MJ2W(Rsi) # [MJ d-1 m-2] to [W m-2]
|
||||
Reference in New Issue
Block a user