Index: branches/2013/dev_MERGE_2013/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_ICE.pro
===================================================================
--- branches/2013/dev_MERGE_2013/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_ICE.pro	(revision 4291)
+++ branches/2013/dev_MERGE_2013/NEMOGCM/CONFIG/ORCA2_LIM/IDL_scripts/std_ts_ICE.pro	(revision 4320)
@@ -1,3 +1,15 @@
-pro std_ts_ICE, masknp, s_iodir_data, POSTSCRIPT = postscript, _extra = ex
+function read_arr2d, filename, varname, t1, t2
+;; function that read input file and return 2d array with monthly timecounter 
+nyear = (t2-t1+1)/12
+arr2d = ncdf_lec(filename, VAR=varname)
+arr2d = arr2d[t1:t2]
+arr2d = reform(arr2d,12,nyear) ; put in 2D array
+arr2d = total(arr2d,2)/nyear ; total over 2th dimension (i.e.years)
+
+return, arr2d
+end 
+
+;; here start procedure that use function read_arr2d  
+pro std_ts_ICE, masknp, s_iodir_data,  POSTSCRIPT = postscript, _extra = ex
 
   compile_opt idl2, strictarrsubs
@@ -10,31 +22,93 @@
 ; get exp2 info
   vICE2 = getenv('VAR2_ICE')   &   prefix2 = getenv('V2ICE_PREF')   &   suffix2 = getenv('V2ICE_SUFF')
+; get ice climatology info
+  std_file_ice =  isafile(getenv('FILE_ICE'), title = 'ICE Extent Climatology', iodir = std_iodir_climato)
 ;
+  time_ice = ncdf_lec( std_file_ice, VAR='time' )
+  time_ice = (time_ice - FLOOR(time_ice) ) * 12
+  time_ice = (round(time_ice) + 11) mod 12; round to nearest integer
+  t1 = where(time_ice eq 0)
+  t1 = t1[0] ;  jannuary
+  t2 = where(time_ice eq 11, count)
+  t2 = t2[count-1] ; last day of december
+
+  vICE_ext_NH = read_arr2d(std_file_ice, getenv('VAR_ICE_EXT_NH'), t1, t2 )
+  vICE_ext_SH = read_arr2d(std_file_ice, getenv('VAR_ICE_EXT_SH'), t1, t2 )
+;
+  vICE_area_NH = read_arr2d(std_file_ice, getenv('VAR_ICE_area_NH'), t1, t2 )
+  vICE_area_SH = read_arr2d(std_file_ice, getenv('VAR_ICE_area_SH'), t1, t2 )
+;  
   cdti3 = string(cnt, format = '(i3.3)')
   print, cdti3 + ') ' + blabla
-  filename = cdti3 + '_ts_AMOC_'+prefix
+  filename = cdti3 + '_ts_ICE_'+prefix
   if prefix NE prefix2 then filename = filename + '_'+prefix2
-  if KEYWORD_SET(postscript) then openps, filename+'_1.ps', portrait = 1
+  if KEYWORD_SET(postscript) then openps, filename+'.ps', portrait = 1
 ;
   d1_d2 = '('+strtrim(date1, 1)+' - '+strtrim(date2, 1)+')'
 ;
   iodir = std_iodir_data
+  ; ICE Area in NORTH Hemisphere
+  domdef, 0, jpi-1, 30, 90, /xindex
+  ICE_N = rseries_ncdf(vICE1, date1, date2, prefix, suffix, FIRSTONLY = 1 - allrec)
+  ICE_N = grossemoyenne(ICE_N.arr, 'xy', /integration, mask2d = masknp)
 
-  domdef, 0, jpi-1, 30, 90, /xindex
-  ICE_N = rseries_ncdf(vICE1, date1, date2, prefix, suffix, FIRSTONLY = 1 - allrec, direc = 'xy', /integration, mask2d = masknp)
-  ICE_N.arr = ICE_N.arr * 1.e-12   &   ICE_N.unit = '10^12 m^2'
-  domdef, 0, jpi-1, -90, -30, /xindex
-  ICE_S = rseries_ncdf(vICE1, date1, date2, prefix, suffix, FIRSTONLY = 1 - allrec, direc = 'xy', /integration, mask2d = masknp)
-  ICE_S.arr = ICE_S.arr * 1.e-12   &   ICE_S.unit = '10^12 m^2'
+  if jpt mod 12 ne 0 then stop
+  nyr=jpt/12.
+  ICE_N = reform(ice_n, 12,nyr)
+  ICE_n = total(ice_n,2)/nyr
+  ICE_N = {arr:ICE_N * 1.e-12, unit : '10^12 m^2'}
 
-  title = prefix+' '+d1_d2+'!C'+'Global Annual Mean Ice Area (North. Hemisp.)'
-  pltt, ICE_N, 't', 0., 15., date1, date2, /REMPLI, /PORTRAIT $
+  ; ICE EXTENT (Area minus 15%) in NORTH Hemisphere
+  ICE_N_15 = rseries_ncdf(vICE1, date1, date2, prefix, suffix, FIRSTONLY = 1 - allrec)
+  msk = ICE_N_15.arr gt 0.15 ; remove 0.15% for observations
+  ICE_N_15 = grossemoyenne( msk, 'xy', /integration, mask2d = masknp)
+  if jpt mod 12 ne 0 then stop
+  nyr=jpt/12.
+  ICE_N_15 = reform(ice_n_15, 12,nyr)
+  ICE_n_15 = total(ice_n_15,2)/nyr
+  ICE_N_15 = {arr:ICE_N_15 * 1.e-12, unit : '10^12 m^2'}
+  ;
+  ;ICE Area in SOUTH Hemisphere
+  domdef, 0, jpi-1, -90, -30, /xindex 
+  ICE_S = rseries_ncdf(vICE1, date1, date2, prefix, suffix, FIRSTONLY = 1 - allrec)
+  ICE_S = grossemoyenne(ICE_S.arr, 'xy', /integration, mask2d = masknp)
+  if jpt mod 12 ne 0 then stop
+  nyr=jpt/12.
+  ICE_S = reform(ice_S, 12,nyr)
+  ICE_S = total(ice_S,2)/nyr
+  ICE_S = {arr:ICE_S * 1.e-12, unit : '10^12 m^2'}
+  ; ICE EXTENT (Area minus 15%) in SOUTH Hemisphere
+  ICE_S_15 = rseries_ncdf(vICE1, date1, date2, prefix, suffix, FIRSTONLY = 1 - allrec)
+  msk = ICE_S_15.arr gt 0.15 ; remove 0.15% for observations
+  ICE_S_15 = grossemoyenne(msk, 'xy', /integration, mask2d = masknp)
+  if jpt mod 12 ne 0 then stop
+  nyr=jpt/12.
+  ICE_S_15 = reform(ice_S_15, 12,nyr)
+  ICE_S_15 = total(ice_S_15,2)/nyr
+  ICE_S_15 = {arr:ICE_S_15 * 1.e-12, unit : '10^12 m^2'}
+  ;
+  title = 'Northern Hemisphere'+'!C'+prefix+' '+d1_d2+'!C'+' Global Annual Mean Ice Area (Black SOLID simulation)'+'!C'+ 'and Extend minus 15% (Blue SOLID simulation)'+'!C'+'Observation (dashed)'
+  jpt=12
+  time=julday(1,15,1900)+30*lindgen(12)
+  pltt, ICE_N, 't', 0., 15., 19000101, 19001231, /REMPLI, /PORTRAIT,MIN = 4., MAX = 16. $
         , small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
-  
-  title = prefix+' '+d1_d2+'!C'+'Global Annual Mean Ice Area (South. Hemisp.)'
-  pltt, ICE_S, 't', 0., 15., date1, date2, /REMPLI, /NOERASE $
+  pltt, ICE_N_15, 't', 0., 15., 19000101, 19001231, /REMPLI, /PORTRAIT $ ; dashed lines is LINESTYLE=2  $
+        , /ov1d, COLOR = 100, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex 
+  pltt, vICE_area_NH, 't', 0., 15., 19000101, 19001231, /REMPLI, /PORTRAIT, LINESTYLE=2 $ 
+         , /ov1d, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+  pltt, vICE_ext_NH, 't', 0., 15., 19000101, 19001231, /REMPLI, /PORTRAIT, LINESTYLE=2 $ 
+        , /ov1d, COLOR = 100, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+;
+  title ='Southern Hemisphere !C'+prefix+' '+d1_d2+' - '+'!C'+'Global Annual Mean Ice Area (Black SOLID simulation)'+'!C'+ 'and Extend minus 15% (Blue SOLID simulation)'+'!C'+'Observation (dashed)'
+  pltt, ICE_S, 't', 0., 15.,19000101 ,19001231 , /REMPLI, /NOERASE , MIN = 0., MAX = 20. $
         , small = [1, 2, 2], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
-  
-  htmltxt = [ htmltxt, '<hr>'+blabla, '<br><img width="80%" src='+filename+'_1.png  />  ' ]
+  pltt, ICE_S_15, 't', 0., 15., 19000101, 19001231, /REMPLI, /PORTRAIT $ 
+        , /ov1d, COLOR = 100, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex 
+  pltt,  vICE_area_SH, 't', 0., 15., 19000101, 19001231, /REMPLI, /PORTRAIT, LINESTYLE=2 $ 
+         , /ov1d, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+  pltt,  vICE_ext_SH, 't', 0., 15., 19000101, 19001231, /REMPLI, /PORTRAIT, LINESTYLE=2 $ 
+        , /ov1d, COLOR = 100, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+;
+  htmltxt = [ htmltxt, '<hr>'+blabla, '<br><img width="80%" src='+filename+'.png  />  ' ]
   if KEYWORD_SET(postscript) then closeps
 
@@ -42,23 +116,70 @@
 
     d1_d2_2 = '('+strtrim(date1_2, 1)+' - '+strtrim(date2_2, 1)+')'
-
     tsave = time
     domdef, 0, jpi-1, 30, 90, /xindex
-    ICE_N2 = rseries_ncdf(vICE2, date1_2, date2_2, prefix2, suffix2, FIRSTONLY = 1 - allrec, direc = 'xy', /integration, mask2d = masknp)
-    ICE_N2.arr = ICE_N2.arr * 1.e-12   &   ICE_N2.unit = '10^12 m^2'
-    domdef, 0, jpi-1, -90, -30, /xindex
-    ICE_S2 = rseries_ncdf(vICE2, date1_2, date2_2, prefix2, suffix2, FIRSTONLY = 1 - allrec, direc = 'xy', /integration, mask2d = masknp)
-    ICE_S2.arr = ICE_S2.arr * 1.e-12   &   ICE_S2.unit = '10^12 m^2'
-    time = tsave   &   IF n_elements(time) NE jpt THEN stop
+    ;ICE Extent in NORTH Hemisphere
+    ICE_N2 = rseries_ncdf(vICE2, date1_2, date2_2, prefix2, suffix2, FIRSTONLY = 1 - allrec)
+    ICE_N2 = grossemoyenne(ICE_N2.arr, 'xy', /integration, mask2d = masknp)
+    if jpt mod 12 ne 0 then stop
+    nyr=jpt/12.
+    ICE_N2 = reform(ICE_N2, 12,nyr)
+    ICE_N2 = total(ICE_N2,2)/nyr
+    ICE_N2 = {arr:ICE_N2 * 1.e-12, unit : '10^12 m^2'}
+    ;ICE Extent minus 15% in NORTH Hemisphere
+    ICE_N2_15 = rseries_ncdf(vICE2, date1_2, date2_2, prefix2, suffix2, FIRSTONLY = 1 - allrec)
+    msk = ICE_N2_15.arr gt 0.15  ; remove 0.15% for observations
+    ICE_N2_15 = grossemoyenne( msk, 'xy', /integration, mask2d = masknp)
+    if jpt mod 12 ne 0 then stop
+    nyr=jpt/12.
+    ICE_N2_15 = reform(ICE_N2_15, 12,nyr)
+    ICE_N2_15 = total(ICE_N2_15,2)/nyr
+    ICE_N2_15 = {arr:ICE_N2_15 * 1.e-12, unit : '10^12 m^2'}
+    ;ICE Extent in SOUTH Hemisphere
+    domdef, 0, jpi-1, -90, -30, /xindex 
+    ICE_S2 = rseries_ncdf(vICE2, date1_2, date2_2, prefix2, suffix2, FIRSTONLY = 1 - allrec)
+    ICE_S2 = grossemoyenne(ICE_S2.arr, 'xy', /integration, mask2d = masknp)
+    if jpt mod 12 ne 0 then stop
+    nyr=jpt/12.
+    ICE_S2 = reform(ICE_S2, 12,nyr)
+    ICE_S2 = total(ICE_S2,2)/nyr
+    ICE_S2 = {arr:ICE_S2 * 1.e-12, unit : '10^12 m^2'}
+    ;ICE Extent minus 15% in SOUTH Hemisphere
+    ICE_S2_15 = rseries_ncdf(vICE2, date1_2, date2_2, prefix2, suffix2, FIRSTONLY = 1 - allrec)
+    msk = ICE_S2_15.arr gt 0.15  ; remove 0.15% for observations
+    ICE_S2_15 = grossemoyenne(msk, 'xy', /integration, mask2d = masknp)
+    if jpt mod 12 ne 0 then stop
+    nyr=jpt/12.
+    ICE_S2_15 = reform(ICE_S2_15, 12,nyr)
+    ICE_S2_15 = total(ICE_S2_15,2)/nyr
+    ICE_S2_15 = {arr:ICE_S2_15 * 1.e-12, unit : '10^12 m^2'}
+  ;
+ ;   time = tsave   &   IF n_elements(time) NE jpt THEN stop
 
     if KEYWORD_SET(postscript) then openps, filename+'_2.ps', portrait = 1
 
-    title = prefix+' '+d1_d2+' - '+prefix2+' '+d1_d2_2+'!C'+'Global Annual Mean Ice Area (North. Hemisp.)'
-    pltt, ICE_N.arr - ICE_N2.arr, 't', -2., 2., date1, date2, /REMPLI, /PORTRAIT, window = 2 $
-          , COLOR = 250, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
-    
-    title = prefix+' '+d1_d2+' - '+prefix2+' '+d1_d2_2+'!C'+'Global Annual Mean Ice Area (South. Hemisp.)'
-    pltt, ICE_S.arr - ICE_S2.arr, 't', -2., 2., date1, date2, /REMPLI, /NOERASE $
-          , COLOR = 250, small = [1, 2, 2], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+
+  title = 'Northern Hemisphere'+'!C'+prefix+' - '+prefix2+' '+d1_d2_2+'!C'+' Global Annual Mean Ice Area (BLUE)'+'!C'+ 'and Extend minus 15% (RED)'
+  jpt=12
+  time=julday(1,15,1900)+30*lindgen(12)
+  pltt, ICE_N.arr - ICE_N2.arr, 't', -.2, .2, 19000101, 19001231, /REMPLI, /PORTRAIT, window = 2 $
+        , COLOR = 250, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+  pltt, ICE_N_15.arr -  ICE_N2_15.arr , 't', -.2, .2, 19000101, 19001231, /REMPLI, /PORTRAIT $ ; linee tratteggiate LINESTYLE=2  $
+        , /ov1d, COLOR = 100, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex 
+;SF  pltt, vICE_area_NH, 't', -2., 2., 19000101, 19001231, /REMPLI, /PORTRAIT, LINESTYLE=2 $ 
+;SF        , /ov1d, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+;SF  pltt, vICE_ext_NH, 't', -2., 2., 19000101, 19001231, /REMPLI, /PORTRAIT, LINESTYLE=2 $ 
+;SF        , /ov1d, COLOR = 100, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+;
+;  title ='Southern Hemisphere'+'!C'+prefix+' - '+prefix2+' '+d1_d2_2+' - '+'!C'+'Global Annual Mean Ice Area (BLUE)'+'!C'+ 'and Extend minus 15% (RED)'
+  title ='Southern Hemisphere'+'!C'
+  pltt, ICE_S.arr - ICE_S2.arr, 't', -2., 2., 19000101, 19001231, /REMPLI, /NOERASE $
+         , COLOR = 250, small = [1, 2, 2], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+  pltt, ICE_S_15.arr -  ICE_S2_15.arr , 't', -2., 2., 19000101, 19001231, /REMPLI, /PORTRAIT $ ; linee tratteggiate LINESTYLE=2  $
+        , /ov1d, COLOR = 100, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+;SF  pltt,  vICE_area_SH, 't', -2., 2., 19000101, 19001231, /REMPLI, /PORTRAIT, LINESTYLE=2 $ 
+;SF         , /ov1d, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+;SF  pltt,  vICE_ext_SH, 't', -2., 2., 19000101, 19001231, /REMPLI, /PORTRAIT, LINESTYLE=2 $ 
+;SF        , /ov1d, COLOR = 100, small = [1, 2, 1], YTITLE = '10^12 m^2 ', TITLE = title, _extra = ex
+;
 
     htmltxt = [ htmltxt, '<hr>'+blabla, '<br><img width="80%" src='+filename+'_2.png  />  ' ]
