source: trunk/src/TropFlux_19890101_20091231.pro @ 7

Last change on this file since 7 was 7, checked in by pinsard, 13 years ago

add some graph - io - in headers

  • Property svn:executable set to *
File size: 8.8 KB
Line 
1;+
2;
3; .. _TropFlux_19890101_20091231.pro:
4;
5; ==============================
6; TropFlux_19890101_20091231.pro
7; ==============================
8;
9; This program computes net heat flux components on the 1° oaflux grid.
10;
11; all input variables are corrected for mean bias and variability.
12;
13; gustiness correction is applied for wind speed based on cronin's climatological
14; gustiness values.
15;
16;
17; .. only:: man
18;
19; Figure is visible on PDF and HTML documents only.
20;
21; .. only:: html
22;
23;     .. graphviz::
24;
25;        digraph TropFlux_19890101_20091231 {
26;           graph [
27;           rankdir="LR",
28;           ]
29;           mask [shape=ellipse,fontname=Courier,label="/Volumes/Iomega_HDD/work/flux_reconstruction/gridded_data/mask_oaflux_30N30S.nc"];
30;           file_sst [shape=ellipse,fontname=Courier,label="/Volumes/Iomega_HDD/TropFlux/input_cor/full_cor/TropFlux_sst_19890101_20091231_v20.nc"];
31;           file_wind [shape=ellipse,fontname=Courier,label="/Volumes/Iomega_HDD/TropFlux/input_cor/full_cor/TropFlux_ws_19890101_20091231_v20.nc"];
32;           file_wg [shape=ellipse,fontname=Courier,label="/Users/pkb/data/TropFlux/TropFlux_gustiness_19890101_20091231_v50.nc"];
33;           file_sw [shape=ellipse,fontname=Courier,label="/Users/pkb/data/TropFlux/TropFlux_swr_19890101_20091231_BLND_v50.nc"];
34;           file_lw [shape=ellipse,fontname=Courier,label="/Volumes/Iomega_HDD/TropFlux/input_cor/full_cor/TropFlux_lwr_19890101_20091231_v2.nc"];
35;           file_air [shape=ellipse,fontname=Courier,label="/Users/pkb/data/TropFlux/TropFlux_t2m_19890101_20091231_v50.nc"];
36;           file_q [shape=ellipse,fontname=Courier,label="/Volumes/Iomega_HDD/TropFlux/input_cor/full_cor/TropFlux_q2m_19890101_20091231_v20.nc"];
37;
38;           ncfile [shape=ellipse,fontname=Courier,label="/Users/pkb/data/TropFlux/TropFlux_19890101_20091231_v51.nc"];
39;
40;           TropFlux_19890101_20091231 [shape=box,
41;           fontname=Courier,
42;           color=blue,
43;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/TropFlux_19890101_20091231.pro",
44;           label="${TROPFLUX}/src/TropFlux_19890101_20091231.pro"];
45;
46;           {mask file_sst file_wind file_wg file_sw file_lw file_air file_q} -> {TropFlux_19890101_20091231} -> {ncfile}
47;           
48;          }
49;
50; SEE ALSO
51; ========
52;
53; :func:`cor30a`
54;
55; EXAMPLES
56; ========
57;
58; ::
59;
60;  IDL> tropflux_19890101_20091231
61;
62; TODO
63; ====
64;
65; hard coded directory - usage of ${TROPFLUX_ID}
66;
67; coding rules
68;
69; EVOLUTIONS
70; ==========
71;
72; - fplod 20101214T112131Z aedon.locean-ipsl.upmc.fr (Darwin)
73;
74;   * add graph
75;
76; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin)
77;
78;   * minimal header
79;
80; - pbk 2008
81;
82;   * creation
83;
84;-
85;
86pro TropFlux_19890101_20091231
87@common
88
89da1=19880101 & da2=20101231
90file='/Volumes/Iomega_HDD/work/flux_reconstruction/gridded_data/mask_oaflux_30N30S.nc'
91initncdf, file
92msk=ncdf_lec(file,var='msk')
93
94dir='/Volumes/Iomega_HDD/TropFlux/input_cor/full_cor/'
95dir1='/Users/pkb/data/TropFlux/'
96
97file_sst=dir+'TropFlux_sst_19890101_20091231_v20.nc'
98file_wind=dir+'TropFlux_ws_19890101_20091231_v20.nc'
99file_sw=dir1+'TropFlux_swr_19890101_20091231_BLND_v50.nc'
100file_lw=dir+'TropFlux_lwr_19890101_20091231_v2.nc'
101file_air=dir1+'TropFlux_t2m_19890101_20091231_v50.nc'
102file_q=dir+'TropFlux_q2m_19890101_20091231_v20.nc'
103file_wg=dir1+'TropFlux_gustiness_19890101_20091231_v50.nc'
104
105initncdf, file_sst
106
107ws=read_ncdf('ws',da1,da2,file=file_wind,/nostr)
108wg=read_ncdf('wg',da1-1,da2,file=file_wg,/nostr)
109tt=time & jpt=n_elements(time)
110sst=read_ncdf('sst',da1,da2,file=file_sst,/nostr)
111sst=reform(sst-273.15)
112swd=read_ncdf('swr',da1,da2,file=file_sw,/nostr)
113lw=read_ncdf('lwr',da1,da2,file=file_lw,/nostr)
114swd=swd/0.94  ;; converting from net swr to downward swr
115
116t2m=read_ncdf('t2m',da1,da2,file=file_air,/nostr)-273.15   ; in C
117q2m=read_ncdf('q2m',da1,da2,file=file_q,/nostr)    ; in g/kg
118
119w=sqrt(ws*ws+wg*wg)  ;; wind corrected for gustiness
120w=ws
121tmask=msk
122help, ws,w,wg,u,sst,swd,t2m,q2m
123ocean=where(msk eq 1,compl=land)
124valmask=1.e20
125time=tt & jpt=n_elements(time)
126
127;
128;; Constants for flux computation
129;
130zu=10.                          ; height of wind speed measurement (m)
131us=0.                           ; surf current (m/s)
132zt=2.                           ; Height of air T measurement (m)
133zq=2.                           ; height of humidity measurement (m)
134P=1008.                         ; Pressure
135zi=600.                         ; Inversion height (m)
136jcool=0                         ; Compute cool-skin
137jwave=0                         ; No waves
138twave=5.
139hwave=1.
140
141caldat, time,mon,day,yea
142swr=fltarr(jpi,jpj,jpt)+1.e20
143lwr=fltarr(jpi,jpj,jpt)+1.e20
144lat=fltarr(jpi,jpj,jpt)+1.e20
145sen=fltarr(jpi,jpj,jpt)+1.e20
146lwnet_clrk=fltarr(jpi,jpj,jpt)+1.e20
147;Ch=fltarr(jpi,jpj,jpt)+1.e20
148;Ce=fltarr(jpi,jpj,jpt)+1.e20
149junk=fltarr(jpi,jpj,jpt)+1.e20
150
151for jt=0,jpt-1 do begin
152  jday=time(jt)-julday(1,1,yea(jt))
153  print, 'Computing Fluxes ',jt,' / ',jpt-1
154;
155;  P=msl(*,*,jt) & P=P(ocean)
156  wn=w(*,*,jt) & wn=wn(ocean)          ; wind speed (m/s)
157  ts=sst(*,*,jt) & ts=ts(ocean)        ; Bulk sst (°C)
158  t=t2m(*,*,jt) & t=t(ocean)           ; 2m Air T (°C)
159  qs=qsee(ts,P)                        ; Sea surface sat. spec. humidity (g/kg)
160  q=q2m(*,*,jt) & q=q(ocean)           ; 2m AIr specific humidity  (g/kg)
161  Rs=swd(*,*,jt) & Rs=Rs(ocean)        ; Downward solar flux (W/m2)
162  ylat=gphit(ocean)
163;  cld=calc_cloud(jday,Rs,ylat)
164  cld=calc_cloud_vlat(jday,Rs,ylat)
165;  Rl=lwdown_clark(ts,q,cld,t,P)        ; Downward IR flux (W/m2)
166  Rl=lw(*,*,jt) & Rl=Rl(ocean)
167  rain=0.
168  lw_clrk=-lwnet_clark(ts,q,cld,t,P)
169;  junk(*,*,jt)=lw_clrk
170;
171;stop
172  y=cor30a(wn,us,ts,t,Qs,Q,Rs,Rl,rain,zi,P,zu,zt,zq,ylat,jcool,jwave,twave,hwave)
173;
174
175; A few punctual missing values (coare does not converge): filled by spatial extrapolation
176  tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,0)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & swr(*,*,jt)=tab*msk+valmask*(1-msk)
177  tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,1)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & lwr(*,*,jt)=tab*msk+valmask*(1-msk)
178  tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,2)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & lat(*,*,jt)=tab*msk+valmask*(1-msk)
179  tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,3)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & sen(*,*,jt)=tab*msk+valmask*(1-msk)
180;  tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(lw_clrk) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & lwnet_clrk(*,*,jt)=tab*msk+valmask*(1-msk)
181;  tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,6)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & Ch(*,*,jt)=tab*msk+valmask*(1-msk)
182;  tab=fltarr(jpi,jpj)+!values.f_nan & x=reform(y(*,7)) & tab(ocean)=x & m=finite(tab) & tab=extrapolate(tab,m) & Ce(*,*,jt)=tab*msk+valmask*(1-msk)
183endfor
184tt=time
185time=timegen(7670, start=julday(1,1,1989,0), units='days') & jpt=n_elements(time)
186;
187cda0=string(jul2date(time(0)),format='(i8.8)')
188cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
189tt=time-julday(1,1,1950,00,00,00)
190xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*))
191
192ncfile='!/Users/pkb/data/TropFlux/TropFlux_19890101_20091231_v51.nc'
193lon_attr={units:'degrees_east',long_name:'Longitude'}
194lat_attr={units:'degrees_north',long_name:'Latitude'}
195swr_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net shortwave radiation',short_name:'swr',axis:'TYX'}
196lwr_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net longwave radiation',short_name:'lwr',axis:'TYX'}
197lwr_clrk_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net longwave radiation from clark',short_name:'lwr',axis:'TYX'}
198lhf_attr={units:'W/m2',missing_value:valmask,long_name:'Surface latent flux',short_name:'lhf',axis:'TYX'}
199shf_attr={units:'W/m2',missing_value:valmask,long_name:'Surface sensible flux',short_name:'shf',axis:'TYX'}
200time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'}
201Ch_attr={units:'',missing_value:valmask,long_name:'heat transfer coefficient at zt',short_name:'Ch',axis:'TYX'}
202Ce_attr={units:'',missing_value:valmask,long_name:'moisture transfer coefficient at zq',short_name:'Ce',axis:'TYX'}
203
204globattr={source:'Fluxes for the Global Tropical Ocean - TropFlux',timerange:cda0+' - '+cda1}
205
206help, swr,lwr,lat,sen,tt,xlon,ylat
207
208ncfields = 'swr[longitude,latitude,time]=swr:swr_attr; ' $
209;          +'lwr_coare[longitude,latitude,time]=lwr:lwr_attr; ' $
210          +'lwr[longitude,latitude,time]=lwnet_clrk:lwr_clrk_attr; ' $
211          +'lhf[longitude,latitude,time]=lat:lhf_attr; ' $
212          +'shf[longitude,latitude,time]=sen:shf_attr; ' $
213;          +'Ch[longitude,latitude,time]=Ch:Ch_attr; ' $
214;          +'Ce[longitude,latitude,time]=Ce:Ce_attr; ' $
215                      + 'longitude[]=xlon:lon_attr; ' $
216                      + 'latitude[]=ylat:lat_attr; ' $
217                      + 'tt[*time]=tt:time_attr ' $
218                      + ' @ globattr'
219
220@ncdf_quickwrite
221
222return
223end
Note: See TracBrowser for help on using the repository browser.