From 8b793c52e312b4d532eb5e9c04ae6724d4afb179 Mon Sep 17 00:00:00 2001
From: Gaelle Tanguy <gaelle.tanguy@meteo.fr>
Date: Wed, 2 Dec 2015 15:28:08 +0000
Subject: [PATCH] Gaelle 2/12/2015 : MAJ 003_KW78

---
 .../001_prep_ideal_case/PRE_IDEA1.nam         |   2 +-
 .../clean_prep_ideal_case_xyz                 |   1 +
 .../run_prep_ideal_case_xyz                   |   2 +-
 MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam   |   4 +-
 .../003_KW78/002_mesonh/EXSEG1.nam_CEN4TH     |  11 +-
 .../KTEST/003_KW78/002_mesonh/EXSEG1.nam_WENO |  14 +-
 .../003_KW78/002_mesonh/clean_mesonh_xyz      |   2 +-
 .../KTEST/003_KW78/002_mesonh/run_mesonh_xyz  |   4 +-
 .../KTEST/003_KW78/003_convdia/dir_conv2dia   |   4 +-
 .../KTEST/003_KW78/003_convdia/run_conv2dia   |   4 +-
 .../KTEST/003_KW78/004_diaprog/clean_diaprog  |   2 +-
 MY_RUN/KTEST/003_KW78/004_diaprog/dir_KW78    |  26 +-
 MY_RUN/KTEST/003_KW78/004_diaprog/run_diaprog |   2 +-
 MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl       |   2 +
 MY_RUN/KTEST/003_KW78/005_ncl/plot_KW78.ncl   | 302 ++++++++++++++++++
 MY_RUN/KTEST/003_KW78/005_ncl/run_ncl         |   9 +
 MY_RUN/KTEST/003_KW78/Makefile                |   4 +-
 17 files changed, 348 insertions(+), 47 deletions(-)
 create mode 100755 MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl
 create mode 100644 MY_RUN/KTEST/003_KW78/005_ncl/plot_KW78.ncl
 create mode 100755 MY_RUN/KTEST/003_KW78/005_ncl/run_ncl

diff --git a/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/PRE_IDEA1.nam b/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/PRE_IDEA1.nam
index 811e8fa86..cd001d4bd 100644
--- a/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/PRE_IDEA1.nam
+++ b/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/PRE_IDEA1.nam
@@ -17,7 +17,7 @@
 &NAM_CONFn LUSERV= T , LUSERC= F LUSERI= F /
 &NAM_GRID_PRE XLAT0=43.29 /
 &NAM_GRIDH_PRE XDELTAX=1.E3 XDELTAY=1.E3  /
-&NAM_LUNITn CINIFILE='KWRAIN.520' /
+&NAM_LUNITn CINIFILE='KWRAIN' /
 &NAM_DYNn_PRE 
   ! CPRESOPT= 'ZRESI' ,
   NITR=4 XRELAX=1. /
diff --git a/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/clean_prep_ideal_case_xyz b/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/clean_prep_ideal_case_xyz
index f3bf99871..3411f2097 100755
--- a/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/clean_prep_ideal_case_xyz
+++ b/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/clean_prep_ideal_case_xyz
@@ -1,3 +1,4 @@
 #!/bin/sh
 set -x
 rm -f KWRAIN.* OUTPUT_LISTING* pipe* *.tex
+rm -f file_for_xtransfer
diff --git a/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/run_prep_ideal_case_xyz b/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/run_prep_ideal_case_xyz
index 62e6b5c17..1b2cb0301 100755
--- a/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/run_prep_ideal_case_xyz
+++ b/MY_RUN/KTEST/003_KW78/001_prep_ideal_case/run_prep_ideal_case_xyz
@@ -5,6 +5,6 @@
 #MNH_LIC for details. version 1.
 set -x
 set -e
-rm -f KWRAIN.520* OUTPUT_LISTING* pipe* *.tex
+rm -f KWRAIN.* OUTPUT_LISTING* pipe* *.tex
 time ${MONORUN} PREP_IDEAL_CASE${XYZ}
 #ddd --directory=~/.... PREP_PGD
diff --git a/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam b/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam
index 286625232..ca5bbef26 100644
--- a/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam
+++ b/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam
@@ -2,7 +2,7 @@
 &NAM_CONFZ
  ! NZ_VERB=5 , NZ_PROC=0 , NB_PROCIO_R=8 , NB_PROCIO_W=8
 /
-&NAM_LUNITn CINIFILE = "KWRAIN.520" /
+&NAM_LUNITn CINIFILE = "KWRAIN" /
 &NAM_CONFn  LUSERV=T LUSERC=T LUSERR=T /
 &NAM_DYNn XTSTEP =10., 
           ! CPRESOPT = "ZRESI",
@@ -15,7 +15,7 @@
 &NAM_LBCn  CLBCX = 2*"OPEN", CLBCY = 2*"OPEN" /
 &NAM_CONF  CCONF = "START", NMODEL = 1,
            LFLAT = T, NVERB = 5,
-           CEXP = "KWRAI", CSEG = "SG520" ,
+           CEXP = "KWRAI", CSEG = "SEG01" ,
            CSPLIT='BSPLITTING' 
            !JPHEXT=3 NHALO=3
            /
diff --git a/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam_CEN4TH b/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam_CEN4TH
index 9e5cf92a0..ca5bbef26 100644
--- a/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam_CEN4TH
+++ b/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam_CEN4TH
@@ -1,7 +1,8 @@
+&NAM_CONFIO  LCDF4=T, LLFIOUT=T, LLFIREAD=F /
 &NAM_CONFZ
- ! NZ_VERB=5 , NZ_PROC=0 , NB_PROCIO_R=8 , NB_PROCIO_W=1
+ ! NZ_VERB=5 , NZ_PROC=0 , NB_PROCIO_R=8 , NB_PROCIO_W=8
 /
-&NAM_LUNITn CINIFILE = "KWRAIN.410" /
+&NAM_LUNITn CINIFILE = "KWRAIN" /
 &NAM_CONFn  LUSERV=T LUSERC=T LUSERR=T /
 &NAM_DYNn XTSTEP =10., 
           ! CPRESOPT = "ZRESI",
@@ -14,8 +15,10 @@
 &NAM_LBCn  CLBCX = 2*"OPEN", CLBCY = 2*"OPEN" /
 &NAM_CONF  CCONF = "START", NMODEL = 1,
            LFLAT = T, NVERB = 5,
-           CEXP = "KWRAI", CSEG = "SG410" ,
-           CSPLIT='BSPLITTING' /
+           CEXP = "KWRAI", CSEG = "SEG01" ,
+           CSPLIT='BSPLITTING' 
+           !JPHEXT=3 NHALO=3
+           /
 &NAM_DYN  XSEGLEN = 1800.,
           XASSELIN = 0.2, LCORIO = F,
           LNUMDIFU = T /
diff --git a/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam_WENO b/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam_WENO
index a863a4d96..464b072bf 100644
--- a/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam_WENO
+++ b/MY_RUN/KTEST/003_KW78/002_mesonh/EXSEG1.nam_WENO
@@ -1,7 +1,8 @@
+&NAM_CONFIO  LCDF4=T, LLFIOUT=T, LLFIREAD=F /
 &NAM_CONFZ
- ! NZ_VERB=5 , NZ_PROC=0 , NB_PROCIO_R=8 , NB_PROCIO_W=1
+ ! NZ_VERB=5 , NZ_PROC=0 , NB_PROCIO_R=8 , NB_PROCIO_W=8
 /
-&NAM_LUNITn CINIFILE = "KWRAIN.410" /
+&NAM_LUNITn CINIFILE = "KWRAIN" /
 &NAM_CONFn  LUSERV=T LUSERC=T LUSERR=T /
 &NAM_DYNn XTSTEP =10., 
           ! CPRESOPT = "ZRESI",
@@ -9,13 +10,16 @@
           LHORELAX_UVWTH = T, LHORELAX_RV = T, LVE_RELAX = F,
                   NRIMX = 6, NRIMY = 6, XRIMKMAX = .005,
           XT4DIFU = 75. /
-&NAM_ADVn  CUVW_ADV_SCHEME="WENO_K", CMET_ADV_SCHEME = "PPM_01", CSV_ADV_SCHEME = "PPM_01" /
+&NAM_ADVn  CUVW_ADV_SCHEME="WENO_K", CMET_ADV_SCHEME = "PPM_01", CSV_ADV_SCHEME = "PPM_01",
+           NWENO_ORDER=5 ,CTEMP_SCHEME='RK53' /
 &NAM_PARAMn  CCLOUD = "KESS" /
 &NAM_LBCn  CLBCX = 2*"OPEN", CLBCY = 2*"OPEN" /
 &NAM_CONF  CCONF = "START", NMODEL = 1,
            LFLAT = T, NVERB = 5,
-           CEXP = "KWRAI", CSEG = "SG410" ,
-           CSPLIT='BSPLITTING' /
+           CEXP = "KWRAI", CSEG = "SEG01" ,
+           CSPLIT='BSPLITTING'
+           !JPHEXT=3 NHALO=3
+           /
 &NAM_DYN  XSEGLEN = 1800.,
           XASSELIN = 0.2, LCORIO = F,
           LNUMDIFU = T /
diff --git a/MY_RUN/KTEST/003_KW78/002_mesonh/clean_mesonh_xyz b/MY_RUN/KTEST/003_KW78/002_mesonh/clean_mesonh_xyz
index 79031722d..946d0c90e 100755
--- a/MY_RUN/KTEST/003_KW78/002_mesonh/clean_mesonh_xyz
+++ b/MY_RUN/KTEST/003_KW78/002_mesonh/clean_mesonh_xyz
@@ -1,4 +1,4 @@
 set -x
 rm -f PRESSURE 
-rm -f KWRAI* OUT* pipe_name
+rm -f KWRAI* OUT* pipe_name file_for_xtransfer
 
diff --git a/MY_RUN/KTEST/003_KW78/002_mesonh/run_mesonh_xyz b/MY_RUN/KTEST/003_KW78/002_mesonh/run_mesonh_xyz
index 2677a67a6..079afbb26 100755
--- a/MY_RUN/KTEST/003_KW78/002_mesonh/run_mesonh_xyz
+++ b/MY_RUN/KTEST/003_KW78/002_mesonh/run_mesonh_xyz
@@ -4,6 +4,6 @@
 #MNH_LIC for details. version 1.
 set -x
 set -e
-ln -fs ../001_prep_ideal_case/KWRAIN.520.*??? .
-rm -f KWRAI.1.SG* OUT*
+ln -fs ../001_prep_ideal_case/KWRAIN.*??? .
+rm -f KWRAI.1.* OUT*
 time ${MPIRUN} MESONH${XYZ}
diff --git a/MY_RUN/KTEST/003_KW78/003_convdia/dir_conv2dia b/MY_RUN/KTEST/003_KW78/003_convdia/dir_conv2dia
index 171088acf..b6310ba65 100644
--- a/MY_RUN/KTEST/003_KW78/003_convdia/dir_conv2dia
+++ b/MY_RUN/KTEST/003_KW78/003_convdia/dir_conv2dia
@@ -1,6 +1,6 @@
 1                                                                               
-KWRAI.1.SG520.004
-KWRAI.1.SG520.004dg
+KWRAI.1.SEG01.004
+KWRAI.1.SEG01.004dg
 n
 n
 0                                                                               
diff --git a/MY_RUN/KTEST/003_KW78/003_convdia/run_conv2dia b/MY_RUN/KTEST/003_KW78/003_convdia/run_conv2dia
index c7d0feb70..8749ea03b 100755
--- a/MY_RUN/KTEST/003_KW78/003_convdia/run_conv2dia
+++ b/MY_RUN/KTEST/003_KW78/003_convdia/run_conv2dia
@@ -4,7 +4,7 @@
 #MNH_LIC for details. version 1.
 set -x
 set -e
-ln -sf ../002_mesonh/KWRAI.1.SG520.004.??? .
-rm -f KWRAI.1.SG520.004dg.???
+ln -sf ../002_mesonh/KWRAI.1.SEG01.004.??? .
+rm -f KWRAI.1.SEG01.004dg.???
 ${POSTRUN} conv2dia < dir_conv2dia
 
diff --git a/MY_RUN/KTEST/003_KW78/004_diaprog/clean_diaprog b/MY_RUN/KTEST/003_KW78/004_diaprog/clean_diaprog
index da0f9b268..1be3a1ada 100755
--- a/MY_RUN/KTEST/003_KW78/004_diaprog/clean_diaprog
+++ b/MY_RUN/KTEST/003_KW78/004_diaprog/clean_diaprog
@@ -1,2 +1,2 @@
 set -x
-rm -f dir.* gmeta KWRAI.1.SG410.00*    OUT_DIA
+rm -f dir.* gmeta KWRAI.1.SEG01.00*    OUT_DIA
diff --git a/MY_RUN/KTEST/003_KW78/004_diaprog/dir_KW78 b/MY_RUN/KTEST/003_KW78/004_diaprog/dir_KW78
index a5bd22564..50b7f9243 100644
--- a/MY_RUN/KTEST/003_KW78/004_diaprog/dir_KW78
+++ b/MY_RUN/KTEST/003_KW78/004_diaprog/dir_KW78
@@ -7,7 +7,7 @@ LCOLAREA=T LISO=F
 ! gestion des vecteurs (1 vecteur sur 4)
 NISKIP=4 XVRL=0.15                                                              
 ! 1er fichier a ouvrir
-_file1_'KWRAI.1.SG520.004dg'                                                    
+_file1_'KWRAI.1.SEG01.004dg'                                                    
 !visu                     
 ! couleur de fond pour le 1er intervalle
 LCOLZERO=T NCOLZERO=1                                                           
@@ -77,26 +77,4 @@ XDIAINT=0.2
 THT_CV__MINUS_LSTHM_CV_                                                         
 WT_CV_                                                                          
 quit
-
-! 2e fichier a ouvrir
-_file2_'KWRAI.1.SEG00.003.dia'                                                  
-! definition d une coupe verticale
-LDEFCV2IND=T                                                                    
-NIDEBCV=2 NJDEBCV=12 NIFINCV=24 NJFINCV=12                                      
-LTRACECV=T                                                                    
-THT_CV_                                                                         
-LTRACECV=F                                                                    
-NIMNMX=-1
-RVT_CV__ON_ULTWT_CV_  
-RCT_CV__ON_RRT_CV_    
-WT_CV_
-! 3e fichier a ouvrir
-_file3_'KWRAI.1.SEG00.004.dia'                                                  
-LDEFCV2IND=T                                                                    
-NIDEBCV=2 NJDEBCV=12 NIFINCV=24 NJFINCV=12                                      
-THT_CV_                                                                         
-RVT_CV__ON_ULTWT_CV_  
-RCT_CV__ON_RRT_CV_    
-WT_CV_
-!
-! a vous d indiquer vos directives                                                                            
+                                                               
diff --git a/MY_RUN/KTEST/003_KW78/004_diaprog/run_diaprog b/MY_RUN/KTEST/003_KW78/004_diaprog/run_diaprog
index 758ff3487..decd3490d 100755
--- a/MY_RUN/KTEST/003_KW78/004_diaprog/run_diaprog
+++ b/MY_RUN/KTEST/003_KW78/004_diaprog/run_diaprog
@@ -4,7 +4,7 @@
 #MNH_LIC for details. version 1.
 set -x
 set -e
-ln -sf ../003_convdia/KWRAI.1.SG520.004dg.??? .
+ln -sf ../003_convdia/KWRAI.1.SEG01.004dg.??? .
 rm -f dir.*
 ${POSTRUN} diaprog < dir_KW78         
 #idt gmeta
diff --git a/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl b/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl
new file mode 100755
index 000000000..7b1634bda
--- /dev/null
+++ b/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl
@@ -0,0 +1,2 @@
+
+rm -f  *.nc4 *.ps 
diff --git a/MY_RUN/KTEST/003_KW78/005_ncl/plot_KW78.ncl b/MY_RUN/KTEST/003_KW78/005_ncl/plot_KW78.ncl
new file mode 100644
index 000000000..3a6caa5b2
--- /dev/null
+++ b/MY_RUN/KTEST/003_KW78/005_ncl/plot_KW78.ncl
@@ -0,0 +1,302 @@
+;================================================;
+  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"   
+  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"   
+; ================================================;
+;================================================;
+  begin
+;=================================================;
+; open file and read in data
+;=================================================;
+  fichier1 = addfile("KWRAI.1.SEG01.004.nc4", "r")
+;==================================================;
+; Open the workstation
+;==================================================;
+  type = "ps"
+  wks = gsn_open_wks(type,"visu_KW78")
+;=================================================;
+; Get informations on variable sizes
+; dims are dims-2 to remove non-physical values
+;=================================================;
+  mdims = getfilevardimsizes(fichier1,"UM") ; get dimension sizes
+  nd = dimsizes(mdims)
+  imax=mdims(nd-1)-2
+  jmax=mdims(nd-2)-2
+  kmax=mdims(nd-3)-2
+;=================================================;
+; lecture des différents champs
+;=================================================;
+  zs  = fichier1->ZS(1:jmax,1:imax) ; ZS
+  zhat  = fichier1->ZHAT(1:kmax+1) ; ZHAT
+  yhat  = fichier1->YHAT(1:jmax+1) ; YHAT
+  xhat  = fichier1->XHAT(1:imax+1) ; XHAT
+
+  wt= fichier1->WT(1:kmax+1,1:jmax,1:imax) ; WT
+  vt= fichier1->VT(1:kmax,1:jmax+1,1:imax) ; VT
+  ut= fichier1->UT(1:kmax,1:jmax,1:imax+1) ; UT
+  tht1= fichier1->THT(1:kmax,1:jmax,1:imax) ; THT
+  tht1@long_name="Potential Temperature"
+  tht1@units="K"
+  lsthm1= fichier1->LSTHM(1:kmax,1:jmax,1:imax) 
+  lsthm1@long_name="Large SCale Potential Temperature"
+  lsthm1@units="K"
+
+  pabst1= fichier1->PABST(1:kmax,1:jmax,1:imax) ; PABST
+  pabst1@long_name="Pressure"
+  pabst1@units="Pa"
+  rvt1= fichier1->RVT(1:kmax,1:jmax,1:imax) ; RVT
+  rvt1@long_name="Vapor mixing ratio"
+  rvt1@units="kg/kg"
+  rct1= fichier1->RCT(1:kmax,1:jmax,1:imax) ; RCT
+  rct1@long_name="Cloud mixing ratio"
+  rct1@units="kg/kg"
+  rrt1= fichier1->RRT(1:kmax,1:jmax,1:imax) ; RRT
+  rrt1@long_name="Rain mixing ratio"
+  rrt1@units="kg/kg"
+
+  inprr= fichier1->INPRR(1:jmax,1:imax) 
+  inprr@long_name="Instantaneous Precipitation Rain Rate"
+  inprr@units="mm/h"
+  acprr= fichier1->ACPRR(1:jmax,1:imax) 
+  acprr@long_name="Accumulated Precipitation Rain Rate"
+  acprr@units="mm"
+
+
+  YYYYDDMM1= fichier1->DTCUR__TDATE
+  SS1=fichier1->DTCUR__TIME
+
+;=================================================;
+; Récupération de la date 
+;=================================================;
+  year1=YYYYDDMM1(0)
+  day1=YYYYDDMM1(1)
+  min1=YYYYDDMM1(2)
+  time1=SS1
+;=================================================;
+; On mets toutes les variables sur la grille 1 
+;=================================================;
+
+  ut1 = wrf_user_unstagger(ut,"X")
+  ut1@long_name="Zonal wind"
+  ut1@units="m/s"
+  vt1 = wrf_user_unstagger(vt,"Y")
+  vt1@long_name="Meridian wind"
+  vt1@units="m/s"
+  wt1 = wrf_user_unstagger(wt,"Z")
+  wt1@long_name="Vertical wind"
+  wt1@units="m/s"
+
+;=================================================;
+; Set some other basic resources
+;=================================================;
+  resmap = True
+  resmap@gsnFrame = False
+  resmap@gsnDraw = False
+  resmap@gsnMaximize = True
+  resmap@gsnPaperOrientation = "portrait" 
+  resmap@gsnSpreadColors= True       
+  resmap@tiYAxisString =" "
+  resmap@cnFillOn= True 
+  resmap@cnLinesOn= False 
+;=================================================;
+; Altitude des niveaux modèles
+;=================================================;
+; Unstagger zhat (from grid 4 to 1)
+  nzh=new(kmax,double)
+  do k=0,kmax-1
+    nzh(k)=(zhat(k)+zhat(k+1))/2.
+  end do
+
+; Create alt (altitude des niveaux modèle)
+  alt=new(dimsizes(tht1),double)
+  zcoef=new((/jmax,imax/),double)
+  zcoef=1.-zs/nzh(kmax-1)
+  do i=0,imax-1
+    do j=0,jmax-1
+      alt(:,j,i) = nzh*zcoef(j,i)+zs(j,i)
+    end do
+  end do
+
+;=================================================;
+; TRACE COUPES HORIZONTALES
+;=================================================;
+  gsn_define_colormap(wks,"rainbow") ; Choose colormap
+
+  opts=resmap
+  opts@cnLevelSelectionMode = "ManualLevels"
+  opts@cnLevelSpacingF    = 0.25
+  opts@cnMinLevelValF    = 0
+  opts@cnMaxLevelValF    = 6
+
+  plot_inprr = gsn_csm_contour(wks,inprr,opts)
+  draw(plot_inprr)
+  frame(wks)
+
+  opts@cnLevelSpacingF    = 0.005
+  opts@cnMinLevelValF    = 0
+  plot_acprr = gsn_csm_contour(wks,acprr,opts)
+  draw(plot_acprr)
+  frame(wks)
+
+  res=resmap
+  res@gsnScalarContour=True
+  res@cnLevelSelectionMode = "ManualLevels"
+  res@cnLevelSpacingF= 5
+  res@cnMinLevelValF= 98250
+  res@cnMaxLevelValF= 98350
+  res@vcMinDistanceF = 0.03 
+  res@vcRefLengthF=0.1  
+  plot=gsn_csm_vector_scalar(wks,ut1(0,:,:),vt1(0,:,:),pabst1(0,:,:),res)
+  draw(plot)
+  frame(wks)
+
+; interpolattion sur les niveaux Z=3000m et Z=5000m
+  rct_plane = wrf_user_intrp3d(rct1,alt,"h",3000,0.,False)
+  ut_plane = wrf_user_intrp3d(ut1,alt,"h",3000,0.,False)
+  vt_plane = wrf_user_intrp3d(vt1,alt,"h",3000,0.,False)
+  rct5000_plane = wrf_user_intrp3d(rct1,alt,"h",5000,0.,False)
+  ut5000_plane = wrf_user_intrp3d(ut1,alt,"h",5000,0.,False)
+  vt5000_plane = wrf_user_intrp3d(vt1,alt,"h",5000,0.,False)
+
+  res2=resmap
+  res2@gsnScalarContour=True
+  res2@vcMinDistanceF = 0.04
+  res2@vcRefLengthF =0.1
+  res2@cnLevelSpacingF = 0.00005
+  res2@cnMinLevelValF = 0
+  res2@tiXAxisString = "Z=3000m"
+  plot=gsn_csm_vector_scalar(wks,ut_plane(:,:),vt_plane(:,:),rct_plane(:,:),res2)
+  draw(plot)
+  frame(wks)
+
+  res2@tiXAxisString = "Z=5000m"
+  plot=gsn_csm_vector_scalar(wks,ut5000_plane(:,:),vt5000_plane(:,:),rct5000_plane(:,:),res2)
+  draw(plot)
+  frame(wks)
+
+
+;============================================
+;   COUPE VERTICALE
+;============================================
+; definition de la coupe verticale
+  opt_cv=False
+  plane = new(2,float)
+  plane =(/3,0/) ; point de depart attention i puis j
+  angle=43       ; attention 0=S-N et 90=O-E
+
+; interpolation sur la coupe verticale
+  rvt_cv=wrf_user_intrp3d(rvt1,alt,"v",plane,angle,False)
+  rct_cv=wrf_user_intrp3d(rct1,alt,"v",plane,angle,False)
+  rrt_cv=wrf_user_intrp3d(rrt1,alt,"v",plane,angle,False)
+  ut_cv=wrf_user_intrp3d(ut1,alt,"v",plane,angle,False)
+  vt_cv=wrf_user_intrp3d(vt1,alt,"v",plane,angle,False)
+  wt_cv=wrf_user_intrp3d(wt1,alt,"v",plane,angle,False)
+  tht_cv=wrf_user_intrp3d(tht1,alt,"v",plane,angle,False)
+  lsthm_cv=wrf_user_intrp3d(lsthm1,alt,"v",plane,angle,False)
+
+  rvt_cv@long_name="Vapor mixing ratio"
+  rct_cv@long_name="Cloud mixing ratio"
+  rrt_cv@long_name="Rain mixing ratio"
+
+
+; projection du vent horizontal dans la coupe verticale
+  wind_cv=ut_cv*sin(angle*3.14/180.)+vt_cv*cos(angle*3.14/180)
+
+  opt_cv=resmap
+  opt_cv@gsnScalarContour=True
+  opt_cv@vcMinDistanceF = 0.03 ; espacement des fleches
+  opt_cv@vcRefLengthF=0.1      ; taille des flèches
+  opt_cv@cnLevelSpacingF    = 0.0005
+  opt_cv@cnMinLevelValF    = 0
+  plot=gsn_csm_vector_scalar(wks,wind_cv(:,:),wt_cv(:,:),rvt_cv(:,:),opt_cv)
+  draw(plot)
+  frame(wks)
+
+
+  res_rc=resmap
+  res_rc@cnFillOn               = True ; turn on color fill
+  res_rc@cnLinesOn               = False ; turn off contour lines
+  res_rc@cnLevelSpacingF    = 0.00005
+  res_rc@cnMinLevelValF    = 0.
+  res_rc@gsnLeftString =" "
+  res_rc@tiXAxisString="Cloud mixing ratio (kg/kg)"
+  plot_rc=gsn_csm_contour(wks,rct_cv,res_rc)
+
+  res_rr=resmap
+  res_rr@cnFillOn               = False ; turn on color fill
+  res_rr@cnLinesOn               = True ; turn off contour lines
+  res_rr@cnLevelSpacingF    = 0.00025
+  res_rr@cnMinLevelValF    = 0.00025
+  plot_rr=gsn_csm_contour(wks,rrt_cv,res_rr)
+
+  overlay(plot_rc,plot_rr)
+  draw(plot_rc)
+  frame(wks)
+
+  res_th=resmap
+  res_th@cnLevelSpacingF    = 0.2
+  res_th@cnMinLevelValF    = -4
+  res_th@cnMaxLevelValF    = 4
+  res_th@tiMainString="THT-LSTHM (K)"
+  gsn_define_colormap(wks,"BlRe") ; Choose colormap
+  plot_th=gsn_csm_contour(wks,tht_cv-lsthm_cv,res_th)
+  draw(plot_th)
+  frame(wks)
+
+  res_wt=resmap
+  res_wt@cnLevelSpacingF    = 0.5
+  res_wt@cnMinLevelValF    = -4
+  res_wt@cnMaxLevelValF    = 10
+  res_wt@tiMainString="WT"
+  plot_wt=gsn_csm_contour(wks,wt_cv,res_wt)
+  draw(plot_wt)
+  frame(wks)
+
+
+;=======================================
+; nouvelle coupe verticale
+;=======================================
+  plane2 = new(2,float)
+  plane2 =(/13,0/) 
+  angle2=0
+
+  rvt_cv2=wrf_user_intrp3d(rvt1,alt,"v",plane2,angle2,False)
+  rct_cv2=wrf_user_intrp3d(rct1,alt,"v",plane2,angle2,False)
+  rrt_cv2=wrf_user_intrp3d(rrt1,alt,"v",plane2,angle2,False)
+  ut_cv2=wrf_user_intrp3d(ut1,alt,"v",plane2,angle2,False)
+  vt_cv2=wrf_user_intrp3d(vt1,alt,"v",plane2,angle2,False)
+  wt_cv2=wrf_user_intrp3d(wt1,alt,"v",plane2,angle2,False)
+  tht_cv2=wrf_user_intrp3d(tht1,alt,"v",plane2,angle2,False)
+  lsthm_cv2=wrf_user_intrp3d(lsthm1,alt,"v",plane2,angle2,False)
+
+  gsn_define_colormap(wks,"Rainbow") 
+
+  opt_cv=resmap
+  opt_cv@gsnScalarContour=True
+  opt_cv@vcMinDistanceF = 0.02 ; espacement des fleches
+  opt_cv@vcRefLengthF=0.15      ; taille des flèches
+  opt_cv@cnLevelSpacingF    = 0.0005
+  opt_cv@cnMinLevelValF    = 0
+  opt_cv@tiMainString="RVT"
+
+  plot=gsn_csm_vector_scalar(wks,vt_cv2,wt_cv2,rvt_cv2,opt_cv)
+  draw(plot)
+  frame(wks)
+
+  res_rc@tiMainString="RCT + RRT"
+  plot_rc2=gsn_csm_contour(wks,rct_cv2,res_rc)
+  plot_rr2=gsn_csm_contour(wks,rrt_cv2,res_rr)
+  overlay(plot_rc2,plot_rr2)
+  draw(plot_rc2)
+  frame(wks)
+
+  gsn_define_colormap(wks,"BlRe") ; Choose colormap
+  plot_th2=gsn_csm_contour(wks,tht_cv2-lsthm_cv2,res_th)
+  draw(plot_th2)
+  frame(wks)
+  
+  plot_wt2=gsn_csm_contour(wks,wt_cv2,res_wt)
+  draw(plot_wt2)
+  frame(wks)
+
+
+end
diff --git a/MY_RUN/KTEST/003_KW78/005_ncl/run_ncl b/MY_RUN/KTEST/003_KW78/005_ncl/run_ncl
new file mode 100755
index 000000000..59c12f7cf
--- /dev/null
+++ b/MY_RUN/KTEST/003_KW78/005_ncl/run_ncl
@@ -0,0 +1,9 @@
+#MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
+#MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt  
+#MNH_LIC for details. version 1.
+set -x
+set -e
+ln -sf ../002_mesonh/KWRAI.1.SEG01.004.nc4 .
+
+ncl  plot_KW78.ncl
diff --git a/MY_RUN/KTEST/003_KW78/Makefile b/MY_RUN/KTEST/003_KW78/Makefile
index 19d4b1eaa..e50e3b333 100755
--- a/MY_RUN/KTEST/003_KW78/Makefile
+++ b/MY_RUN/KTEST/003_KW78/Makefile
@@ -3,9 +3,11 @@ all:
 	cd 002_mesonh          && run_mesonh_xyz
 	cd 003_convdia         && run_conv2dia
 	cd 004_diaprog         && run_diaprog
+	cd 005_ncl             && run_ncl
 
 clean:
 	cd 001_prep_ideal_case && clean_prep_ideal_case_xyz
 	cd 002_mesonh          && clean_mesonh_xyz
 	cd 003_convdia         && clean_conv2dia
-	cd 004_diaprog         && clean_diaprog
\ No newline at end of file
+	cd 004_diaprog         && clean_diaprog
+	cd 005_ncl             && clean_ncl
-- 
GitLab