1 | ;+ |
---|
2 | ; |
---|
3 | ; .. _TropFlux_swr_DT_19890101_20071231.pro: |
---|
4 | ; |
---|
5 | ; ===================================== |
---|
6 | ; TropFlux_swr_DT_19890101_20071231.pro |
---|
7 | ; ===================================== |
---|
8 | ; |
---|
9 | ; DESCRIPTION |
---|
10 | ; =========== |
---|
11 | ; |
---|
12 | ; Correction of swr delay time on OAFLUX grid |
---|
13 | ; |
---|
14 | ; :file:`${PROJECT_OD}/swr_oafluxgrid_1985_2007.nc` |
---|
15 | ; have been produced ++by pk |
---|
16 | ; |
---|
17 | ; Corrected swr delay on OAFLUX grid |
---|
18 | ; is written in |
---|
19 | ; :file:`${PROJECT_OD}/TropFlux_swr_19890101_20071231_DT.nc` |
---|
20 | ; if this file not already exists. |
---|
21 | ; |
---|
22 | ; This file will be used by :ref:`TropFlux_swr_BLND_19890101_20091231.pro`. |
---|
23 | ; |
---|
24 | ; .. graphviz:: |
---|
25 | ; |
---|
26 | ; digraph tropflux_swr_dt_19890101_20071231 { |
---|
27 | ; |
---|
28 | ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/swr_oafluxgrid_1985_2007.nc"]; |
---|
29 | ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_swr_19890101_20071231_DT.nc"]; |
---|
30 | ; |
---|
31 | ; tropflux_swr_dt_19890101_20071231 [shape=box, |
---|
32 | ; fontname=Courier, |
---|
33 | ; color=blue, |
---|
34 | ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/TropFlux_swr_DT_19890101_20071231.pro", |
---|
35 | ; label="${PROJECT}/src/TropFlux_swr_DT_19890101_20071231.pro"]; |
---|
36 | ; |
---|
37 | ; {file_in}-> {tropflux_swr_dt_19890101_20071231} -> {file_out} |
---|
38 | ; |
---|
39 | ; } |
---|
40 | ; |
---|
41 | ; SEE ALSO |
---|
42 | ; ======== |
---|
43 | ; |
---|
44 | ; :ref:`project_profile.sh` |
---|
45 | ; |
---|
46 | ; :ref:`mooring_corrections` |
---|
47 | ; |
---|
48 | ; :ref:`data_in_swr` |
---|
49 | ; |
---|
50 | ; :func:`initncdf <saxo:initncdf>` |
---|
51 | ; :func:`read_ncdf <saxo:read_ncdf>` |
---|
52 | ; :func:`grossemoyenne <saxo:grossemoyenne>` |
---|
53 | ; :func:`julday <saxo:julday>` |
---|
54 | ; :func:`caldat <saxo:caldat>` |
---|
55 | ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` |
---|
56 | ; |
---|
57 | ; EXAMPLES |
---|
58 | ; ======== |
---|
59 | ; |
---|
60 | ; :: |
---|
61 | ; |
---|
62 | ; IDL> .compile TropFlux_swr_DT_19890101_20071231 |
---|
63 | ; IDL> tropflux_swr_dt_19890101_20071231 |
---|
64 | ; |
---|
65 | ; TODO |
---|
66 | ; ==== |
---|
67 | ; |
---|
68 | ; NaNf values in ouptut file while 1.e20 in input file !! |
---|
69 | ; |
---|
70 | ; coding rules |
---|
71 | ; |
---|
72 | ; why compile is needed ? uppercase in file name |
---|
73 | ; |
---|
74 | ; any way change the name to swr_dt_correction_ndcf.pro |
---|
75 | ; to homogenize names of tools |
---|
76 | ; |
---|
77 | ; use the output of concat_swr.sh to be written. |
---|
78 | ; now use swr_oafluxgrid_1985_2007.nc provided by pk 20110811 |
---|
79 | ; |
---|
80 | ; KNOWN ISSUES |
---|
81 | ; ============ |
---|
82 | ; |
---|
83 | ; test of existence of fullfilename not very efficient because |
---|
84 | ; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented |
---|
85 | ; |
---|
86 | ; EVOLUTIONS |
---|
87 | ; ========== |
---|
88 | ; |
---|
89 | ; $Id$ |
---|
90 | ; |
---|
91 | ; $URL$ |
---|
92 | ; |
---|
93 | ; - fplod 20110812T073138Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
94 | ; |
---|
95 | ; * usage of ${PROJECT_OD} |
---|
96 | ; * complete description |
---|
97 | ; * remove v50 in output filename |
---|
98 | ; |
---|
99 | ; - fplod 20101215T091726Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
100 | ; |
---|
101 | ; * add graph in header |
---|
102 | ; |
---|
103 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
104 | ; |
---|
105 | ; * minimal header |
---|
106 | ; |
---|
107 | ; - pbk 2008 |
---|
108 | ; |
---|
109 | ; * creation |
---|
110 | ; |
---|
111 | ;- |
---|
112 | pro TropFlux_swr_DT_19890101_20071231 |
---|
113 | ; |
---|
114 | @cm_4cal |
---|
115 | @cm_4data |
---|
116 | @cm_4mesh |
---|
117 | @cm_4data |
---|
118 | @cm_project |
---|
119 | ; |
---|
120 | ; test if ${PROJECT_OD} defined |
---|
121 | CASE project_od_env OF |
---|
122 | '' : BEGIN |
---|
123 | msg = 'eee : ${PROJECT_OD} is not defined' |
---|
124 | ras = report(msg) |
---|
125 | STOP |
---|
126 | END |
---|
127 | ELSE: BEGIN |
---|
128 | msg = 'iii : ${PROJECT_OD} is ' + project_od_env |
---|
129 | ras = report(msg) |
---|
130 | END |
---|
131 | ENDCASE |
---|
132 | ; |
---|
133 | ; check if output data will be possible |
---|
134 | iodirout = isadirectory(project_od_env) |
---|
135 | ; |
---|
136 | ; existence and protection for reading |
---|
137 | IF (FILE_TEST(iodirout, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
138 | msg = 'eee : the directory' + iodirout + ' is not accessible.' |
---|
139 | ras = report(msg) |
---|
140 | STOP |
---|
141 | ENDIF |
---|
142 | ; |
---|
143 | ; existence and protection for writing |
---|
144 | IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN |
---|
145 | msg = 'eee : the directory' + iodirout + ' was not found.' |
---|
146 | ras = report(msg) |
---|
147 | STOP |
---|
148 | ENDIF |
---|
149 | ; |
---|
150 | ; build data filename |
---|
151 | filename='swr_oafluxgrid_1985_2007.nc' |
---|
152 | ; |
---|
153 | ; check if this file exists |
---|
154 | msg='iii : looking for ' + filename |
---|
155 | ras = report(msg) |
---|
156 | fullfilename = isafile(iodirout + filename, NEW=0, /MUST_EXIST) |
---|
157 | IF fullfilename[0] EQ '' THEN BEGIN |
---|
158 | msg = 'eee : the file ' + fullfilename + ' was not found.' |
---|
159 | ras = report(msg) |
---|
160 | STOP |
---|
161 | ENDIF |
---|
162 | ; |
---|
163 | ; build output filename |
---|
164 | filename_out = 'TropFlux_swr_19890101_20071231_DT.nc' |
---|
165 | fullfilename_out = iodirout + filename_out |
---|
166 | ; in order to avoid unexpected overwritten |
---|
167 | IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN |
---|
168 | msg = 'eee : the file ' + fullfilename_out + ' already exists.' |
---|
169 | ras = report(msg) |
---|
170 | STOP |
---|
171 | ENDIF |
---|
172 | ; |
---|
173 | initncdf, filename |
---|
174 | |
---|
175 | sw=read_ncdf("swr", 19890101, 20071231, file=filename,/nostr) |
---|
176 | help, sw |
---|
177 | |
---|
178 | sw_mean=grossemoyenne(sw, 't',/nan) |
---|
179 | help, sw_mean |
---|
180 | |
---|
181 | tt=time & jpt=n_elements(time) |
---|
182 | caldat, time,mon,day,yea |
---|
183 | sw_m=sw*0. & sw_bias=sw*0. |
---|
184 | |
---|
185 | for jt=0,jpt-1 do begin |
---|
186 | jtt=(time(jt)-julday(1,1,yea(jt))) < 364 |
---|
187 | swr=reform(sw_mean(*,*)) |
---|
188 | sw_m(*,*,jt)=swr |
---|
189 | sw_bias(*,*,jt)=(((swr-295.4)*18.36/(200.-295.4)) > 0.) < 18.37 |
---|
190 | endfor |
---|
191 | |
---|
192 | help, sw_m, sw_bias |
---|
193 | swa=sw-sw_m |
---|
194 | swa=swa/(0.901273) ;; variability correction (seasonal_cycle_swr_isccp.pro) |
---|
195 | |
---|
196 | swr=sw_m+swa-sw_bias ;; new swr, corrected for bias and variability |
---|
197 | ;writing field |
---|
198 | ;time=julday(1,1,1989)+lindgen(7670) |
---|
199 | cda0=string(jul2date(tt(0)),format='(i8.8)') |
---|
200 | cda1=string(jul2date(tt(jpt-1)),format='(i8.8)') |
---|
201 | |
---|
202 | lat=reform(gphit(0,0:jpj-1)) |
---|
203 | lon=reform(glamt(0:jpi-1,0)) |
---|
204 | time=time-julday(1,1,1950) & jpt=n_elements(time) |
---|
205 | |
---|
206 | ncfile='!' + fullfilename_out |
---|
207 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
208 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
209 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'} |
---|
210 | sw_attr={units:'w/m^2',missing_value:1.e20,long_name:'Net Shortwave Radiation',short_name:'swr',axis:'TYX'} |
---|
211 | globattr={source:'Obtained from ISCCP. Corrections has been done on mean bias and variability',timerange:cda0+' - '+cda1} |
---|
212 | |
---|
213 | ncfields = 'swr[longitude,latitude,time]=swr:sw_attr; ' $ |
---|
214 | + 'longitude[]=lon:lon_attr; ' $ |
---|
215 | + 'latitude[]=lat:lat_attr; ' $ |
---|
216 | + 'time[*time]=time:time_attr ' $ |
---|
217 | + ' @ globattr' |
---|
218 | |
---|
219 | @ncdf_quickwrite |
---|
220 | |
---|
221 | end |
---|