source: trunk/src/TropFlux_swr_NRT_19890101_20091231.pro @ 79

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

precision in procedure (tools and fields)

File size: 4.1 KB
Line 
1;+
2;
3; .. _TropFlux_swr_NRT_19890101_20091231.pro:
4;
5; ======================================
6; TropFlux_swr_NRT_19890101_20091231.pro
7; ======================================
8;
9;
10;     .. graphviz::
11;
12;        digraph tropflux_swr_nrt_19890101_200912311 {
13;           graph [
14;           rankdir="LR",
15;           ]
16;           file_sw [shape=ellipse,fontname=Courier,label="/Users/pkb/data/TropFlux/TropFlux_swr_19890101_20071231_DT_v50.nc"];
17;           file_olr [shape=ellipse,fontname=Courier,label="/Users/pkb/data/heat_budget/NOAA_OLR/olr_oafluxgrid_30n30s_19890101_20091231.nc"];
18;           ncfile [shape=ellipse,fontname=Courier,label="/Users/pkb/data/TropFlux/TropFlux_swr_19890101_20091231_NRT_v50.nc"];
19;
20;           tropflux_swr_nrt_19890101_200912311 [shape=box,
21;           fontname=Courier,
22;           color=blue,
23;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/TropFlux_swr_NRT_19890101_200912311.pro",
24;           label="${PROJECT}/src/TropFlux_swr_NRT_19890101_200912311.pro"];
25;
26;           {file_sw file_olr}-> {tropflux_swr_nrt_19890101_200912311} -> {ncfile}
27;       }
28;
29; SEE ALSO
30; ========
31;
32; :func:`initncdf <saxo:initncdf>`
33; :func:`read_ncdf <saxo:read_ncdf>`
34; :func:`julday <saxo:julday>`
35; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>`
36;
37; EXAMPLES
38; ========
39;
40; ::
41;
42;  IDL> tropflux_swr_nrt_19890101_20091231
43;
44; TODO
45; ====
46;
47; hard coded directory - usage of ${PROJECT_ID}
48;
49; coding rules
50;
51; change the name to swr_nrt_correction_ncdf.pro
52;
53; EVOLUTIONS
54; ==========
55;
56; - fplod 20101215T092145Z aedon.locean-ipsl.upmc.fr (Darwin)
57;
58;   * add graph in header
59;
60; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin)
61;
62;   * minimal header
63;
64; - pbk 2008
65;
66;   * creation
67;
68;-
69pro TropFlux_swr_NRT_19890101_20091231
70@common
71file='/Users/pkb/data/TropFlux/TropFlux_swr_19890101_20071231_DT_v50.nc'
72initncdf, file
73sw=read_ncdf("swr", 19890101, 20071231, file=file,/nostr)
74
75swi=sw
76file_olr='/Users/pkb/data/heat_budget/NOAA_OLR/olr_oafluxgrid_30n30s_19890101_20091231.nc'
77
78initncdf,file_olr
79olr=read_ncdf('olr',19890100, 20071231,file=file_olr,/nost)
80
81help, sw, olr
82
83;;creating climatology
84
85ny=(2007-1989)+1
86nt=365*ny
87olri=total(reform(olr(*,*,0:nt-1),nxt,nyt,365,ny),4)/ny
88swi=total(reform(swi(*,*,0:nt-1),nxt,nyt,365,ny),4)/ny
89
90help, olri, swi
91
92;; applying smoothing
93nsmooth=45
94
95swi=[[[swi]],[[swi]],[[swi]]] & olri=[[[olri]],[[olri]],[[olri]]]
96si=size(sw) & n1=si(1) & n2=si(2)
97
98for j=0,n2-1 do begin
99  for i=0,n1-1 do begin
100    x=reform(swi(i,j,*))
101    y=reform(olri(i,j,*))
102    swi(i,j,*)=smooth(x,nsmooth)
103    olri(i,j,*)=smooth(y,nsmooth)
104  endfor
105endfor
106
107swi=swi[*,*,365:365+364] & olri=olri[*,*,365:365+364]
108help, swi
109
110initncdf, file_olr
111olr=read_ncdf('olr', 19890100, 20091231, box=box, file=file_olr,/nostr)
112tt=time & jpt=n_elements(time)
113caldat, time,mon,day,yea
114swm=olr*0. & olrm=olr*0.
115for jt=0,jpt-1 do begin
116  jtt=(time(jt)-julday(1,1,yea(jt))) < 364
117  swm(*,*,jt)=swi(*,*,jtt)
118  olrm(*,*,jt)=olri(*,*,jtt)
119endfor
120
121help, swm, olrm
122
123olra=olr-olrm                       ; olr anomaly
124rec=swm+(olra/0.760364)             ; reconstructed sw
125;writing field
126time=julday(1,1,1989)+lindgen(7670)
127cda0=string(jul2date(tt(0)),format='(i8.8)')
128cda1=string(jul2date(tt(jpt-1)),format='(i8.8)')
129
130lat=reform(gphit(0,0:jpj-1))
131lon=reform(glamt(0:jpi-1,0))
132time=time-julday(1,1,1950) & jpt=n_elements(time)
133
134ncfile='!/Users/pkb/data/TropFlux/TropFlux_swr_19890101_20091231_NRT_v50.nc'
135lon_attr={units:'degrees_east',long_name:'Longitude'}
136lat_attr={units:'degrees_north',long_name:'Latitude'}
137time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:''}
138sw_attr={units:'w/m^2',missing_value:1.e20,long_name:'Net Shortwave Radiation',short_name:'swr',axis:'TYX'}
139globattr={source:'Reconstructed from corrected OLR anomalies and TropFlux mean SWR climatology',timerange:cda0+' - '+cda1}
140
141
142ncfields = 'sw[longitude,latitude,time]=rec:sw_attr; ' $
143                      + 'longitude[]=lon:lon_attr; ' $
144                      + 'latitude[]=lat:lat_attr; ' $
145                      + 'time[*time]=time:time_attr ' $
146                      + ' @ globattr'
147
148@ncdf_quickwrite
149
150end
Note: See TracBrowser for help on using the repository browser.