1 | ;+ |
---|
2 | ; |
---|
3 | ; .. _cronin_gustiness_ncdf.pro: |
---|
4 | ; |
---|
5 | ; ========================= |
---|
6 | ; cronin_gustiness_ncdf.pro |
---|
7 | ; ========================= |
---|
8 | ; |
---|
9 | ; Cronin gustiness correction on corrected sst on OAFLUX grid |
---|
10 | ; |
---|
11 | ; :file:`${PROJECT_OD}/TropFlux_sst_19890101_20091231.nc` have been produced by |
---|
12 | ; :ref:`sst_correction_ncdf.pro`. |
---|
13 | ; |
---|
14 | ; Cronin gustiness corrected ++ on corrected sst on OAFLUX grid |
---|
15 | ; is written in |
---|
16 | ; :file:`${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc` |
---|
17 | ; if this file not already exists. |
---|
18 | ; |
---|
19 | ; This file will be used by :ref:`TropFlux_swr_BLND_19890101_20091231.pro` and |
---|
20 | ; :ref:`TropFlux_19890101_20091231.pro`. |
---|
21 | ; |
---|
22 | ; .. graphviz:: |
---|
23 | ; |
---|
24 | ; digraph cronin_gustiness_ncdf { |
---|
25 | ; |
---|
26 | ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_sst_19890101_20091231.nc"]; |
---|
27 | ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc"]; |
---|
28 | ; |
---|
29 | ; cronin_gustiness_ncdf [shape=box, |
---|
30 | ; fontname=Courier, |
---|
31 | ; color=blue, |
---|
32 | ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/cronin_gustiness_ncdf.pro", |
---|
33 | ; label="${PROJECT}/src/cronin_gustiness_ncdf.pro"]; |
---|
34 | ; |
---|
35 | ; {file_in} -> {cronin_gustiness_ncdf} -> {file_out} |
---|
36 | ; } |
---|
37 | ; |
---|
38 | ; EXAMPLES |
---|
39 | ; ======== |
---|
40 | ; |
---|
41 | ; :: |
---|
42 | ; |
---|
43 | ; IDL> cronin_gustiness_ncdf |
---|
44 | ; |
---|
45 | ; SEE ALSO |
---|
46 | ; ======== |
---|
47 | ; |
---|
48 | ; :ref:`project_profile.sh` |
---|
49 | ; |
---|
50 | ; :ref:`mooring_corrections` |
---|
51 | ; |
---|
52 | ; :ref:`sst_correction_ncdf.pro`. |
---|
53 | ; |
---|
54 | ; :func:`initncdf <saxo:initncdf>` |
---|
55 | ; :func:`julday <saxo:julday>` |
---|
56 | ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` |
---|
57 | ; |
---|
58 | ; TODO |
---|
59 | ; ==== |
---|
60 | ; |
---|
61 | ; coding rules |
---|
62 | ; |
---|
63 | ; why writing more than 1 timestep ? |
---|
64 | ; |
---|
65 | ; KNOWN ISSUES |
---|
66 | ; ============ |
---|
67 | ; |
---|
68 | ; test of existence of fullfilename_in not very efficient because |
---|
69 | ; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented |
---|
70 | ; |
---|
71 | ; EVOLUTIONS |
---|
72 | ; ========== |
---|
73 | ; |
---|
74 | ; $Id$ |
---|
75 | ; |
---|
76 | ; $URL$ |
---|
77 | ; |
---|
78 | ; - fplod 20110808T144208Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
79 | ; |
---|
80 | ; * usage of ${PROJECT_OD} |
---|
81 | ; * complete description |
---|
82 | ; * remove v50 in output filename |
---|
83 | ; * remove return statement |
---|
84 | ; |
---|
85 | ; - fplod 20101215T092619Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
86 | ; |
---|
87 | ; * add graph in header |
---|
88 | ; |
---|
89 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
90 | ; |
---|
91 | ; * minimal header |
---|
92 | ; |
---|
93 | ; - pbk 2008 |
---|
94 | ; |
---|
95 | ; * creation |
---|
96 | ; |
---|
97 | ;- |
---|
98 | pro cronin_gustiness_ncdf |
---|
99 | ; |
---|
100 | @cm_4cal |
---|
101 | @cm_4data |
---|
102 | @cm_4mesh |
---|
103 | @cm_4data |
---|
104 | @cm_project |
---|
105 | ; |
---|
106 | ; test if ${PROJECT_OD} defined |
---|
107 | CASE project_od_env OF |
---|
108 | '' : BEGIN |
---|
109 | msg = 'eee : ${PROJECT_OD} is not defined' |
---|
110 | ras = report(msg) |
---|
111 | STOP |
---|
112 | END |
---|
113 | ELSE: BEGIN |
---|
114 | msg = 'iii : ${PROJECT_OD} is ' + project_od_env |
---|
115 | ras = report(msg) |
---|
116 | END |
---|
117 | ENDCASE |
---|
118 | ; |
---|
119 | ; check if output data will be possible |
---|
120 | iodirout = isadirectory(project_od_env) |
---|
121 | ; |
---|
122 | ; existence and protection for reading |
---|
123 | IF (FILE_TEST(iodirout, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
124 | msg = 'eee : the directory' + iodirout + ' is not accessible.' |
---|
125 | ras = report(msg) |
---|
126 | STOP |
---|
127 | ENDIF |
---|
128 | ; |
---|
129 | ; existence and protection for writing |
---|
130 | IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN |
---|
131 | msg = 'eee : the directory' + iodirout + ' was not found.' |
---|
132 | ras = report(msg) |
---|
133 | STOP |
---|
134 | ENDIF |
---|
135 | ; |
---|
136 | da1=19880101 & da2=20101231 |
---|
137 | date1=19890101 & date2=20081231 |
---|
138 | ; |
---|
139 | ; build data filename |
---|
140 | filename='TropFlux_sst_19890101_20091231.nc' |
---|
141 | ; |
---|
142 | ; check if this file exists |
---|
143 | fullfilename = isafile(iodirout + filename, NEW=0, /MUST_EXIST) |
---|
144 | IF fullfilename[0] EQ '' THEN BEGIN |
---|
145 | msg = 'eee : the file ' + fullfilename + ' was not found.' |
---|
146 | ras = report(msg) |
---|
147 | STOP |
---|
148 | ENDIF |
---|
149 | ; |
---|
150 | ; build output filename |
---|
151 | filename_out = 'TropFlux_gustiness_19890101_20091231.nc' |
---|
152 | fullfilename_out = iodirout + filename_out |
---|
153 | ; in order to avoid unexpected overwritten |
---|
154 | IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN |
---|
155 | msg = 'eee : the file ' + fullfilename_out + ' already exists.' |
---|
156 | ras = report(msg) |
---|
157 | STOP |
---|
158 | ENDIF |
---|
159 | ; |
---|
160 | initncdf, fullfilename |
---|
161 | sst=read_ncdf('sst',da1,da2,file=fullfilename,/nostr) & sst=reform(sst-273.15) |
---|
162 | help, sst |
---|
163 | |
---|
164 | sst_clim=grossemoyenne(sst, 't',/nan) |
---|
165 | ;wg=0.175*sst_clim-3.17 ;; line fit obtained from the scatter (Cronin gustiness Vs ERAI SST) |
---|
166 | ;help, wg |
---|
167 | |
---|
168 | jpt=n_elements(time) |
---|
169 | |
---|
170 | wg_tot=sst*0. |
---|
171 | for jt=0, jpt-1 do begin |
---|
172 | wg_tot(*,*,jt)=(((sst_clim(*,*)-23.7)*2.1/(29.8-23.7)) > 1.) <2.1 |
---|
173 | endfor |
---|
174 | help, wg_tot |
---|
175 | |
---|
176 | ;; writing field |
---|
177 | time=timegen(7670, units='days', start=julday(1,1,1989,0)) & jpt=n_elements(time) |
---|
178 | |
---|
179 | cda0=string(jul2date(time(0)),format='(i8.8)') |
---|
180 | cda1=string(jul2date(time(jpt-1)),format='(i8.8)') |
---|
181 | tt=time-julday(1,1,1950,00,00,00) |
---|
182 | xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*)) |
---|
183 | |
---|
184 | ncfile='!' + fullfilename_out |
---|
185 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
186 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
187 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} |
---|
188 | gust_attr={units:'m/s',missing_value:valmask,long_name:'Climatological gustiness',short_name:'wg',axis:'TYX'} |
---|
189 | globattr={source:'Climatological wind gustiness obtained by fitting cronins gustiness values against sst ',timerange:cda0+' - '+cda1} |
---|
190 | |
---|
191 | ncfields = 'wg[longitude,latitude,time]=wg_tot:gust_attr; ' $ |
---|
192 | + 'longitude[]=xlon:lon_attr; ' $ |
---|
193 | + 'latitude[]=ylat:lat_attr; ' $ |
---|
194 | + 'tt[*time]=tt:time_attr ' $ |
---|
195 | + ' @ globattr' |
---|
196 | |
---|
197 | @ncdf_quickwrite |
---|
198 | |
---|
199 | end |
---|