4 Star 27 Fork 10

Yonghe/GeoFlying

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ModelInputPara.cs 11.58 KB
一键复制 编辑 原始数据 按行查看 历史
Yonghe 提交于 2020-10-02 09:33 . first
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace GeoFly
{
/// <summary>
/// 系统外部率定参数类
/// </summary>
public class ModelInputPara
{
void ResetContent()
{
GSKv = GLKv = GBKv = GRKv = 0;
LowWaterSurfQLoss = HighWaterSurfQLoss = MidWaterSurfQLoss = 100;
LatQLoss = BaseQLoss = RiverQLoss = 100;
RiverProType = RiverType .M_RIVER_SECTION_RECTANGLE;
RiverProWidth = 20;
HillProType = RiverType.M_RIVER_SECTION_HILLSIDE;
HillProWidth = 120;
SurfQLinearFactor = 1;
SurfQOutFactor = 0.9;
LatQOutFactor = 0.5;
DailyMeanPcpTime = 4;
SnowTemperature = 0.5;
DDF = 0.5;
DeepBaseQ = 0;
}
public bool ReadPara(string FileName, ModelInputPara g_ModelInputPara1)
{
ResetContent();
if (!File.Exists(FileName))
return false;
StreamReader sr = new StreamReader(FileName);
sr.ReadLine();
sr.ReadLine();
string[] value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.GSKv = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.GLKv = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.GBKv = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.GRKv = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.LowWaterSurfQLoss = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.MidWaterSurfQLoss = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.HighWaterSurfQLoss = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.LatQLoss = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.BaseQLoss = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.RiverQLoss = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.RiverProType =(RiverType) Convert.ToInt32(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.RiverProWidth = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.HillProType =(RiverType) Convert.ToInt32(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.HillProWidth = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.SMCTimeWeight = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.SMCGridRTravelTime = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.LMCTimeWeight = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.LMCGridRTravelTime = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.BMCTimeWeight = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.BMCGridRTravelTime = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.SurfQLinearFactor = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.SurfQOutFactor = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.LatQOutFactor = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.DailyMeanPcpTime = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.SnowTemperature = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.DDF = Convert.ToDouble(value[1]);
value = sr.ReadLine().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
this.DeepBaseQ = Convert.ToDouble(value[1]);
return true;
}
public void WritePara(string FileName)
{
StreamWriter sw = new StreamWriter(FileName);
string str= " DCBAM Model Input Parameters: " +DateTime.Now.ToString();
sw.WriteLine(str);
sw.WriteLine();
str="地表径流滞时演算速度系数\t"+this.GSKv.ToString();
sw.WriteLine(str);
str="壤中径流滞时演算速度系数\t"+this.GLKv.ToString();
sw.WriteLine(str);
str="地下径流滞时演算速度系数\t"+this.GBKv.ToString();
sw.WriteLine(str);
str="河道径流滞时演算速度系数\t"+this.GRKv.ToString();
sw.WriteLine(str);
str="枯水期地表径流损失系数\t"+this.LowWaterSurfQLoss.ToString();
sw.WriteLine(str);
str="平水期地表径流损失系数\t"+this.MidWaterSurfQLoss.ToString();
sw.WriteLine(str);
str="丰水期地表径流损失系数\t"+ this.HighWaterSurfQLoss.ToString();
sw.WriteLine(str);
str="壤中径流传输损失系数\t"+ this.LatQLoss.ToString();
sw.WriteLine(str);
str="地下径流传输损失系数\t"+ this.BaseQLoss.ToString();
sw.WriteLine(str);
str="河道径流传输损失系数\t"+ this.RiverQLoss.ToString();
sw.WriteLine(str);
str="栅格河道断面类型\t"+ (int)this.RiverProType;
sw.WriteLine(str);
str="栅格河道断面宽度\t"+ this.RiverProWidth.ToString();
sw.WriteLine(str);
str="坡面河道断面类型\t"+ (int)this.HillProType;
sw.WriteLine(str);
str="坡面河道断面宽度\t"+ this.HillProWidth.ToString();
sw.WriteLine(str);
str="地表汇流时间差分权重\t"+ this.SMCTimeWeight.ToString();
sw.WriteLine(str);
str="地表汇流传播时间\t"+ this.SMCGridRTravelTime.ToString();
sw.WriteLine(str);
str="壤中汇流时间差分权重\t"+ this.LMCTimeWeight.ToString();
sw.WriteLine(str);
str="壤中汇流传播时间\t"+ this.LMCGridRTravelTime.ToString();
sw.WriteLine(str);
str="地下汇流时间差分权重\t"+ this.BMCTimeWeight.ToString();
sw.WriteLine(str);
str="地下汇流传播时间\t"+ this.BMCGridRTravelTime.ToString();
sw.WriteLine(str);
str="地表径流线性调节因子\t"+ this.SurfQLinearFactor.ToString();
sw.WriteLine(str);
str="地表径流出流系数\t"+ this.SurfQOutFactor.ToString();
sw.WriteLine(str);
str="壤中径流出流系数\t"+ this.LatQOutFactor.ToString();
sw.WriteLine(str);
str="日平均降雨时间长度\t"+ this.DailyMeanPcpTime.ToString();
sw.WriteLine(str);
str="降雪临界温度\t"+ this.SnowTemperature.ToString();
sw.WriteLine(str);
str="度-日系数\t"+ this.DDF.ToString();
sw.WriteLine(str);
str="深层地下基流调节量\t"+ this.DeepBaseQ.ToString();
sw.WriteLine(str);
sw.Close();
MessageBox.Show("外部参数保存完毕");
}
/// <summary>
/// 栅格地表径流滞时演算速度系数
/// </summary>
public double GSKv;
/// <summary>
/// 栅格壤中流滞时演算速度系数
/// </summary>
public double GLKv;
/// <summary>
/// 栅格地下径流滞时演算数度系数
/// </summary>
public double GBKv;
/// <summary>
/// 河道栅格滞时演算速度系数
/// </summary>
public double GRKv;
/// <summary>
/// 枯水期地表径流损失系数
/// </summary>
public double LowWaterSurfQLoss;
/// <summary>
/// 丰水期地表径流损失系数
/// </summary>
public double HighWaterSurfQLoss;
/// <summary>
/// 平水期地表径流损失系数
/// </summary>
public double MidWaterSurfQLoss;
/// <summary>
/// 壤中径流传输损失系数
/// </summary>
public double LatQLoss;
/// <summary>
/// 地下径流传输损失系数
/// </summary>
public double BaseQLoss;
/// <summary>
/// 河道径流传输损失系数
/// </summary>
public double RiverQLoss;
/// <summary>
/// 栅格河道断面类型
/// </summary>
public RiverType RiverProType;
/// <summary>
/// 栅格河道断面宽度
/// </summary>
public double RiverProWidth;
/// <summary>
/// 坡面河道断面类型
/// </summary>
public RiverType HillProType;
/// <summary>
/// 坡面河道断面宽度
/// </summary>
public double HillProWidth;
/// <summary>
/// 地表汇流时间差分权重
/// </summary>
public double SMCTimeWeight;
/// <summary>
/// 地表汇流传播时间
/// </summary>
public double SMCGridRTravelTime;
/// <summary>
/// 壤中汇流时间差分权重
/// </summary>
public double LMCTimeWeight;
/// <summary>
/// 壤中汇流传播时间
/// </summary>
public double LMCGridRTravelTime;
/// <summary>
/// 地下汇流时间差分权重
/// </summary>
public double BMCTimeWeight;
/// <summary>
/// 地下汇流传播时间
/// </summary>
public double BMCGridRTravelTime;
/// <summary>
/// 地表径流线性调节因子
/// </summary>
public double SurfQLinearFactor;
/// <summary>
/// 地表径流出流系数
/// </summary>
public double SurfQOutFactor;
/// <summary>
/// 壤中径流出流系数
/// </summary>
public double LatQOutFactor;
/// <summary>
/// 每日平均降水时间
/// </summary>
public double DailyMeanPcpTime;
/// <summary>
/// 降雪临界温度
/// </summary>
public double SnowTemperature;
/// <summary>
/// 度-日系数
/// </summary>
public double DDF;
/// <summary>
/// 深层地下基流调节量
/// </summary>
public double DeepBaseQ;
};
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/sucksis/geo-flying.git
[email protected]:sucksis/geo-flying.git
sucksis
geo-flying
GeoFlying
master

搜索帮助