没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
8页
1、处理国家气候中心160站的降水、气温资料,要求把下载的文件放在“e:\160\”中。 2、文件命名方式降水“r”开头,气温“t”开头,如1月降水资料为r1601.txt,11月气温资料为t16011.txt。 3、要求资料要完整,缺测需手动补全数据,处理完后为文本格式,可直接导入excel或access使用。 4、本人初学c#,使用的方法比较繁琐且简单,欢迎探讨。 作者QQ:723501863
资源推荐
资源详情
资源评论
*********************************************************************************
说明
1、处理国家气候中心160站的降水、气温资料,要求把下载的文件放在“e:\160\”中。
2、文件命名方式降水“r”开头,气温“t”开头,如1月降水资料为r1601.txt,11月气温资料为t16011.txt。
3、要求资料要完整,处理完后为文本格式,可直接导入excel或access使用。
4、本人初学c#,使用的方法比较繁杂且简单,欢迎探讨。
作者QQ:723501863
*********************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace _160
{
class Program
{
static void Main(string[] args)
{
string path = @"e:\160\temdata.txt";
string path1 = @"e:\160\t1601.txt";
string path2 = @"e:\160\t1602.txt";
string path3 = @"e:\160\t1603.txt";
string path4 = @"e:\160\t1604.txt";
string path5 = @"e:\160\t1605.txt";
string path6 = @"e:\160\t1606.txt";
string path7 = @"e:\160\t1607.txt";
说明
1、处理国家气候中心160站的降水、气温资料,要求把下载的文件放在“e:\160\”中。
2、文件命名方式降水“r”开头,气温“t”开头,如1月降水资料为r1601.txt,11月气温资料为t16011.txt。
3、要求资料要完整,处理完后为文本格式,可直接导入excel或access使用。
4、本人初学c#,使用的方法比较繁杂且简单,欢迎探讨。
作者QQ:723501863
*********************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace _160
{
class Program
{
static void Main(string[] args)
{
string path = @"e:\160\temdata.txt";
string path1 = @"e:\160\t1601.txt";
string path2 = @"e:\160\t1602.txt";
string path3 = @"e:\160\t1603.txt";
string path4 = @"e:\160\t1604.txt";
string path5 = @"e:\160\t1605.txt";
string path6 = @"e:\160\t1606.txt";
string path7 = @"e:\160\t1607.txt";
string path8 = @"e:\160\t1608.txt";
string path9 = @"e:\160\t1609.txt";
string path10 = @"e:\160\t16010.txt";
string path11 = @"e:\160\t16011.txt";
string path12 = @"e:\160\t16012.txt";//open data.txt//
StreamWriter sw = File.CreateText(path);
sw.WriteLine("ID 序号 年代 1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月");//新建文档,写入行标题//
int n = 160, m = 63, id = 1, station = 1, year = 1951;//n-站点数,m―年数//
int a=0, i, j;//定义变量//
StreamReader sr1 = File.OpenText(path1);
string str1 = sr1.ReadToEnd();
string str1n = str1.Replace("\r\n", "");
string[,] data1 = new string[63, 160];
for (i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
{
data1[i, j] = str1n.Substring(a, 5);
a = a + 5;
}
}
sr1.Close();//提取1月数据//
a = 0;
StreamReader sr2 = File.OpenText(path2);
string str2 = sr2.ReadToEnd();
string str2n = str2.Replace("\r\n", "");
string path9 = @"e:\160\t1609.txt";
string path10 = @"e:\160\t16010.txt";
string path11 = @"e:\160\t16011.txt";
string path12 = @"e:\160\t16012.txt";//open data.txt//
StreamWriter sw = File.CreateText(path);
sw.WriteLine("ID 序号 年代 1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月");//新建文档,写入行标题//
int n = 160, m = 63, id = 1, station = 1, year = 1951;//n-站点数,m―年数//
int a=0, i, j;//定义变量//
StreamReader sr1 = File.OpenText(path1);
string str1 = sr1.ReadToEnd();
string str1n = str1.Replace("\r\n", "");
string[,] data1 = new string[63, 160];
for (i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
{
data1[i, j] = str1n.Substring(a, 5);
a = a + 5;
}
}
sr1.Close();//提取1月数据//
a = 0;
StreamReader sr2 = File.OpenText(path2);
string str2 = sr2.ReadToEnd();
string str2n = str2.Replace("\r\n", "");
剩余7页未读,继续阅读
资源评论
- luoluoa2017-05-09太遗憾了,不能用了
- 夜以2014-10-27气象局天气接口已经更改,不能使用
- ask9192017-04-08可以用啊,先在http://ncc.cma.gov.cn/Website/index.php?ChannelID=43&WCHID=5上把每个月下载下来,放在指定目录就可以了
- 独钓寒江n2014-03-28下载试用了,证实这个源码不能使用,原因不在于源码有错误,而在于气象局天气接口已经更改了。
yangmanli2014
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功