From ca5a418d70cf33016c8fe7e115fe47ee50c74ec8 Mon Sep 17 00:00:00 2001
From: awalther <andi.walther@ssec.wisc.edu>
Date: Tue, 30 Oct 2018 11:09:22 -0500
Subject: [PATCH] major udates for caliop/cpr profilings

---
 cws2__add_c.pro               |  6 +++---
 cws_read__get_metadata.pro    |  7 +++----
 cws_read__readdata_CLV.pro    | 16 +++++++++++++---
 cws_read__readdata_SUI.pro    |  2 +-
 cws_stats__caliop_profile.pro | 36 +++++++++++++++++++++++------------
 icwg2_add_lev2.pro            | 20 +++++++++++++++++++
 icwg2_transform.pro           |  9 ++++++---
 test_sui.pro                  | 14 ++++++++++++++
 8 files changed, 84 insertions(+), 26 deletions(-)
 create mode 100644 icwg2_add_lev2.pro
 create mode 100644 test_sui.pro

diff --git a/cws2__add_c.pro b/cws2__add_c.pro
index 5c3039c..57adb68 100644
--- a/cws2__add_c.pro
+++ b/cws2__add_c.pro
@@ -233,11 +233,11 @@ pro cws2::add_c, overpass = overpass, cth_reference = cth_reference, affi = affi
   ; add actual data to the level C file 
   print, '... add data to AVAC-S level C file ', ntime, ' datapoits '
   print, '/'+affi+'/'+self.cws_sensor+'/'+product, ', add_c in cws2__define.pro'
+  
+  
   self->h5add, cfile, cData, group='/'+affi+'/'+self.cws_sensor+'/'+product
 
-  print, ''
-  print, ''
-  print, ''
+ 
 
 end
 
diff --git a/cws_read__get_metadata.pro b/cws_read__get_metadata.pro
index 9eea7f8..b5ff57d 100644
--- a/cws_read__get_metadata.pro
+++ b/cws_read__get_metadata.pro
@@ -164,10 +164,9 @@ PRO cws_read::get_metadata, name=name, version=version, img_type=img_type, img_q
     unit	= '1'
     accuracy	=  0.
     slope	=  1.
-    if self.grp eq 'COX' then begin
-      slope     =  10. / 256.
-      ;;slope	=  max(img) / 256. 
-    endif
+    
+   
+   
     if (self.product eq 'ucod')   then slope =  80. / 256.
     if (self.product eq 'ucod2')  then slope =  80. / 256.
     offset		=  0
diff --git a/cws_read__readdata_CLV.pro b/cws_read__readdata_CLV.pro
index d7b0bd3..aefc177 100644
--- a/cws_read__readdata_CLV.pro
+++ b/cws_read__readdata_CLV.pro
@@ -33,8 +33,10 @@ function cws_read::readdata_CLV
       END
  			
       'ref':BEGIN
-        ref = read_hdf_ssec(self.infile,'REF')	
+        ref = read_hdf_ssec(self.infile,'REF')
+        	ref = rotate(ref,7)
 	refu =  read_hdf_ssec(self.infile,'REFU')	
+  refu = rotate(refu,7)
 	nodata_idx=where(ref le 0 or refu gt 1.,nodata_anz)
  	img = float(ref)
  	IF nodata_anz gt 0 THEN img[nodata_idx]=-1.
@@ -44,9 +46,11 @@ function cws_read::readdata_CLV
  			
       'cod':BEGIN
         cod = read_hdf_ssec(self.infile,'COD')
+        cod = rotate(cod,7)
         codu = read_hdf_ssec(self.infile,'CODU')
         nodata_idx=where(cod le 0 or codu gt 1. ,nodata_anz)
         IF nodata_anz gt 0 THEN cod[nodata_idx]=-1.
+        
         RETURN,cod
       END
  			
@@ -88,8 +92,14 @@ function cws_read::readdata_CLV
         ; data  =   0.* (cph gt  4) + 1.* (between(cph,1,3)) + 2.* (cph eq 4) $
         ;         + 4.* (cph eq 0)
                 
-        data =   0.* (cph eq 5) + 1.*(cph eq 1) + 2.*(cph eq 4) $
-               + 3.*((cph eq 3) or (cph eq 2)) + 4.*(cph eq 0)
+        data =  $
+                  1 * (cph eq 3) $
+              +   2 * (between(cph, 5.5,9.5)) $
+              +   3 * (cph eq 5)
+               
+               
+               
+               
  	RETURN, data
       END
  			
diff --git a/cws_read__readdata_SUI.pro b/cws_read__readdata_SUI.pro
index 3639e01..493321c 100644
--- a/cws_read__readdata_SUI.pro
+++ b/cws_read__readdata_SUI.pro
@@ -29,7 +29,7 @@ case self.product of
      idx = where (img le 0.)
      img[idx] = -999.
        img = rotate(img,5)
-       
+      
       
        return,img
       
diff --git a/cws_stats__caliop_profile.pro b/cws_stats__caliop_profile.pro
index 4138540..aa2c090 100644
--- a/cws_stats__caliop_profile.pro
+++ b/cws_stats__caliop_profile.pro
@@ -239,33 +239,33 @@ for u=0,n_elements(sfcbin)-1 do  radar[sfcbin[u]:*,u]= -999.
     
     no_cloud_idx = where(cmb eq 1,cNoCloud) 
     if  cNoCloud gt 0 then begin
-      p010=plot(compl,make_array(cNoCloud,value=1),'y+',/overplot )  
+      p010=plot(compl,make_array(cNoCloud,value=1),'y.',/overplot )  
     endif  
   
     phase_idx_wat = where(cph eq 1,cWat )
     if cWat gt 1 then begin
-      p011=plot(phase_idx_wat,make_array(cWat,value=2),'g+',/overplot  )   
+      p011=plot(phase_idx_wat,make_array(cWat,value=2),'g.',/overplot  )   
     endif 
     
     phase_idx_ice = where(cph eq 2,cIce )
     if  cIce gt 1 then begin
-       p012=plot(phase_idx_ice,make_array(cIce,value=3),'r+',/overplot  )  
+       p012=plot(phase_idx_ice,make_array(cIce,value=3),'r.',/overplot  )  
     endif
     
     phase_idx_mix = where(cph eq 3,cMix )
     if  cMix gt 1 then begin
-      p013=plot(phase_idx_mix,make_array(cMix,value=4),'c+',/overplot  ) 
+      p013=plot(phase_idx_mix,make_array(cMix,value=4),'c.',/overplot  ) 
     endif
     
     
     thisP = !P
     !p.charsize /= 2.4
     
-    t30 = text ( nr_idx+10, -0. , 'Cl' , color='blue',/data) 
-    t31 = text ( nr_idx+10, -0.8 , 'NCl' , color='gold',/data) 
-    t32 = text ( nr_idx+10, -1.6 , 'Wat' , color='green',/data) 
-    t33 = text ( nr_idx+10, -2.4 , 'Ice' , color='red',/data) 
-    t34 = text ( nr_idx+10, -3.2 , 'Mix' , color='purple',/data) 
+   ; t30 = text ( nr_idx+10, -0. , 'Cl' , color='blue',/data) 
+    t31 = text ( 0.93,0.63, 'NoCl' , color='gold',font_size=7) 
+    t32 = text ( 0.93,0.645, 'Wat' , color='green',font_size=7) 
+    t33 = text ( 0.93,0.66, 'Ice' , color='red',font_size=7) 
+   ; t34 = text ( nr_idx+10, -3.2 , 'Mix' , color='purple',/data) 
     
    
     !p = thisP
@@ -284,12 +284,19 @@ for u=0,n_elements(sfcbin)-1 do  radar[sfcbin[u]:*,u]= -999.
     
     ; plot COD
     
-    p10 = plot ( indgen(n_elements(ind)),cod ,'r+' ,/overplot,sym_size=0.5)
-    p11 = plot ( indgen(n_elements(ind)),cod_wat,'g+',/overplot,sym_size=0.5)
-    p12 = plot ( indgen(n_elements(ind)),cod_modis, 'b+',/overplot,sym_size=0.5)
+    p10 = plot ( indgen(n_elements(ind)),cod ,'r+' ,/overplot,sym_size=0.5,name='Ice')
+    p11 = plot ( indgen(n_elements(ind)),cod_wat,'g+',/overplot,sym_size=0.5,name = 'Water')
+    p12 = plot ( indgen(n_elements(ind)),cod_modis, 'b+',/overplot,sym_size=0.5,name='Modis or AMSR-E')
     
     t12 =text ( 0.5,0.627,'Cloud optical depth' , align = 0.5 )
    
+    t13 = text ( 0.1,0.624,'+ Ice ','r',font_size=7)
+    t14 = text ( 0.18,0.624,'+ Water ','g',font_size=7)
+    t15 = text ( 0.26,0.624,'+ Modis ','b',font_size=7)
+    
+    ;leg = legend(target=[p10,p11,p12],position= [0.8,0.3],/auto_text_color,linestyle = 6 )
+    
+   
 
    ; plot,indgen(n_elements(ind)),cod,pos=[0.1,0.46,0.9,0.62],/noerase $
 ;              , yRange=[0,50],psym=1 $
@@ -328,6 +335,8 @@ for u=0,n_elements(sfcbin)-1 do  radar[sfcbin[u]:*,u]= -999.
     
     
     t20= text (   0.5,0.227,'Liquid water path',align=0.5)    
+    t21 = text ( 0.1,0.224,'+ MSG Water ','g',font_size=7)
+    t22 = text ( 0.24,0.224,'+ AMSR-E  ','b',font_size=7)
     
     
    ; ax0 = Axis('x',axis_range= [0,n_elements(ind)-1],style = 0)
@@ -374,6 +383,9 @@ for u=0,n_elements(sfcbin)-1 do  radar[sfcbin[u]:*,u]= -999.
                  ,sym_size=0.5,/overplot )                          
               
       
+     
+   t4 = text (0.05,0.01,'created on '+systime(),font_size=7)   
+      
   w.save,outFile+'.png'
   print,outFile+'.png'
 
diff --git a/icwg2_add_lev2.pro b/icwg2_add_lev2.pro
new file mode 100644
index 0000000..7f671c3
--- /dev/null
+++ b/icwg2_add_lev2.pro
@@ -0,0 +1,20 @@
+pro icwg2_add_lev2, grp_list=grp_list
+
+
+
+default,prd_list,['cmb','ctp','ctt','cth','cod','ref','cph','lwp']
+default,grp_list,['CLV','LARN','SUI','TPS','UKMN']
+o=cws2()
+for ovp = 11311,11320 do begin
+  foreach prd, prd_list do begin
+    foreach grp,grp_list do begin
+      o.add_c,overpass=ovp,affi=grp,product=prd
+    endforeach
+  endforeach
+
+
+endfor
+
+
+
+end
diff --git a/icwg2_transform.pro b/icwg2_transform.pro
index 6b528f9..ebedcb8 100644
--- a/icwg2_transform.pro
+++ b/icwg2_transform.pro
@@ -1,20 +1,23 @@
 ;
 
-pro icwg2_transform, grp
+pro icwg2_transform, grp, prd_list = prd_list
 
 default,grp,'TPS'
-prd_list = ['cmb','ctp','ctt','cth','cod','ref','cph','lwp']
+default,prd_list,['cmb','ctp','ctt','cth','cod','ref','cph','lwp']
 ;prd_list=['cmb','ctp']
+;prd_list='cph'
 o=cws_read()
 o.set_group,grp
 
-o.set_date,2008,6,13,12,0
+o.set_date,2008,6,13,13,45
 foreach prd, prd_list do begin
     o.set_product,prd
     o.transformIt,/force
  endforeach
 
+
 stop
+
 for hh = 0,23 do begin
   for mm = 0,45,15 do begin
     o.set_date,2008,6,13,hh,mm
diff --git a/test_sui.pro b/test_sui.pro
new file mode 100644
index 0000000..854d2b2
--- /dev/null
+++ b/test_sui.pro
@@ -0,0 +1,14 @@
+pro test_sui
+
+o=cws_read()
+o.set_product, 'ctp'
+o.set_group, 'SUI'
+o.set_date, 2008, 6, 13 , 13 , 45
+
+data = o.get_data()
+
+help,data
+stop
+
+
+end
-- 
GitLab