水灾害课程设计.doc
《水灾害课程设计.doc》由会员分享,可在线阅读,更多相关《水灾害课程设计.doc(10页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、水灾害课程设计任务:1、 分析1961-2009年,站点每年发生干旱总日数、轻旱日数、中旱日数、重旱日数、特旱日数的年均值,要求用柱状图表示各种干旱类型的年均值,在图表中标注,并对图表进行分析说明。2、 分析1961-2009年,站点每年发生干旱总日数、轻旱日数、中旱日数、重旱日数、特旱日数及其逐年变化情况,要求制作表格来表示各种干旱类型发生日数及各种干旱类型的平均强度,用折线图表示每种干旱类型逐年变化情况,做出趋势线并对图表进行分析说明(变化过程、规律、极值)。3、 分析1961-2009年,站点发生干旱过程数量、每个干旱过程持续时间、起止日期及干旱过程强度,要求用表格表示,并分析出干旱过程
2、持续时间及干旱过程强度的最大最小值。二、课程设计具体数据处理步骤1、对2000-2009年的数据CI值*0.1折算为真实值,然后通过VB编程对数据处理,计算结果输出在excel中。具体编程代码如下:Private Sub Command1_Click()Dim i, j As IntegerDim n As IntegerDim gr, qr, zr, zhr, tr As IntegerDim wgrsum, grsum, qrsum, zrsum, zhrsum, trsum, CIsum As Single gr,qr,zr,zhr,tr分别代表各种干旱类型日数Dim gpj, qpj,
3、 zpj, zhpj, tpj As SingleDim CI(1 To 3653) As SingleDim kaishi, tianshu As IntegerOpen I:Users暮光雨泽Desktop本科生课程CI真实值.txt For Input As #1For i = 1 To 3653Input #1, CI(i)Next iClose #1Dim ExlSet Exl = CreateObject(Excel.Application)Set myworkbook = Exl.Workbooks.Open(I:Users暮光雨泽Desktop本科生课程计算结果输出.xlsx)
4、 打开excel文件等待输入数据Exl.Visible = TrueSet xlsheet = myworkbook.Worksheets(sheet1)If Option1.Value = True Then 判断年数,同时闰年非闰年 kaishi = 1: tianshu = 366 ElseIf Option2.Value = True Then kaishi = 367: tianshu = 365 ElseIf Option3.Value = True Then kaishi = 732: tianshu = 365 ElseIf Option4.Value = True Then
5、kaishi = 1097: tianshu = 365 ElseIf Option5.Value = True Then kaishi = 1462: tianshu = 366 ElseIf Option6.Value = True Then kaishi = 1828: tianshu = 365 ElseIf Option7.Value = True Then kaishi = 2193: tianshu = 365 ElseIf Option8.Value = True Then kaishi = 2558: tianshu = 365 ElseIf Option9.Value =
6、True Then kaishi = 2923: tianshu = 366 ElseIf Option10.Value = True Then kaishi = 3288: tianshu = 365End IfFor i = 1 To tianshu CI(i) = CI(kaishi + i - 1) CIsum = CIsum + CI(i)Next in = 0: gr = 0: qr = 0: zr = 0: zhr = 0: tr = 0For i = 1 To tianshu If CI(i) -0.6 Then 判断干旱类型 n = n + 1: wgrsum = wgrsu
7、m + CI(i) gr = tianshu - n: grsum = CIsum - wgrsum ElseIf CI(i) -1.2 Then qr = qr + 1: qrsum = qrsum + CI(i) ElseIf CI(i) -1.8 Then zr = zr + 1: zrsum = zrsum + CI(i) ElseIf CI(i) -2.4 Then zhr = zhr + 1: zhrsum = zhrsum + CI(i) ElseIf CI(i) = -2.4 Then tr = tr + 1: trsum = trsum + CI(i) End IfNext
8、igpj = grsum / grqpj = qrsum / qrzpj = zrsum / zrIf zhrsum = 0 Or zhr = 0 Then zhpj = 0 Else zhpj = zhrsum / zhrEnd IfIf trsum = 0 Or tr = 0 Then tpj = 0 Else tpj = trsum / trEnd If xlsheet.cells(1, 1) = 日期: xlsheet.cells(1, 2) = 干旱总日数: xlsheet.cells(1, 3) = 轻旱日数: xlsheet.cells(1, 4) = 中旱日数 xlsheet.
9、cells(1, 5) = 重旱日数: xlsheet.cells(1, 6) = 特旱日数: xlsheet.cells(1, 7) = 平均干旱强度: xlsheet.cells(1, 8) = 平均轻旱强度 xlsheet.cells(1, 9) = 平均中旱强度: xlsheet.cells(1, 10) = 平均重旱强度: xlsheet.cells(1, 11) = 平均特旱强度If Option1.Value = True Then 输出结果到excel中 xlsheet.cells(2, 1) = 2000: xlsheet.cells(2, 2) = gr: xlsheet.
10、cells(2, 3) = qr: xlsheet.cells(2, 4) = zr: xlsheet.cells(2, 5) = zhr xlsheet.cells(2, 6) = tr: xlsheet.cells(2, 7) = gpj: xlsheet.cells(2, 8) = qpj: xlsheet.cells(2, 9) = zpj: xlsheet.cells(2, 10) = zhpj xlsheet.cells(2, 11) = tpj ElseIf Option2.Value = True Then xlsheet.cells(3, 1) = 2001: xlsheet
11、.cells(3, 2) = gr: xlsheet.cells(3, 3) = qr: xlsheet.cells(3, 4) = zr: xlsheet.cells(3, 5) = zhr xlsheet.cells(3, 6) = tr: xlsheet.cells(3, 7) = gpj: xlsheet.cells(3, 8) = qpj: xlsheet.cells(3, 9) = zpj: xlsheet.cells(3, 10) = zhpj xlsheet.cells(3, 11) = tpj ElseIf Option3.Value = True Then xlsheet.
12、cells(4, 1) = 2002: xlsheet.cells(4, 2) = gr: xlsheet.cells(4, 3) = qr: xlsheet.cells(4, 4) = zr: xlsheet.cells(4, 5) = zhr xlsheet.cells(4, 6) = tr: xlsheet.cells(4, 7) = gpj: xlsheet.cells(4, 8) = qpj: xlsheet.cells(4, 9) = zpj: xlsheet.cells(4, 10) = zhpj xlsheet.cells(4, 11) = tpj ElseIf Option4
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 水灾 课程设计
限制150内