source: TOOLS/CMIP6_FORCING/AER_STRAT/volc.sh @ 4473

Last change on this file since 4473 was 4473, checked in by tlurton, 5 years ago

Adapted volc.sh script to possibility of VLR-L39 resolution, with necessary auxiliary files.

  • Property svn:executable set to *
File size: 20.5 KB
Line 
1dirpwd=`pwd`
2
3vv='v4'
4
5#--choose the resolution
6#--only LR and zoom works fully for now !
7#lmdz='VVLR'
8#lmdz='VLR_L79'
9#lmdz='VLR'
10lmdz='LR'
11#lmdz='MR'
12#--added for Frederique Cheruy
13#lmdz='zoom_128x89'
14
15dirout='/data/'${USER}'/CMIP6/VOLC/'${lmdz}'_'${vv}'/'
16echo $dirout
17if [ ! -d ${dirout} ] ; then mkdir -p ${dirout} ; fi
18
19cat > process_volc_${lmdz}.pro << EOF
20pro regrid
21;--version sans longitude
22;--latitude - level - wavelength - time
23;--sep 2017: add lat and month z variations of model layers
24;--Olivier Boucher
25;
26lmdz='${lmdz}'
27;
28if (lmdz eq 'VVLR') then begin
29dimlonlmdz=48
30dimlatlmdz=37
31dimz=19
32output='/data/${USER}/CMIP6/VOLC/VVLR_${vv}/'
33latfirst=90.
34latinc=-180./float(dimlatlmdz-1)
35latitudelmdz=latfirst+latinc*indgen(dimlatlmdz)
36endif
37
38if (lmdz eq 'VLR') then begin
39dimlonlmdz=96
40dimlatlmdz=96
41dimz=39
42output='/data/${USER}/CMIP6/VOLC/VLR_${vv}/'
43latfirst=90.
44latinc=-180./float(dimlatlmdz-1)
45latitudelmdz=latfirst+latinc*indgen(dimlatlmdz)
46endif
47
48if (lmdz eq 'VLR_L79') then begin
49dimlonlmdz=96
50dimlatlmdz=96
51dimz=79
52output='/data/${USER}/CMIP6/VOLC/VLR_L79_${vv}/'
53latfirst=90.
54latinc=-180./float(dimlatlmdz-1)
55latitudelmdz=latfirst+latinc*indgen(dimlatlmdz)
56endif
57
58if (lmdz eq 'LR') then begin
59dimlonlmdz=144
60dimlatlmdz=143
61dimz=79
62output='/data/${USER}/CMIP6/VOLC/LR_${vv}/'
63latfirst=90.
64latinc=-180./float(dimlatlmdz-1)
65latitudelmdz=latfirst+latinc*indgen(dimlatlmdz)
66endif
67
68if (lmdz eq 'MR') then begin
69dimlonlmdz=256
70dimlatlmdz=257
71dimz=79
72output='/data/${USER}/CMIP6/VOLC/MR_${vv}/'
73latfirst=90.
74latinc=-180./float(dimlatlmdz-1)
75latitudelmdz=latfirst+latinc*indgen(dimlatlmdz)
76endif
77
78if (lmdz eq 'zoom_128x89') then begin
79dimlonlmdz=128
80dimlatlmdz=89
81dimz=79
82output='/data/${USER}/CMIP6/VOLC/${lmdz}_${vv}/'
83latitudelmdz=[90., 86.85495, 83.8430634, 80.9792252, 78.2779922, 75.7526321, 73.4137878, 71.2680206, 69.3164978, $
84              67.5542145,   65.9702301, 64.5487747, 63.2709846, 62.1167107, 61.0660896, 60.1005592, 59.2034454, $
85              58.360157,    57.5581551, 56.7868576, 56.0374718, 55.302887,  54.5775719, 53.8574829, 53.1399384, $
86              52.4233971,   51.7071419, 50.9909439, 50.2747459, 49.5585518, 48.8423538, 48.1261597, 47.4099655, $
87              46.6937675,   45.9775734, 45.2613792, 44.5451813, 43.8289604, 43.1125679, 42.395504,  41.6765518, $
88              40.9534645,   40.2226982, 39.4792557, 38.7165909, 37.9265213, 37.099102,  36.2225075, 35.2828789, $
89              34.2642632,   33.1487236, 31.9167614, 30.5481758, 29.0234509, 27.32551,   25.4415455, 23.3643932, $
90              21.0930786,   18.6323872, 15.9917059, 13.1835403, 10.2221146, 7.12228632, 3.89880991, 0.565921485,$
91              -2.86286402, -6.37483072, -9.95808029, -13.6015415, -17.2949867, -21.029068, -24.7953758, -28.5864811, $
92             -32.3959961, -36.2186012, -40.0500298, -43.8870316, -47.7272758, -51.5692215, -55.4119453, -59.2549667, $
93             -63.0980797, -66.9412079, -70.7843399, -74.6274719, -78.4706039, -82.313736, -86.156868, -90.]
94endif
95
96NSW=6
97NLW=16
98;
99;--script only works on ciclad
100dir='/prodigfs/project/input4MIPs/VOLC/${vv}/'
101;;;not available for v4
102;;;filename=dir+'CMIP_1850_2014_extinction_550nm_${vv}.nc'
103;;;NETCDFREAD,filename,'altitude',altitude,dimaltitude
104;;;NETCDFREAD,filename,'ext550',ext550,dimext
105;
106filename=dir+'CMIP_IPSL-CM6_radiation_${vv}.nc'
107;
108NETCDFREAD,filename,'altitude',altitude,dimaltitude
109NETCDFREAD,filename,'latitude',latitude,dimlatitude
110NETCDFREAD,filename,'wl1_sun',wl1_sun,solar_bands
111NETCDFREAD,filename,'wl2_sun',wl2_sun,solar_bands
112NETCDFREAD,filename,'wl1_earth',wl1_earth,terrestrial_bands
113NETCDFREAD,filename,'wl2_earth',wl2_earth,terrestrial_bands
114NETCDFREAD,filename,'month',month,dimmonth
115NETCDFREAD,filename,'ext_sun',ext_sun,dimext
116NETCDFREAD,filename,'omega_sun',omega_sun,dimext
117NETCDFREAD,filename,'g_sun',g_sun,dimext
118NETCDFREAD,filename,'ext_earth',ext_earth,dimext
119NETCDFREAD,filename,'omega_earth',omega_earth,dimext
120NETCDFREAD,filename,'g_earth',g_earth,dimext
121;
122print ,'wl1_sun=', wl1_sun
123print ,'wl2_sun=', wl2_sun
124print ,'wl1_ear=', wl1_earth
125print ,'wl2_ear=', wl2_earth
126;
127print ,'min max ext_sun=', min(ext_sun),   max(ext_sun)
128print ,'min max ome_sun=', min(omega_sun), max(omega_sun)
129;for nl=0, NSW-1 do begin
130;print ,'min max ome_sun nl=', nl, min(omega_sun(*,*,*,nl)), max(omega_sun(*,*,*,nl))
131;endfor
132print ,'min max ggg_sun=', min(g_sun),     max(g_sun)
133print ,'min max ext_ear=', min(ext_earth), max(ext_earth)
134;
135dimlat=dimlatitude(0)
136dimalt=dimaltitude(0)
137dimtime=dimmonth(0)
138;
139;--vertical resolution in Beiping's code
140dz=0.5
141;
142month_in_year=12
143;;month_in_year=1
144;
145;--compute optical depth of input data
146;--dimension ext_sun(l,k,j,nl)
147;ext_sun0=ext_sun(0,*,*,*)
148;print , 'size ext_sun0=', size(ext_sun0)
149;tau_sun=TOTAL(ext_sun0,2)*dz
150;print ,'min max tau_sun l=0 =', min(tau_sun),   max(tau_sun)
151;
152zz=fltarr(dimz)
153;
154;---approximate altitudes of LMDZ - L19 and L39
155;---NOT RECOMMENDED
156;
157if (dimz eq 19) then begin
158zz=[ 0.07125416, 0.2402302, 0.4865242, 0.8627044, 1.426484, 2.244528,    $
159    3.394085, 4.952366, 6.950302, 9.26943, 11.59338, 13.71214, 15.83651, $
160    18.27338, 21.16397, 24.63156, 28.9039, 34.57184, 44.51565] ;
161endif
162;
163if (dimz eq 39) then begin
164zz=[0.0338988, 0.1106602, 0.2139233, 0.3609663, 0.5685416, 0.8534464,     $
165    1.233232, 1.726868, 2.355076, 3.139813, 4.101937, 5.25541, 6.596076,  $
166    8.085103, 9.636482, 11.13441, 12.50023, 13.75765, 15.00424, 16.32207, $
167    17.74403, 19.27899, 20.93219, 22.70941, 24.61736, 26.66389, 28.85831, $
168    31.21178, 33.73778, 36.45278, 39.37709, 42.53607, 45.96209, 49.69786, $
169    53.80379, 58.37727, 63.61497, 70.07092, 80.52708]
170endif
171;
172;---exact altitudes of LMDZ -- L79
173;--only exists for LR, MR and zoom_128x89 at the moment
174if (dimz eq 79) then begin
175  filename='./zalt_zonmean_${lmdz}_l79_rev.nc'
176  NETCDFREAD,filename,'GEOP',zz,dimzz
177  NETCDFREAD,filename,'LAT',zzlat,dimzzlat
178  NETCDFREAD,filename,'TIME_COUNTER',zztime,dimzztime
179  dimzzilat=dimzzlat[0]
180  dimzzitime=dimzztime[0]
181  ;--becareful zz comes with four dimensions
182  ;--lon lat k time
183  print, 'GEOP size=', size(zz)
184  ;--becareful zzlat comes with South Pole first
185  print, 'LAT from zalt field=', zzlat
186  if (dimzzilat ne dimlatlmdz) then begin
187    print , 'PB dimension latitude'
188  endif
189endif
190;
191if (dimz eq 39) then begin
192  filename='./zalt_zonmean_${lmdz}_l39_rev.nc'
193  NETCDFREAD,filename,'GEOP',zz,dimzz
194  NETCDFREAD,filename,'LAT',zzlat,dimzzlat
195  NETCDFREAD,filename,'TIME_COUNTER',zztime,dimzztime
196  dimzzilat=dimzzlat[0]
197  dimzzitime=dimzztime[0]
198  ;--becareful zz comes with four dimensions
199  ;--lon lat k time
200  print, 'GEOP size=', size(zz)
201  ;--becareful zzlat comes with South Pole first
202  print, 'LAT from zalt field=', zzlat
203  if (dimzzilat ne dimlatlmdz) then begin
204    print , 'PB dimension latitude'
205  endif
206endif
207;
208;
209;--reconstructing the vertical coordinate at interfaces (in unit km)
210;--and reverse lat axis for zzi  i==>ii
211;--and reverse zz axis for zzi   dimz-1-k==>k
212;--and forget about lon axis : index 0 in zz
213zzi=fltarr(dimzzilat,dimzzitime,dimz+1)
214for i=0, dimzzilat-1 do begin
215 ii=dimzzilat-1-i
216 for t=0, dimzzitime-1 do begin
217  zzi(ii,t,0)=0.0
218  for k=1, dimz-1 do begin
219   zzi(ii,t,k)=(zz(0,i,dimz-1-(k-1),t)+zz(0,i,dimz-1-k,t))/2.0
220  endfor
221  zzi(ii,t,dimz)=100.00
222 endfor
223endfor
224print, 'zzi=',zzi
225;
226lev=indgen(dimz)+1
227;
228dimzori=dimalt
229zziori=fltarr(dimzori+1)
230zziori(0)=altitude(0)-0.25
231for k=1, dimzori do begin
232 zziori(k)=altitude(k-1)+0.25
233endfor
234;
235;--550 nm properties
236;;;not available for v4
237;;;tau_550_lmdz=fltarr(dimlatlmdz,dimz,month_in_year)
238;
239;--SW properties
240tau_sun_lmdz=fltarr(dimlatlmdz,dimz,NSW,month_in_year)
241ome_sun_lmdz=fltarr(dimlatlmdz,dimz,NSW,month_in_year)
242ggg_sun_lmdz=fltarr(dimlatlmdz,dimz,NSW,month_in_year)
243;
244tau_sun_lmdz_ave=fltarr(dimlatlmdz,dimz,NSW,month_in_year)
245ome_sun_lmdz_ave=fltarr(dimlatlmdz,dimz,NSW,month_in_year)
246ggg_sun_lmdz_ave=fltarr(dimlatlmdz,dimz,NSW,month_in_year)
247;
248tau_sun_lmdz_tr=fltarr(dimlatlmdz,dimz,NSW,month_in_year)
249ome_sun_lmdz_tr=fltarr(dimlatlmdz,dimz,NSW,month_in_year)
250ggg_sun_lmdz_tr=fltarr(dimlatlmdz,dimz,NSW,month_in_year)
251;
252;--LW properties tau_abs
253tau_ear_lmdz=fltarr(dimlatlmdz,dimz,NLW,month_in_year)
254;
255tau_ear_lmdz_ave=fltarr(dimlatlmdz,dimz,NLW,month_in_year)
256;
257tau_ear_lmdz_tr=fltarr(dimlatlmdz,dimz,NLW,month_in_year)
258;
259tau_sun_lmdz_ave(*,*,*,0)=1.e-15
260ome_sun_lmdz_ave(*,*,*,0)=1.e-15
261ggg_sun_lmdz_ave(*,*,*,0)=0.0
262tau_ear_lmdz_ave(*,*,*,0)=1.e-15
263;
264yearend=dimtime/month_in_year-1
265;
266for year=0, yearend do begin
267;
268;;;not available for v4
269;;;tau_550_lmdz(*,*,*)=1.e-15
270tau_sun_lmdz(*,*,*,*)=1.e-15
271ome_sun_lmdz(*,*,*,*)=1.e-15
272ggg_sun_lmdz(*,*,*,*)=0.0
273tau_ear_lmdz(*,*,*,*)=1.e-15
274;
275chyr=strcompress(1850+year,/rem)
276;
277for mth=0,month_in_year-1 do begin
278;
279;--timestep
280l=mth+month_in_year*year
281print,'year mth l=',chyr, mth, l
282;
283;regridding
284for j=0, dimlatlmdz-1  do begin
285;
286;--finding latitude in beiping luo data
287jj=0
288for jluo=0,dimlat-2 do begin
289  if (latitudelmdz(j) gt (latitude(jluo)+latitude(jluo+1))/2. ) then begin
290    jj=jluo+1
291  endif
292endfor
293;
294for k=0, dimz-1 do begin
295for kori=0, dimzori-1 do begin
296;
297;fraction de la maille kori qui se trouve dans la maille k
298frac= max([0.0,min([zzi(j,mth,k+1),zziori(kori+1)])-max([zzi(j,mth,k),zziori(kori)])])/(zziori(kori+1)-zziori(kori))
299;
300;;;not available for v4
301;;;tau_550_lmdz(j,k,mth)=tau_550_lmdz(j,k,mth)+ext550(l,kori,jj)*dz*frac
302;
303for nl=0, NSW-1 do begin
304  tau_sun_lmdz(j,k,nl,mth)=tau_sun_lmdz(j,k,nl,mth)+ext_sun(l,kori,jj,nl)*dz*frac
305  ome_sun_lmdz(j,k,nl,mth)=ome_sun_lmdz(j,k,nl,mth)+omega_sun(l,kori,jj,nl)*ext_sun(l,kori,jj,nl)*dz*frac
306  ggg_sun_lmdz(j,k,nl,mth)=ggg_sun_lmdz(j,k,nl,mth)+g_sun(l,kori,jj,nl)*omega_sun(l,kori,jj,nl)*ext_sun(l,kori,jj,nl)*dz*frac
307;
308  tau_sun_lmdz_ave(j,k,nl,0)=tau_sun_lmdz_ave(j,k,nl,0)+ext_sun(l,kori,jj,nl)*dz*frac
309  ome_sun_lmdz_ave(j,k,nl,0)=ome_sun_lmdz_ave(j,k,nl,0)+omega_sun(l,kori,jj,nl)*ext_sun(l,kori,jj,nl)*dz*frac
310  ggg_sun_lmdz_ave(j,k,nl,0)=ggg_sun_lmdz_ave(j,k,nl,0)+g_sun(l,kori,jj,nl)*omega_sun(l,kori,jj,nl)*ext_sun(l,kori,jj,nl)*dz*frac
311endfor
312;
313for nl=0, NLW-1 do begin
314  tau_ear_lmdz(j,k,nl,mth)=tau_ear_lmdz(j,k,nl,mth)+ext_earth(l,kori,jj,nl)*(1.-omega_earth(l,kori,jj,nl))*dz*frac
315  tau_ear_lmdz_ave(j,k,nl,0)=tau_ear_lmdz_ave(j,k,nl,0)+ext_earth(l,kori,jj,nl)*(1.-omega_earth(l,kori,jj,nl))*dz*frac
316endfor
317;
318endfor
319;--end lat loop
320;
321endfor
322endfor
323;--end k loops
324;
325endfor
326;--end month loop
327;
328;renormalizing intensive SW properties
329ggg_sun_lmdz(*,*,*,*)=ggg_sun_lmdz(*,*,*,*)/ome_sun_lmdz(*,*,*,*)
330ome_sun_lmdz(*,*,*,*)=ome_sun_lmdz(*,*,*,*)/tau_sun_lmdz(*,*,*,*)
331;
332;saving netcdf file
333;
334print ,'min max ext_sun lmdz=', min(tau_sun_lmdz), max(tau_sun_lmdz)
335print ,'min max ome_sun lmdz=', min(ome_sun_lmdz), max(ome_sun_lmdz)
336;for nl=0, NSW-1 do begin
337;print ,'min max ome_sun lmdz nl =', nl, min(ome_sun_lmdz(*,*,nl,*)), max(ome_sun_lmdz(*,*,nl,*))
338;endfor
339print ,'min max ggg_sun lmdz=', min(ggg_sun_lmdz), max(ggg_sun_lmdz)
340print ,'min max ext_ear lmdz=', min(tau_ear_lmdz), max(tau_ear_lmdz)
341;
342print ,'min max ext_sun lmdz l=1=', min(tau_sun_lmdz(*,*,*,0)), max(tau_sun_lmdz(*,*,*,0))
343print ,'min max ome_sun lmdz l=1=', min(ome_sun_lmdz(*,*,*,0)), max(ome_sun_lmdz(*,*,*,0))
344print ,'min max ggg_sun lmdz l=1=', min(ggg_sun_lmdz(*,*,*,0)), max(ggg_sun_lmdz(*,*,*,0))
345print ,'min max ext_ear lmdz l=1=', min(tau_ear_lmdz(*,*,*,0)), max(tau_ear_lmdz(*,*,*,0))
346;
347;--compute optical depth of output data
348;tau_sun=TOTAL(tau_sun_lmdz,2)
349;print ,'min max tau_sun_lmdz vert=', min(tau_sun),   max(tau_sun)
350;
351opticstruct={lat:fltarr(dimlatlmdz),lev:fltarr(dimz),             $
352             wav:fltarr(NSW),time:fltarr(month_in_year),          $
353             tau_sun:fltarr(dimlatlmdz,dimz,NSW,month_in_year),   $
354             ome_sun:fltarr(dimlatlmdz,dimz,NSW,month_in_year),   $
355             ggg_sun:fltarr(dimlatlmdz,dimz,NSW,month_in_year) }
356;
357opticstruct.lat=latitudelmdz
358opticstruct.lev=lev
359opticstruct.wav=(wl1_sun(0:NSW-1)+wl2_sun(0:NSW-1))/2.
360opticstruct.time=float(indgen(month_in_year)+1)
361opticstruct.tau_sun=tau_sun_lmdz
362opticstruct.ome_sun=ome_sun_lmdz
363opticstruct.ggg_sun=ggg_sun_lmdz
364;
365attributes = {units:strarr(7),long_name:strarr(7)}
366attributes.units =     ['degrees_north','level','meters','month','-','-','-']
367attributes.long_name = ['latitude','level','wavelength','time','tau_sun','ome_sun','g_sun']
368;
369dimensions = {isdim:intarr(7), links:intarr(4,7)}
370       dimensions.isdim =  [1,1,1,1,0,0,0]  ; (1=dimension, 0=variable)
371       dimensions.links = [ [-1,-1,-1,-1],[-1,-1,-1,-1],   $
372                            [-1,-1,-1,-1],[-1,-1,-1,-1],   $
373                            [0,1,2,3],[0,1,2,3],[0,1,2,3]  ]
374;
375netcdfwrite,output+'tauswstrat.2D.'+chyr+'.nc',opticstruct,clobber=1, $
376            attributes=attributes, dimensions=dimensions
377;
378opticstruct={lat:fltarr(dimlatlmdz),lev:fltarr(dimz),             $
379             wav:fltarr(NLW),time:fltarr(month_in_year),          $
380             tau_ear:fltarr(dimlatlmdz,dimz,NLW,month_in_year) }
381;
382opticstruct.lat=latitudelmdz
383opticstruct.lev=lev
384opticstruct.wav=(wl1_earth+wl2_earth)/2.
385opticstruct.time=float(indgen(month_in_year)+1)
386opticstruct.tau_ear=tau_ear_lmdz
387;
388attributes = {units:strarr(5),long_name:strarr(5)}
389attributes.units = ['degrees_north','level','cm-1','month','-']
390attributes.long_name = ['latitude','level','wavenumber','time','tau_ear']
391;
392dimensions = {isdim:intarr(5), links:intarr(4,5)}
393       dimensions.isdim =  [1,1,1,1,0]  ; (1=dimension, 0=variable)
394       dimensions.links = [ [-1,-1,-1,-1],[-1,-1,-1,-1],   $
395                            [-1,-1,-1,-1],[-1,-1,-1,-1],   $
396                            [0,1,2,3]  ]
397;
398netcdfwrite,output+'taulwstrat.2D.'+chyr+'.nc',opticstruct,clobber=1, $
399            attributes=attributes, dimensions=dimensions
400;
401;;;not available in v4
402;;;opticstruct={lat:fltarr(dimlatlmdz),lev:fltarr(dimz),             $
403;;;             time:fltarr(month_in_year),                          $
404;;;             tau550:fltarr(dimlatlmdz,dimz,month_in_year) }
405;
406;;;opticstruct.lat=latitudelmdz
407;;;opticstruct.lev=lev
408;;;opticstruct.time=float(indgen(month_in_year)+1)
409;;;opticstruct.tau550=tau_550_lmdz
410;
411;;;attributes = {units:strarr(4),long_name:strarr(4)}
412;;;attributes.units = ['degrees_north','level','month','-']
413;;;attributes.long_name = ['latitude','level','time','tau550']
414;
415;;;dimensions = {isdim:intarr(4), links:intarr(3,4)}
416;;;       dimensions.isdim =  [1,1,1,0]  ; (1=dimension, 0=variable)
417;;;       dimensions.links = [ [-1,-1,-1],[-1,-1,-1],   $
418;;;                            [-1,-1,-1],[0,1,2]  ]
419;
420;;;netcdfwrite,output+'tau550strat.2D.'+chyr+'.nc',opticstruct,clobber=1, $
421;;;            attributes=attributes, dimensions=dimensions
422;
423endfor
424;--end loop on years
425;
426;now deal with average conditions
427ggg_sun_lmdz_ave(*,*,*,0)=ggg_sun_lmdz_ave(*,*,*,0)/ome_sun_lmdz_ave(*,*,*,0)
428ome_sun_lmdz_ave(*,*,*,0)=ome_sun_lmdz_ave(*,*,*,0)/tau_sun_lmdz_ave(*,*,*,0)
429tau_sun_lmdz_ave(*,*,*,0)=tau_sun_lmdz_ave(*,*,*,0)/float(dimtime)
430tau_ear_lmdz_ave(*,*,*,0)=tau_ear_lmdz_ave(*,*,*,0)/float(dimtime)
431;
432for mth=1, month_in_year-1 do begin
433  ggg_sun_lmdz_ave(*,*,*,mth)=ggg_sun_lmdz_ave(*,*,*,0)
434  ome_sun_lmdz_ave(*,*,*,mth)=ome_sun_lmdz_ave(*,*,*,0)
435  tau_sun_lmdz_ave(*,*,*,mth)=tau_sun_lmdz_ave(*,*,*,0)
436  tau_ear_lmdz_ave(*,*,*,mth)=tau_ear_lmdz_ave(*,*,*,0)
437endfor
438;
439opticstruct={lat:fltarr(dimlatlmdz),lev:fltarr(dimz),             $
440             wav:fltarr(NSW),time:fltarr(month_in_year),          $
441             tau_sun:fltarr(dimlatlmdz,dimz,NSW,month_in_year),   $
442             ome_sun:fltarr(dimlatlmdz,dimz,NSW,month_in_year),   $
443             ggg_sun:fltarr(dimlatlmdz,dimz,NSW,month_in_year) }
444;
445opticstruct.lat=latitudelmdz
446opticstruct.lev=lev
447opticstruct.wav=(wl1_sun(0:NSW-1)+wl2_sun(0:NSW-1))/2.
448opticstruct.time=float(indgen(month_in_year))
449opticstruct.tau_sun=tau_sun_lmdz_ave
450opticstruct.ome_sun=ome_sun_lmdz_ave
451opticstruct.ggg_sun=ggg_sun_lmdz_ave
452;
453attributes = {units:strarr(7),long_name:strarr(7)}
454attributes.units =     ['degrees_north','level','meters','month','-','-','-']
455attributes.long_name = ['latitude','level','wavelength','time','tau_sun','ome_sun','g_sun']
456;
457dimensions = {isdim:intarr(7), links:intarr(4,7)}
458       dimensions.isdim =  [1,1,1,1,0,0,0]  ; (1=dimension, 0=variable)
459       dimensions.links = [ [-1,-1,-1,-1],[-1,-1,-1,-1],   $
460                            [-1,-1,-1,-1],[-1,-1,-1,-1],   $
461                            [0,1,2,3],[0,1,2,3],[0,1,2,3]  ]
462;
463netcdfwrite,output+'tauswstrat.2D.ave.nc',opticstruct,clobber=1, $
464            attributes=attributes, dimensions=dimensions
465;
466opticstruct={lat:fltarr(dimlatlmdz),lev:fltarr(dimz),             $
467             wav:fltarr(NLW),time:fltarr(month_in_year),          $
468             tau_ear:fltarr(dimlatlmdz,dimz,NLW,month_in_year) }
469;
470opticstruct.lat=latitudelmdz
471opticstruct.lev=lev
472opticstruct.wav=(wl1_earth+wl2_earth)/2.
473opticstruct.time=float(indgen(month_in_year))
474opticstruct.tau_ear=tau_ear_lmdz_ave
475;
476attributes = {units:strarr(5),long_name:strarr(5)}
477attributes.units = ['degrees_north','level','cm-1','month','-']
478attributes.long_name = ['latitude','level','wavenumber','time','tau_ear']
479;
480dimensions = {isdim:intarr(5), links:intarr(4,5)}
481       dimensions.isdim =  [1,1,1,1,0]  ; (1=dimension, 0=variable)
482       dimensions.links = [ [-1,-1,-1,-1],[-1,-1,-1,-1],   $
483                            [-1,-1,-1,-1],[-1,-1,-1,-1],   $
484                            [0,1,2,3]  ]
485;
486netcdfwrite,output+'taulwstrat.2D.ave.nc',opticstruct,clobber=1, $
487            attributes=attributes, dimensions=dimensions
488;
489;--finally prepare the 10-year transition period
490;--that is 2015-2023 for v3 or 2017-2025 for v4
491;--we mix the last year of the period with the climatology
492;
493for year=1850+yearend+1,1850+yearend+9 do begin
494;
495chyr=strcompress(year,/rem)
496print,'year =',chyr
497;--compute weights
498w1=float(1850+yearend+10-year)/10.
499w2=1.0-w1
500;--SW properties
501tau_sun_lmdz_tr=w1*tau_sun_lmdz+w2*tau_sun_lmdz_ave
502ome_sun_lmdz_tr=w1*tau_sun_lmdz*ome_sun_lmdz+w2*tau_sun_lmdz_ave*ome_sun_lmdz_ave
503ggg_sun_lmdz_tr=w1*tau_sun_lmdz*ome_sun_lmdz*ggg_sun_lmdz+ $
504                w2*tau_sun_lmdz_ave*ome_sun_lmdz_ave*ggg_sun_lmdz_ave
505ggg_sun_lmdz_tr=ggg_sun_lmdz_tr/ome_sun_lmdz_tr
506ome_sun_lmdz_tr=ome_sun_lmdz_tr/tau_sun_lmdz_tr
507;
508;--LW properties
509tau_ear_lmdz_tr=w1*tau_ear_lmdz+w2*tau_ear_lmdz_ave
510;
511;--prepare SW output
512opticstruct={lat:fltarr(dimlatlmdz),lev:fltarr(dimz),             $
513             wav:fltarr(NSW),time:fltarr(month_in_year),          $
514             tau_sun:fltarr(dimlatlmdz,dimz,NSW,month_in_year),   $
515             ome_sun:fltarr(dimlatlmdz,dimz,NSW,month_in_year),   $
516             ggg_sun:fltarr(dimlatlmdz,dimz,NSW,month_in_year) }
517;
518opticstruct.lat=latitudelmdz
519opticstruct.lev=lev
520opticstruct.wav=(wl1_sun(0:NSW-1)+wl2_sun(0:NSW-1))/2.
521opticstruct.time=float(indgen(month_in_year)+1)
522opticstruct.tau_sun=tau_sun_lmdz_tr
523opticstruct.ome_sun=ome_sun_lmdz_tr
524opticstruct.ggg_sun=ggg_sun_lmdz_tr
525;
526attributes = {units:strarr(7),long_name:strarr(7)}
527attributes.units =     ['degrees_north','level','meters','month','-','-','-']
528attributes.long_name = ['latitude','level','wavelength','time','tau_sun','ome_sun','g_sun']
529;
530dimensions = {isdim:intarr(7), links:intarr(4,7)}
531       dimensions.isdim =  [1,1,1,1,0,0,0]  ; (1=dimension, 0=variable)
532       dimensions.links = [ [-1,-1,-1,-1],[-1,-1,-1,-1],   $
533                            [-1,-1,-1,-1],[-1,-1,-1,-1],   $
534                            [0,1,2,3],[0,1,2,3],[0,1,2,3]  ]
535;
536netcdfwrite,output+'tauswstrat.2D.'+chyr+'.nc',opticstruct,clobber=1, $
537            attributes=attributes, dimensions=dimensions
538;
539;--prepare LW output
540opticstruct={lat:fltarr(dimlatlmdz),lev:fltarr(dimz),             $
541             wav:fltarr(NLW),time:fltarr(month_in_year),          $
542             tau_ear:fltarr(dimlatlmdz,dimz,NLW,month_in_year) }
543;
544opticstruct.lat=latitudelmdz
545opticstruct.lev=lev
546opticstruct.wav=(wl1_earth+wl2_earth)/2.
547opticstruct.time=float(indgen(month_in_year)+1)
548opticstruct.tau_ear=tau_ear_lmdz_tr
549;
550attributes = {units:strarr(5),long_name:strarr(5)}
551attributes.units = ['degrees_north','level','cm-1','month','-']
552attributes.long_name = ['latitude','level','wavenumber','time','tau_ear']
553;
554dimensions = {isdim:intarr(5), links:intarr(4,5)}
555       dimensions.isdim =  [1,1,1,1,0]  ; (1=dimension, 0=variable)
556       dimensions.links = [ [-1,-1,-1,-1],[-1,-1,-1,-1],   $
557                            [-1,-1,-1,-1],[-1,-1,-1,-1],   $
558                            [0,1,2,3]  ]
559;
560netcdfwrite,output+'taulwstrat.2D.'+chyr+'.nc',opticstruct,clobber=1, $
561            attributes=attributes, dimensions=dimensions
562;
563endfor
564;--end loop on years
565;
566end
567EOF
568
569cat > volc_${lmdz}.job << EOF2
570#PBS -N process_volc_${lmdz}
571#PBS -S /bin/bash
572#PBS -q week # there exist: short, day, days3, week...
573#PBS -k eo  # to write the output of stdin
574### Max memory
575#PBS -l vmem=10gb   # virtual memory
576#PBS -l  mem=10gb
577
578cd $dirpwd
579
580module load idl
581
582idl << eof
583.r netcdf
584.r process_volc_${lmdz}
585regrid
586eof
587EOF2
588
589qsub volc_${lmdz}.job
Note: See TracBrowser for help on using the repository browser.