1 | ;+ |
---|
2 | ; |
---|
3 | ; .. _TropFlux_swr_BLND_19890101_20091231.pro: |
---|
4 | ; |
---|
5 | ; ======================================= |
---|
6 | ; TropFlux_swr_BLND_19890101_20091231.pro |
---|
7 | ; ======================================= |
---|
8 | ; |
---|
9 | ; :file:`${PROJECT_OD}/TropFlux_swr_19890101_20071231_DT.nc` |
---|
10 | ; containing ++ |
---|
11 | ; have been produced by :ref:`TropFlux_swr_DT_19890101_20071231.pro`. |
---|
12 | ; |
---|
13 | ; :file:`${PROJECT_OD}/TropFlux_swr_19890101_20091231_NRT.nc` |
---|
14 | ; containing ++ |
---|
15 | ; have been produced by :ref:`TropFlux_swr_NRT_19890101_20091231.pro`. |
---|
16 | ; |
---|
17 | ; :file:`${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc` containing ++ |
---|
18 | ; have been produced by :ref:` cronin_gustiness_ncdf.pro`. |
---|
19 | ; |
---|
20 | ; ++ are written |
---|
21 | ; in :file:`${PROJECT_OD}/TropFlux_swr_19890101_20091231_BLND.nc` |
---|
22 | ; if this file not already exists. |
---|
23 | ; |
---|
24 | ; This file will be used by :ref:`TropFlux_19890101_20091231.pro`. |
---|
25 | ; |
---|
26 | ; .. graphviz:: |
---|
27 | ; |
---|
28 | ; digraph tropflux_swr_blnd_19890101_20091231 { |
---|
29 | ; graph [ |
---|
30 | ; rankdir="LR", |
---|
31 | ; ] |
---|
32 | ; |
---|
33 | ; file_dt [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20071231_DT.nc"]; |
---|
34 | ; file_nrt [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20091231_NRT.nc"]; |
---|
35 | ; file_gustiness [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc"]; |
---|
36 | ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20091231_blnd.nc"]; |
---|
37 | ; |
---|
38 | ; tropflux_swr_blnd_19890101_20091231 [shape=box, |
---|
39 | ; fontname=Courier, |
---|
40 | ; color=blue, |
---|
41 | ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/TropFlux_swr_BLND_19890101_20091231.pro", |
---|
42 | ; label="${PROJECT}/src/TropFlux_swr_BLND_19890101_20091231.pro"]; |
---|
43 | ; |
---|
44 | ; {file_dt file_nrt file_gustiness} -> {tropflux_swr_blnd_19890101_20091231} -> {file_out} |
---|
45 | ; |
---|
46 | ; } |
---|
47 | ; |
---|
48 | ; SEE ALSO |
---|
49 | ; ======== |
---|
50 | ; |
---|
51 | ; :func:`initncdf <saxo:initncdf>` |
---|
52 | ; :func:`read_ncdf <saxo:read_ncdf>` |
---|
53 | ; :func:`julday <saxo:julday>` |
---|
54 | ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` |
---|
55 | ; |
---|
56 | ; EXAMPLES |
---|
57 | ; ======== |
---|
58 | ; |
---|
59 | ; :: |
---|
60 | ; |
---|
61 | ; IDL> .compile TropFlux_swr_BLND_19890101_20091231 |
---|
62 | ; IDL> tropflux_swr_blnd_19890101_20091231 |
---|
63 | ; |
---|
64 | ; |
---|
65 | ; TODO |
---|
66 | ; ==== |
---|
67 | ; |
---|
68 | ; avoid mix lower/uppercase in pro name to avoid compile |
---|
69 | ; |
---|
70 | ; coding rules |
---|
71 | ; |
---|
72 | ; complete description |
---|
73 | ; |
---|
74 | ; why different date1 and date2 when readind dt and nrt |
---|
75 | ; |
---|
76 | ; why two read_ncdf for nrt |
---|
77 | ; |
---|
78 | ; according to pk 20110811 we can include this process in TropFlux_swr_NRT_19890101_20091231.pro |
---|
79 | ; |
---|
80 | ; KNOWN ISSUES |
---|
81 | ; ============ |
---|
82 | ; |
---|
83 | ; test of existence of fullfilename_in not very efficient because |
---|
84 | ; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented |
---|
85 | ; |
---|
86 | ; EVOLUTIONS |
---|
87 | ; ========== |
---|
88 | ; |
---|
89 | ; - fplod 20110809T115747Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
90 | ; |
---|
91 | ; * usage of ${PROJECT_OD} |
---|
92 | ; * remove v* from filenames (in and out) |
---|
93 | ; * add test on IO files |
---|
94 | ; |
---|
95 | ; - fplod 20101215T085754Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
96 | ; |
---|
97 | ; * add graph in header |
---|
98 | ; |
---|
99 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
100 | ; |
---|
101 | ; * minimal header |
---|
102 | ; |
---|
103 | ; - pbk 2008 |
---|
104 | ; |
---|
105 | ; * creation |
---|
106 | ; |
---|
107 | ;- |
---|
108 | pro TropFlux_swr_BLND_19890101_20091231 |
---|
109 | ; |
---|
110 | @cm_4cal |
---|
111 | @cm_4data |
---|
112 | @cm_4mesh |
---|
113 | @cm_4data |
---|
114 | @cm_project |
---|
115 | ; |
---|
116 | ; |
---|
117 | ; test if ${PROJECT_OD} defined |
---|
118 | CASE project_od_env OF |
---|
119 | '' : BEGIN |
---|
120 | msg = 'eee : ${PROJECT_OD} is not defined' |
---|
121 | ras = report(msg) |
---|
122 | STOP |
---|
123 | END |
---|
124 | ELSE: BEGIN |
---|
125 | msg = 'iii : ${PROJECT_OD} is ' + project_od_env |
---|
126 | ras = report(msg) |
---|
127 | END |
---|
128 | ENDCASE |
---|
129 | ; |
---|
130 | ; check if output data will be possible |
---|
131 | iodirout = isadirectory(project_od_env) |
---|
132 | ; |
---|
133 | ; existence and protection for reading |
---|
134 | IF (FILE_TEST(iodirout, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
135 | msg = 'eee : the directory' + iodirout + ' is not accessible.' |
---|
136 | ras = report(msg) |
---|
137 | STOP |
---|
138 | ENDIF |
---|
139 | ; |
---|
140 | ; existence and protection for writing |
---|
141 | IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN |
---|
142 | msg = 'eee : the directory' + iodirout + ' was not found.' |
---|
143 | ras = report(msg) |
---|
144 | STOP |
---|
145 | ENDIF |
---|
146 | ; |
---|
147 | ; build dt data filename |
---|
148 | filename_dt="TropFlux_swr_19890101_20071231_DT.nc" |
---|
149 | ; |
---|
150 | ; check if this file exists |
---|
151 | msg='iii : looking for ' + filename_dt |
---|
152 | ras = report(msg) |
---|
153 | fullfilename_dt = isafile(iodirout + filename_dt, NEW=0, /MUST_EXIST) |
---|
154 | IF fullfilename_dt[0] EQ '' THEN BEGIN |
---|
155 | msg = 'eee : the file ' + fullfilename_dt + ' was not found.' |
---|
156 | ras = report(msg) |
---|
157 | STOP |
---|
158 | ENDIF |
---|
159 | |
---|
160 | ; build nrt data filename |
---|
161 | filename_nrt="TropFlux_swr_19890101_20091231_NRT.nc" |
---|
162 | ; |
---|
163 | ; check if this file exists |
---|
164 | msg='iii : looking for ' + filename_nrt |
---|
165 | ras = report(msg) |
---|
166 | fullfilename_nrt = isafile(iodirout + filename_nrt, NEW=0, /MUST_EXIST) |
---|
167 | IF fullfilename_nrt[0] EQ '' THEN BEGIN |
---|
168 | msg = 'eee : the file ' + fullfilename_nrt + ' was not found.' |
---|
169 | ras = report(msg) |
---|
170 | STOP |
---|
171 | ENDIF |
---|
172 | ; |
---|
173 | ; build wg data filename |
---|
174 | filename_wg="TropFlux_gustiness_19890101_20091231.nc" |
---|
175 | ; |
---|
176 | ; check if this file exists |
---|
177 | msg='iii : looking for ' + filename_wg |
---|
178 | ras = report(msg) |
---|
179 | fullfilename_wg = isafile(iodirout + filename_wg, NEW=0, /MUST_EXIST) |
---|
180 | IF fullfilename_wg[0] EQ '' THEN BEGIN |
---|
181 | msg = 'eee : the file ' + fullfilename_wg + ' was not found.' |
---|
182 | ras = report(msg) |
---|
183 | STOP |
---|
184 | ENDIF |
---|
185 | ; |
---|
186 | ; build output filename |
---|
187 | filename_out = 'TropFlux_swr_19890101_20091231_BLND.nc' |
---|
188 | fullfilename_out = iodirout + filename_out |
---|
189 | ; in order to avoid unexpected overwritten |
---|
190 | IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN |
---|
191 | msg = 'eee : the file ' + fullfilename_out + ' already exists.' |
---|
192 | ras = report(msg) |
---|
193 | STOP |
---|
194 | ENDIF |
---|
195 | ; |
---|
196 | initncdf, fullfilename_dt |
---|
197 | dt=read_ncdf("swr", 19890101, 20071231, file=fullfilename_dt,/nostr) |
---|
198 | help, dt |
---|
199 | |
---|
200 | initncdf, fullfilename_nrt |
---|
201 | nrt=read_ncdf("sw", 20080100, 20100112, file=fullfilename_nrt,/nostr) |
---|
202 | help, nrt |
---|
203 | |
---|
204 | swr_nrt=read_ncdf("sw", 19880101, 20100112, file=fullfilename_nrt,/nostr) |
---|
205 | |
---|
206 | swr_dt=[[[dt]],[[nrt]]] |
---|
207 | help, swr_dt, swr_nrt |
---|
208 | |
---|
209 | swr_merged=swr_dt*0. |
---|
210 | |
---|
211 | time=timegen(7670, units='days', start=julday(1,1,1989,0)) & jpt=n_elements(time) |
---|
212 | |
---|
213 | a=interpol([1.,0.],[julday(10,01,2007),julday(12,31,2007)],time) |
---|
214 | a=((a > 0.) < 1.) |
---|
215 | for jt=0,jpt-1 do swr_merged(*,*,jt)=swr_dt(*,*,jt)*a(jt)+(1-a(jt))*swr_nrt(*,*,jt) |
---|
216 | |
---|
217 | initncdf, file_wg |
---|
218 | time=timegen(7670, units='days', start=julday(1,1,1989,0)) & jpt=n_elements(time) |
---|
219 | lat=reform(gphit(0,0:jpj-1)) |
---|
220 | lon=reform(glamt(0:jpi-1,0)) |
---|
221 | cda0=string(jul2date(time(0)),format='(i8.8)') |
---|
222 | cda1=string(jul2date(time(jpt-1)),format='(i8.8)') |
---|
223 | |
---|
224 | time=time-julday(1,1,1950,00,00) |
---|
225 | ncfile='!' + fullfilename_out |
---|
226 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
227 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
228 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'} |
---|
229 | sw_attr={units:'w/m^2',missing_value:1.e20,long_name:'Net Shortwave Radiation',short_name:'swr',axis:'TYX'} |
---|
230 | globattr={source:'ISCCP based SWR until 2007, after 2007 timeseries is completed with OLR based SWR. A linear transition is applied from ISCCP based SWR to OLR based SWR'} |
---|
231 | |
---|
232 | ncfields = 'swr[longitude,latitude,time]=swr_merged:sw_attr; ' $ |
---|
233 | + 'longitude[]=lon:lon_attr; ' $ |
---|
234 | + 'latitude[]=lat:lat_attr; ' $ |
---|
235 | + 'time[*time]=time:time_attr ' $ |
---|
236 | + ' @ globattr' |
---|
237 | |
---|
238 | @ncdf_quickwrite |
---|
239 | |
---|
240 | end |
---|