KSH腳本說明 一、UNGRIBKSH以及UNGRIBSSTKSH∶ 即UNGRIB .docx_第1頁
KSH腳本說明 一、UNGRIBKSH以及UNGRIBSSTKSH∶ 即UNGRIB .docx_第2頁
KSH腳本說明 一、UNGRIBKSH以及UNGRIBSSTKSH∶ 即UNGRIB .docx_第3頁
KSH腳本說明 一、UNGRIBKSH以及UNGRIBSSTKSH∶ 即UNGRIB .docx_第4頁
KSH腳本說明 一、UNGRIBKSH以及UNGRIBSSTKSH∶ 即UNGRIB .docx_第5頁
已閱讀5頁,還剩19頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

Ksh腳本說明一、Ungrib.ksh以及ungrib_SST.ksh: 即ungrib.exe。流程:需要namelist以及Vtable表;根據(jù)分析時間來替換原來的時間;關(guān)鍵字:SOURCE背景場的類型,如ETA, AVN, RUC等1、時間部分腳本代碼說明if $ECHO $START_TIME | $AWK /:digit:10$/ ; then #判斷START_TIME是不是10個數(shù)字的格式,$分別表示頭和尾,:digit:表示數(shù)字, #10表示匹配10次 START_TIME=$ECHO $START_TIME | $SED s/(:digit:2)$/ 1/ # 這里要注意的是/(:digit:2)$表示匹配最后兩個數(shù)字,然后()表示標(biāo)簽1, # 1即表示第一個括號里的內(nèi)容,注意到1前的空格。 # 整句話的意思就是將數(shù)據(jù)最后兩個數(shù)字前加一空格 # 即yyyymmddhh,變成yyyymmdd hhelif ! $ECHO $START_TIME | $AWK /:digit:8:blank:1:digit:2$/ ; then $ECHO ERROR: start time, $START_TIME, is not in yyyymmddhh or yyyymmdd hh format exit 1fi2、date的用法START_TIME=$DATE -d $START_TIME 3 hours ago #往前3個小時,關(guān)鍵字有years、days、minutes、 hours and seconds,ago往前推算#沒有ago則是往后。#時間格式為yyyymmdd hhmm。( FCST_LENGTH = $FCST_LENGTH + 3 )END_TIME=$DATE -d $START_TIME $FCST_LENGTH hoursstart_yyyymmdd_hhmmss=$DATE +%Y-%m-%d_%H:%M:%S -d $START_TIMEend_yyyymmdd_hhmmss=$DATE +%Y-%m-%d_%H:%M:%S -d $END_TIME時間域% H 小時(00.23)% I 小時(01.12)% k 小時(0.23) % l 小時(1.12)% M 分(00.59)% p 顯示出AM或PM% r 時間(hh:mm:ss AM或PM),12小時% s 從1970年1月1日00:00:00到目前經(jīng)歷的秒數(shù)% S 秒(00.59)% T 時間(24小時制)(hh:mm:ss) % X 顯示時間的格式(H:M:S) % Z 時區(qū) 日期域 % a 星期幾的簡稱( Sun.Sat)% A 星期幾的全稱( Sunday.Saturday)% b 月的簡稱(Jan.Dec) % B 月的全稱(January.December)% c 日期和時間( Mon Nov 8 14:12:46 CST 1999)% d 一個月的第幾天(01.31)% D 日期(mmddyy)% h 和%b選項相同% j 一年的第幾天(001.366)% m 月(01.12) % w 一個星期的第幾天(0代表星期天)% W 一年的第幾個星期(00.53,星期一為第一天)% x 顯示日期的格式(mm/dd/yy)% y 年的最后兩個數(shù)字( 1999則是99)% Y 年(例如:1970,1996等)3、正則表達(dá)式在各種常用的工具中,正則表達(dá)式如此的相似卻又不同。下表列出了一些常用的正則表達(dá)式,以及其不同之處。項目總多,遺漏必有不少,請各位看官不吝指出。以perl的正則為基準(zhǔn),不同的用法以粉紅色標(biāo)出。()grep 2.5.1egrep 2.5.1sed 3.02sed 4.07awk 3.1.1perl 5.8.0vim 6.1JavaScript ?轉(zhuǎn)義行頭行尾$n個 或 僅定義 -posix 或 -re-interval有效(要表達(dá)和 沒有定義-posix或-re-interval時,不能用的語法, 同義 *或*, (要表達(dá)*,得用*)*+或+, (要表達(dá)+, 得用+)+?或?, (要表達(dá)?, 得用?)?任意字符. 含 . . /s修飾后則含 . 除 . 除 (pat) 匹配并獲結(jié)果(pat)(pat)(pat)(pat)或(pat) (要表達(dá)括號,用( ) )(pat)(pat)(pat)(?:pat) 匹配但不獲結(jié)果 不支持不支持不支持不支持(?:pat)不支持(?:pat)(?=pat) 等于預(yù)查不支持不支持不支持不支持(?=pat)不支持(?=pat)(?!pat) 不等預(yù)查不支持不支持不支持不支持(?!pat)不支持(?!pat)| 或|或| (要表達(dá)|,得用|)|其中任意字符xyzxyzxyzxyzxyzxyzxyz.ch. =ch=不支持不支持.ch.不支持不支持不支持不支持單詞邊界 不支持不支持非單詞邊界 BBBB不支持B不支持B單詞左右邊界 不支持 (同義不支持(同義控制字符 /cx不支持不支持cx不支持cx不支持cx數(shù)字d不支持不支持不支持不支持ddd非數(shù)字D不支持不支持不支持不支持DDD換頁 f不支持不支持高版本支持ff另義 f表示文件名字符f換行 不支持不支持不支持回車 不支持不支持空白 s不支持不支持不支持不支持sss非空白 S不支持不支持不支持不支持SSS制表符 不支持不支持高版本支持垂直制表符 v不支持不支持高版本支持vv另義 v表示very magicv單詞字符 w A-Za-z0-9_www不支持www非單詞字符 W A-Za-z0-9WWW不支持WWWxn 16進(jìn)制不支持不支持高版本支持xnxn另義 x表示0-9A-Za-zxn八進(jìn)制不支持不支持不支持不支持后向引用僅取結(jié)果可用僅取結(jié)果可用:alnum: 字母和數(shù)字:alnum:alnum:alnum:alnum:alnum:alnum:不支持:alpha: 字母:alpha:alpha:alpha:alpha:alpha:alpha:不支持:cntrl: 控制字符:cntrl:cntrl:cntrl:cntrl:cntrl:cntrl:不支持:digit: 數(shù)字:digit:digit:digit:digit:digit:digit:不支持:graph: 可打印字符(不含空格):graph:graph:graph:graph:graph:graph:不支持:lower: 小寫:lower:lower:lower:lower:lower:lower:不支持:print: 可打印字符(含空格):print:print:print:print:print:print:不支持:punct: 標(biāo)點:punct:punct:punct:punct:punct:punct:不支持:space: 空格:space:space:space:space:space:space:不支持:upper: 大寫字母:upper:upper:upper:upper:upper:upper:不支持:xdigit: 16進(jìn)制數(shù)字:xdigit:xdigit:xdigit:xdigit:xdigit:xdigit:不支持:return: 不支持不支持不支持不支持不支持:return:不支持:tab: 不支持不支持不支持不支持不支持:tab:不支持:escape: 不支持不支持不支持不支持不支持:escape:不支持:backspace: 不支持不支持不支持不支持不支持:backspace:不支持原文地址 /u/8048/showart_37777.htmlsed s/:blank:/g /misc/whome/rtrr/static_rr13_boundary/namelist.wps | gawk -posix /#&/ | sed s/:cntrl:/g第一個sed刪除空格,第二個gawk中的第一個 表示行頭,第二個,表示非,也就是不依這些開頭的。最后sed替換的是ctrl+*,估計主要是考慮到windows拖到linux時可能的換行符。kefengwfe2 /ksh$ echo end_date=2007-04-26_12:00:00,2006-08-16_12:00:00, | cut -d= -f 1end_datekefengwfe2 /ksh$ echo end_date=2007-04-26_12:00:00,2006-08-16_12:00:00, | cut -d= -f 22007-04-26_12:00:00,2006-08-16_12:00:00,以等號間隔,-f表示第幾字段,-d表示分隔符,注意這兩個參數(shù)要搭配使用。關(guān)于if -n $_H_ -a $_H_ -eq $start_hour ; then關(guān)于這段參數(shù) n, -a的說明,請查看man ksh4、小結(jié)這個csh首先判斷ungrib所需文件的存在與否;根據(jù)分析時間來替換參數(shù),包括start_date、end_date、interval_seconds以及prefix;根據(jù)時間來選擇grib數(shù)據(jù),并連接為GRIBFILE.AAA 形式;運行ungrib.exe,判斷文件是否生成。Ungrib以后的文件頭以SOURCE這個環(huán)境變量來指定。Ungrib.ksh 運行后的結(jié)果如果是GFS場,則以GFS開頭,ungrib_SST.ksh 運行后則為SST二、metgrid.ksh流程:完成metgrid。即將全球數(shù)據(jù)水平插值到模式格點1、ksh關(guān)鍵部分分析for name in $SED s/:blank:/g $WPSNAMELIST | $AWK /#&/do # If theres an = in the line if $ECHO $name | $AWK /=/ ; then ( i=i+1 ) left=$ECHO $name | $CUT -d= -f 1 | $AWK print toupper($0) right=$ECHO $name | $CUT -d= -f 2# var$i=$left val$i=$right ( _$left_=$i ) #這里是給每個namelist中名字在val數(shù)組中的位置,在接下來的 _FG_NAME_里會用到這個值 else val$i=$val$i$name fidone# Get an array of fg_names from the namelistset -A source_list $ECHO $val$_FG_NAME_ | $SED s/,1,/ /g#這句話的意思是將 和 ,替換為空格kefengwfe6 bin$ echo GFS,SST | sed s/,1,/ /g GFS SST2、小結(jié)判斷目錄存在與否;更新namelist.wps文件,包括start_date、end_date、interval_seconds、fg_name和constants_name; 通過xml傳入文件路徑,將GFS以及SST文件連接到當(dāng)前運行目錄;運行metgrid.exe,然后判斷文件是否生成。三、real_wpsdfi_bd3.ksh、real_wpsdfi_bd2.ksh和real_wpsdfi_bd.ksh1、ksh用法rsldir=rsl.$LS -l -time-style=+%Y%m%d%H%M%S rsl.out.0000 | $CUT -d -f 7kefengwfe2 /ksh$ ls -l -time-style=+%Y%m%d%H%M%Stotal 20-rw-r-r- 1 kefeng ou 888 20090829232620 namelist.wps-rw-r-r- 1 kefeng ou 11217 20090828212008 out.log-rwxr-xr-x 1 kefeng ou 3919 20090829232619 time.ksh時間顯示格式上可以自定義。2、區(qū)別 START_TIME=$DATE -d $START_TIME 3 hours # real_wpsdfi_bd2.kshSTART_TIME=$DATE -d $START_TIME # real_wpsdfi_bd.ksh if ! -r wrfinput_d01 ; then # real_wpsdfi_bd.ksh增加了初始場是否生成的判斷 $ECHO ERROR: wrfinput_d01 does not exist! exit 1 fi3、小結(jié):判斷目錄存在與否;更新namelist.input,主要是時間項;運行real.exe,生成側(cè)邊界和初始場;將生成的側(cè)邊界拷貝一份,即文件名加上時間項先保存;將運行日志保留。start_year = 2008, 2000, 2000, start_month = 07, 01, 01,. start_day = 09, 24, 24, start_hour = 12, 12, 12, start_minute = 00, 00, 00, start_second = 00, 00, 00, end_year = 2008, 2000, 2000, end_month = 07, 01, 01, end_day = 10, 25, 25, end_hour = 00, 12, 12, end_minute = 00, 00, 00, end_second = 00, 00, 00, interval_seconds = 10800,dfi_opt = 3,dfi_bckstop_year = 2008, dfi_bckstop_month = 07, dfi_bckstop_day = 09, dfi_bckstop_hour = 11, dfi_bckstop_minute = 20, dfi_bckstop_second = 00, dfi_fwdstop_year = 2008, dfi_fwdstop_month = 07, dfi_fwdstop_day = 09, dfi_fwdstop_hour = 12, dfi_fwdstop_minute = 20, dfi_fwdstop_second = 00四、wrf_wpsdfi_bd.ksh 可執(zhí)行程序:wrf.exe運行結(jié)果輸出目錄:$ MOAD_DATAHOME_ARW /boundary初始場:GFS預(yù)報場,如果存在GSI的分析場,則用GSI的分析場。但多半這里用的是GFS場。邊界條件:GFS預(yù)報場。Namelist更新基本和上面的一樣,只更新了時間項。五、cleanRR13.ksh刪除2天前的目錄;刪除2天前的側(cè)邊界條件;刪除12小時前的預(yù)報場;保留日志。六、lightning.ksh輸入資料路徑:/public/data/lightning輸出資料路徑:$ MOAD_DATAHOME_ARW_1H/2009082709/obsprd 可執(zhí)行程序:process_Lightning.exe數(shù)據(jù)范圍:Spatial coordinates N: 60.0S: 18.0E: -60.0W: -130.0參數(shù)文件:&SETUP analysis_time = 2009083118, NLDN_filenum = 2, IfAlaska = true, /作用:將當(dāng)前分析時刻前30分鐘以及后5分鐘的數(shù)據(jù)認(rèn)為都作為分析時刻時間窗內(nèi)讀入;將其連接為NLDN_lightning_($ifile);另外,alaska數(shù)據(jù)時文本格式,將其連接為ALSKA_lightning;運行process_Lightning.exe將觀測數(shù)據(jù)轉(zhuǎn)成prepbufr格式。七、mosaic.ksh輸入資料路徑:/public/data/radar/nssl/mosaic3d_nc輸出資料路徑:$ MOAD_DATAHOME_ARW_1H/2009082709/obsprd 可執(zhí)行程序:process_NSSL_mosaic.exe作用:將不同區(qū)域mosaic數(shù)據(jù)合成一個,水平插值到模式格點;并輸出二進(jìn)制和prepbufr兩種格式;需要模式地形數(shù)據(jù),即geo_em.d01.nc。八、gsi_sat_V3.ksh1、ksh特殊用法說明 這里和big和little endian的數(shù)據(jù)有關(guān): export F_UFMTENDIAN=big;little:10,13,15,66#通過這個參數(shù)來確定數(shù)據(jù)在什么通道號進(jìn)行big-little endian的轉(zhuǎn)換。 export GMPIENVVAR=F_UFMTENDIAN export MV2_ON_DEMAND_THRESHOLD=256/services/userguides/intel8/fc/f_ug1/cmp_endi.htmIn the general case, the variable consists of two parts divided by a semicolon. No spaces are allowed inside the F_UFMTENDIAN value. The variable has the following syntax:F_UFMTENDIAN=MODE | MODE; EXCEPTIONwhere:MODE = big | littleEXCEPTION = big:ULIST | little:ULIST | ULISTULIST = U | ULIST,UU = decimal | decimal -decimal MODE defines current format of data, represented in the files; it can be omitted. The keyword little means that the data has little endian format and will not be converted. This is the default.The keyword big means that the data has big endian format and will be converted. EXCEPTION is intended to define the list of exclusions for MODE. EXCEPTION keyword (little or big) defines data format in the files that are connected to the units from the EXCEPTION list. This value overrides MODE value for the units listed. The EXCEPTION keyword and the colon can be omitted. The default when the keyword is omitted is big. Each list member U is a simple unit number or a number of units. The number of list members is limited to 64. decimal is a non-negative decimal number less than 232.The command line for the variable setting in the shell is:Sh: export F_UFMTENDIAN=MODE;EXCEPTION1). F_UFMTENDIAN=big All input/output operations perform conversion from big-endian to little-endian on READ and from little-endian to big-endian on WRITE.2). F_UFMTENDIAN=little;big:10,20or F_UFMTENDIAN=big:10,20or F_UFMTENDIAN=10,20In this case, only on unit numbers 10 and 20 the input/output operations perform big-little endian conversion.3). F_UFMTENDIAN=big;little:8In this case, on unit number 8 no conversion operation occurs. On all other units, the input/output operations perform big-little endian conversion.4). F_UFMTENDIAN=10-20 Define 10, 11, 12 19, 20 units for conversion purposes; on these units, the input/output operations perform big-little endian conversion.5). Assume you set F_UFMTENDIAN=10,100 and run the following eger*4 cc4integer*8 cc8integer*4 c4integer*8 c8c4 = 456c8 = 789 C prepare little endian representation of dataopen(11,file=lit.tmp,form=unformatted)write(11) c8write(11) c4close(11)C prepare big endian representation of dataopen(10,file=big.tmp,form=unformatted)write(10) c8write(10) c4close(10)C read big endian data and operate with them on C little endian machineopen(100,file=big.tmp,form=unformatted)read(100) cc8read(100) cc4C Any operation with data, which have been readC . . .close(100)stopendNow compare lit.tmp and big.tmp files with the help of od utility. od -t x4 lit.tmp0000000 00000008 00000315 00000000 000000080000020 00000004 000001c8 000000040000034 od -t x4 big.tmp0000000 08000000 00000000 15030000 080000000000020 04000000 c8010000 0400000000000342、運行目錄:$ MOAD_DATAHOME_ARW_1H/2009082709/gsiprd3、作業(yè)流程:1). 找最近12小時內(nèi)ruc的預(yù)報場作為背景場;2). 如果沒有找到,則尋找未經(jīng)過任何同化,直接從GFS預(yù)報的場作為背景場。但這里需要注意的是這里的直接預(yù)報是從每天的03,09,15,21開始,也就是用的是GFS場預(yù)報3小時的場作為模式輸入的背景場;3). 如果執(zhí)行的是第2)步,則需要更新地面變量(full_cycle_surface.exe或partial_cycle_surface.exe),以及snow的數(shù)據(jù)信息(process_NESDIS_imssnow.exe)。4). 06點用GFS直接的預(yù)報場和RUC的預(yù)報場來更新SST(update_SST.exe);5). 04點的時候更新geo_em.d01.nc這個文件里面的snow信息(需要latest.SNOW_IMS文件,process_NESDIS_imssnow.exe)。6). 準(zhǔn)備好背景場后,開始連接觀測數(shù)據(jù);拷貝常量文件;最后運行nam_gsi,完成變分同化。九、gsi_diag.ksh運行目錄:$ MOAD_DATAHOME_ARW_1H/2009082709/gsiprd可執(zhí)行程序:read_diag_conv.exe$CAT namelist.conv &iosetup dirname=., outfilename=./diag_results, numpe=$GSIPROC, nloop=1,2,3 $iosetup / EOFread_diag_rad.exe$CAT namelist.rad &iosetup dirname=., outfilename=./diag_results, numpe=$GSIPROC, nloop=1,3 instrument=amsub_n16,amsub_n17,hirs3_n17, $iosetup /EOF九、gsi_sat_bias.ksh可執(zhí)行程序:angupdatecat input &setup jpch=592,nstep=90,nsize=1,wgtang=0.008333333,wgtlap=0.0, iuseqc=1,dtmax=1.0, iyy1=$iy,imm1=$im,idd1=$id,ihh1=$ih, iyy2=$iy,imm2=$im,idd2=$id,ihh2=$ih, dth=01,ndat=29 / &obs_input dtype(01)=hirs2, dplat(01)=n14, dsis(01)=hirs2_n14, dtype(02)=hirs3, dplat(02)=n16, dsis(02)=hirs3_n16, dtype(03)=hirs3, dplat(03)=n17, dsis(03)=hirs3_n17, dtype(04)=hirs4, dplat(04)=n18, dsis(04)=hirs4_n18, dtype(05)=sndr, dplat(05)=g10_prep, dsis(05)=sndr_g10, dtype(06)=sndr, dplat(06)=g12_prep, dsis(06)=sndr_g12, dtype(07)=goesimg, dplat(07)=g10, dsis(07)=goesimg_g10, dtype(08)=goesimg, dplat(08)=g12, dsis(08)=goesimg_g12, dtype(09)=airs, dplat(09)=aqua, dsis(09)=airs281SUBSET_aqua, dtype(10)=msu, dplat(10)=n14, dsis(10)=msu_n14,dtype(11)=amsua, dplat(11)=n15, dsis(11)=amsua_n15, dtype(12)=amsua, dplat(12)=n16, dsis(12)=amsua_n16, dtype(13)=amsua, dplat(13)=n17, dsis(13)=amsua_n17, dtype(14)=amsua, dplat(14)=n18, dsis(14)=amsua_n18, dtype(15)=amsua, dplat(15)=aqua, dsis(15)=amsua_aqua, dtype(16)=amsub, dplat(16)=n15, dsis(16)=amsub_n15, dtype(17)=amsub, dplat(17)=n16, dsis(17)=amsub_n16, dtype(18)=amsub, dplat(18)=n17, dsis(18)=amsub_n17, dtype(19)=mhs, dplat(19)=n18, dsis(19)=mhs_n18, dtype(20)=ssmi, dplat(20)=f13, dsis(20)=ssmi_f13, dtype(21)=ssmi, dplat(21)=f14, dsis(21)=ssmi_f14, dtype(22)=ssmi, dplat(22)=f15, dsis(22)=ssmi_f15, dtype(23)=amsre_low, dplat(23)=aqua, dsis(23)=amsre_aqua, dtype(24)=amsre_mid, dplat(24)=aqua, dsis(24)=amsre_aqua, dtype(25)=amsre_hig, dplat(25)=aqua, dsis(25)=amsre_aqua, dtype(26)=ssmis_las, dplat(26)=f16, dsis(26)=ssmis_f16, dtype(27)=ssmis_uas, dplat(27)=f16, dsis(27)=ssmis_f16, dtype(28)=ssmis_img, dplat(28)=f16, dsis(28)=ssmis_f16, dtype(29)=ssmis_env, dplat(29)=f16, dsis(29)=ssmis_f16, /EOF十、wrf_wpsdfi.ksh 可執(zhí)行程序:wrf.exe運行結(jié)果輸出目錄:$ MOAD_DATAHOME_ARW /2009082709/wrfprd初始場: GSI的分析場。邊界條件:GFS預(yù)報場。Namelist更新和wrf_wpsdfi_bd.ksh的一樣,只更新了時間相關(guān)項。和wrf_wpsdfi_bd.ksh不同的是增加了邊界條件搜索下。十一、post_anl.ksh 和post.ksh區(qū)別:前者處理GSI分析場,后者處理預(yù)報場;前者處理一個時次,后者處理12個小時的預(yù)報。 $MOAD_DATAROOT/wrfprd/wrfout_d01_$timestr可執(zhí)行程序:wrfpost.exe結(jié)果輸出目錄:$ MOAD_DATAHOME_ARW_1H/2009082709/postprdPost.ksh工作目錄在對應(yīng)的預(yù)報時間,比如00,01等,處理成功后移到postprd下。$MV $workdir/WRFPRS$FCST_TIME.tm00 $MOAD_DATAROOT/postprd$MV $wo

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論