4 Star 25 Fork 10

Yonghe / GeoFlying

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ModelRunPara.cs 5.85 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
{
//系统运行参数类
public class ModelRunPara
{
public ModelRunPara()
{
}
public void ResetContent()//结构初始化
{
PETMethod = 0;
AETMethod = 0;
InterpMethod = 0;
AIMethod = 0;
DLAICalcMethod = 0;
}
/// <summary>
/// 读入系统运行参数
/// </summary>
/// <param name="FileName"></param>
/// <returns></returns>
public void ReadPara(string FileName)
{
if (!File.Exists(FileName))
{
MessageBox.Show(FileName + "文件不存在");
return;
}
StreamReader sr = new StreamReader(FileName);
sr.ReadLine();
sr.ReadLine();
string[] saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.PETMethod = (PET_METHOD)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.AETMethod = (AET_METHOD)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.InterpMethod = (SpatialInterMethod)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.AIMethod = (AridIndexMethod)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.DLAICalcMethod = (DailyLAICalMethod)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.RunoffSimuType = (RunOffSimuType)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.SurfRouteMethod = (SurfRouteMehtod)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.LatRouteMethod = (SurfRouteMehtod)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.BaseRouteMethod = (SurfRouteMehtod)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.RiverRouteMethod = (RiverRouteMethod)Convert.ToInt32(saOut[1]);
saOut = sr.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
this.InfilCurveType = (InfilltrationType)Convert.ToInt32(saOut[1]);
}
/// <summary>
/// 输出系统运行参数
/// </summary>
/// <param name="FileName"></param>
public void WritePara(string FileName)
{
StreamWriter sw = new StreamWriter(FileName);
sw.WriteLine(" DCBAM Model Running Parameters: " + DateTime.Now.Date.ToString() + "\t" + DateTime.Now.TimeOfDay.ToString());
sw.WriteLine();
sw.WriteLine("潜在蒸散量计算方法\t" + (int)HydroSimulate.g_ModelRunPara.PETMethod);
sw.WriteLine("实际蒸散量计算方法\t" + (int)HydroSimulate.g_ModelRunPara.AETMethod);
sw.WriteLine("空间插值方法\t" + (int)HydroSimulate.g_ModelRunPara.InterpMethod);
sw.WriteLine("干旱指数计算方法\t"+(int)HydroSimulate.g_ModelRunPara.AIMethod);
sw.WriteLine("逐日LAI计算方法\t"+(int)HydroSimulate.g_ModelRunPara.DLAICalcMethod);
sw.WriteLine("降雨径流过程计算类型\t"+ (int)HydroSimulate.g_ModelRunPara.RunoffSimuType);
sw.WriteLine("地表径流汇流演算方法\t"+ (int)HydroSimulate.g_ModelRunPara.SurfRouteMethod);
sw.WriteLine("壤中径流汇流演算方法\t"+ (int)HydroSimulate.g_ModelRunPara.LatRouteMethod);
sw.WriteLine("地下径流汇流演算方法\t"+ (int)HydroSimulate.g_ModelRunPara.BaseRouteMethod);
sw.WriteLine("河道汇流演算方法\t"+ (int)HydroSimulate.g_ModelRunPara.RiverRouteMethod);
sw.WriteLine("下渗曲线类型\t"+ (int)HydroSimulate.g_ModelRunPara.InfilCurveType);
sw.Close();
}
/// <summary>
/// 潜在蒸散发计算方法
/// </summary>
public PET_METHOD PETMethod; //蒸散发计算方法
/// <summary>
/// 空间插值方法
/// </summary>
public SpatialInterMethod InterpMethod; //空间插值方法
/// <summary>
/// 实际蒸散发计算方法
/// </summary>
public AET_METHOD AETMethod; //实际蒸散发计算方法
/// <summary>
/// 干旱指数计算方法
/// </summary>
public AridIndexMethod AIMethod; //干旱指数计算方法
/// <summary>
/// 逐日LAI计算方法
/// </summary>
public DailyLAICalMethod DLAICalcMethod; //逐日LAI计算方法
/// <summary>
/// 降雨径流过程类型
/// </summary>
public RunOffSimuType RunoffSimuType; //降雨径流过程类型
/// <summary>
/// 坡面汇流方法
/// </summary>
public SurfRouteMehtod SurfRouteMethod; //坡面汇流方法
/// <summary>
/// 壤中流汇流方法
/// </summary>
public SurfRouteMehtod LatRouteMethod; //壤中流汇流方法
/// <summary>
/// 地下径流汇流方法
/// </summary>
public SurfRouteMehtod BaseRouteMethod; //地下径流汇流方法
/// <summary>
/// 河道汇流方法
/// </summary>
public RiverRouteMethod RiverRouteMethod; //河道汇流方法
/// <summary>
/// 下渗曲线类型
/// </summary>
public InfilltrationType InfilCurveType; //下渗曲线类型
};
}
C#
1
https://gitee.com/sucksis/geo-flying.git
git@gitee.com:sucksis/geo-flying.git
sucksis
geo-flying
GeoFlying
master

搜索帮助