搜档网
当前位置:搜档网 › RClimDex中文用户手册

RClimDex中文用户手册

RClimDex中文用户手册
RClimDex中文用户手册

RClimDex (1.0)

极端气候指数计算软件

用户手册

张学斌 Feng Yang

加拿大环境部气候研究中心

2004年9月10日

南京信息工程大学遥感学院陈昌春译注

2013.8

作者致谢

RClimDex 由Xuebin Zhang(张学斌)and Feng Yang(加拿大气象局气候研究部)开发与维护,最初的开发由加拿大国际发展办事处通过《加中气候协作项目,C5》资助。Lisa Alexander, Francis Zwiers, Byron Gleason, David Stephenson, Albert Klan Tank, Mark New, Lucie Vincent与Tom Peterson对R包的开发与测试作出了重要贡献。CCl/CLIVAR ETCCDMI的有关研讨会也对RClimDex的改进提供了宝贵的意见。.

译者的话

原英文说明中所介绍的下载网址链接已无效,新网址包括

http://www.pcic.uvic.ca/tools-and-data/climdex

https://www.sodocs.net/doc/313474514.html,/software.shtml

RClimdex可计算极端气候指数27项,以下摘录来自一硕士论文《内蒙古地区极端气候事件时空变化及其与NDVI的相关性》(使用RClimdex软件)的15项指数名称翻译及一段简要说明。

1.指数名称、解释、单位

FD0 霜日一年中日最低温<0℃的日数天

SU25 夏日日数日最高气温>25℃的日数天

GSL 作物生长期连续6 日>5℃或<5℃的时间跨度天

TN10p 冷夜日数日最低气温<10%分位值的日数天

TN90p 暖夜日数日最低气温>90%分位值的日数天

TX10p 冷昼日数日最高温<10%分位值的日数天

TX90p 暖昼日数日最高温>90%分位值的日数天

WSDI 热持续指数连续6 日最高温在90%分位值日数天

CSDI 冷持续指数连续6 日最低温在10%分位值日数天

RX5day 5 日最大降水量每月内连续五日的最大降水量 mm

CDD 持续干燥指数日降水量<1mm 的最长连续日数天

CWD 持续湿润指数日降水量≥mm 的最大持续日数天

SDII 普通日降水强度降水量≥1mm 的总量与日数之比 mm

R10 强降水日数每年日降水量>=10mm 的总日数天

R95pTOT 强降水量 95%分位值强降水之和 mm

2.简要说明

在应用RClimDex 处理数据之前,必须确保每个站点的数据以文本格式储存,并且储存的气象数据必须按照年、月、日、24 小时日降水量、日最高气温、日最低气温等顺序排列,各记录项之间通过空格将其隔开。由于研究的气象记录年限跨

度很大,难免有些记录值缺测,因此程序要求所有的缺测值都统一设为-99.9。启

动R 编辑器,读入RClimDex 程序,在桌面窗口的引导下读入某站点气象数据的文本文件,程序将对文件数据进行检验处理,用于提高所用数据的质量。检验处理主要涉及几个方面的错误记录检查:(1)日最低温>日最高温(2)日降水量<0mm(3)记录值严重偏离本地区气象实际情况,即超出3 倍标准差的值定义为出界值,通过人工检查同相邻站点的记录进行比对,合理的保留,不合理的按缺测进行处理。进行完质量控制处理后就可以对数据进行计算处理,得出一系列的excel 格式的文件结果。

目录

1.简介

2.R语言安装

2.1How to install R

2.2How to run R

3.如何使用RClimDex?

3.1RClimDex的加载与使用

3.2数据质量控制

3.3指数计算

4.已知的bugs

5.Bug报告

Appendix A: 气候指数列表

Appendix B: 输入数据格式

Appendix C: 指数定义

Appendix D: Threshold and in-base period temperature indices calculation Appendix E: R for Windows FAQ

1. 介绍

加拿大气象研究中心的Xuebin Zhang(张学斌,华人)与Feng Yang 开发的RClimDex(1.0)是对ClimDex软件(由加拿大国家气候数据中心的Byron Gleason 开发)的R语言改写与改进。RClimDex(1.0)是基于R 编辑器开发的用于计算多种极端气候指数。

ClimDex是以Excel为基础的程序,意在提供容易使用的软件包用于计算监测气候变化的气候极值。它由加拿大国家气候数据中心的Byron Gleason开发,已经用于CCl/CLIVAR workshops on climate indices from 2001.

使用者可以在窗口界面的提示和引导下将研究区域的气象记录值文件进行处理和计算,结果将以excel 文件的形式输出。

ClimDex项目软件开发之初就强调运行环境不依赖于特定的操作系统。因此使用R语言就就非常自然,因为R语言是健壮的、强大的统计分析与绘图软件。它既可运行于Windows 系统,也可运行于Unix系统。2003年发现,在ClimDex及其他程序中,计算百分位基础的温度指数在指数序列组中出现了不一致性,修正工作需要的引导(又称“自展”)工作在EXCEL中难以进行,这使开发ClimDex的R语言包显得更加迫切。

RClimDex (1.0)有着比较友好的操作界面,计算由CCl/CLIVAR推荐及可由用

户定义门槛值的重要极端气候指数27 种,包括16 个极端温度指数和11 个极端降水指数,这27 个极端气候指数都是世界气象组织气候委员会推荐使用的核心极端气候指数,已包括了ClimDex (Version 1.3)中的几乎全部指数。RClimDex (1.0)在R 1.84下进行开发,它应该可以运行于R 1.84及其后的版本。

开发极端气候指数软件的目的之一是用于气候监测研究,这要求各项指数必须均一化(一致化)。数据均一化在本版中已经设想并未实施。当前的RClimDex版只包括一个简单的数据质量控制程序,由ClimDex计划(译者注:ClimDex是一个专门的计划,有专门的网站。当前分别有EXCEL版本、R语言版本、FORTRAN 语言版本的ClimDex软件)提供。对于ClimDex的用户,我们希望,在计算极端指数前已进行数据质量控制。本用户手册提供逐步操作的说明。

2. R语言的安装与运行(译者注:很方便,几乎不需要设置,一路点击即可)

R is a language and environment for statistical computing and graphics. It is a implementation of the S language developed by John Chambers and colleagues Laboratories (formerly AT&T, now Lucent Technologies). S-plus provides a commercial implementation of the S language.

2.1 How to install R

RClimDex需要R包与图形用户界面TclTk。R的安装过程非常简单:1) 登录网站https://www.sodocs.net/doc/313474514.html,, 2) Follow the links to download the most recent version of R for your computer operating system from any mirror site of CRAN.

对于Microsoft Windows (95, 98, 2000, and XP)系统,下载Windows版安装程序。进行安装后,R将出现在你的机器中,并且在你的桌面增加快捷图标。TclTk 程序已包含在R 1.9.0及以后版本中。

对于Linux系统, download proper precompiled binaries and follow the instruction to install R. For other unix systems, you many need to download source code and compile it yourself.

2.2 How to run R

在 Windows系统环境下,双击桌面的R快捷图标,或者在“开始”菜单中点击, R用户界面将会出现。第一次使用时你可能需要配置称做“HOME”的环境变量。详情可参见附录E中用户常问的问题(FAQ)。

在unix 环境下,直接在 R程序界面运行。

欲在R界面退出,输入q()即可。在Windows系统下,还可以选择“File”菜单然后点击“Exit”选项。

3. 如何使用RClimDex

3.1 RClimDex的加载

1. 直接在R窗口中操作,RClimDex可以通过下拉菜单加载R包。在RGui菜单下选“File” ,再选“Source R code”。这将弹出一个窗口,你应指向你保存RClimDex的位置。

2.在R语言命令提示符“>”下,输入源文件(R包)名称:source(“rclimdex.r”)。如文件不在缺省目录(什么目录?)中,在rclimdex.r名称之前,你可能需要用全路径名,此时在提示符下输入:source("f:/rclimdex/rclimdex.r"(注意:全路径名之间的间隔符为unix下采用的“/”而不是windows操作系统命令行(即以前的DOS操作系统)下的“\”)。这将加载RClimDex。

一旦源程序加载成功,RClimDex主菜单就会出现:

3.2. 加载数据,运行质量控制模块(QC)

数据质量控制模块是计算极端指数的预备性处理工作。RClimDex质量控制模块执行如下功能: 1) 用R语言认可的数据格式代替缺失值(假设原数据以-99.9表示),如用“NA”表示“不可得”;2) 用“NA”代替所有的不合理值。这些值包括 a) 小于0的日降水量;b) 小于日最小气温的日最大气温。此外,质量控制模块还能识别日最大气温与日最大气温的离群值(不正常值)。这些离群值是由用户定义的区域之外的日特征值。当前,这个区域被定义为均值±日特征值的n倍标准差(翻译待审核!),即[mean –n*std, mean+n*std]。std表示日特征值的标准差,

n 表示一个用户的输入,mean(均值)表示气候特征的日值。

在RClimDex主菜单中选择“Load Data and Run QC” ,打开的窗口形式如下。用户能够选取用于计算极端指数的气候数据文件。

文件名的格式应该有如“stationname.txt”。文件中数值格式应该符合附录B的要求。在这个实例中,我们使用一个名为“21946.txt”、ASCII格式的站点数据。数据加载成功之后,一个弹出窗口出现。

如果这一步没有顺利完成,一个错误信息提示将会出现。这通常是由于输入格式有误。请比较你的数据格式与手册提供的样例数据格式。

不合理的值将被自动识别,但离群值需要用户进行确认。

n的缺省值是3 (根据“为数据质量控制设定参数”的设定),但这个数值用户可以改写。因为3可能标志(flag)着一个很大的数值,用户可能希望设定为4。当

参数设定是为了以后使用(翻译待复核!),不需要填写“Station name or code”,点击“OK” 继续。

译者注:此处n表示原始气象数据序列的标准差。如某地实际降水等变化超出此缺省值,可以适当放大,如将“3”改成“5”以避免误将真实值当成离群值。

如果发现不合理值,将会出现弹出窗口。例如,日最小气温大于日最大气温。

如果在日降水量中出现负值(除了以-99.9表示缺测的情况) ,将会出现以下窗口:

如果有离群值出现,将出现以下窗口。

译者注:离群值的查找很方便。如果出现离群值,根据系统提示的目录中生成的文件21946tepstdQC.csv对原始数据中的不合理值进行查找与修改即可。

数据控制模块完成,将会弹出一个窗口。同时,4个Excel文件:“21946tempQC.csv”,“21946prcpQC.csv”, “21946tepstdQC.csv”, and“21946indcal.csv” 将建立在一个名为log的子目录中。开始的2个文件包含着气温与降水中存在的不合理值(比“离群值”还不合理)信息,第3个文件标记所有可能的气温离群值及其出现日期。最后一个文件包含着数据控制模块的信息,并将用于指数的计算。注意:在最后的一个文件中,仅用NA代替缺失值和不合理值,并未改变作了标记的离群值。为了可视化,4个用于日最高、最低气温、日降水时间序列范围绘图的PDF文档 (缺失值被标为红点) 放置在log目录之中。.

因此,用户可能需要检查文件“21946tepstdQC.csv” 中的数据,是否标记为离群值的数据真的为离群值。文件“21946indcal.csv” 可以用Windows 系统下的Excel 软件或Unix系统下的编辑器进行修改。这一步操作完成之后,用户点击OK,进入后续的指数计算。

注意:指数采用数据质量控制后的数据进行计算。原始的输入文件并未改变。

译者注:21946tepstdQC.csv中保存着软件认为可能不合理的值,用户可以查看或修改。不合理值包括:降水量为负值、最低气温大于最高气温。系统自动生成一个校核过的新数据文件进行后续处理,并不直接使用原始数据文件)因此,用户想要修改原始数据文件以改正错误值的话,应当重新加载数据,数据质量控制模块也需要再次运行。

3.3. 指数计算

RClimDex能够计算附录A中全部的27种核心气候指数,用户可以根据需要选择指数进行计算。

在主菜单中选择值“计算指数(Indices Calculation)”之后,用户被要求设置某些参数。“设置参数值(Set Parameter Values)”窗口允许用户输入用于门槛值计算的基期的第1年和最后1年、站点纬度(南半球为负值)、用户定义的日降水门槛值P (用毫米mm表示), 当日降水超过这个门槛值时计算持续日数 (Rnn指示器)、4个用户定义的气温门槛值。“用户定义的日最高限值(User defined Upper Limit of Day High)”用于计算日最高气温高于门槛值时的持续日数。“用户定义的日最高限值(User defined Lower Limit of Day High)”用于计算日最高气温低于该值时的持续日数。“用户定义的日低值上限(User defined Upper Limit of Day Low)”用于计算日最低气温超过该值时的持续日数。“用户定义的日低值下限(User defined Lower Limit of Day Low)”用于计算日最低气温低于此值的持续日数。这些指数分别被称作SUmm、FDmm、TRmm、IDmm,“mm”对应于用户定义的值。

译者注:基期的第1年系统自动识别为原始序列的第2个值的年份,而不是第1个值的年份,原因见《4. 已知的差错》。采用默认设置不作改动可以运行,但具体影响本人尚未深入分析。对于降水指数的计算可能无直接影响,但影响温度指数的计算。《4. 已知的差错》提供的一个补救方法是在观测数据前面增加一个值(但标为-99.9)详见《4. 已知的差错》。“用户定义的日降水门槛值P (用毫米mm表示), 当日降水超过这个门槛值时计算持续日数 (Rnn指示器)”的修改可能影响连续湿润指数的计算(CWD)。

这一步完成之后,一个窗口会出现,允许用户选择需要计算的指数。缺省设置为计算所有指数。

退选不需计算的指数项目后,点击“OK” 进行计算。根据选择计算的指数多少,这一步的计算时间各有长短。

译者注:在调试过程中,为节约运算时间可退选暂不需要计算的项目。如仅需CDD,保留CDD选项即可。

需要计算的指数运算完成之后,出现一个弹出窗口。

计算所得的指数序列以Excel格式存放在名为indices的子目录中。指数结果文件名称类似“21946_XXX.cvs”,XXX表示指数的名称。数据的各列用逗号(“,”)分隔。考虑可视化需要,绘制了年序列、趋势(最小线性二乘法solid line,locally weighted linear regression (dashed line))的图形,线性回归的趋势拟合也进行了绘制。这些图形被保存在名为JPEG的子目录中,图形文件名命名方法与前述类似,仅将“cvs”换成“jpg”。

译者注:提示窗口仅标出了plots目录,其他结果文件也在相应目录之中。

选择“计算指数(Indices Calculation)”可以为同样的站点计算其它的指数。对于其他站点,选择“数据质量控制模块(Data QC)”、重复上述的同样过程。所有的计算完成之后,选择“Exit”即可。

4. 已知的差错

在RClimDex本版以及此前版本中有一个已知的差错。假如可得数据的第1年与

基期的第1年相同的话,程序将中止执行。产生这个差错的原因之一是气温百分

比指数计算中需要一个基期以外的数据。避免这个差错的一个方法是在观测序列的第1个数据之前增加一个值,比如数据文件的基期为1961-1990、现有数据从1961年1月1日开始,可以在数据文件中增加1个前1天的数据(视作缺测,标为-99.9):“1960 12 31 -99.9 -99.9 -99.9”

5. 差错报告

Please report any bugs/errors to yang.feng@ec.gc.ca with error messages and data being used for the calculation of the indices. This will be helpful in producing a better release in the near future. We would also appreciate your suggestions for further improvement.

APPENDIX A: List of ETCCDMI core Climate Indices

ID Indicator name Definitions UNITS

FD0 Frost days

Annual count when TN(daily minimum)<0oC Days

SU25 Summer days

Annual count when TX(daily maximum)>25oC Days

ID0 Ice days

Annual count when TX(daily maximum)<0oC Days

TR20 Tropical nights

Annual count when TN(daily minimum)>20oC Days

GSL Growing season

Length

Annual (1st Jan to 31st Dec in NH, 1st July to 30th June in

SH) count between first span of at least 6 days with

TG>5oC and first span after July 1 (January 1 in SH) of 6

days with TG<5oC

Days

TXx Max Tmax

Monthly maximum value of daily maximum temp oC

TNx Max Tmin

Monthly maximum value of daily minimum temp oC

TXn Min Tmax

Monthly minimum value of daily maximum temp oC

TNn Min Tmin

Monthly minimum value of daily minimum temp oC

TN10p Cool nights

Percentage of days when TN<10th percentile Days

TX10p Cool days

Percentage of days when TX<10th percentile Days

TN90p Warm nights

Percentage of days when TN>90th percentile Days

TX90p Warm days

Percentage of days when TX>90th percentile Days

WSDI Warm spell duration

indicator

Annual count of days with at least 6 consecutive days

when TX>90th percentile

Days

CSDI Cold spell duration

indicator

Annual count of days with at least 6 consecutive days

when TN<10th percentile

Days

DTR Diurnal temperature

range Monthly mean difference between TX and TN oC

RX1day Max 1-day

precipitation amount Monthly maximum 1-day precipitation Mm

Rx5day Max 5-day

precipitation amount Monthly maximum consecutive 5-day precipitation Mm

SDII Simple daily intensity

index

Annual total precipitation divided by the number of wet

days (defined as PRCP>=1.0mm) in the year

Mm/da

y

R10 Number of heavy

precipitation days Annual count of days when PRCP>=10mm Days

R20 Number of very

heavy precipitation

days

Annual count of days when PRCP>=20mm Days

Rnn Number of days

above nn mm

Annual count of days when PRCP>=nn mm, nn is user

defined threshold

Days

CDD Consecutive dry days

Maximum number of consecutive days with RR<1mm Days

CWD Consecutive wet days

Maximum number of consecutive days with RR>=1mm Days

R95p Very wet days

Annual total PRCP when RR>95th percentile Mm

R99p Extremely wet days

Annual total PRCP when RR>99th percentile mm

PRCPTOT Annual total wet-day

precipitation Annual total PRCP in wet days (RR>=1mm) mm

APPENDIX B: 输入数据格式

译者注:用于输入的观测数据文件只能使用纯文本格式,不能使用CSV文件等。

All of the data files that are read or written are in list formatted format. The exception is the very first data file that is processed in the “ Quality Control” step. This input data file has several requirements:

1.ASCII text file 译者注:ASCII码文本文件

2.Columns as following sequences: Year, Month, Day, PRCP, TMAX, TMIN. (NOTE: PRCP units = millimeters and Temperature units= degrees Celsius)

3.The format as described above must be space delimited (e.g. each element separated by one or more spaces).

4.For data records, missing data must be coded as -99.9; data records must be in calendar date order. Missing dates allowed.

Example data Format for the initial data file (e.g. used in the …Quality Control? step):

译者注:数据格式必须与上表保持一致,年、月、日、降水值(mm)、最高气温、最低气温(摄氏温度)。缺测值必须使用-99.9。所有记录必须按日历年排序,但允许有缺失。比如上表中1月5、6、7日缺失。

APPENDIX C: Indices definitions

Definitions for indicators listed in Appendix A. For practical reasons, in this version of the software, not all indices are calculated on a monthly basis. Monthly indices are calculated if no more than 3 days are missing in a month, while annual values are calculated if no more than 15 days are missing in a year. No annual value will be calculated if any one month?s data ar e missing. For threshold indices, a threshold is calculated if at least 70% of data are present. For spell duration indicators (marked with a *), a spell can continue into the next year and is counted against the year in which the spell ends e.g. a cold spell (CSDI) in the Northern Hemisphere beginning on 31st December 2000 and ending on 6th January 2001 is counted towards the total number of cold spells in 2001.

1. FD0

Let ij Tn be the daily minimum temperature on day i in period j . Count the number of days where:

0ij Tn C

2. SU25

Let ij Tx be the daily maximum temperature on day i period j . Count the number of days where:

25ij Tx C >?

3. ID0

Let ij Tx be the daily maximum temperature on day i in period j . Count the number of days where:

0ij Tx C

4. TR20

Let ij Tn be the daily minimum temperature on day i in period j . Count the number of days where:

20ij Tn C >?

5. GSL

Let ij T be the mean temperature on day i in period j . Count the number of days between the first occurrence of at least 6 consecutive days with:

5o ij T C >

and the first occurrence after 1st July (1st January in SH) of at least 6 consecutive days with:

5o ij T C <

6. TXx

Let kj Tx be the daily maximum temperatures in month k , period j . The maximum daily maximum temperature each month is then:-

max()kj kj TXx Tx =

7. TNx

Let kj Tn be the daily minimum temperatures in month k , period j . The maximum daily minimum temperature each month is then:-

max()kj kj TNx Tn =

8. TXn

Let kj Tx be the daily maximum temperatures in month k , period j . The minimum daily maximum temperature each month is then:-

min()kj kj TXn Tx =

9. TNn

Let kj Tn be the daily minimum temperatures in month k , period j . The minimum daily minimum temperature each month is then:-

min()kj kj TNn Tn =

10. Tn10p

Let ij Tn be the daily minimum temperature on day i in period j and let 10in Tn be the calendar day 10th percentile centred on a 5-day window (calculated using method from Appendix D). The percentage of time is determined where:

10ij in Tn Tn <

11. Tx10p

Let ij Tx be the daily maximum temperature on day i in period j and let 10in Tx be the calendar day 10th percentile centred on a 5-day window (calculated using method from Appendix D). The percentage of time is determined where:

10ij in Tx Tx <

12. Tn90p

Let ij Tn be the daily minimum temperature on day i in period j and let 90in Tn be the calendar day 90th percentile centred on a 5-day window (calculated using method from Appendix D). The percentage of time is determined where:

90ij in Tn Tn >

13. Tx90p

Let ij Tx be the daily maximum temperature on day i in period j and let 90in Tx be the calendar day 90th percentile centred on a 5-day window (calculated using method from Appendix D). The percentage of time is determined where:

90ij in Tx Tx >

14. WSDI*

Let ij Tx be the daily maximum temperature on day i in period j and let 90in Tx be the calendar day 90th percentile centred on a 5-day window (calculated using method from Appendix D). Then the number of days per period is summed where, in intervals of at least 6 consecutive days:-

90ij in Tx Tx >

15. CSDI*

Let ij Tn be the daily minimum temperature at day i in period j and let 10in Tx be the calendar day 10th percentile centred on a 5-day window (calculated using the method from Appendix D). Then the number of days per period is summed where, in intervals of at least 6 consecutive days:-

10ij in Tn Tn <

16. DTR

Let ij Tx and ij Tn be the daily maximum and minimum temperature respectively on day i in period j . If I represents the number of days in j , then:

()

1

I

ij

ij i j Tx

Tn DTR I

=-=

17. RX1day

Let ij RR be the daily precipitation amount on day i in period j . Then maximum 1-day values for period j are:

1max()j ij Rx day RR =

18. Rx5day

Let kj RR be the precipitation amount for the 5-day interval ending k , period j . Then maximum 5-day values for period j are:

5max()j kj Rx day RR =

19. SDII

Let wj RR be the daily precipitation amount on wet days,(1)w RR mm ≥in period j . If W represents number of wet days in j , then:

1W

w wj

j RR SDII W

==

20. R10

Let ij RR be the daily precipitation amount on day i in period j . Count the number of days where:

10ij RR mm ≥

21. R20

Let ij RR be the daily precipitation amount on day i in period j . Count the number of days where:

20ij RR mm ≥

相关主题