Index: TOOLS/CMIP6_FORCING/AER_STRAT/README
===================================================================
--- TOOLS/CMIP6_FORCING/AER_STRAT/README	(revision 4183)
+++ TOOLS/CMIP6_FORCING/AER_STRAT/README	(revision 4473)
@@ -59,2 +59,3 @@
 Revised 18/09/2018
 Revised 11/12/2018
+Revised 06/2019 by Th. Lurton to add support for VLR-L39.
Index: TOOLS/CMIP6_FORCING/AER_STRAT/grid_vlr
===================================================================
--- TOOLS/CMIP6_FORCING/AER_STRAT/grid_vlr	(revision 4473)
+++ TOOLS/CMIP6_FORCING/AER_STRAT/grid_vlr	(revision 4473)
@@ -0,0 +1,14 @@
+gridtype  = lonlat
+gridsize  = 9216
+xname     = lon
+xlongname = Longitude
+xunits    = degrees_east
+yname     = lat
+ylongname = Latitude
+yunits    = degrees_north
+xsize     = 96
+ysize     = 96
+xfirst    = -180
+xinc      = 3.75
+yfirst    = 90
+yinc      = -1.89474
Index: TOOLS/CMIP6_FORCING/AER_STRAT/volc.sh
===================================================================
--- TOOLS/CMIP6_FORCING/AER_STRAT/volc.sh	(revision 4183)
+++ TOOLS/CMIP6_FORCING/AER_STRAT/volc.sh	(revision 4473)
@@ -1,5 +1,5 @@
 dirpwd=`pwd`
 
-vv='v3'
+vv='v4'
 
 #--choose the resolution
@@ -8,6 +8,6 @@
 #lmdz='VLR_L79'
 #lmdz='VLR'
-#lmdz='LR'
-lmdz='MR'
+lmdz='LR'
+#lmdz='MR'
 #--added for Frederique Cheruy
 #lmdz='zoom_128x89'
@@ -99,7 +99,8 @@
 ;--script only works on ciclad
 dir='/prodigfs/project/input4MIPs/VOLC/${vv}/'
-filename=dir+'CMIP_1850_2014_extinction_550nm_${vv}.nc'
-NETCDFREAD,filename,'altitude',altitude,dimaltitude
-NETCDFREAD,filename,'ext550',ext550,dimext
+;;;not available for v4
+;;;filename=dir+'CMIP_1850_2014_extinction_550nm_${vv}.nc'
+;;;NETCDFREAD,filename,'altitude',altitude,dimaltitude
+;;;NETCDFREAD,filename,'ext550',ext550,dimext
 ;
 filename=dir+'CMIP_IPSL-CM6_radiation_${vv}.nc'
@@ -188,4 +189,21 @@
 endif
 ;
+if (dimz eq 39) then begin
+  filename='./zalt_zonmean_${lmdz}_l39_rev.nc'
+  NETCDFREAD,filename,'GEOP',zz,dimzz
+  NETCDFREAD,filename,'LAT',zzlat,dimzzlat
+  NETCDFREAD,filename,'TIME_COUNTER',zztime,dimzztime
+  dimzzilat=dimzzlat[0]
+  dimzzitime=dimzztime[0]
+  ;--becareful zz comes with four dimensions
+  ;--lon lat k time
+  print, 'GEOP size=', size(zz)
+  ;--becareful zzlat comes with South Pole first
+  print, 'LAT from zalt field=', zzlat
+  if (dimzzilat ne dimlatlmdz) then begin
+    print , 'PB dimension latitude'
+  endif
+endif
+;
 ;
 ;--reconstructing the vertical coordinate at interfaces (in unit km)
@@ -216,5 +234,6 @@
 ;
 ;--550 nm properties
-tau_550_lmdz=fltarr(dimlatlmdz,dimz,month_in_year)
+;;;not available for v4
+;;;tau_550_lmdz=fltarr(dimlatlmdz,dimz,month_in_year)
 ;
 ;--SW properties
@@ -243,7 +262,10 @@
 tau_ear_lmdz_ave(*,*,*,0)=1.e-15
 ;
-for year=0, dimtime/month_in_year-1 do begin
-;
-tau_550_lmdz(*,*,*)=1.e-15
+yearend=dimtime/month_in_year-1
+;
+for year=0, yearend do begin
+;
+;;;not available for v4
+;;;tau_550_lmdz(*,*,*)=1.e-15
 tau_sun_lmdz(*,*,*,*)=1.e-15
 ome_sun_lmdz(*,*,*,*)=1.e-15
@@ -276,5 +298,6 @@
 frac= max([0.0,min([zzi(j,mth,k+1),zziori(kori+1)])-max([zzi(j,mth,k),zziori(kori)])])/(zziori(kori+1)-zziori(kori))
 ;
-tau_550_lmdz(j,k,mth)=tau_550_lmdz(j,k,mth)+ext550(l,kori,jj)*dz*frac
+;;;not available for v4
+;;;tau_550_lmdz(j,k,mth)=tau_550_lmdz(j,k,mth)+ext550(l,kori,jj)*dz*frac
 ;
 for nl=0, NSW-1 do begin
@@ -376,24 +399,25 @@
             attributes=attributes, dimensions=dimensions
 ;
-opticstruct={lat:fltarr(dimlatlmdz),lev:fltarr(dimz),             $ 
-             time:fltarr(month_in_year),                          $
-             tau550:fltarr(dimlatlmdz,dimz,month_in_year) }
-;
-opticstruct.lat=latitudelmdz
-opticstruct.lev=lev
-opticstruct.time=float(indgen(month_in_year)+1)
-opticstruct.tau550=tau_550_lmdz
-;
-attributes = {units:strarr(4),long_name:strarr(4)}
-attributes.units = ['degrees_north','level','month','-']
-attributes.long_name = ['latitude','level','time','tau550']
-;
-dimensions = {isdim:intarr(4), links:intarr(3,4)}
-       dimensions.isdim =  [1,1,1,0]  ; (1=dimension, 0=variable)
-       dimensions.links = [ [-1,-1,-1],[-1,-1,-1],   $
-                            [-1,-1,-1],[0,1,2]  ]
-;
-netcdfwrite,output+'tau550strat.2D.'+chyr+'.nc',opticstruct,clobber=1, $
-            attributes=attributes, dimensions=dimensions
+;;;not available in v4
+;;;opticstruct={lat:fltarr(dimlatlmdz),lev:fltarr(dimz),             $ 
+;;;             time:fltarr(month_in_year),                          $
+;;;             tau550:fltarr(dimlatlmdz,dimz,month_in_year) }
+;
+;;;opticstruct.lat=latitudelmdz
+;;;opticstruct.lev=lev
+;;;opticstruct.time=float(indgen(month_in_year)+1)
+;;;opticstruct.tau550=tau_550_lmdz
+;
+;;;attributes = {units:strarr(4),long_name:strarr(4)}
+;;;attributes.units = ['degrees_north','level','month','-']
+;;;attributes.long_name = ['latitude','level','time','tau550']
+;
+;;;dimensions = {isdim:intarr(4), links:intarr(3,4)}
+;;;       dimensions.isdim =  [1,1,1,0]  ; (1=dimension, 0=variable)
+;;;       dimensions.links = [ [-1,-1,-1],[-1,-1,-1],   $
+;;;                            [-1,-1,-1],[0,1,2]  ]
+;
+;;;netcdfwrite,output+'tau550strat.2D.'+chyr+'.nc',opticstruct,clobber=1, $
+;;;            attributes=attributes, dimensions=dimensions
 ;
 endfor
@@ -463,12 +487,14 @@
             attributes=attributes, dimensions=dimensions
 ;
-;--finally prepare the transition period 2015-2023
+;--finally prepare the 10-year transition period 
+;--that is 2015-2023 for v3 or 2017-2025 for v4
 ;--we mix the last year of the period with the climatology
 ;
-for year=2015,2023 do begin
+for year=1850+yearend+1,1850+yearend+9 do begin
 ;
 chyr=strcompress(year,/rem)
+print,'year =',chyr
 ;--compute weights
-w1=float(2024-year)/10.
+w1=float(1850+yearend+10-year)/10.
 w2=1.0-w1
 ;--SW properties
@@ -552,4 +578,6 @@
 cd $dirpwd
 
+module load idl
+
 idl << eof
 .r netcdf 
