2013年7月3日 星期三

How to read DYNAMO sounding data Part1

當資料越原始,他就越難處理。這裡要介紹資料中的大魔王--sounding,之後更進一步延伸到Yanai (1973)的傳奇工作,如何用探空計算出積雲對流的做功(這是part2才會討論的東西)。

DYNAMO sounding 網站 http://data.eol.ucar.edu/master_list/?project=DYNAMO


首先手頭上需要三個東西

(1)sounding資料 cls檔的格式--->這當然是廢話啦XD
(2)Matlab  ---> 好處是讀資料和畫圖可以一起用
(3)工作站


一開始資料會長這樣,最前面的是所謂的head(也就是說明測站的部份)。通常一個cls檔會有1~9個不等的head,但為什麼會數量不一呢?所謂人有失足馬有失蹄,放氣球總會失敗,而那該死多放幾次的東西就會變成資料處理的夢魘...除此之外,氣球飛行的速度也不一樣,所以不用期望他每天會有相同的資料量= =+


所以我們的第一步就是把他所有head找出來(這邊很幸運的,資料總是在16行head之後出現,這部份是很固定的),所以我們需要一個工作站和一支shell大量處理cls檔。


Step1:先把所有cls放到工作站的同個資料夾內

Step2:執行下面這之shell檔

#!bin/sh
ls > list.txt
for i in $(cat list.txt)
do
grep -n "Data"  ./${i} > test2.txt
awk 'NR==1;NR==2;NR==3;NR==4;NR==5;NR==6;NR==7;NR==8;' test2.txt | cut -f 1 -d : > ${i}.txt
done

簡單介紹一下幾個關鍵指令 grep是找尋字元(而我們這次要找的就是上面圖中第一行的Data這個字),但如果今天我們要知道字元在哪行,就要加上-n這個附屬性質,
他會回傳
1:Data
2:Data
之類的東西。後面的awk則是去掉數字以外的部份,這樣一來我們就可以只留下行數,而不留下"Data"這個字。(反正看不懂的話就執行這支檔案就懂了XDDD)

有了所有的cls檔的head所在位置之後,便可以把他和cls檔一起載下來,而我檔名命名的習慣
就是在原來的cls之後直接加上.txt
例如:Colombo20111001.cls 對應的head行數檔就是 Colombo20111001.cls.txt



Step3:使用Matlab

這邊提供我使用的程式總共三支
main:https://www.dropbox.com/s/xrn2az7aweb2txj/read2.m
水氣:https://www.dropbox.com/s/0mk8b0s9913s9hf/saturate_q.m
標準層(每25hPafitting):https://www.dropbox.com/s/7gtyo23j94a9ncd/inteptest.m

主要是第一支,另外兩支則是function。簡單講解概念如下,因為matlab從cls檔讀出之後全部都是字串,所以必須轉成數字,但我們只需要轉有數字的部份,這也是為什麼Step1 & Step2的地方要先把所有有英文字的位置先找出來。

然後這邊主要要改的有三個
(1)第十行的start time (2)第十二行的endtime (3)底下的一堆的32

(1)(2)的部份要對照剛剛從工作站下載下來的其中一個檔案list.txt,看自己的第一個cls是從哪邊開始,如下圖。如果想作10/01~10/15那就放starttime=2 endtime=16

(3)而這一堆的32是指垂直有32層,如果欲求不滿,想要來個威猛200層也是不反對(通常sounding資料都可以超過 2000層),那就要先去修改inteptest這支function,這支function設定每25hPa做一次fitting,如果想要改細,那就在inteptest的倒數第二行"aa=aa-25"的地方把25改小,然後把回圈loop次數調高就可以了。(目前設定是讓回圈跑到200hPa)


Step4:執行Matlab主程式,他就會自動吐出一天四筆且內插過的測站資料,如果有人白爛少放了一次氣球,沒關係防爆功能也已經做好了,該次就會整個column顯示nan(但一天只放一顆或兩顆的目前還沒把防爆功能寫入,3~8顆的都可以順利讀入,如果數量過多或過少則一天四筆都會顯示nan)。而目前設定輸出 RH H U V W qv T等變數。








2013年1月17日 星期四

How to read TRMM hdf data by Matlab (1A,2A )

Maybe lots of people also face the same problem when they try to use TRMM data. Here, I want to write down every steps as detail as possible to make sure that people who have no idea can operate this useful data easily.


Step1: Make sure your personal computer is installed with Matlab(any version is available )

Step2:Download the data from NASA website
http://mirador.gsfc.nasa.gov/cgi-bin/mirador/presentNavigation.pl?tree=project&project=TRMM&dataGroup=Orbital&CGISESSID=66232b166b683630dfde5075b086bba4&location=(-90,-180),(90,180)
and choose by date and make sure the orbits of TRMM in your data can cover the domain you want to select.
(in 2A25 you can find a logo near the size information, you can use it to check the orbit of your data)












Step3 :Use Matleb intrinsic function hdftool















Step4: There will be a message box popping out



















Step 5:expand the column and select the data that you want to import
EX: find the scan navigation,which can show the track of your satellite.
you can use "import" bottom or the import command to get the matrix you want.











Step6:the dimension of matrixes have different meanings

if the dimension is 9249*1--->9249=time step,1=the value of measure on the Nadir(星下點)
if the dimension is 9249*49--> 9249=time step,49=the 49 pixels near the Nadir
if the dimension is 9249*49*2 (or 9249*49*6)--> 2 and 6 can be different parameter for the RADAR function
if the dimension is 9249*49*80--> 80 means the vertical measurement(cross section)


For more detail information can be found in the guide book
http://www.eorc.jaxa.jp/TRMM/document/text/handbook_e.pdf



2013年1月3日 星期四

Interesting raining in winter Taiwan

                                          http://www.cwb.gov.tw/V7/observe/radar/?type=2

This RADAR reflectivity  shows one of the most common raining type in winter Taiwan.

(1) Local precipitation due to winter monsoon(north-easterly) and topography (raining region is concentrated in 宜蘭  and 基隆). The cloud of this type precipitation is relative shallow(stratus cloud) and the maximum diabatic heating level is around 850hPa
(2)The convergence zone between land-sea breeze and winter monsoon , its raining region is near the east coast of Taiwan. This type of raining is getting stronger in the midnight when the land breeze is the strongest. It's heating profile is close to deep convection but more stationary (it can last over 3 days)
 (3)"Overrunning". the warm-moisture air from south China sea is tilting by northeasterly, and when the free troposphere is stable(with strong stratification), the feature of gravity wave becomes more obvious. Its raining region can go across from south to north Taiwan.

The speed of gravity wave we saw on the RADAR is around 70km/hr=19.45m/s. It's easy to say this is 3or 4th internal mode from a simplification wave speed diagnostic equation. The maximum heating level is around
800hPa~700hPa.

External Mode~300m/s
1st internal mode~60m/s
2st internal mode~(60/2)=30 m/s
3st internal mode~(60/3)=20 m/s
4st internal mode~(60/4)=15m/s
...
nth. internal mode~(60/n)=... (m/s)
..
and the maximum heating profile is also easy to find on the following  picture.