- 积分
- 11679
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-6-23
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2017-5-6 13:18:05
|
显示全部楼层
代码如下:
MeteoDataInfo aDataInfo = new MeteoDataInfo();
string dir = @"E:\MeteoInfo\MeteoInfoDemo\MyTry\dataSurfer\";
string file = dir + @"\fnl_20140820_00_00_c";
aDataInfo.OpenGRIBData(file);
List<Data> list;
string datasFile;
int levels = 26;
int[] levelsFlag = new int[26] {1000,975,950,925,900,850,800,750,700,650,600,550,500,450,400,350,300,250,200,150,100,70, 50,30,20,10};
for (int level = 0; level < levels; level++)
{
aDataInfo.LevelIndex = level;
GridData u = aDataInfo.GetGridData("ugrd@isobaric"); // u
GridData v = aDataInfo.GetGridData("vgrd@isobaric"); // v
GridData h = aDataInfo.GetGridData("hgt@isobaric"); // hight
double[,] us = u.Data;
double[,] vs = v.Data;
double[,] hs = h.Data;
list = new List<Data>();
Data aData;
datasFile = dir + "20140820_" + levelsFlag[level] + "hPa.xls";
for (int i = 0; i < 181; i++)
{
for (int j = 0; j < 360; j++)
{
// 想取25-35 115-125的数据,因为观其i的区间为0-180 ,所以在25和35的基础上加了一个90
if (i >= 115 && i <= 125 && j >= 115 && j <= 125)
{
aData = new Data();
aData.lon = j;
aData.lat = i - 90;
aData.hight = hs[i, j];
aData.u = us[i, j];
aData.v = vs[i, j];
list.Add(aData);
}
}
}
ToExcel(list, datasFile);
} |
|