Calculating Sat. water vapor pressure from air temperature: What is wrong? [message #53329] |
Mon, 02 April 2007 17:53 |
kim20026
Messages: 54 Registered: November 2006
|
Member |
|
|
Goodday, everyone. I came with a new question. Please take a look at
this code.
I am going to calculate saturated water vapor pressure from air
temperature using clausius-clapeyron equation.
The air temperature is on tem(4:27, *) in my test.txt below.
;site_id year month day h01 h02 h03 h04 h05 h06 h07 h08 h09 h10 h11
h12 h13 h14 h15 h16 h17 h18 h19 h20 h21 h22 h23 h24
; 90 2003 1 1 -53 -21 -22 -38 -44 -52 -50
-51 -23 -12 -6 1 1 13 6 4 -13 -19
-29 -34 -43 -59 -59 -61
; 90 2003 1 2 -71 -65 -76 -69 -70 -73 -67
-69 -43 -9 4 6 14 9 21 14 0 -5
-7 -15 -17 -13 -10 -24
; 90 2003 1 3 -17 -7 -6 -14 -23 -9 -16
-11 -19 4 13 17 24 15 9 5 -9 -19
-19 -25 -33 -41 -50 -52
.
.
.
I want to keep the first 1 to 4 columns and change 4 to 28 columns
with this equation.
tem0 = tem/10 - 273.3 ; for unit conversion from celcius into K.
SatVP = 6.11*exp(19.59*(tem0-273.3)/tem0) ; modified clausius-
clapeyron equation.
So, I tried this way.
---------------------------------
pro SatVPNWS
file = 'test.txt'
ndata = file_lines(file) ;number of lines in data file
site_num = 72 ; NATIONAL WEATHER STATION IN KOREA
tem = intarr(28, ndata)
tem0 = tem/10 - 273.3
SatVP = 6.11*exp(19.59*(tem0-273.3)/tem0)
close, 1
openr, 1, file ;reading air temperature measured in NWS
readf, 1, tem
close, 1
openw,2, 'SatVP_00.txt'
for j=0,ndata-1 do begin
printf, 2, tem[0:3,j], satVP[4:27,j] , format = '(4i6,2x,24F8.3,
2x)'
endfor
close, 2
end
-----------------------------
and this is the SatVP_00.txt
90 2003 1 1
************************************************************ ************************************************************ ************************************************************ *************
90 2003 1 2
************************************************************ ************************************************************ ************************************************************ ************
90 2003 1 3
************************************************************ ************************************************************ ************************************************************ ************
There must be something wrong, but I don't know what is it exactly.
Firstly, I suspected the format statement. I changed the parmeters and
ran again and again, but the results were always same.
Please give me some suggestions for correct format for this case, and
check if I make other mistakes. Thanks.
Harry
|
|
|