1 | PRO forcagequimarche,iyear,ian |
---|
2 | @init2 |
---|
3 | @initorca2_bab |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | @common |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | ;ian='01' |
---|
13 | ;iyear='1993' |
---|
14 | |
---|
15 | e_exp='ESS' |
---|
16 | rep_fred='/usr/work/sur/fvi/OPA/geomag/' |
---|
17 | key_portrait = 0 |
---|
18 | ; stockage des fichiers brut |
---|
19 | ioDATA='/usr/work/sur/fvi/OPA/ORCA2/' |
---|
20 | file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' |
---|
21 | print, file_U |
---|
22 | file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' |
---|
23 | print, file_V |
---|
24 | file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' |
---|
25 | print, file_T |
---|
26 | file_Sed= rep_fred+'cond_sed_ORCA2.nc' |
---|
27 | file_Br= rep_fred+'Br_ORCA2.nc' |
---|
28 | |
---|
29 | |
---|
30 | ; title |
---|
31 | t_exp= e_exp |
---|
32 | ; t_exp0= e_exp0 |
---|
33 | t_bt = 'bar_transp' |
---|
34 | ioORLN2 = '/usr/work/sur/fvi/OPA/ORCA2' |
---|
35 | ;facteur d'echelle vertical for partial steps |
---|
36 | e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') |
---|
37 | e3u3d=read_ncdf('e3u_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') |
---|
38 | SIGMAsed=read_ncdf('cond_sed',0,/timestep,/nostruct,/tout,filename=file_Sed,/cont_nofill) |
---|
39 | ;BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br) |
---|
40 | BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill) |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | ; vertical integration: |
---|
46 | e3t3d=make_array(jpi,jpj,jpk) |
---|
47 | for k=0, jpk-1 do begin &$ |
---|
48 | for j=0,jpj-1 do begin &$ |
---|
49 | for i=0,jpi-1 do begin &$ |
---|
50 | e3t3d(i,j,k) = e3t(k) &$ |
---|
51 | endfor &$ |
---|
52 | endfor &$ |
---|
53 | endfor |
---|
54 | jpt = 73 |
---|
55 | |
---|
56 | ;vud = make_array(jpi,jpj,jpt) |
---|
57 | ;vvd = make_array(jpi, jpj, jpt) |
---|
58 | divBustar = make_array(jpi, jpj, jpt) |
---|
59 | diver3=replicate(0.,182,149,1,73) |
---|
60 | sigma3=replicate(0.,182,149,1,73) |
---|
61 | |
---|
62 | |
---|
63 | FOR jt = 0, jpt-1 DO BEGIN &$ |
---|
64 | |
---|
65 | ; ouverture des fichiers et stockage en memoire partial steps |
---|
66 | vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U) &$ |
---|
67 | ;stop |
---|
68 | vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V) &$ |
---|
69 | ;stop |
---|
70 | ; lecture salinite & temperature |
---|
71 | temp= read_ncdf('votemper',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T) |
---|
72 | ;stop |
---|
73 | salin=read_ncdf('vosaline',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T) |
---|
74 | ;stop |
---|
75 | conduct=0.02047780622061 + 0.00273147624197*temp + 0.00035133182334*temp*temp + 0.09139808809909*salin + 0.00241425798890*salin*temp -0.00023998958774*salin*salin |
---|
76 | mask_t=where(conduct GT 1.e+19) |
---|
77 | conduct(mask_t)=0. |
---|
78 | ; Somme conduct au point T |
---|
79 | |
---|
80 | |
---|
81 | ; Calcul SIGMA |
---|
82 | |
---|
83 | SIGMAoc=total(conduct*e3t3d*tmask,3) |
---|
84 | SIGMA=SIGMAsed+SIGMAoc |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2. |
---|
89 | |
---|
90 | SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2. |
---|
91 | |
---|
92 | ; Calcul B en points u et v |
---|
93 | |
---|
94 | BR_u=(BR+shift(BR,-1,0))/2. |
---|
95 | |
---|
96 | BR_v=(BR+shift(BR,0,1))/2. |
---|
97 | |
---|
98 | |
---|
99 | ; Calcul integrale conduct |
---|
100 | |
---|
101 | conduct_u=(conduct+shift(conduct,-1,0,0))/2. |
---|
102 | |
---|
103 | conduct_v=(conduct+shift(conduct,0,1,0))/2. |
---|
104 | |
---|
105 | u_cond_u=total( vu*conduct_u*e3u3d*umask(),3) |
---|
106 | |
---|
107 | v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3) |
---|
108 | |
---|
109 | |
---|
110 | Bu_star= BR_u*u_cond_u/SIGMA_u |
---|
111 | |
---|
112 | Bv_star= BR_v*v_cond_v/SIGMA_v |
---|
113 | |
---|
114 | ; Divergence du champ |
---|
115 | |
---|
116 | Diver=divfred(Bu_star,Bv_star) |
---|
117 | |
---|
118 | Diver=Diver*1e-6 |
---|
119 | ;stop |
---|
120 | lecontinent=where(Diver GT 1.E08) |
---|
121 | Diver(lecontinent)=0. |
---|
122 | |
---|
123 | |
---|
124 | |
---|
125 | ;stop |
---|
126 | ;bande de recouvrement:: |
---|
127 | |
---|
128 | diver3(1:180,0:147,*,jt)=Diver(*,*) |
---|
129 | diver3(0,*,*,*)=diver3(180,*,*,*) |
---|
130 | diver3(181,*,*,*)=diver3(1,*,*,*) |
---|
131 | |
---|
132 | sigma3(1:180,0:147,*,jt)=SIGMA(*,*) |
---|
133 | sigma3(0,*,*,*)=sigma3(180,*,*,*) |
---|
134 | sigma3(181,*,*,*)=sigma3(1,*,*,*) |
---|
135 | |
---|
136 | |
---|
137 | print, jt |
---|
138 | |
---|
139 | |
---|
140 | ENDFOR |
---|
141 | ; on ferme le NetCDF |
---|
142 | ;NCDF_CLOSE,id3 |
---|
143 | ;NCDF_CLOSE,id4 |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | |
---|
148 | temps=fltarr(73) |
---|
149 | temps(0)=0. |
---|
150 | for jt=0,71 do begin &$ |
---|
151 | temps(jt+1)=temps(jt) +5*86400. &$ |
---|
152 | endfor |
---|
153 | print,temps |
---|
154 | |
---|
155 | vargrid = 'T' |
---|
156 | iodir = '/usr/work/sur/fvi/OPA/ORCA2/' |
---|
157 | ; Nom |
---|
158 | idout = NCDF_CREATE(iodir+'DivBustar_5d_'+iyear+'_grid_T.nc',/clobber) |
---|
159 | print, 'Creation du fichier Netcdf' |
---|
160 | NCDF_CONTROL, idout, /nofill |
---|
161 | ; Dimension |
---|
162 | xidout = NCDF_DIMDEF(idout, 'x',jpiglo) |
---|
163 | yidout = NCDF_DIMDEF(idout, 'y',jpjglo) |
---|
164 | didout = NCDF_DIMDEF(idout, 'deptht',1) |
---|
165 | tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited) |
---|
166 | |
---|
167 | didout1 = NCDF_DIMDEF(idout, 'deptht1',jpk) |
---|
168 | |
---|
169 | |
---|
170 | ; Attributs globaux |
---|
171 | id0 = NCDF_VARDEF(idout, 'nav_lon' , [xidout, yidout ], /FLOAT) |
---|
172 | id1 = NCDF_VARDEF(idout, 'nav_lat' , [xidout, yidout ], /FLOAT) |
---|
173 | id2 = NCDF_VARDEF(idout, 'deptht' , [ didout1 ], /FLOAT) |
---|
174 | id3 = NCDF_VARDEF(idout, 'time_counter', [ tidout], /FLOAT) |
---|
175 | id4 = NCDF_VARDEF(idout, 'Diver' , [xidout, yidout, didout, tidout], /DOUBLE) |
---|
176 | |
---|
177 | ; Variable 0 |
---|
178 | NCDF_ATTPUT, idout, id0, 'units', 'degrees_east' |
---|
179 | NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude' |
---|
180 | NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid' |
---|
181 | ; Variable 1 |
---|
182 | NCDF_ATTPUT, idout, id1, 'units', 'degrees_north' |
---|
183 | NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude' |
---|
184 | NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid' |
---|
185 | ; Variable 2 |
---|
186 | NCDF_ATTPUT, idout, id2, 'units','meters' |
---|
187 | NCDF_ATTPUT, idout, id2, 'long_name','Depth' |
---|
188 | NCDF_ATTPUT, idout, id2, 'nav_model','Default grid' |
---|
189 | ; Variable3 |
---|
190 | NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-01 00:00:00 ' |
---|
191 | NCDF_ATTPUT, idout, id3, 'calendar','noleap' |
---|
192 | NCDF_ATTPUT, idout, id3, 'title', 'Time' |
---|
193 | NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis' |
---|
194 | NCDF_ATTPUT, idout, id3, 'time_origin','0001-JAN-01 00:00:00' |
---|
195 | ; Variables |
---|
196 | NCDF_ATTPUT, idout, id4, 'long_name', 'Divergence' |
---|
197 | |
---|
198 | |
---|
199 | NCDF_CONTROL, idout, /ENDEF |
---|
200 | |
---|
201 | ; Creation de la longitude |
---|
202 | NCDF_VARPUT, idout, id0, glamt |
---|
203 | ; Creation de la latitude |
---|
204 | NCDF_VARPUT, idout, id1, gphit |
---|
205 | ; Creation de la profondeur |
---|
206 | NCDF_VARPUT, idout, id2, gdept |
---|
207 | ; Creation du calendrier |
---|
208 | |
---|
209 | NCDF_VARPUT, idout, id3, temps |
---|
210 | |
---|
211 | |
---|
212 | ; Ecriture des donnees |
---|
213 | |
---|
214 | ; ecriture des glam_8 |
---|
215 | NCDF_VARPUT, idout, id4 , diver3 |
---|
216 | |
---|
217 | NCDF_CLOSE, idout |
---|
218 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
---|
219 | ;;;;meme topo pour SIGMA |
---|
220 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
---|
221 | |
---|
222 | idout = NCDF_CREATE(iodir+'Sigma_5d_'+iyear+'_grid_T.nc',/clobber) |
---|
223 | print, 'Creation du fichier Netcdf' |
---|
224 | NCDF_CONTROL, idout, /nofill |
---|
225 | ; Dimension |
---|
226 | xidout = NCDF_DIMDEF(idout, 'x',jpiglo) |
---|
227 | yidout = NCDF_DIMDEF(idout, 'y',jpjglo) |
---|
228 | didout = NCDF_DIMDEF(idout, 'deptht',1) |
---|
229 | tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited) |
---|
230 | |
---|
231 | didout1 = NCDF_DIMDEF(idout, 'deptht1',jpk) |
---|
232 | |
---|
233 | |
---|
234 | ; Attributs globaux |
---|
235 | id0 = NCDF_VARDEF(idout, 'nav_lon' , [xidout, yidout ], /FLOAT) |
---|
236 | id1 = NCDF_VARDEF(idout, 'nav_lat' , [xidout, yidout ], /FLOAT) |
---|
237 | id2 = NCDF_VARDEF(idout, 'deptht' , [ didout1 ], /FLOAT) |
---|
238 | id3 = NCDF_VARDEF(idout, 'time_counter', [ tidout], /FLOAT) |
---|
239 | id4 = NCDF_VARDEF(idout, 'Sigma' , [xidout, yidout, didout, tidout], /DOUBLE) |
---|
240 | |
---|
241 | ; Variable 0 |
---|
242 | NCDF_ATTPUT, idout, id0, 'units', 'degrees_east' |
---|
243 | NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude' |
---|
244 | NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid' |
---|
245 | ; Variable 1 |
---|
246 | NCDF_ATTPUT, idout, id1, 'units', 'degrees_north' |
---|
247 | NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude' |
---|
248 | NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid' |
---|
249 | ; Variable 2 |
---|
250 | NCDF_ATTPUT, idout, id2, 'units','meters' |
---|
251 | NCDF_ATTPUT, idout, id2, 'long_name','Depth' |
---|
252 | NCDF_ATTPUT, idout, id2, 'nav_model','Default grid' |
---|
253 | ; Variable3 |
---|
254 | NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-01 00:00:00 ' |
---|
255 | NCDF_ATTPUT, idout, id3, 'calendar','noleap' |
---|
256 | NCDF_ATTPUT, idout, id3, 'title', 'Time' |
---|
257 | NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis' |
---|
258 | NCDF_ATTPUT, idout, id3, 'time_origin','0001-JAN-01 00:00:00' |
---|
259 | ; Variables |
---|
260 | NCDF_ATTPUT, idout, id4, 'long_name', 'Total Conductance' |
---|
261 | |
---|
262 | |
---|
263 | NCDF_CONTROL, idout, /ENDEF |
---|
264 | |
---|
265 | ; Creation de la longitude |
---|
266 | NCDF_VARPUT, idout, id0, glamt |
---|
267 | ; Creation de la latitude |
---|
268 | NCDF_VARPUT, idout, id1, gphit |
---|
269 | ; Creation de la profondeur |
---|
270 | NCDF_VARPUT, idout, id2, gdept |
---|
271 | ; Creation du calendrier |
---|
272 | |
---|
273 | NCDF_VARPUT, idout, id3, temps |
---|
274 | |
---|
275 | |
---|
276 | ; Ecriture des donnees |
---|
277 | |
---|
278 | ; ecriture des glam_8 |
---|
279 | NCDF_VARPUT, idout, id4 , sigma3 |
---|
280 | |
---|
281 | NCDF_CLOSE, idout |
---|
282 | |
---|
283 | |
---|
284 | END |
---|