diff --git a/MY_RUN/KTEST/001_2Drelief/004_ncl/clean_ncl b/MY_RUN/KTEST/001_2Drelief/004_ncl/clean_ncl deleted file mode 100755 index 8b82cdb8e78561ded4ce43712ce50580c6423c07..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/001_2Drelief/004_ncl/clean_ncl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/001_2Drelief/004_ncl/plot_2Drelief.ncl b/MY_RUN/KTEST/001_2Drelief/004_ncl/plot_2Drelief.ncl deleted file mode 100644 index bfeaa593ef6d570f496d8ae85a8a249fdbe9c8c2..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/001_2Drelief/004_ncl/plot_2Drelief.ncl +++ /dev/null @@ -1,359 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; -begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("EXPER.1.HYD2D.002.nc", "r") - fichier2 = addfile("EXPER.1.HYD2D.003.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_2Drelief") -;=================================================; -; lecture des différents champs -;=================================================; - jphext = fichier1->JPHEXT - mdims = getfilevardimsizes(fichier1,"UT") - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - kmax=mdims(nd-2)-2 - -zs = fichier1->ZS(jphext:imax+jphext-1) ; ZS -zhat = fichier1->ZHAT(1:kmax+1) ; ZHAT -xhat = fichier1->XHAT(jphext:imax+jphext-1+1) ; XHAT - -lsthm1 = fichier1->LSTHM(0,1:kmax,jphext:imax+jphext-1) ; LSTHM -lsthm1@long_name="LSTHM" -lsthm1@units="K" - -lsum1_old = fichier1->LSUM(0,1:kmax,jphext:imax+jphext-1+1) ; LSUM -wt1_old= fichier1->WT(0,1:kmax+1,jphext:imax+jphext-1) ; WT -ut1_old= fichier1->UT(0,1:kmax,jphext:imax+jphext-1+1) ; UT - -tht1= fichier1->THT(0,1:kmax,jphext:imax+jphext-1) ; THT -tht1@long_name="Potential Temperature" -tht1@units="K" - -rvt1= fichier1->RVT(0,1:kmax,jphext:imax+jphext-1) ; RVT -rvt1@long_name="Vapor mixing ratio" -rvt1@units="g/kg" - -cflu1= fichier1->CFLU(0,1:kmax,jphext:imax+jphext-1) ; CFLU -cflu1@long_name="CFLU" -cflu1@units="-" - -cflw1= fichier1->CFLW(0,1:kmax,jphext:imax+jphext-1) ; CFLW -cflw1@long_name="CFLW" -cflw1@units=" " - -;YYYYDDMM1= fichier1->DTCUR__TDATE -SS1=fichier1->DTCUR -;YYYYDDMM2= fichier2->DTCUR__TDATE -SS2=fichier2->DTCUR - -lsthm2 = fichier2->LSTHM(0,1:kmax,jphext:imax+jphext-1) ; LSTHM -lsthm2@long_name="LSTHM" -lsthm2@units="K" - -lsum2_old = fichier2->LSUM(0,1:kmax,jphext:imax+jphext-1+1) ; LSUM -wt2_old= fichier2->WT(0,1:kmax+1,jphext:imax+jphext-1) ; WT -ut2_old= fichier2->UT(0,1:kmax,jphext:imax+jphext-1+1) ; UT - -tht2= fichier2->THT(0,1:kmax,jphext:imax+jphext-1) ; THT -tht2@long_name="Potential Temperature" -tht2@units="K" - -rvt2= fichier2->RVT(0,1:kmax,jphext:imax+jphext-1) ; RVT -rvt2@long_name="Vapor mixing ratio" -rvt2@units="g/kg" - -cflu2= fichier2->CFLU(0,1:kmax,jphext:imax+jphext-1) ; CFLU -cflu2@long_name="CFLU" -cflu2@units="-" - -cflw2= fichier2->CFLW(0,1:kmax,jphext:imax+jphext-1) ; CFLW -cflw2@long_name="CFLW" -cflw2@units=" " - -;=================================================; -; Récupération de la date -;=================================================; -;year1=YYYYDDMM1(0) -;day1=YYYYDDMM1(1) -;min1=YYYYDDMM1(2) -time1=SS1 -;year2=YYYYDDMM2(0) -;day2=YYYYDDMM2(1) -;min2=YYYYDDMM2(2) -time2=SS2 -;=================================================; -; On mets toutes les variables sur la grille 1 -;=================================================; - - -lsum1 = wrf_user_unstagger(lsum1_old,"X") -lsum1@long_name="LSUM" -lsum1@units="m/s" -ut1 = wrf_user_unstagger(ut1_old,"X") -ut1@long_name="Zonal wind" -ut1@units="m/s" - -lsum2 = wrf_user_unstagger(lsum1_old,"X") -lsum2@long_name="LSUM" -lsum2@units="m/s" -ut2 = wrf_user_unstagger(ut1_old,"X") -ut2@long_name="Zonal wind" -ut2@units="m/s" - -; Unstagger wt (from grid 4 to 1) - wt1=new((/kmax,imax/),double) - wt2=new((/kmax,imax/),double) - - do k=0,kmax-2 - wt1(k,:)=(wt1_old(k,:)+wt1_old(k+1,:))/2. - wt2(k,:)=(wt2_old(k,:)+wt2_old(k+1,:))/2. - end do - wt1(kmax-1,:)=2*wt1_old(kmax-1,:)-wt1_old(kmax-2,:) - wt2(kmax-1,:)=2*wt2_old(kmax-1,:)-wt2_old(kmax-2,:) - -wt1@long_name="Vertical wind" -wt1@units="m/s" -wt2@long_name="Vertical wind" -wt2@units="m/s" - -;=================================================; -; Altitude des niveaux modèles -;=================================================; -; Unstagger zhat (from grid 4 to 1) - nzh=new(kmax,double) - do k=0,kmax-2 - nzh(k)=(zhat(k)+zhat(k+1))/2. - end do - nzh(kmax-1)=2*zhat(kmax-1)-zhat(kmax-2) - -; Create a (altitude des niveaux modèle) - z=new(dimsizes(tht1),double) - zcoef=new(imax,double) - zcoef=1.-zs/nzh(kmax-1) - - do i=0,imax-1 - z(:,i) = nzh*zcoef(i)+zs(i) - end do - - xconf=conform(tht1,xhat(0:imax-1),1) -;=================================================; -; Set some other basic resources -;=================================================; - resmap = True - resmap@gsnFrame = False - resmap@gsnDraw = False - resmap@gsnMaximize = True - resmap@gsnPaperOrientation = "portrait" - resmap@gsnSpreadColors = True ; use full range of colormap - resmap@tiYAxisString =" " - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - - resmap@tmXBLabelStride = 2 ; to reduce the number of labels on xaxis - resmap@lbLabelStride = 2. ; to reduce the number of labels on labelbar - - -;pour prendre en compte l'orographie sur la coupe verticale. - resmap@sfYArray = z ; 2D - resmap@sfXArray = xconf ; 2D - resmap@trGridType = "TriangularMesh" - - -resmap@tiXAxisPosition="Left" -resmap@tiXAxisFontHeightF=0.015 -;=================================================; -; TRACE -;=================================================; - gsn_define_colormap(wks,"rainbow") ; Choose colormap - -opts=resmap -opts@cnLevelSelectionMode = "ExplicitLevels" -cnLevels = (/4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12/) -opts@cnLevels = cnLevels -opts@tiXAxisString="time="+time1+"s" -plot_ut1 = gsn_csm_contour(wks,ut1,opts) -draw(plot_ut1) -frame(wks) -opts@tiXAxisString="time="+time2+"s" -plot_ut2 = gsn_csm_contour(wks,ut2,opts) -draw(plot_ut2) -frame(wks) -delete(opts) -delete(cnLevels) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF = 2.5 -opts@cnMinLevelValF = 285 -opts@cnMaxLevelValF = 330 - -opts@tiXAxisString="time="+time1+"s" - -plot_tht1 = gsn_csm_contour(wks,tht1,opts) -draw(plot_tht1) -frame(wks) -opts@tiXAxisString="time="+time2+"s" -plot_tht2 = gsn_csm_contour(wks,tht2,opts) -draw(plot_tht2) -frame(wks) -delete(opts) - - - resmap@lbLabelStride = 3. ; to reduce the number of labels on labelbar -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF = 0.04 -opts@cnMinLevelValF = -0.4 -opts@cnMaxLevelValF = 0.28 -opts@tiXAxisString="time="+time1+"s" -plot_wt1 = gsn_csm_contour(wks,wt1,opts) -draw(plot_wt1) -frame(wks) -opts@tiXAxisString="time="+time2+"s" -plot_wt2 = gsn_csm_contour(wks,wt2,opts) -draw(plot_wt2) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF = 0.0002 -opts@cnMinLevelValF = 0.0002 -opts@cnMaxLevelValF = 0.0038 -opts@tiXAxisString="time="+time1+"s" -;opts@lbLabelSride = 5. -plot_rvt1 = gsn_csm_contour(wks,rvt1,opts) -draw(plot_rvt1) -frame(wks) -opts@tiXAxisString="time="+time2+"s" -plot_rvt2 = gsn_csm_contour(wks,rvt2,opts) -draw(plot_rvt2) -frame(wks) -delete(opts) - - resmap@lbLabelStride = 2. ; to reduce the number of labels on labelbar -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF = 0.003 -opts@cnMinLevelValF = 0.028 -opts@cnMaxLevelValF = 0.078 -opts@tiXAxisString="time="+time1+"s" -plot_cflu1 = gsn_csm_contour(wks,cflu1,opts) -draw(plot_cflu1) -frame(wks) - -opts@tiXAxisString="time="+time2+"s" -plot_cflu2 = gsn_csm_contour(wks,cflu2,opts) -draw(plot_cflu2) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF = 0.004 -opts@cnMinLevelValF = 0.004 -opts@cnMaxLevelValF = 0.072 -opts@tiXAxisString="time="+time1+"s" -plot_cflw1 = gsn_csm_contour(wks,cflw1,opts) -draw(plot_cflw1) -frame(wks) -opts@tiXAxisString="time="+time2+"s" -plot_cflw2 = gsn_csm_contour(wks,cflw2,opts) -draw(plot_cflw2) -frame(wks) -delete(opts) - - -res=resmap -;=================================================== -; profils verticaux -;=================================================== -;==================================== - resmap@pmLegendDisplayMode = "Always" - resmap@pmLegendWidthF = 0.05 - resmap@pmLegendHeightF = 0.15 - resmap@lgPerimOn = False - resmap@pmLegendSide = "Top" - resmap@pmLegendParallelPosF = .1 - resmap@lgLabelFontHeightF = .01 - resmap@pmLegendOrthogonalPosF = -0.3 - resmap@tmXBLabelStride = 1 ; - -; delete ressources not needed for vertcal profiles - delete(resmap@sfXArray) - delete(resmap@sfYArray) - delete(resmap@cnFillOn) - delete(resmap@cnLinesOn) - delete(resmap@gsnSpreadColors) - delete(resmap@lbLabelStride) - - -res_w=resmap -res_t=resmap - -res_w@gsnRightString="time="+time1+"s" -res_w@trXMinF=-0.3 -res_w@trXMaxF=0.3 -res_w@xyLineColors = (/"red","green"/) ; change line color -res_w@xyExplicitLegendLabels = (/"WT","THT-LSTHM"/) -res_w@tiXAxisString = "WT" ; title -res_w@tiXAxisFontHeightF = 0.015 -res_t@pmLegendOrthogonalPosF = -0.4 -res_t@pmLegendParallelPosF = .15 -res_t@trXMinF=-0.8 -res_t@trXMaxF=0.1 -res_t@xyLineColors = (/"green"/) ; change line color -res_t@xyExplicitLegendLabels = (/"THT-LSTHM"/) -res_t@gsnLeftString = "THT-LSTHM" ; title -res_t@gsnLeftStringFontHeightF = 0.015 - -plot = gsn_csm_x2y (wks,wt1(:,127),tht1(:,127)-lsthm1(:,127),z(:,127),res_w,res_t) -draw(plot) -frame(wks) - -res_t@trXMinF=-1 -res_t@trXMaxF=0.2 -res_w@gsnRightString="time="+time2+"s" -plot = gsn_csm_x2y (wks,wt2(:,127),tht2(:,127)-lsthm2(:,127),z(:,127),res_w,res_t) -draw(plot) -frame(wks) - -res_u=resmap -res_lsu=resmap - -res_w@xyExplicitLegendLabels = (/"WT","UT-LSUM"/) -res_lsu@pmLegendOrthogonalPosF = -0.4 -res_lsu@pmLegendParallelPosF = .15 -res_lsu@trXMinF=-0.2 -res_lsu@trXMaxF=0.8 -res_lsu@xyLineColors = (/"green"/) ; change line color -res_lsu@xyExplicitLegendLabels = (/"UT-LSUM"/) -res_lsu@gsnLeftString = "UT-LSUM" ; title -res_lsu@tiMainFontHeightF = 0.015 -res_w@gsnRightString="time="+time1+"s" - -plot = gsn_csm_x2y (wks,wt1(:,127),ut1(:,127)-lsum1(:,127),z(:,127),res_w,res_lsu) -draw(plot) -frame(wks) -res_lsu@trXMinF=-2 -res_lsu@trXMaxF=2 -res_w@gsnRightString="time="+time2+"s" - -plot = gsn_csm_x2y (wks,wt2(:,127),ut2(:,127)-lsum2(:,127),z(:,127),res_w,res_lsu) -draw(plot) -frame(wks) - - -end diff --git a/MY_RUN/KTEST/001_2Drelief/004_ncl/run_ncl b/MY_RUN/KTEST/001_2Drelief/004_ncl/run_ncl deleted file mode 100755 index 7b7d112fe13bb04dc72ab09f57cdb0a1538f775e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/001_2Drelief/004_ncl/run_ncl +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -#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 - -ln -sf ../002_mesonh/EXPER.1.HYD2D.002.nc . -ln -sf ../002_mesonh/EXPER.1.HYD2D.003.nc . - -rm -f visu_2Drelief.*.png - -ncl plot_2Drelief.ncl -${POSTRUN} display visu_2Drelief.000001.png -${POSTRUN} display visu_2Drelief.000002.png -${POSTRUN} display visu_2Drelief.000003.png -${POSTRUN} display visu_2Drelief.000004.png -${POSTRUN} display visu_2Drelief.000005.png -${POSTRUN} display visu_2Drelief.000006.png -${POSTRUN} display visu_2Drelief.000007.png -${POSTRUN} display visu_2Drelief.000008.png -${POSTRUN} display visu_2Drelief.000009.png -${POSTRUN} display visu_2Drelief.000010.png -${POSTRUN} display visu_2Drelief.000011.png -${POSTRUN} display visu_2Drelief.000012.png -${POSTRUN} display visu_2Drelief.000013.png -${POSTRUN} display visu_2Drelief.000014.png -${POSTRUN} display visu_2Drelief.000015.png -${POSTRUN} display visu_2Drelief.000016.png -exit 0 diff --git a/MY_RUN/KTEST/001_2Drelief/Makefile b/MY_RUN/KTEST/001_2Drelief/Makefile index 13deef8a4562ab8cad879c74b3b6ce78024bd9c2..b0b9bbf2df570c65c08ed85b1d56e85c5a09bb29 100644 --- a/MY_RUN/KTEST/001_2Drelief/Makefile +++ b/MY_RUN/KTEST/001_2Drelief/Makefile @@ -4,7 +4,6 @@ all: ifneq "$(MNH_PYTHON)" "NO" cd 003_python && run_python endif - cd 004_ncl && run_ncl clean: cd 001_prep_ideal_case && clean_prep_ideal_case_xyz @@ -12,7 +11,6 @@ clean: ifneq "$(MNH_PYTHON)" "NO" cd 003_python && clean_python endif - cd 004_ncl && clean_ncl python: cd 003_python && run_python diff --git a/MY_RUN/KTEST/002_3Drelief/004_ncl/clean_ncl b/MY_RUN/KTEST/002_3Drelief/004_ncl/clean_ncl deleted file mode 100755 index 8b82cdb8e78561ded4ce43712ce50580c6423c07..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/002_3Drelief/004_ncl/clean_ncl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/002_3Drelief/004_ncl/plot_3Drelief.ncl b/MY_RUN/KTEST/002_3Drelief/004_ncl/plot_3Drelief.ncl deleted file mode 100644 index 6706552180c7485a15750f37f1e56294925f794e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/002_3Drelief/004_ncl/plot_3Drelief.ncl +++ /dev/null @@ -1,73 +0,0 @@ -;================================================; - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; - begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("REL3D.1.EXP01.002.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_3Drelief") -;=================================================; -; lecture des différents champs -;=================================================; - jphext = fichier1->JPHEXT - mdims = getfilevardimsizes(fichier1,"UT") - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - - - - ut= fichier1->UT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; UT - ut@long_name="Zonal wind" - ut@units="m/s" - - - -;=================================================; -; Unstagger U -;=================================================; - ut!0="Z" - ut!1="Y" - ut!2="X" - u = wrf_user_unstagger(ut,"X") - -;=================================================; -; Set some other basic resources -;=================================================; - resmap = True - resmap@gsnFrame = False - resmap@gsnDraw = False - resmap@gsnMaximize = True - resmap@gsnPaperOrientation = "portrait" - resmap@gsnSpreadColors= True - resmap@tiMainString ="UT level 2 " - resmap@cnFillOn= True - resmap@cnLinesOn= False - - resmap@lbLabelStride = 4. ; to reduce number of labels on labelbar - - -;=================================================; -; TRACE -;=================================================; - gsn_define_colormap(wks,"rainbow") - - resmap@cnLevelSelectionMode = "ManualLevels" - resmap@cnLevelSpacingF = 0.25 - resmap@cnMinLevelValF = 8 - resmap@cnMaxLevelValF = 14 - plot_ut = gsn_csm_contour(wks,u(0,:,:),resmap) - draw(plot_ut) - frame(wks) - -end diff --git a/MY_RUN/KTEST/002_3Drelief/004_ncl/run_ncl b/MY_RUN/KTEST/002_3Drelief/004_ncl/run_ncl deleted file mode 100755 index 59aa382501a8593f023111b9f1b3b02592554245..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/002_3Drelief/004_ncl/run_ncl +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -#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 - -ln -sf ../002_mesonh/REL3D.1.EXP01.002.nc . - -rm -f visu_3Drelief* - -ncl plot_3Drelief.ncl -${POSTRUN} display visu_3Drelief.png -exit 0 diff --git a/MY_RUN/KTEST/002_3Drelief/Makefile b/MY_RUN/KTEST/002_3Drelief/Makefile index 76fa1761ed35a74ba7d10078fd7ae9ea9397be2c..a636d2c462c692ceadf2beb8b33f88703dbe1518 100644 --- a/MY_RUN/KTEST/002_3Drelief/Makefile +++ b/MY_RUN/KTEST/002_3Drelief/Makefile @@ -4,7 +4,6 @@ all: ifneq "$(MNH_PYTHON)" "NO" cd 003_python && run_python endif - cd 004_ncl && run_ncl clean: cd 001_prep_ideal_case && clean_prep_ideal_case_xyz @@ -12,7 +11,6 @@ clean: ifneq "$(MNH_PYTHON)" "NO" cd 003_python && clean_python endif - cd 004_ncl && clean_ncl python: cd 003_python && run_python diff --git a/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl b/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl deleted file mode 100755 index 8b82cdb8e78561ded4ce43712ce50580c6423c07..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/003_KW78/005_ncl/plot_KW78.ncl b/MY_RUN/KTEST/003_KW78/005_ncl/plot_KW78.ncl deleted file mode 100644 index a25a8a407774a675ff16edb746d49d0c8c28ae7b..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/005_ncl/plot_KW78.ncl +++ /dev/null @@ -1,312 +0,0 @@ -;================================================; - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; - begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("KWRAI.1.SEG01.004.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_KW78") -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = fichier1->JPHEXT - mdims = getfilevardimsizes(fichier1,"UT") - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - - -;=================================================; -; lecture des différents champs -;=================================================; - zs = fichier1->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) ; ZS - zhat = fichier1->ZHAT(1:kmax+1) ; ZHAT - yhat = fichier1->YHAT(1:jmax+jphext-1+1) ; YHAT - xhat = fichier1->XHAT(1:imax+jphext-1+1) ; XHAT - - vtype = typeof(zs) - - wt= fichier1->WT(0,1:kmax+1,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; WT - vt= fichier1->VT(0,1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; VT - ut= fichier1->UT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; UT - tht1= fichier1->THT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; THT - tht1@long_name="Potential Temperature" - tht1@units="K" - lsthm1= fichier1->LSTHM(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - lsthm1@long_name="Large SCale Potential Temperature" - lsthm1@units="K" - - pabst1= fichier1->PABST(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; PABST - pabst1@long_name="Pressure" - pabst1@units="Pa" - rvt1= fichier1->RVT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RVT - rvt1@long_name="Vapor mixing ratio" - rvt1@units="kg/kg" - rct1= fichier1->RCT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RCT - rct1@long_name="Cloud mixing ratio" - rct1@units="kg/kg" - rrt1= fichier1->RRT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RRT - rrt1@long_name="Rain mixing ratio" - rrt1@units="kg/kg" - - inprr= fichier1->INPRR(0,jphext:jmax+jphext-1,jphext:imax+jphext-1) - inprr@long_name="Instantaneous Precipitation Rain Rate" - inprr@units="mm/h" - acprr= fichier1->ACPRR(0,jphext:jmax+jphext-1,jphext:imax+jphext-1) - acprr@long_name="Accumulated Precipitation Rain Rate" - acprr@units="mm" - - ;YYYYDDMM1= fichier1->DTCUR__TDATE - SS1=fichier1->DTCUR - -;=================================================; -; 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 - resmap@lbLabelStride = 2. ; to reduce the number of labels on labelbar -;=================================================; -; Altitude des niveaux modèles -;=================================================; -; Unstagger zhat (from grid 4 to 1) - nzh=new(kmax,vtype) - 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),vtype) - zcoef=new((/jmax,imax/),vtype) - 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 - - resmap@lbLabelStride = 4. ; to reduce the number of labels on labelbar - 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 - opts@cnMaxLevelValF = 0.09 - plot_acprr = gsn_csm_contour(wks,acprr,opts) - draw(plot_acprr) - frame(wks) - - resmap@lbLabelStride = 4. ; to reduce the number of labels on labelbar - res=resmap - res@gsnScalarContour=True - res@cnLevelSelectionMode = "ManualLevels" - res@cnLevelSpacingF= 10 - 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) - - resmap@lbLabelStride = 12. ; to reduce the number of labels on labelbar - 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 deleted file mode 100755 index 8c66c7cb4e74d54b38a589a9146ef9d0bb8f4fa8..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/005_ncl/run_ncl +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -#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 - -ln -sf ../002_mesonh/KWRAI.1.SEG01.004.nc . - -rm -f visu_KW78.*.png - -ncl plot_KW78.ncl -${POSTRUN} display visu_KW78.000001.png -${POSTRUN} display visu_KW78.000002.png -${POSTRUN} display visu_KW78.000003.png -${POSTRUN} display visu_KW78.000004.png -${POSTRUN} display visu_KW78.000005.png -${POSTRUN} display visu_KW78.000006.png -${POSTRUN} display visu_KW78.000007.png -${POSTRUN} display visu_KW78.000008.png -${POSTRUN} display visu_KW78.000009.png -${POSTRUN} display visu_KW78.000010.png -${POSTRUN} display visu_KW78.000011.png -${POSTRUN} display visu_KW78.000012.png -${POSTRUN} display visu_KW78.000013.png -exit 0 diff --git a/MY_RUN/KTEST/003_KW78/007_ncl_diag/clean_diag_xyz b/MY_RUN/KTEST/003_KW78/007_ncl_diag/clean_diag_xyz deleted file mode 100755 index 19b1bf34eb5ca4964c57e9b503ef15a7e940213f..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/007_ncl_diag/clean_diag_xyz +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -x -rm -f KWRAI* OUTPUT_LISTING* OUTPUT_TRANSFER pipe* *.tex -rm -f file_for_xtransfer - diff --git a/MY_RUN/KTEST/003_KW78/007_ncl_diag/clean_ncl b/MY_RUN/KTEST/003_KW78/007_ncl_diag/clean_ncl deleted file mode 100755 index cb8d15455b843f252abe2c6d262197c9e22d5352..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/007_ncl_diag/clean_ncl +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f KWRAI.1.SEG01.004* visu_KW78_diag.png diff --git a/MY_RUN/KTEST/003_KW78/007_ncl_diag/plot_KW78_diag.ncl b/MY_RUN/KTEST/003_KW78/007_ncl_diag/plot_KW78_diag.ncl deleted file mode 100755 index 73483697141487eaa1724dda02f50e1d52cecedf..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/007_ncl_diag/plot_KW78_diag.ncl +++ /dev/null @@ -1,127 +0,0 @@ -;================================================; - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; - begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("KWRAI.1.SEG01.004.nc", "r") - fichier2 = addfile("KWRAI.1.SEG01.004dia.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_KW78_diag") -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = fichier2->JPHEXT - mdims = getfilevardimsizes(fichier2,"CLUSTERID") - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - - -;=================================================; -; lecture des différents champs -;=================================================; - zs = fichier1->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) ; ZS - zhat = fichier1->ZHAT(1:kmax+1) ; ZHAT - yhat = fichier1->YHAT(1:jmax+jphext-1+1) ; YHAT - xhat = fichier1->XHAT(1:imax+jphext-1+1) ; XHAT - - wt= fichier1->WT(0,1:kmax+1,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; WT - vt= fichier1->VT(0,1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; VT - ut= fichier1->UT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; UT - - idt1= fichier2->CLUSTERID(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; CLUSTERID - idt1@long_name="Cluster Identity Number" - idt1@units="" - - YYYYDDMM1= fichier1->DTCUR - SS1=fichier1->DTCUR - -;=================================================; -; 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 - resmap@lbLabelStride = 12. ; to reduce the number of labels on labelbar -;=================================================; -; 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(ut1),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 - - -;======================================= -; coupe verticale clustering -;======================================= - - gsn_define_colormap(wks,"BlRe") - - 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 - opt_cv@cnLevelSelectionMode = "ExplicitLevels" - opt_cv@cnLevels = (/1/) - opt_cv@cnFillColors = (/0,84/) - opt_cv@tiMainString = "Identified Updraft as cluster where w > 10 m/s" - - plot_idt=gsn_csm_vector_scalar(wks,ut1(:,13,:),wt1(:,13,:),idt1(:,13,:),opt_cv) - - draw(plot_idt) - frame(wks) - - -end diff --git a/MY_RUN/KTEST/003_KW78/007_ncl_diag/run_ncl b/MY_RUN/KTEST/003_KW78/007_ncl_diag/run_ncl deleted file mode 100755 index ab46be0a29beaa0b1a96ace425e1ace5867b9b3b..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/007_ncl_diag/run_ncl +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -#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 - -ln -sf ../002_mesonh/KWRAI.1.SEG01.004.nc . -ln -sf ../003_diag/KWRAI.1.SEG01.004dia.nc . - -rm -f visu_KW78_diag.png - -ncl plot_KW78_diag.ncl -${POSTRUN} display visu_KW78_diag.png - -exit 0 diff --git a/MY_RUN/KTEST/003_KW78/Makefile b/MY_RUN/KTEST/003_KW78/Makefile index 3dc66698d1977cf61d89dc4752ccf699b742dee6..793e1223286e4f04e395c251c7bac91161548db8 100644 --- a/MY_RUN/KTEST/003_KW78/Makefile +++ b/MY_RUN/KTEST/003_KW78/Makefile @@ -5,8 +5,6 @@ all: ifneq "$(MNH_PYTHON)" "NO" cd 004_python && run_python endif - cd 005_ncl && run_ncl - cd 007_ncl_diag && run_ncl clean: cd 001_prep_ideal_case && clean_prep_ideal_case_xyz @@ -15,8 +13,6 @@ clean: ifneq "$(MNH_PYTHON)" "NO" cd 004_python && clean_python endif - cd 005_ncl && clean_ncl - cd 007_ncl_diag && clean_ncl python: cd 004_python && run_python diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/MESONHtools.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/MESONHtools.ncl deleted file mode 100644 index 9cae6400a0dade82e20ba68463722fbb13d4c81d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/MESONHtools.ncl +++ /dev/null @@ -1,915 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" - -;------------------------------------------------------------- -;contains: -; procedure MESONH_map_c -;function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) -;function mnh_map_overlays(in_file[1]:file,wks:graphic,plots[*]:graphic, \ -; opt_arg[1]:logical,opt_mp[1]:logical) -;function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;------------------------------------------------------------- - -;============================================================== -; J.-P. CHABOUREAU -; This is a driver that selects the appropriate -; mapping function based upon the file variables RPK, BETA, LATOR, LONOR -; -; -; Sample usage: -; a = addfile("...", r") -; IMAX = a->IMAX -; JMAX = a->JMAX -; lat2d = new((/JMAX,IMAX/),"double") -; lat2d(:,:)=0. -; lon2d = new((/JMAX,IMAX/),"double") -; lon2d(:,:)=0. -; icorners = new((/2,2/),"integer") -; icorners(:,:)=0 -; res = True -; MESONH_map_c (a, res, lat2d, lon2d, icorners) -; -; -undef("MESONH_map_c") -;============================================================== -procedure MESONH_map_c (in_file:file, res:logical, plat, plon, icorner) -;============================================================== -;local rank, dimll, nlat, mlon, lat, lon -local rank, dimll, nlat, mlon -begin - -; Check if the variable RPK is in the file -; ---------------------------------------- -if(isfilevar(in_file,"RPK")) then - -; Read projection parameters -; ------------------------- - ZRPK = in_file->RPK - ZLATOR = in_file->LATOR - ZLONOR = in_file->LONOR - ZBETA = in_file->BETA - ZLAT0 = in_file->LAT0 - ZLON0 = in_file->LON0 - -; Case netcdf from lfi2cdf -; ------------------------- - - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - -; unstagger - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - - else - -; Case netcdf from extractdia -; --------------------------- - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - - end if - - print ("LATOR="+ZLATOR+" - LONOR="+ZLONOR) - print ("ZLAT0="+ZLAT0+" - ZLON0="+ZLON0) - print ("ZDX="+zdx+" - RPK="+ZRPK+" - BETA="+ZBETA) - print ("IMAX="+IMAX+" - JMAX="+JMAX) - - if (ZRPK.gt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = 90. - end if - - if (ZRPK.lt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = -90. - end if - - if (ZRPK.eq.0) then - ; Mercator projection -; --------------------------- - res@mpProjection = "Mercator" - end if - - print("Map projection="+res@mpProjection) - -else - print ("MESONH_map_c: Error no RPK variable in input file") -end if - -;=================================================; -; calculate 2D lat and lon -; based on src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - -; Constants -; ----------- - if(isfilevar(in_file,"IMAX")) - XRADIUS=6371229.0d ; Earth radius (meters) - else - XRADIUS=6371.2290d ; Earth radius (km) - end if - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - -;=================================================; - if (ZRPK.eq.0) then -; MERCATOR -;=================================================; - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - plon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - plat(jj,ji)=zlat - end do - end do - -;=================================================; - else -; STEREOGRAPHIC PROJECTION -;=================================================; - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - plon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - plat(jj,ji)=zlat - end do - end do - - end if - -; Defining the corners of the domain -;==================================== - if (icorner(0,0).eq.icorner(1,1)) then - icorner(0,0)=0 - icorner(1,0)=JMAX-1 - icorner(0,1)=0 - icorner(1,1)=IMAX-1 - end if -; print ("icorner"+icorner) - - res@mpLimitMode = "Corners" - res@mpLeftCornerLatF = plat(icorner(0,0),icorner(0,1)) - res@mpLeftCornerLonF = plon(icorner(0,0),icorner(0,1)) - res@mpRightCornerLatF = plat(icorner(1,0),icorner(1,1)) - res@mpRightCornerLonF = plon(icorner(1,0),icorner(1,1)) - -; print ("Corner (0,0); Lat="+res@mpLeftCornerLatF+ \ -; ", Lon="+res@mpLeftCornerLonF) -; print ("Oppos corner; Lat="+res@mpRightCornerLatF+ \ -; ", Lon= "+res@mpRightCornerLonF) - -;========================================== -; Turn on lat / lon labeling -;========================================== - res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - res@mpOutlineBoundarySets = "AllBoundaries" ; state boundaries - res@mpPerimDrawOrder = "PostDraw" ; force map perim -;========================================== -; Needed for regional native projection -;========================================== - res@tfDoNDCOverlay = True - res@gsnAddCyclic = False ; regional data - -end - -;=========================================== -;------------------------------------------------------------------------ -undef("MESONH_pinter") -function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;************************************************************************* -; S. BIELLI -; This is a routine that interpolate fields on pressure level for plotting -; based on pinter.f90 -; The field to be interpolated must be given at the mass point (grid 1) -; usage : var_inter=MESONHfunction(var_to_interpol, 850., AbsPressure) -; Abs pressure must be in Pa -; - -begin - - dimL= dimsizes(loc_param) - -; First test for grid = 0 - - dimp=dimsizes(ppabs) - - pout=pfield(0:dimL-1,:,:) - pfield@_FillValue=999 - pout@_FillValue=999 - pout=pout@_FillValue - - do jkp = 0, dimL-1 - zref=log10(loc_param(jkp)*100.) - do jloop = 0, dimp(1)-1 - do iloop = 0, dimp(2)-1 - kloop=0 - flag=True - do while (flag .and. (kloop.lt.(dimp(2)-2))) - if (.not.ismissing(ppabs(kloop,jloop,iloop))) then - zxm=log10(ppabs(kloop,jloop,iloop)) - zxp=log10(ppabs(kloop+1,jloop,iloop)) - if ((zxp-zref)*(zref-zxm) .ge. 0) then - pout(jkp,jloop,iloop)= (pfield(kloop,jloop,iloop)*(zxp-zref)+ \ - pfield(kloop+1,jloop,iloop)*(zref-zxm))/ (zxp-zxm) - flag=False - end if - end if - kloop=kloop+1 - end do - end do - end do - end do - - return(pout) - -end - -;-------------------------------------------------------------------------------- -undef("mnh_map") -function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) - -begin -; -; This function creates a map plot, and bases the projection on -; the MAP_PROJ attribute in the given file. -; -; 1. Make a copy of the resource list, and set some resources -; common to all map projections. -; -; 2. Determine the projection being used, and set resources based -; on that projection. -; -; 3. Create the map plot, and draw and advance the frame -; (if requested). - - opts = opt_args ; Make a copy of the resource list - opts = True - -; Set some resources depending on what kind of map projection is -; chosen. -; -; ZRPK != 0 : "Stereographic" -; ZRPK = 0 : "Mercator" -;=================================================; -; src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - XRADIUS=6371229.0d ; Earth radius (meters) - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - - if(isfilevar(in_file,"RPK")) - ZRPK=in_file->RPK - ZLON0=in_file->LON0 - ZLAT0=in_file->LAT0 - ZLATOR=in_file->LATOR - ZLONOR=in_file->LONOR - ZBETA=in_file->BETA - else - print ("mnh_map: Error no RPK variable in input file") - return(new(1,graphic)) - end if - -; Case netcdf from lfi2cdf - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - else -; Case netcdf from extractdia - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - end if -; - - lat = new((/JMAX,IMAX/),"double") - lon = new((/JMAX,IMAX/),"double") - - -; Stereographic projection - if(ZRPK .gt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", 90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - - if(ZRPK .lt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", -90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - -; Mercator projection - if(ZRPK .eq. 0) - projection = "Mercator" - end if - - opts@mpNestTime = get_res_value_keep(opts, "mpNestTime",0) - - -; LAT and LON are not saved in the file - if (ZRPK.eq.0) then - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - lon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - lat(jj,ji)=zlat - end do - end do - else - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - lon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - lat(jj,ji)=zlat - end do - end do - end if - - dims = dimsizes(lat) - - do ii = 0, dims(0)-1 - do jj = 0, dims(1)-1 - if ( lon(ii,jj) .lt. 0.0) then - lon(ii,jj) = lon(ii,jj) + 360. - end if - end do - end do - - opts@start_lat = lat(0,0) - opts@start_lon = lon(0,0) - opts@end_lat = lat(dims(0)-1,dims(1)-1) - opts@end_lon = lon(dims(0)-1,dims(1)-1) - - -; Set some resources common to all map projections. - opts = set_mp_resources(opts) - - if ( isatt(opts,"ZoomIn") .and. opts@ZoomIn ) then - y1 = 0 - x1 = 0 - y2 = dims(0)-1 - x2 = dims(1)-1 - if ( isatt(opts,"Ystart") ) then - y1 = opts@Ystart - delete(opts@Ystart) - end if - if ( isatt(opts,"Xstart") ) then - x1 = opts@Xstart - delete(opts@Xstart) - end if - if ( isatt(opts,"Yend") ) then - if ( opts@Yend .le. y2 ) then - y2 = opts@Yend - end if - delete(opts@Yend) - end if - if ( isatt(opts,"Xend") ) then - if ( opts@Xend .le. x2 ) then - x2 = opts@Xend - end if - delete(opts@Xend) - end if - - opts@mpLeftCornerLatF = lat(y1,x1) - opts@mpLeftCornerLonF = lon(y1,x1) - opts@mpRightCornerLatF = lat(y2,x2) - opts@mpRightCornerLonF = lon(y2,x2) - - if ( opts@mpRightCornerLonF .lt. 0.0 ) then - opts@mpRightCornerLonF = opts@mpRightCornerLonF + 360.0 - end if - - delete(opts@ZoomIn) - end if - - -; The default is not to draw the plot or advance the frame, and -; to maximize the plot in the frame. - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", False) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", False) - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - delete_attrs(opts) ; Clean up. - mp = gsn_map(wks,projection,opts) ; Create map plot. - - return(mp) ; Return. - -end - -;-------------------------------------------------------------------------------- - -undef("mnh_map_overlays") -function mnh_map_overlays(in_file[1]:file, \ - wks:graphic, \ - plots[*]:graphic, \ - opt_arg[1]:logical, \ - opt_mp[1]:logical) - -; Based on wrf_map_overlays -; -; This procedure takes an array of plots and overlays them on a -; base plot - map background. -; -; It will advance the plot and cleanup, unless you set the -; PanelPlot resource to True. -; -; Attributes recognized by this procedure: -; FramePlot -; PanelPlot -; NoTitles (don't do any titles) -; CommonTitle & PlotTile is used to overwrite field titles -; CommonTitle will super-seed NoTitles -; -; If FramePlot False, then Draw the plot but do not Frame. -; In this case a user want to add to the drawing, and will -; have to advance the Frame manually in the script. -; -; If the "NoTitles" attribute exists and is set True, then -; don't create the top-left titles, and leave the main titles alone. -; This resource can be useful if you are planning to panel -; the plots. -; -; If PanelPlot is set to True, then this flags to wrf_map_overlays -; that these plots are going to be eventually paneled (likely -; by gsn_panel), and hence 1) draw and frame should not be called -; (unless gsnDraw and/or gsnFrame are explicitly set to True), -; and 2) the overlays and titles should not be removed with -; NhlRemoveOverlay and NhlRemoveAnnotation. -; -begin - - opts = opt_arg ; Make a copy of the resource lists - opt_mp_2 = opt_mp - - ; Let's make the map first - base = mnh_map(wks,in_file,opt_mp_2) - - no_titles = get_res_value(opts,"NoTitles",False) ; Do we want field titles? - com_title = get_res_value(opts,"CommonTitle",False) ; Do we have a common title? - if ( com_title ) then - plot_title = get_res_value(opts,"PlotTitle"," ") - no_titles = True - end if - - call_draw = True - call_frame = get_res_value(opts,"FramePlot",True) ; Do we want to frame the plot? - panel_plot = get_res_value(opts,"PanelPlot",False) ; Are we paneling? - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - nplots = dimsizes(plots) -; font_color = "Black" - - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then -; class_name = NhlClassName(plots(i)) -; print(class_name) -; if(class_name.eq."contourPlotClass") then -; getvalues plots(i) -; "cnFillOn" : fill_on -; "cnLineColor" : line_color -; end getvalues -; if (.not.fill_on) then -; font_color = line_color -; end if -; end if - if(.not.no_titles) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - if(i.eq.0) then - SubTitles = SubTitle - else - SubTitles = SubTitles + "~C~" + SubTitle - end if - end if - if(com_title .and. i .eq. nplots-1) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - SubTitles = plot_title - end if - setvalues plots(i) - "tfDoNDCOverlay" : True - "tiMainOn" : False - end setvalues - overlay(base,plots(i)) - else - print("mnh_map_overlays: Warning: overlay plot #" + i + " is not valid.") - end if - end do - - if(.not.no_titles .or. com_title) then - font_height = get_res_value_keep(opts,"FontHeightF",0.01) - txt = create "map_titles" textItemClass wks - "txString" : SubTitles - "txFontHeightF" : font_height - ;"txFontColor" : font_color - end create - anno = NhlAddAnnotation(base,txt) - setvalues anno - "amZone" : 3 - "amJust" : "BottomLeft" - "amSide" : "Top" - "amParallelPosF" : 0.005 - "amOrthogonalPosF" : 0.03 - "amResizeNotify" : False - end setvalues - base@map_titles = anno - end if -; -; gsnDraw and gsnFrame default to False if panel plot. -; - if(panel_plot) then - call_draw = False - call_frame= False - end if - - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", call_draw) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", call_frame) - - draw_and_frame(wks,base,opts@gsnDraw,opts@gsnFrame,False, \ - opts@gsnMaximize) - - if(.not.panel_plot) then - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then - NhlRemoveOverlay(base,plots(i),False) - else - print("wrf_remove_map_overlays: Warning: overlay plot #" + i + " is not valid.") - print(" Nothing to remove.") - end if - end do - end if - - if(.not.no_titles.and..not.panel_plot) then - if(isatt(base,"map_titles")) then - NhlRemoveAnnotation(base,base@map_titles) - delete(base@map_titles) - end if - end if - -return(base) -end - -;-------------------------------------------------------------------------------- -undef("wrf_user_intrp3d") -function wrf_user_intrp3d( var3d:numeric, z_in:numeric, \ - plot_type:string, \ - loc_param:numeric, angle:numeric, opts:logical ) - -; var3d - 3d field to interpolate (all input fields must be unstaggered) -; z_in - interpolate to this field (either p/z) -; plot_type - interpolate horizontally "h", or vertically "v" -; loc_param - level(s) for horizontal plots (eg. 500hPa ; 3000m - scalar), -; plane for vertical plots (2 values representing an xy point -; on the model domain through which the vertical plane will pass -; OR 4 values specifying start and end values -; angle - 0.0 for horizontal plots, and -; an angle for vertical plots - 90 represent a WE cross section -; opts Used IF opts is TRUE, else use loc_param and angle to determine crosssection - -begin - - - if(plot_type .eq. "h" ) then ; horizontal cross section needed - - dimL = dimsizes(loc_param) - - dims = dimsizes(var3d) - nd = dimsizes(dims) - - dimX = dims(nd-1) - dimY = dims(nd-2) - dimZ = dims(nd-3) - dim4 = 1 - dim5 = 1 - if ( nd .eq. 4 ) then - dim4 = dims(nd-4) - end if - if ( nd .eq. 5 ) then - dim4 = dims(nd-4) - dim5 = dims(nd-5) - end if - - var3 = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - z = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - var2d = new ( (/ dim5, dim4, dimL, dimY, dimX /) , typeof(var3d) ) - - if ( nd .eq. 5 ) then - var3 = var3d - z = z_in - end if - if ( nd .eq. 4 ) then - var3(0,:,:,:,:) = var3d(:,:,:,:) - z(0,:,:,:,:) = z_in(:,:,:,:) - end if - if ( nd .eq. 3 ) then - var3(0,0,:,:,:) = var3d(:,:,:) - z(0,0,:,:,:) = z_in(:,:,:) - end if - - - if ( z(0,0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z(0,0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z = z * 0.01 - end if - if ( loc_param(0) .gt. 2000. ) then - ; looks like the input was specified in Pa - change this - loc_param = loc_param * 0.01 - end if - end if - - do il = 0,dimL-1 - var = wrf_interp_3d_z(var3,z,loc_param(il)) - var2d(:,:,il,:,:) = var(:,:,:,:) - end do - - copy_VarAtts(var3d,var3) - if(isatt(var3,"description")) then - delete_VarAtts(var3,(/"description"/)) - end if - if(isatt(var3,"units")) then - delete_VarAtts(var3,(/"units"/)) - end if - if(isatt(var3,"MemoryOrder")) then - delete_VarAtts(var3,(/"MemoryOrder"/)) - end if - if(isatt(var3,"_FillValue")) then - delete_VarAtts(var3,(/"_FillValue"/)) - end if - copy_VarAtts(var3,var2d) - - nn = nd-2 - var2d!nn = "plevs" - - if ( dimL .gt. 1 ) then - if ( nd .eq. 5 ) then - return( var2d ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,:,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,:,:,:) ) - end if - else - if ( z(0,0,0,0,0) .gt. 500.) then - var2d@PlotLevelID = loc_param + " hPa" - else - var2d@PlotLevelID = .001*loc_param + " km" - end if - if ( nd .eq. 5 ) then - return( var2d(:,:,0,:,:) ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,0,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,0,:,:) ) - end if - end if - - - end if - - - - - if(plot_type .eq. "v" ) then ; vertical cross section needed - - dims = dimsizes(var3d) - if ( dimsizes(dims) .eq. 4 ) then - if ( z_in(0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in(0,:,:,:) - else - if ( z_in(0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in - end if - -; set vertical cross section - if (opts) then - xy = wrf_user_set_xy( z, loc_param(0)-1, loc_param(1)-1, \ ; the -1 is for NCL dimensions - loc_param(2)-1, loc_param(3)-1, \ - angle, opts ) - else - xy = wrf_user_set_xy( z, loc_param(0), loc_param(1), \ - 0.0, 0.0, angle, opts ) - end if - xp = dimsizes(xy) - - -; first we interp z - var2dz = wrf_interp_2d_xy( z, xy) - -; interp to constant z grid - if(var2dz(0,0) .gt. var2dz(1,0) ) then ; monotonically decreasing coordinate - z_max = floor(max(z)/10)*10 ; bottom value - z_min = ceil(min(z)/10)*10 ; top value - dz = 1. - nlevels = tointeger( (z_max-z_min)/dz) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_max - dz = -dz - else - z_max = max(z) - z_min = 0. -;; MODI SOLINE -; dz = 0.01 * z_max - dz = 0.001 * z_max - nlevels = tointeger( z_max/dz ) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_min - end if -; print("nlevels="+nlevels) -; print("dz="+dz) - - do i=1, nlevels-1 - z_var2d(i) = z_var2d(0)+i*dz - end do - - -; interp the variable - if ( dimsizes(dims) .eq. 4 ) then - var2d = new( (/dims(0), nlevels, xp(0)/), typeof(var2dz)) - do it = 0,dims(0)-1 - var2dtmp = wrf_interp_2d_xy( var3d(it,:,:,:), xy) - do i=0,xp(0)-1 - var2d(it,:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - end do - var2d!0 = var3d!0 - var2d!1 = "Vertical" - var2d!2 = "Horizontal" - else - var2d = new( (/nlevels, xp(0)/), typeof(var2dz)) - var2dtmp = wrf_interp_2d_xy( var3d, xy) - do i=0,xp(0)-1 - var2d(:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - var2d!0 = "Vertical" - var2d!1 = "Horizontal" - end if - - - st_x = tointeger(xy(0,0)) + 1 - st_y = tointeger(xy(0,1)) + 1 - ed_x = tointeger(xy(xp(0)-1,0)) + 1 - ed_y = tointeger(xy(xp(0)-1,1)) + 1 - if (opts) then - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ")" - else - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ") ; center=(" + \ - loc_param(0) + "," + loc_param(1) + \ - ") ; angle=" + angle - end if - - return(var2d) -end if - - -end - diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/clean_ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/clean_ncl deleted file mode 100755 index 3a0b73ae44942a2454ba2e68db4cb894106dd4f0..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/clean_ncl +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "!!!! WARNING :: CLEAN_RANGS_FILES !!!!" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo -echo do you real want to delete high resolution -echo -echo coastline files for ncl ????? -echo -echo "(yes/no)" -read ANSWER -set -x -if [ "X$ANSWER" = "Xyes" ] -then -rm -fr ran* gs* -fi -rm -f *.lfi *.des *.nc -rm -f dirextract *cdl OUT* diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/dir_exnetcdf b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/dir_exnetcdf deleted file mode 100644 index f39dba49c772930ca52215ac0a49211adfdbc27e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/dir_exnetcdf +++ /dev/null @@ -1,29 +0,0 @@ -REUNI.1.00A20.004dg -KCDL - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 -CONF - UT - VT - WT -ALT -THT -PABST -RVT -RCT -RRT -RIT -ACPRR -ZSBIS -END diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/get_ncl_highres_files b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/get_ncl_highres_files deleted file mode 100755 index 3b0e44937a9a0273c09a5f90f355d5601cb0011d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/get_ncl_highres_files +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -NCARG_RANGS=`pwd` -export NCARG_RANGS -echo -[ -f ~/.hluresfile ] || ( wget -c -nd http://www.ncl.ucar.edu/Document/Graphics/hluresfile ; mv hluresfile ~/.hluresfile ) -echo "You will download high resolution coastline files for NCL" -echo "in this directory:" -echo NCL_HIGHRES_FILES=$NCARG_RANGS -echo -set -x -cd $NCARG_RANGS -NCL_HIGHRES_URL="http://www2008.io-warnemuende.de/homepages/rfeistel/download" -export NCL_HIGHRES_URL -for file in rangs\(0\) rangs\(1\) rangs\(2\) \ - rangs\(3\) rangs\(4\) \ - gshhs\(0\) gshhs\(1\) gshhs\(2\) \ - gshhs\(3\) gshhs\(4\) -do -[ -f $file.zip ] || ( wget -c -nd $NCL_HIGHRES_URL/$file.zip ; unzip $file.zip ; ) -done - diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_BasicMap1.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_BasicMap1.ncl deleted file mode 100644 index 3b62c567aeafb4f6f8784f3230f162c8085c18ee..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_BasicMap1.ncl +++ /dev/null @@ -1,88 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -; ================================================; -begin -;=================================================; -; Open MESONH file -;=================================================; - mnh_file="REUNI.1.00A20.004dgKCL.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"ZSBIS") ; get some dimension sizes for the file - nd = dimsizes(mdims) - IMAX=mdims(nd-1) - JMAX=mdims(nd-2) - -;=================================================; -; Read some variables -;=================================================; - ZS = a->ZSBIS(0,:,:) - ZS@long_name="Orography" - ZS@units="m" - -;============================================== -; Use MESONHtools procedure to set projection -;============================================== - resmap = True - - lat2d = new((/JMAX,IMAX/),"double") - lat2d(:,:)=0. - lon2d = new((/JMAX,IMAX/),"double") - lon2d(:,:)=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; More map resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; highres version (must be donwloaded) - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 0.5 ; spacing for lat lines - resmap@mpGridLonSpacingF = 0.5 ; spacing for lon lines - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - -;=================================================; -; PLOT Orography (filled contour) -;=================================================; - -; Open workstation and define colormap -; ------------------------------------- - wks = gsn_open_wks("X11","plt_BasicMap1") ; open a ncgm file - gsn_define_colormap(wks,"topo_15lev") ; Choose colormap - -; General resources -; -------------------- - resmap@gsnMaximize = True ; to maximize size - resmap@gsnSpreadColors = True ; use full range of colormap - -; Contour resources -;------------------- - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,250,500,750,1000,1250,1500,1750,2000,2250,2500,2750,3000/) - resmap@cnLevels = cnLevels - - resmap@lbLabelAngleF = 45 ; angle labels - - - -;=================================================; -; PLOT ZS -;=================================================; - plot = gsn_csm_contour_map(wks,ZS,resmap) - -end - - diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_Cloud1.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_Cloud1.ncl deleted file mode 100644 index 38e12ff80915470a1caa2b445ec7256769bf4042..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_Cloud1.ncl +++ /dev/null @@ -1,156 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -;===================================================================== -; Example of script to plot RVM, RCM, RRM and RIM on model levels -; from MESONH netcdf file generated with extractdia -;===================================================================== - -begin - -;=================================================; -; Open file -;=================================================; -; MESONH input file - mnh_file="REUNI.1.00A20.004dgKCL.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"ZSBIS") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1) - jmax=mdims(nd-2) - -;=================================================; -; We generate plots, but what kind do we prefer? -; For paper quality plot do not use ncgm or eps -; ps , pdf , x11 -;=================================================; -; type = "ps" - type = "x11" - -;=================================================; -; Open the workstation and choose colormap -;=================================================; - wks = gsn_open_wks(type,"plt_Cloud") - gsn_define_colormap(wks,"WhBlGrYeRe") ; overwrite the .hluresfile color map - -;=================================================; -; Read the variables we will need -;=================================================; -; Read water wapor mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RVT")) - qv = a->RVT(0,:,:,:) - qv = qv*1000. - qv@units = "g/kg" - qv@description="Water vapor mixing ratio" - end if - -; Read cloud mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"MRC")) - qc = a->MRC(0,:,:,:) - qc = qc - qc@units = "g/kg" - qc@description="Cloud mixing ratio" - end if - -; Read rain mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"MRR")) - qr = a->MRR(0,:,:,:) - qr = qr - qr@units = "g/kg" - qr@description="Rain mixing ratio" - end if - -; Read ice mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RIT")) - qi = a->RIT(0,:,:,:) - qi = qi*1000. - qi@units = "g/kg" - qi@description="Ice mixing ratio" - end if - -;============================================== -; Use MESONHtools procedure to set projection -;============================================== -; Define lat and lon before calling procedure MESONH_map_c -; It is also important to define correctly the units -;----------------------------------------------------------; - lat2d = new((/jmax,imax/),"double") - lat2d@units="degrees_north" - lat2d(:,:)=0. - lon2d = new((/jmax,imax/),"double") - lon2d@units="degrees_east" - lon2d(:,:)=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Call MESONH_map_c to define automatically map projection parameters -; Return lat2d, lon2d and corners variables -;-----------------------------------------------; - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Additional map resources -;=================================================; - - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpFillOn = False - -;=========================================================; -; Loop over levels by step of 5 -;=========================================================; - -do level = 0,19,5 ; LOOP OVER LEVELS - - display_level = level + 1 - -; Contour resources -;------------------- - opts = resmap - opts@cnFillOn = True - opts@cnLinesOn = False - - opts@tiMainString = "Model Level " + display_level - - -; Plot wapor mixing ratio if it exists -; ----------------------------------------- - if (isvar("qv")) - plot = gsn_csm_contour_map(wks,qv(level,:,:),opts) - end if - -; Plot cloud mixing ratio if it exists -; ----------------------------------------- - if (isvar("qc")) - plot = gsn_csm_contour_map(wks,qc(level,:,:),opts) - end if - -; Plot rain mixing ratio if it exists -; ----------------------------------------- - if (isvar("qr")) - plot = gsn_csm_contour_map(wks,qr(level,:,:),opts) - end if - -; Plot ice mixing ratio if it exists -; ----------------------------------------- - if (isvar("qi")) - plot = gsn_csm_contour_map(wks,qi(level,:,:),opts) - end if - - -end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_CrossSection1.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_CrossSection1.ncl deleted file mode 100644 index 289b83107ffb32ce699e1403d325b90d4f6c5179..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_CrossSection1.ncl +++ /dev/null @@ -1,276 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -;========================================================================; -; Example script to plot vertical cross-section along a defined line from -; MESONH netcdf file generated with extractdia -;========================================================================; - - -begin - -;=================================================; -; Open file -;=================================================; -; MESONH netcdf input file generated by extractdia - mnh_file="REUNI.1.00A20.004dgKCL.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; We generate plots, but what kind do we prefer? -; For paper quality plot do not use ncgm or eps -;=================================================; - type = "x11" -; type = "ps" -; type = "pdf" -; type = "ps" - -;=================================================; -; Open the workstation and choose colormap -;=================================================; - wks = gsn_open_wks(type,"plt_CrossSection1") - gsn_define_colormap(wks,"topo_15lev") - - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"UM") ; get some dimension sizes for the file - nd = dimsizes(mdims) - -;=================================================; -; Read some variables from mnh_file -;=================================================; - ZS =a->ZSBIS(0,:,:) - - th = a->THM(0,:,:,:) - th@long_name="Potential Temperature" - th@description="TH" - - um = a->UM(0,:,:,:) - um@description="U" - - z= a->VLEV(:,:,:) - z@description="Height" - - zmin = 0. - zmax = 6. ; We are only interested in the first 6km - nz = floattoint(zmax + 1) - -;=================================================; -; Use MESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; - - resmap=True - - lat2d = new(dimsizes(ZS),"double") - lat2d@units="degrees_north" - lat2d=0. - lon2d = new(dimsizes(ZS),"double") - lon2d@units="degrees_east" - lon2d=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Define Other Resources for map ploting -;=================================================; - resmap@gsnFrame = False - - resmap@mpFillOn = False - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - - resmap@cnFillOn = True - resmap@cnLinesOn = False - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,250,500,750,1000,1250,1500,1750,2000,2250,2500,2750,3000/) - resmap@cnLevels = cnLevels - - resmap@lbLabelAngleF = 45 ; angle labels - - FirstPlot = True - -;=================================================; -; Planes definition and interpolation -;=================================================; - do ip = 1, 3 ; we are doing 3 plots - ; all with the pivot point (plane) in the center of the domain - ; at angles 0, 45 and 90 - ; - ; | - ; angle=0 is | - ; | - ; -; Define the plane where the cross-section will be done -; ------------------------------------------------------ - plane = new(2,float) - plane = (/ mdims(nd-1)/2, mdims(nd-2)/2 /) ; pivot point is center of domain (x,y) - - opts = False - - if(ip .eq. 1) then - angle = 90. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - end if - if(ip .eq. 2) then - angle = 0. - X_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - X_desc = "latitude" - end if - if(ip .eq. 3) then - angle = -45. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - end if - -; Interpolate fields onto the defined plane -; -------------------------------------------- - um_plane = wrf_user_intrp3d(um,z,"v",plane,angle,opts) - th_plane = wrf_user_intrp3d(th,z,"v",plane,angle,opts) - - -; Find the index where 6km is - only need to do this once -;-------------------------------------------------------- - if ( FirstPlot ) then - zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts) - printVarSummary(zz) - b = ind(zz(:,0) .gt. zmax ) - zmax_pos = b(0) - 1 - if ( abs(zz(zmax_pos,0)-zmax) .lt. abs(zz(zmax_pos+1,0)-zmax) ) then - zspan = b(0) - 1 - else - zspan = b(0) - end if - delete(zz) - delete(b) - FirstPlot = False - end if - -; X-axis labels -;-------------- - dimsX = dimsizes(X_plane) - xmin = X_plane(0) - xmax = X_plane(dimsX(0)-1) - xspan = dimsX(0)-1 - nx = 2 - -; Options for XY Plots -;----------------------- - opts_xy = True - - opts_xy@gsnFrame = False - opts_xy@gsnDraw = False - - opts_xy@tiXAxisString = X_desc - opts_xy@tiYAxisString = "Height (km)" - opts_xy@tiXAxisFontHeightF = 0.020 - opts_xy@tiYAxisFontHeightF = 0.020 - -; Resources to plot the topography (missing values in fields) -;------------------------------------------------------------- - opts_xy@cnMissingValPerimOn = True - opts_xy@cnMissingValFillColor = "red" - opts_xy@cnMissingValFillPattern = 8 - -; Tickmarks / Labels -;--------------------- - opts_xy@tmXTOn = False - opts_xy@tmYROn = False - opts_xy@tmXBMode = "Explicit" - opts_xy@tmXBValues = fspan(0,xspan,nx) ; Create tick marks - opts_xy@tmXBLabels = sprintf("%.1f",fspan(xmin,xmax,nx)) ; Create labels - opts_xy@tmXBLabelFontHeightF = 0.015 - opts_xy@tmYLMode = "Explicit" - opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks - opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels - opts_xy@tmXBMajorLengthF = 0.02 - opts_xy@tmYLMajorLengthF = 0.02 - opts_xy@tmYLLabelFontHeightF = 0.015 - - opts_xy@lbAutoManage = False ; we control label bar - opts_xy@pmLabelBarWidthF = 0.5 ; - opts_xy@pmLabelBarHeightF = 0.1 ; - - -; Plotting options for U -;----------------------- - opts_um = opts_xy - opts_um@pmLabelBarOrthogonalPosF = -0.1 - opts_um@cnFillOn = True - opts_um@gsnRightStringParallelPosF = 0.1 - opts_um@gsnRightStringOrthogonalPosF = 0.01 - - -; Plotting options for Temperature -;--------------------------------- - opts_th = opts_xy - opts_th@cnInfoLabelZone = 1 - opts_th@cnInfoLabelSide = "Top" - opts_th@cnInfoLabelPerimOn = True - opts_th@cnInfoLabelOrthogonalPosF= -0.00005 - - opts_th@gsnLeftStringParallelPosF = 0.9 - opts_th@gsnLeftStringOrthogonalPosF = 0.01 - - -; Get the contour info for the th and um -;---------------------------------------- - contour_th = gsn_csm_contour(wks,th_plane(0:zmax_pos,:),opts_th) - contour_um = gsn_csm_contour(wks,um_plane(0:zmax_pos,:),opts_um) - -;================ -; MAKE PLOTS -;================ - -; Horizontal plot with topography -;----------------------------------------------------------------------- - plot=gsn_csm_contour_map(wks,ZS,resmap) - -; Draw line that shows the position of the cross section -;-------------------------------------------------------- - lat_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - lon_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - - lnres = True - lnres@gsLineThicknessF = 3.0 - lnres@gsLineColor = "Red" - do ii = 0,dimsX(0)-2 - gsn_polyline(wks,plot,(/lon_plane(ii),lon_plane(ii+1)/),(/lat_plane(ii),lat_plane(ii+1)/),lnres) - end do - frame(wks) - delete(lon_plane) - delete(lat_plane) - - pltres = True - pltres@FramePlot = True - - -; Draw Vertical cross-section -;-------------------------- - - overlay(contour_um,contour_th) ; plot x-section - draw(contour_um) - frame(wks) - - -; Delete options and fields, so we don't have carry over -;------------------------------------------------------ - delete(opts_xy) - delete(opts_th) - delete(opts_um) - delete(th_plane) - delete(um_plane) - delete(X_plane) - -end do ; make next cross section - - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_ModelLevels1.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_ModelLevels1.ncl deleted file mode 100644 index 826b0266656ca51c2d5d0e0e6ca824b5e618c465..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_ModelLevels1.ncl +++ /dev/null @@ -1,227 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "MESONHtools.ncl" - -;=================================================; -; Example of script to plot field on model levels from MESONH netcdf file -; generated with extractdia -;=================================================; - -begin -;=================================================; -; Open file -;=================================================; -; The MESONH input file. - mnh_file="REUNI.1.00A20.004dgKCL.nc" - a = addfile(mnh_file,"r") - -;==================================================; -; Open the workstation and choose colormap -;==================================================; - type = "x11" - wks = gsn_open_wks(type,"plt_ModelLevels1") - gsn_define_colormap(wks,"rainbow+gray") - -;=================================================; -; Read the variables we need -;=================================================; - th = a->THM(0,:,:,:) ; theta - th@description="Potential Temperature" - - qv = a->RVM(0,:,:,:) ; Qv - qv = qv*1000. - qv@units = "g/kg" - qv@description="Water vapor mixing ratio" - - u = a->UM(0,:,:,:) ; u - u@description="U" - - v = a->VM(0,:,:,:) ; v - v@description="V" - -; Calculate wind speed -;------------------------ - spd = (u*u + v*v)^(0.5) ; speed in m/sec - spd@description = "Wind Speed" - spd@units = "m/s" - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = dimsizes(th) - nd=dimsizes(mdims) - imax=mdims(nd-1) - jmax=mdims(nd-2) - kmax=mdims(nd-3) - -;=================================================; -; Use MESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; - lat2d = new((/jmax,imax/),"double") - lat2d@units="degrees_north" - lat2d=0. - - lon2d = new((/jmax,imax/),"double") - lon2d@units="degrees_east" - lon2d=0. - - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - - resmap=True - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Set some other basic resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; highres map data version - resmap@mpFillOn = False - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - -;=========================================================; -; Loop over levels by step of 20 -;=========================================================; - dimsv = dimsizes(th) ; Get number of levels - do level =0,dimsv(0)-1,20 ; LOOP OVER LEVELS - -; Title -;-------- - display_level = level + 1 - resmap@tiMainString = "Model Level " + display_level - - -;======================= -; Resources for Theta -;======================= - opts = resmap - opts@gsnDraw = False ; don't draw yet - opts@gsnFrame = False ; don't advance frame yet - - opts@gsnContourLineThicknessesScale = 2.0 - - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = -0.05 - opts@cnInfoLabelParallelPosF = 0.97 - - contour = gsn_csm_contour_map(wks,th(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;====================== -; Resources for Qv -;====================== - opts = resmap - - opts@gsnFrame = False - opts@gsnDraw = False - - opts@gsnSpreadColors = True - opts@gsnSpreadColorStart = 30 - opts@gsnSpreadColorEnd = -2 - - opts@cnLineColor = "Blue" - opts@cnFillOn = True - - contour = gsn_csm_contour_map(wks,qv(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;=============================================== -; Overlay Wind Vectors and Speed over basic map -;=============================================== - -;======================= -; 1.Create Base map plot -;======================= - - resmap@gsnDraw = False ; don't draw yet - resmap@gsnFrame = False ; don't advance frame yet - - map=gsn_map(wks,"Stereographic",resmap) - -;======================= -; 2.Create Wind speed plot -;======================= - opts_ws = True - -; General resources -;------------------- - opts_ws@gsnFrame = False - opts_ws@gsnDraw = False - opts_ws@gsnSpreadColors = True - opts_ws@gsnSpreadColorStart = 30 - opts_ws@gsnSpreadColorEnd = -2 - -; Tickmark resources -;--------------------- -; No tickmark and label on axis for this plot -; They are already drawn by the basic map plot -; ------------------------------------------- - opts_ws@tmXBOn = False - opts_ws@tmYROn = False - opts_ws@tmXBLabelsOn = False - opts_ws@tmYRLabelsOn = False - - opts_ws@lbOrientation = "Vertical" -; Transformation resources -;--------------------------- -; Field is already on the right projection -;------------------------------------------ - opts_ws@tfDoNDCOverlay = True - -; Contour resources -; ------------------- - opts_ws@cnFillOn = True - opts_ws@cnLinesOn = False - -; PLOT -;----- - contour = gsn_csm_contour(wks,spd(level,:,:),opts_ws) - -;=========================== -; 3.Create Wind vector plot -;=========================== - opts_vec = True - - opts_vec@gsnFrame = False - opts_vec@gsnDraw = False - opts_vec@gsnLeftString = "Wind Vector" - opts_vec@gsnLeftStringParallelPosF = 0.3 - opts_vec@gsnLeftStringOrthogonalPosF = 0.018 - -; No Tickmarks/labels -;------------- - opts_vec@tmXBOn = False - opts_vec@tmYROn = False - opts_vec@tmXBLabelsOn = False - opts_vec@tmYRLabelsOn = False - - opts_vec@tfDoNDCOverlay = True - -; Vector resources - opts_vec@vcRefLengthF = 0.1 - opts_vec@vcRefMagnitudeF = 25 - opts_vec@vcMinDistanceF = 0.05 - - -; PLOT -;----- - vector = gsn_csm_vector(wks,u(level,:,:),v(level,:,:),opts_vec) - -;=================== -; 4.Overlay and draw -;=================== - overlay(map,contour) - overlay(map,vector) - - draw(map) - frame(wks) - - - end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_PressureLevel1.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_PressureLevel1.ncl deleted file mode 100644 index 2667ac88b12016b8865bc56de197dc0f428166f0..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/mnh_PressureLevel1.ncl +++ /dev/null @@ -1,203 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -;======================================================================; -; Example script to interpolate from model to pressure level and -; to plot some fields from MESONH netcdf file generated with extractdia -;======================================================================; - -begin - -;=======================================================; -; Pressure levels that we want the data interpolated to -;=======================================================; - pressure_levels = (/ 850., 700., 500., 300./) - nlevels = dimsizes(pressure_levels) ; number of pressure levels - -;=================================================; -; Open file -; MESONH netcdf input file generated with extractdia -;=================================================; - mnh_file="REUNI.1.00A20.004dgKCL.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf and x11 (for debugging) -;==================================================; - type = "x11" - wks = gsn_open_wks(type,"plt_PressureLevel2") - gsn_define_colormap(wks,"spread_15lev") - -;=================================================; -; Read the variables we need -;=================================================; - tk = a->THT(0,:,:,:) ; potential temperature - tk@description="Potential Temperature" - - u = a->UT(0,:,:,:) ; u - - v = a->VT(0,:,:,:) ; v - - p = a->PABST(0,:,:,:) ; pressure - p@description="Pressure" - - rv = a->RVT(0,:,:,:)*1000 ; water vapor mixing ratio - rv@description="Water vapor mixing ratio" - - ZS = a->ZSBIS(0,:,:) ; terrain - - z = a->VLEV(:,:,:) ; heigth - z@description="Height" - - -;=================================================; -; Horizontal interpolation on pressure levels -;=================================================; - do level = 0,nlevels-1 ; LOOP OVER LEVELS - - pressure = pressure_levels(level) - - tk_plane = wrf_user_intrp3d(tk,p,"h",pressure,0.,False) - z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) - u_plane = wrf_user_intrp3d( u,p,"h",pressure,0.,False) - v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False) - rv_plane = wrf_user_intrp3d( rv,p,"h",pressure,0.,False) - - spd_plane = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec - spd_plane@description = "Wind Speed" - spd_plane@units = "m/s" - - u_plane@units = "m/s" - v_plane@units = "m/s" - - -;================================== -; Create plots using wrf functions -;================================== - res=True - res@MainTitle = "MESONH" - res@Footer = False - - -; Plotting options for Tk -;------------------------ - opts = res - opts@cnLineColor = "Red" -; opts@ContourParameters = (/ 0.1 /) - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 2.0 - contour_tk = wrf_contour(a,wks,tk_plane,opts) - delete(opts) - - -; Plotting options for RV -;-------------------------- - opts = res - - opts@cnFillOn = True - opts@cnMissingValFillColor = "Red" - opts@cnMissingValFillPattern = 8 - - opts@pmLabelBarOrthogonalPosF = -0.1 - - contour_rv = wrf_contour(a,wks,rv_plane,opts) - delete(opts) - - -; Plotting options for Wind Speed -;-------------------------------- - opts = res - - opts@gsnContourLineThicknessesScale = 3.0 - - opts@cnLineColor = "MediumSeaGreen" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - - contour_spd = wrf_contour(a,wks,spd_plane,opts) - delete(opts) - - -; Plotting options for Wind Vectors -;---------------------------------- - opts = res - - opts@FieldTitle = "Wind" ; overwrite Field Title - opts@NumVectors = 47 ; wind barb density - - vector = wrf_vector(a,wks,u_plane,v_plane,opts) - delete(opts) - - -; Plotting options for Geopotential Heigh -;---------------------------------------- - opts_z = res - opts_z@gsnContourLineThicknessesScale = 2.0 - opts_z@cnLineColor = "Blue" - - -;============ -; MAKE PLOTS -;============ - pltres = True - -; Resources for map -;--------------------- - resmap = True - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - resmap@mpGeophysicalLineThicknessF = 2.0 - resmap@mpGridLineThicknessF = 2.0 - resmap@mpLimbLineThicknessF = 2.0 - resmap@mpNationalLineThicknessF = 2.0 - resmap@mpGridAndLimbOn = False ; turn off lat/lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data - - -; Overlay rv , tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 850 ) then ; plot temp, rv, height, wind barbs - - contour_height = wrf_contour(a,wks,z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_rv,contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 700 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 500 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay wind speed , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 300 ) then ; plot windspeed, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_spd,contour_height, \ - vector/),pltres,resmap) - end if - - delete(opts_z) - - end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/run_ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/run_ncl deleted file mode 100755 index 11c9cafb8e6bb391d7b232f92ead4fd1fc57a8c8..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_extractdia/run_ncl +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -#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. -#### Get highres coastline data for ncl -./get_ncl_highres_files -set -x -# Set NCARG_RANGS variable if highres data were downloaded -[ ! -f rangs\(0\).zip ] || export NCARG_RANGS=`pwd` -echo $NCARG_RANGS -#### MNH file to convert in netcdf -ln -sf ../004_convdia/REUNI.1.00A20.004dg.lfi . -rm -f REUNI.1.00A20.004dg?KCL -#### Conversion to netcdf using extractdia -extractdia < dir_exnetcdf -#~/LIBMNH/libtools/tools/diachro/LXgfortran_32/extractdia < dir_exnetcdf -# Check if ncl is installed -path_ncl=`which ncl` -if [ "$path_ncl" == "" ] -then -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "! ERROR: NCL is not installed or the path to !" -echo "! ncl binary is not set correctly !" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -exit -fi -#### Running ncl scripts with file REUNI.1.00A20.004dgKCL.nc -# Plot topography -ncl mnh_BasicMap1.ncl -# Horizontal cross sections on model levels -ncl mnh_ModelLevels1.ncl -# Horizontal cross section on model levels of microphysics variables -ncl mnh_Cloud1.ncl -# Vertical cross section along an arbitrary line -ncl mnh_CrossSection1.ncl -# Horizontal cross section on pessure level (interpolation) -ncl mnh_PressureLevel1.ncl diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/MESONHtools.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/MESONHtools.ncl deleted file mode 100644 index 9cae6400a0dade82e20ba68463722fbb13d4c81d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/MESONHtools.ncl +++ /dev/null @@ -1,915 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" - -;------------------------------------------------------------- -;contains: -; procedure MESONH_map_c -;function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) -;function mnh_map_overlays(in_file[1]:file,wks:graphic,plots[*]:graphic, \ -; opt_arg[1]:logical,opt_mp[1]:logical) -;function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;------------------------------------------------------------- - -;============================================================== -; J.-P. CHABOUREAU -; This is a driver that selects the appropriate -; mapping function based upon the file variables RPK, BETA, LATOR, LONOR -; -; -; Sample usage: -; a = addfile("...", r") -; IMAX = a->IMAX -; JMAX = a->JMAX -; lat2d = new((/JMAX,IMAX/),"double") -; lat2d(:,:)=0. -; lon2d = new((/JMAX,IMAX/),"double") -; lon2d(:,:)=0. -; icorners = new((/2,2/),"integer") -; icorners(:,:)=0 -; res = True -; MESONH_map_c (a, res, lat2d, lon2d, icorners) -; -; -undef("MESONH_map_c") -;============================================================== -procedure MESONH_map_c (in_file:file, res:logical, plat, plon, icorner) -;============================================================== -;local rank, dimll, nlat, mlon, lat, lon -local rank, dimll, nlat, mlon -begin - -; Check if the variable RPK is in the file -; ---------------------------------------- -if(isfilevar(in_file,"RPK")) then - -; Read projection parameters -; ------------------------- - ZRPK = in_file->RPK - ZLATOR = in_file->LATOR - ZLONOR = in_file->LONOR - ZBETA = in_file->BETA - ZLAT0 = in_file->LAT0 - ZLON0 = in_file->LON0 - -; Case netcdf from lfi2cdf -; ------------------------- - - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - -; unstagger - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - - else - -; Case netcdf from extractdia -; --------------------------- - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - - end if - - print ("LATOR="+ZLATOR+" - LONOR="+ZLONOR) - print ("ZLAT0="+ZLAT0+" - ZLON0="+ZLON0) - print ("ZDX="+zdx+" - RPK="+ZRPK+" - BETA="+ZBETA) - print ("IMAX="+IMAX+" - JMAX="+JMAX) - - if (ZRPK.gt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = 90. - end if - - if (ZRPK.lt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = -90. - end if - - if (ZRPK.eq.0) then - ; Mercator projection -; --------------------------- - res@mpProjection = "Mercator" - end if - - print("Map projection="+res@mpProjection) - -else - print ("MESONH_map_c: Error no RPK variable in input file") -end if - -;=================================================; -; calculate 2D lat and lon -; based on src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - -; Constants -; ----------- - if(isfilevar(in_file,"IMAX")) - XRADIUS=6371229.0d ; Earth radius (meters) - else - XRADIUS=6371.2290d ; Earth radius (km) - end if - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - -;=================================================; - if (ZRPK.eq.0) then -; MERCATOR -;=================================================; - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - plon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - plat(jj,ji)=zlat - end do - end do - -;=================================================; - else -; STEREOGRAPHIC PROJECTION -;=================================================; - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - plon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - plat(jj,ji)=zlat - end do - end do - - end if - -; Defining the corners of the domain -;==================================== - if (icorner(0,0).eq.icorner(1,1)) then - icorner(0,0)=0 - icorner(1,0)=JMAX-1 - icorner(0,1)=0 - icorner(1,1)=IMAX-1 - end if -; print ("icorner"+icorner) - - res@mpLimitMode = "Corners" - res@mpLeftCornerLatF = plat(icorner(0,0),icorner(0,1)) - res@mpLeftCornerLonF = plon(icorner(0,0),icorner(0,1)) - res@mpRightCornerLatF = plat(icorner(1,0),icorner(1,1)) - res@mpRightCornerLonF = plon(icorner(1,0),icorner(1,1)) - -; print ("Corner (0,0); Lat="+res@mpLeftCornerLatF+ \ -; ", Lon="+res@mpLeftCornerLonF) -; print ("Oppos corner; Lat="+res@mpRightCornerLatF+ \ -; ", Lon= "+res@mpRightCornerLonF) - -;========================================== -; Turn on lat / lon labeling -;========================================== - res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - res@mpOutlineBoundarySets = "AllBoundaries" ; state boundaries - res@mpPerimDrawOrder = "PostDraw" ; force map perim -;========================================== -; Needed for regional native projection -;========================================== - res@tfDoNDCOverlay = True - res@gsnAddCyclic = False ; regional data - -end - -;=========================================== -;------------------------------------------------------------------------ -undef("MESONH_pinter") -function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;************************************************************************* -; S. BIELLI -; This is a routine that interpolate fields on pressure level for plotting -; based on pinter.f90 -; The field to be interpolated must be given at the mass point (grid 1) -; usage : var_inter=MESONHfunction(var_to_interpol, 850., AbsPressure) -; Abs pressure must be in Pa -; - -begin - - dimL= dimsizes(loc_param) - -; First test for grid = 0 - - dimp=dimsizes(ppabs) - - pout=pfield(0:dimL-1,:,:) - pfield@_FillValue=999 - pout@_FillValue=999 - pout=pout@_FillValue - - do jkp = 0, dimL-1 - zref=log10(loc_param(jkp)*100.) - do jloop = 0, dimp(1)-1 - do iloop = 0, dimp(2)-1 - kloop=0 - flag=True - do while (flag .and. (kloop.lt.(dimp(2)-2))) - if (.not.ismissing(ppabs(kloop,jloop,iloop))) then - zxm=log10(ppabs(kloop,jloop,iloop)) - zxp=log10(ppabs(kloop+1,jloop,iloop)) - if ((zxp-zref)*(zref-zxm) .ge. 0) then - pout(jkp,jloop,iloop)= (pfield(kloop,jloop,iloop)*(zxp-zref)+ \ - pfield(kloop+1,jloop,iloop)*(zref-zxm))/ (zxp-zxm) - flag=False - end if - end if - kloop=kloop+1 - end do - end do - end do - end do - - return(pout) - -end - -;-------------------------------------------------------------------------------- -undef("mnh_map") -function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) - -begin -; -; This function creates a map plot, and bases the projection on -; the MAP_PROJ attribute in the given file. -; -; 1. Make a copy of the resource list, and set some resources -; common to all map projections. -; -; 2. Determine the projection being used, and set resources based -; on that projection. -; -; 3. Create the map plot, and draw and advance the frame -; (if requested). - - opts = opt_args ; Make a copy of the resource list - opts = True - -; Set some resources depending on what kind of map projection is -; chosen. -; -; ZRPK != 0 : "Stereographic" -; ZRPK = 0 : "Mercator" -;=================================================; -; src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - XRADIUS=6371229.0d ; Earth radius (meters) - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - - if(isfilevar(in_file,"RPK")) - ZRPK=in_file->RPK - ZLON0=in_file->LON0 - ZLAT0=in_file->LAT0 - ZLATOR=in_file->LATOR - ZLONOR=in_file->LONOR - ZBETA=in_file->BETA - else - print ("mnh_map: Error no RPK variable in input file") - return(new(1,graphic)) - end if - -; Case netcdf from lfi2cdf - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - else -; Case netcdf from extractdia - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - end if -; - - lat = new((/JMAX,IMAX/),"double") - lon = new((/JMAX,IMAX/),"double") - - -; Stereographic projection - if(ZRPK .gt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", 90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - - if(ZRPK .lt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", -90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - -; Mercator projection - if(ZRPK .eq. 0) - projection = "Mercator" - end if - - opts@mpNestTime = get_res_value_keep(opts, "mpNestTime",0) - - -; LAT and LON are not saved in the file - if (ZRPK.eq.0) then - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - lon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - lat(jj,ji)=zlat - end do - end do - else - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - lon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - lat(jj,ji)=zlat - end do - end do - end if - - dims = dimsizes(lat) - - do ii = 0, dims(0)-1 - do jj = 0, dims(1)-1 - if ( lon(ii,jj) .lt. 0.0) then - lon(ii,jj) = lon(ii,jj) + 360. - end if - end do - end do - - opts@start_lat = lat(0,0) - opts@start_lon = lon(0,0) - opts@end_lat = lat(dims(0)-1,dims(1)-1) - opts@end_lon = lon(dims(0)-1,dims(1)-1) - - -; Set some resources common to all map projections. - opts = set_mp_resources(opts) - - if ( isatt(opts,"ZoomIn") .and. opts@ZoomIn ) then - y1 = 0 - x1 = 0 - y2 = dims(0)-1 - x2 = dims(1)-1 - if ( isatt(opts,"Ystart") ) then - y1 = opts@Ystart - delete(opts@Ystart) - end if - if ( isatt(opts,"Xstart") ) then - x1 = opts@Xstart - delete(opts@Xstart) - end if - if ( isatt(opts,"Yend") ) then - if ( opts@Yend .le. y2 ) then - y2 = opts@Yend - end if - delete(opts@Yend) - end if - if ( isatt(opts,"Xend") ) then - if ( opts@Xend .le. x2 ) then - x2 = opts@Xend - end if - delete(opts@Xend) - end if - - opts@mpLeftCornerLatF = lat(y1,x1) - opts@mpLeftCornerLonF = lon(y1,x1) - opts@mpRightCornerLatF = lat(y2,x2) - opts@mpRightCornerLonF = lon(y2,x2) - - if ( opts@mpRightCornerLonF .lt. 0.0 ) then - opts@mpRightCornerLonF = opts@mpRightCornerLonF + 360.0 - end if - - delete(opts@ZoomIn) - end if - - -; The default is not to draw the plot or advance the frame, and -; to maximize the plot in the frame. - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", False) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", False) - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - delete_attrs(opts) ; Clean up. - mp = gsn_map(wks,projection,opts) ; Create map plot. - - return(mp) ; Return. - -end - -;-------------------------------------------------------------------------------- - -undef("mnh_map_overlays") -function mnh_map_overlays(in_file[1]:file, \ - wks:graphic, \ - plots[*]:graphic, \ - opt_arg[1]:logical, \ - opt_mp[1]:logical) - -; Based on wrf_map_overlays -; -; This procedure takes an array of plots and overlays them on a -; base plot - map background. -; -; It will advance the plot and cleanup, unless you set the -; PanelPlot resource to True. -; -; Attributes recognized by this procedure: -; FramePlot -; PanelPlot -; NoTitles (don't do any titles) -; CommonTitle & PlotTile is used to overwrite field titles -; CommonTitle will super-seed NoTitles -; -; If FramePlot False, then Draw the plot but do not Frame. -; In this case a user want to add to the drawing, and will -; have to advance the Frame manually in the script. -; -; If the "NoTitles" attribute exists and is set True, then -; don't create the top-left titles, and leave the main titles alone. -; This resource can be useful if you are planning to panel -; the plots. -; -; If PanelPlot is set to True, then this flags to wrf_map_overlays -; that these plots are going to be eventually paneled (likely -; by gsn_panel), and hence 1) draw and frame should not be called -; (unless gsnDraw and/or gsnFrame are explicitly set to True), -; and 2) the overlays and titles should not be removed with -; NhlRemoveOverlay and NhlRemoveAnnotation. -; -begin - - opts = opt_arg ; Make a copy of the resource lists - opt_mp_2 = opt_mp - - ; Let's make the map first - base = mnh_map(wks,in_file,opt_mp_2) - - no_titles = get_res_value(opts,"NoTitles",False) ; Do we want field titles? - com_title = get_res_value(opts,"CommonTitle",False) ; Do we have a common title? - if ( com_title ) then - plot_title = get_res_value(opts,"PlotTitle"," ") - no_titles = True - end if - - call_draw = True - call_frame = get_res_value(opts,"FramePlot",True) ; Do we want to frame the plot? - panel_plot = get_res_value(opts,"PanelPlot",False) ; Are we paneling? - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - nplots = dimsizes(plots) -; font_color = "Black" - - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then -; class_name = NhlClassName(plots(i)) -; print(class_name) -; if(class_name.eq."contourPlotClass") then -; getvalues plots(i) -; "cnFillOn" : fill_on -; "cnLineColor" : line_color -; end getvalues -; if (.not.fill_on) then -; font_color = line_color -; end if -; end if - if(.not.no_titles) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - if(i.eq.0) then - SubTitles = SubTitle - else - SubTitles = SubTitles + "~C~" + SubTitle - end if - end if - if(com_title .and. i .eq. nplots-1) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - SubTitles = plot_title - end if - setvalues plots(i) - "tfDoNDCOverlay" : True - "tiMainOn" : False - end setvalues - overlay(base,plots(i)) - else - print("mnh_map_overlays: Warning: overlay plot #" + i + " is not valid.") - end if - end do - - if(.not.no_titles .or. com_title) then - font_height = get_res_value_keep(opts,"FontHeightF",0.01) - txt = create "map_titles" textItemClass wks - "txString" : SubTitles - "txFontHeightF" : font_height - ;"txFontColor" : font_color - end create - anno = NhlAddAnnotation(base,txt) - setvalues anno - "amZone" : 3 - "amJust" : "BottomLeft" - "amSide" : "Top" - "amParallelPosF" : 0.005 - "amOrthogonalPosF" : 0.03 - "amResizeNotify" : False - end setvalues - base@map_titles = anno - end if -; -; gsnDraw and gsnFrame default to False if panel plot. -; - if(panel_plot) then - call_draw = False - call_frame= False - end if - - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", call_draw) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", call_frame) - - draw_and_frame(wks,base,opts@gsnDraw,opts@gsnFrame,False, \ - opts@gsnMaximize) - - if(.not.panel_plot) then - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then - NhlRemoveOverlay(base,plots(i),False) - else - print("wrf_remove_map_overlays: Warning: overlay plot #" + i + " is not valid.") - print(" Nothing to remove.") - end if - end do - end if - - if(.not.no_titles.and..not.panel_plot) then - if(isatt(base,"map_titles")) then - NhlRemoveAnnotation(base,base@map_titles) - delete(base@map_titles) - end if - end if - -return(base) -end - -;-------------------------------------------------------------------------------- -undef("wrf_user_intrp3d") -function wrf_user_intrp3d( var3d:numeric, z_in:numeric, \ - plot_type:string, \ - loc_param:numeric, angle:numeric, opts:logical ) - -; var3d - 3d field to interpolate (all input fields must be unstaggered) -; z_in - interpolate to this field (either p/z) -; plot_type - interpolate horizontally "h", or vertically "v" -; loc_param - level(s) for horizontal plots (eg. 500hPa ; 3000m - scalar), -; plane for vertical plots (2 values representing an xy point -; on the model domain through which the vertical plane will pass -; OR 4 values specifying start and end values -; angle - 0.0 for horizontal plots, and -; an angle for vertical plots - 90 represent a WE cross section -; opts Used IF opts is TRUE, else use loc_param and angle to determine crosssection - -begin - - - if(plot_type .eq. "h" ) then ; horizontal cross section needed - - dimL = dimsizes(loc_param) - - dims = dimsizes(var3d) - nd = dimsizes(dims) - - dimX = dims(nd-1) - dimY = dims(nd-2) - dimZ = dims(nd-3) - dim4 = 1 - dim5 = 1 - if ( nd .eq. 4 ) then - dim4 = dims(nd-4) - end if - if ( nd .eq. 5 ) then - dim4 = dims(nd-4) - dim5 = dims(nd-5) - end if - - var3 = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - z = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - var2d = new ( (/ dim5, dim4, dimL, dimY, dimX /) , typeof(var3d) ) - - if ( nd .eq. 5 ) then - var3 = var3d - z = z_in - end if - if ( nd .eq. 4 ) then - var3(0,:,:,:,:) = var3d(:,:,:,:) - z(0,:,:,:,:) = z_in(:,:,:,:) - end if - if ( nd .eq. 3 ) then - var3(0,0,:,:,:) = var3d(:,:,:) - z(0,0,:,:,:) = z_in(:,:,:) - end if - - - if ( z(0,0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z(0,0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z = z * 0.01 - end if - if ( loc_param(0) .gt. 2000. ) then - ; looks like the input was specified in Pa - change this - loc_param = loc_param * 0.01 - end if - end if - - do il = 0,dimL-1 - var = wrf_interp_3d_z(var3,z,loc_param(il)) - var2d(:,:,il,:,:) = var(:,:,:,:) - end do - - copy_VarAtts(var3d,var3) - if(isatt(var3,"description")) then - delete_VarAtts(var3,(/"description"/)) - end if - if(isatt(var3,"units")) then - delete_VarAtts(var3,(/"units"/)) - end if - if(isatt(var3,"MemoryOrder")) then - delete_VarAtts(var3,(/"MemoryOrder"/)) - end if - if(isatt(var3,"_FillValue")) then - delete_VarAtts(var3,(/"_FillValue"/)) - end if - copy_VarAtts(var3,var2d) - - nn = nd-2 - var2d!nn = "plevs" - - if ( dimL .gt. 1 ) then - if ( nd .eq. 5 ) then - return( var2d ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,:,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,:,:,:) ) - end if - else - if ( z(0,0,0,0,0) .gt. 500.) then - var2d@PlotLevelID = loc_param + " hPa" - else - var2d@PlotLevelID = .001*loc_param + " km" - end if - if ( nd .eq. 5 ) then - return( var2d(:,:,0,:,:) ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,0,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,0,:,:) ) - end if - end if - - - end if - - - - - if(plot_type .eq. "v" ) then ; vertical cross section needed - - dims = dimsizes(var3d) - if ( dimsizes(dims) .eq. 4 ) then - if ( z_in(0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in(0,:,:,:) - else - if ( z_in(0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in - end if - -; set vertical cross section - if (opts) then - xy = wrf_user_set_xy( z, loc_param(0)-1, loc_param(1)-1, \ ; the -1 is for NCL dimensions - loc_param(2)-1, loc_param(3)-1, \ - angle, opts ) - else - xy = wrf_user_set_xy( z, loc_param(0), loc_param(1), \ - 0.0, 0.0, angle, opts ) - end if - xp = dimsizes(xy) - - -; first we interp z - var2dz = wrf_interp_2d_xy( z, xy) - -; interp to constant z grid - if(var2dz(0,0) .gt. var2dz(1,0) ) then ; monotonically decreasing coordinate - z_max = floor(max(z)/10)*10 ; bottom value - z_min = ceil(min(z)/10)*10 ; top value - dz = 1. - nlevels = tointeger( (z_max-z_min)/dz) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_max - dz = -dz - else - z_max = max(z) - z_min = 0. -;; MODI SOLINE -; dz = 0.01 * z_max - dz = 0.001 * z_max - nlevels = tointeger( z_max/dz ) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_min - end if -; print("nlevels="+nlevels) -; print("dz="+dz) - - do i=1, nlevels-1 - z_var2d(i) = z_var2d(0)+i*dz - end do - - -; interp the variable - if ( dimsizes(dims) .eq. 4 ) then - var2d = new( (/dims(0), nlevels, xp(0)/), typeof(var2dz)) - do it = 0,dims(0)-1 - var2dtmp = wrf_interp_2d_xy( var3d(it,:,:,:), xy) - do i=0,xp(0)-1 - var2d(it,:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - end do - var2d!0 = var3d!0 - var2d!1 = "Vertical" - var2d!2 = "Horizontal" - else - var2d = new( (/nlevels, xp(0)/), typeof(var2dz)) - var2dtmp = wrf_interp_2d_xy( var3d, xy) - do i=0,xp(0)-1 - var2d(:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - var2d!0 = "Vertical" - var2d!1 = "Horizontal" - end if - - - st_x = tointeger(xy(0,0)) + 1 - st_y = tointeger(xy(0,1)) + 1 - ed_x = tointeger(xy(xp(0)-1,0)) + 1 - ed_y = tointeger(xy(xp(0)-1,1)) + 1 - if (opts) then - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ")" - else - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ") ; center=(" + \ - loc_param(0) + "," + loc_param(1) + \ - ") ; angle=" + angle - end if - - return(var2d) -end if - - -end - diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/clean_ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/clean_ncl deleted file mode 100755 index bb0f6a460def102235c5996a0665357b2d569eb9..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/clean_ncl +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "!!!! WARNING :: CLEAN_RANGS_FILES !!!!" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo -echo do you real want to delete high resolution -echo -echo coastline files for ncl ????? -echo -echo "(yes/no)" -read ANSWER -set -x -if [ "X$ANSWER" = "Xyes" ] -then -rm -fr ran* gs* -fi -rm -f *.lfi *.cdf diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/get_ncl_highres_files b/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/get_ncl_highres_files deleted file mode 100755 index 3b0e44937a9a0273c09a5f90f355d5601cb0011d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/get_ncl_highres_files +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -NCARG_RANGS=`pwd` -export NCARG_RANGS -echo -[ -f ~/.hluresfile ] || ( wget -c -nd http://www.ncl.ucar.edu/Document/Graphics/hluresfile ; mv hluresfile ~/.hluresfile ) -echo "You will download high resolution coastline files for NCL" -echo "in this directory:" -echo NCL_HIGHRES_FILES=$NCARG_RANGS -echo -set -x -cd $NCARG_RANGS -NCL_HIGHRES_URL="http://www2008.io-warnemuende.de/homepages/rfeistel/download" -export NCL_HIGHRES_URL -for file in rangs\(0\) rangs\(1\) rangs\(2\) \ - rangs\(3\) rangs\(4\) \ - gshhs\(0\) gshhs\(1\) gshhs\(2\) \ - gshhs\(3\) gshhs\(4\) -do -[ -f $file.zip ] || ( wget -c -nd $NCL_HIGHRES_URL/$file.zip ; unzip $file.zip ; ) -done - diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_BasicMap2.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_BasicMap2.ncl deleted file mode 100644 index 737a1e1da69020e920b6d99b576fa9ccc4e354cb..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_BasicMap2.ncl +++ /dev/null @@ -1,94 +0,0 @@ -;================================================; -; Always load these files in the same order -; ----------------------------------------- -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -begin -;=================================================; -; Open file -;=================================================; - mnh_file="REUNI.1.00A20.004.cdf" - a = addfile(mnh_file, "r") - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"ZS") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - -;=================================================; -; Read some variables frm mnh_file -;=================================================; - ZS = a->ZS(1:jmax,1:imax) - ZS@long_name="Orography" - ZS@units="m" - - Z=a->ZHAT - Y=a->YHAT(1:jmax) - X=a->XHAT(1:imax) - -;=================================================; -; Use MESONHtools procedure to set projection info -;=================================================; - resmap = True ; plot mods desired - - imax = a->IMAX - jmax = a->JMAX - lat2d = new((/jmax,imax/),"double") - lat2d(:,:)=0. - lon2d = new((/jmax,imax/),"double") - lon2d(:,:)=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Map resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - - resmap@mpGeophysicalLineThicknessF = 2.0 - -;=================================================; -; Plot Orography (ZS) (filled contour) -;=================================================; - -; Open workstation and define colormap -; ------------------------------------- - wks = gsn_open_wks("x11","plt_BasicMap2") ; open a X11 - gsn_define_colormap(wks,"topo_15lev") ; Choose colormap - -; General resources -; -------------------- - resmap@gsnMaximize = True ; to maximize size - resmap@gsnSpreadColors = True ; use full range of colormap - -; Contour resources -; -------------------- - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,250,500,750,1000,1250,1500,1750,2000,2250,2500,2750,3000/) - resmap@cnLevels = cnLevels - - resmap@lbOrientation = "Vertical" - -; Plot -; ----- - plot = gsn_csm_contour_map(wks,ZS,resmap) - -end - - diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_Cloud2.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_Cloud2.ncl deleted file mode 100644 index cb451e7018e0c72d5f357a602918376815c9689a..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_Cloud2.ncl +++ /dev/null @@ -1,155 +0,0 @@ - -; Example script to produce plots for a WRF real-data run, -; with the ARW coordinate dynamics option. - -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -begin -;=================================================; -; Open file -;=================================================; -; MESONH input file - mnh_file="REUNI.1.00A20.004.cdf" - a = addfile(mnh_file, "r") - -;==================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use type= ps or pdf or x11 (for debugging) -;==================================================; - - type = "x11" - wks = gsn_open_wks(type,"plt_Cloud2") - gsn_define_colormap(wks,"WhBlGrYeRe") ; overwrite the .hluresfile color map - -;=================================================; -; Get informations on variable sizes -;=================================================; - - mdims = getfilevardimsizes(a,"RVM") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - kmax=mdims(nd-3)-2 -; -2 : to remove non-physical values - -;=================================================; -; Read the variables we will need -;=================================================; - -; Read water wapor mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RVM")) - qv = a->RVM(1:kmax,1:jmax,1:imax) - qv = qv*1000. - qv@units = "g/kg" - qv@description="Water vapor mixing ratio" - end if - -; Read cloud mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RCM")) - qc = a->RCM(1:kmax,1:jmax,1:imax) - qc = qc*1000. - qc@units = "g/kg" - qc@description="Cloud mixing ratio" - end if - -; Read rain mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RRM")) - qr = a->RRM(1:kmax,1:jmax,1:imax) - qr = qr*1000. - qr@units = "g/kg" - qr@description="Rain mixing ratio" - end if - -; Read ice mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RIM")) - qi = a->RIM(1:kmax,1:jmax,1:imax) - qi = qi*1000. - qi@units = "g/kg" - qi@description="Ice mixing ratio" - end if - -;=================================================; -; Use MESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; - -; Define lat and lon before calling procedure MESONH_map_c -; It is also important to define correctly the units -;----------------------------------------------------------; - lat2d = new((/jmax,imax/),"double") - lat2d@units="degrees_north" - lat2d=0. - lon2d = new((/jmax,imax/),"double") - lon2d@units="degrees_east" - lon2d=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Call MESONH_map_c to define automatically map projection parameters -; And return lat2d, lon2d and cormap (corners) variables -;-----------------------------------------------; - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Set some other basic resources -;=================================================; - - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpFillOn = False - -;=========================================================; -; Loop over levels by step of 5 -;=========================================================; - do level = 0,19,5 - - display_level = level + 1 - -; Contour resources -;-------------------- - opts = resmap - opts@cnFillOn = True - opts@cnLinesOn = False - - opts@tiMainString = "Model Level "+display_level - - -; Plot wapor mixing ratio if it exists -; ----------------------------------------- - if (isvar("qv")) - plot=gsn_csm_contour_map(wks,qv(level,:,:),opts) - end if - -; Plot cloud mixing ratio if it exists -; ----------------------------------------- - if (isvar("qc")) - plot=gsn_csm_contour_map(wks,qc(level,:,:),opts) - end if - -; Plot rain mixing ratio if it exists -; ----------------------------------------- - if (isvar("qr")) - plot=gsn_csm_contour_map(wks,qr(level,:,:),opts) - end if - -; Plot ice mixing ratio if it exists -; ----------------------------------------- - if (isvar("qi")) - plot=gsn_csm_contour_map(wks,qi(level,:,:),opts) - end if - - - end do ; END OF LEVEL LOOP -;=================================================; - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_CrossSection2.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_CrossSection2.ncl deleted file mode 100644 index 47b0589311aad88bbcadaec6c096193f5fab8c76..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_CrossSection2.ncl +++ /dev/null @@ -1,309 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -begin - -;=================================================; -; Open file -;=================================================; - in_file="REUNI.1.00A20.004.cdf" - a = addfile(in_file, "r") - -;=================================================; -; We generate plots, but what kind do we prefer? -; For paper quality plot do not use ncgm or eps -;=================================================; - type = "x11" -; type = "ps" -; type = "pdf" -; type = "ps" - -;=================================================; -; Open the workstation and choose colormap -;=================================================; - wks = gsn_open_wks(type,"plt_CrossSection2") - gsn_define_colormap(wks,"topo_15lev") - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"UT") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - kmax=mdims(nd-3)-2 - -;=================================================; -; Read some variables from mnh_file -;=================================================; - ZS =a->ZS(1:jmax,1:imax) - - th = a->THT(1:kmax,1:jmax,1:imax) - th@long_name="Potential Temperature" - th@description="TH" - - um = a->UT(1:kmax,1:jmax,1:imax+1) - um@description="U" - - zh= a->ZHAT(1:kmax+1) - -;=================================================; -; Take care of the Arakawa C grid -;=================================================; -; Unstagger zh (from grid 4 to 1) -;----------------------------------; - nzh=new(kmax,double) - do k=0,kmax-1 - nzh(k)=(zh(k)+zh(k+1))/2. - end do - -; Unstagger U -;----------------------------------; - um!0="Z" - um!1="Y" - um!2="X" - u_unst = wrf_user_unstagger(um,"X") - -;=================================================; -; Needed for the wrf_intrp3d function -;=================================================; -; Create Z3D -;----------------------------------; - z=new(dimsizes(th),double) - zcoef=1.-ZS/nzh(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - z(:,j,i) = nzh*zcoef(j,i)+ZS(j,i) - end do - end do - -; get height info for labels -;----------------------------------; - zmin = 0. - zmax = 6. ; We are only interested in the first 6km - nz = floattoint(zmax + 1) - -;=================================================; -; Use MESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; - -; Define lat and lon before calling procedure MESONH_map_c -; It is also important to define correctly the units -;----------------------------------------------------------; - lat2d = new(dimsizes(ZS),"double") - lat2d@units="degrees_north" - lat2d=0. - lon2d = new(dimsizes(ZS),"double") - lon2d@units="degrees_east" - lon2d=0. - cormap = new((/2,2/),"integer") - cormap(:,:)=0 - -; Resources for the map projection -;-----------------------------------------------; - resmap=True - -; Call MESONH_map_c to define automatically -; map projection parameters -;-----------------------------------------------; - MESONH_map_c (a, resmap, lat2d, lon2d, cormap) - -;=================================================; -; Define Other Resources for map ploting -;=================================================; - - resmap@gsnFrame = False - resmap@gsnMaximize = True - -; Map resources -;-----------------------------------------------; - resmap@mpFillOn = False - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - -; Contour definitions -;-----------------------------------------------; - resmap@cnFillOn = True - resmap@cnLinesOn = False - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,250,500,750,1000,1250,1500,1750,2000,2250,2500,2750,3000/) - resmap@cnLevels = cnLevels - - resmap@lbOrientation = "Vertical" - - - FirstPlot = True - -;=================================================; -; Planes definition and interpolation -;=================================================; - do ip = 1, 3 ; we are doing 3 plots - ; all with the pivot point (plane) in the center of the domain - ; at angles 0, 45 and 90 - ; - ; | - ; angle=0 is | - ; | - ; - -; Define the plane where the cross-section will be done -; ------------------------------------------------------ - plane = new(2,float) - plane = (/ (mdims(nd-1)-2)/2, (mdims(nd-2)-2)/2 /) ; pivot point is center of domain (x,y) - -; Resource for the interpolation -; -------------------------------- - opts = False - - if(ip .eq. 1) then - angle = 90. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - end if - if(ip .eq. 2) then - angle = 0. - X_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - X_desc = "latitude" - end if - if(ip .eq. 3) then - angle = -45. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - - end if - -; Interpolate fields onto the defined plane -; -------------------------------------------- - um_plane = wrf_user_intrp3d(u_unst,z,"v",plane,angle,opts) - th_plane = wrf_user_intrp3d(th,z,"v",plane,angle,opts) - -; Find the index where 6km is - only need to do this once -; -------------------------------------------- - if ( FirstPlot ) then - zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts) - b = ind(zz(:,0) .gt. zmax*1000. ) - zmax_pos = b(0) - 1 - if ( abs(zz(zmax_pos,0)-zmax*1000.) .lt. abs(zz(zmax_pos+1,0)-zmax*1000.) ) then - zspan = b(0) - 1 - else - zspan = b(0) - end if - delete(zz) - delete(b) - FirstPlot = False - end if - -; Define X-axis labels -;---------------------- - dimsX = dimsizes(X_plane) - xmin = X_plane(0) - xmax = X_plane(dimsX(0)-1) - xspan = dimsX(0)-1 - nx = 3 - -; Options for XY Plots -;----------------------------------------- - opts_xy = True - opts_xy@tiXAxisString = X_desc - opts_xy@tiYAxisString = "Height (km)" - opts_xy@tiXAxisFontHeightF = 0.020 - opts_xy@tiYAxisFontHeightF = 0.020 - -; Resources to plot the topography (missing values in fields) -;----------------------------------------- - opts_xy@cnMissingValPerimOn = True - opts_xy@cnMissingValFillColor = "red" - opts_xy@cnMissingValFillPattern = 8 - -; Tickmarks/labels resources -;------------------------------ - opts_xy@lbOrientation = "Vertical" - - opts_xy@tmXTOn = False - opts_xy@tmYROn = False - opts_xy@tmXBMode = "Explicit" - opts_xy@tmXBValues = fspan(0,xspan,nx) ; Create tick marks - opts_xy@tmXBLabels = sprintf("%.2f",fspan(xmin,xmax,nx)) ; Create labels - opts_xy@tmXBLabelFontHeightF = 0.015 - opts_xy@tmYLMode = "Explicit" - opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks - opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels - opts_xy@tmXBMajorLengthF = 0.02 - opts_xy@tmYLMajorLengthF = 0.02 - opts_xy@tmYLLabelFontHeightF = 0.015 - - -; Plotting options for U -;-------------------------- - opts_um = opts_xy - opts_um@cnFillOn = True - -; Plotting options for Temperature -;-------------------------- - opts_th = opts_xy - opts_th@cnInfoLabelZone = 1 - opts_th@cnInfoLabelSide = "Top" - opts_th@cnInfoLabelPerimOn = True - opts_th@cnInfoLabelOrthogonalPosF = -0.00005 - - opts_th@gsnLeftStringParallelPosF = 0.1 - opts_th@gsnLeftStringOrthogonalPosF = 0.01 - -;====================== -; MAKE PLOTS -;====================== - -; Horizontal plot with topography -;----------------------------------------------------------------------- - plot=gsn_csm_contour_map(wks,ZS,resmap) - -; Draw line that shows the position of the cross section -;----------------------------------------------------------------------- - lat_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - lon_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - - lnres = True - lnres@gsLineThicknessF = 3.0 - lnres@gsLineColor = "Red" - do ii = 0,dimsX(0)-2 - gsn_polyline(wks,plot,(/lon_plane(ii),lon_plane(ii+1)/),(/lat_plane(ii),lat_plane(ii+1)/),lnres) - end do - frame(wks) - delete(lon_plane) - delete(lat_plane) - -; Vertical cross-section -;-------------------------- - opts_th@gsnFrame = False - opts_th@gsnDraw = False - - - - opts_um@gsnFrame = False - opts_um@gsnDraw = False - - contour_th = gsn_csm_contour(wks,th_plane(0:zmax_pos,:),opts_th) - contour_um = gsn_csm_contour(wks,um_plane(0:zmax_pos,:),opts_um) - - overlay(contour_um,contour_th) ; plot x-section - draw(contour_um) - frame(wks) - - -; Delete options and fields, so we don't have carry over -;------------------------------------------------------- - delete(opts_xy) - delete(opts_th) - delete(opts_um) - delete(th_plane) - delete(um_plane) - delete(X_plane) - -end do ; make next cross section - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_ModelLevels2.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_ModelLevels2.ncl deleted file mode 100644 index cf09ccd0be1b12c2c3d799a826ee3ffefef7de0c..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_ModelLevels2.ncl +++ /dev/null @@ -1,257 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "MESONHtools.ncl" - -;=============================================================; -; Example of script to plot field on model levels from MESONH -; netcdf file generated with lfi2cdf -;=============================================================; - -begin - -;=================================================; -; Open file -;=================================================; -; The MESONH input file. -; ---------------------- - mnh_file="REUNI.1.00A20.004.cdf" - a = addfile(mnh_file,"r") - -;==================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf or x11 (for debugging) -;==================================================; - type = "x11" - wks = gsn_open_wks(type,"plt_ModelLevels2") - gsn_define_colormap(wks,"rainbow+gray") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - mdims = getfilevardimsizes(a,"THT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - kmax=mdims(nd-3)-2 - -;=================================================; -; Read the variables we need -;=================================================; - th = a->THT(1:kmax,1:jmax,1:imax) ; theta - th@long_name="Potential Temperature" - th@units = "K" - - qv = a->RVT(1:kmax,1:jmax,1:imax) ; Qv - qv = qv*1000. - qv@long_name="Water vapor mixing ratio" - qv@units = "g/kg" - - um = a->UT(1:kmax,1:jmax,1:imax+1) ; u - um@long_name="U" - um@units="m/s" - - vm = a->VT(1:kmax,1:jmax+1,1:imax) ; v - vm@long_name="V" - vm@units="m/s" - - ; Unstagger U -; -------------------- - um!0="Z" - um!1="Y" - um!2="X" - u = wrf_user_unstagger(um,"X") - - ; Unstagger V -; -------------------- - vm!0="Z" - vm!1="Y" - vm!2="X" - v = wrf_user_unstagger(vm,"Y") - v@description="V" - -; Calculate wind speed -; -------------------- - spd = (u*u + v*v)^(0.5) ; speed in m/sec - spd@long_name = "Wind Speed" - spd@units = "m/s" - -;=================================================; -; Use MESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; -; Define lat and lon before calling procedure MESONH_map_c -; It is also important to define correctly the units -;----------------------------------------------------------; - lat2d = new((/jmax,imax/),"double") - lat2d@units="degrees_north" - lat2d=0. - lon2d = new((/jmax,imax/),"double") - lon2d@units="degrees_east" - lon2d=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Call MESONH_map_c to define automatically map projection parameters -; And return lat2d, lon2d and cormap (corners) variables -;-----------------------------------------------------------------; - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Set some other basic resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; highres map data version - resmap@mpFillOn = False - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - - -;=========================================================; -; Loop over levels by step of 20 -;=========================================================; - do level =0,kmax-1,20 ; LOOP OVER LEVELS - - display_level = level + 1 - resmap@tiMainString = "Model Level " + display_level - -;======================= -; Resources for Theta -;======================= - opts = resmap - - opts@gsnFrame = False - opts@gsnDraw = False - opts@gsnContourLineThicknessesScale = 2.0 - - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = -0.05 - opts@cnInfoLabelParallelPosF = 0.97 - - contour = gsn_csm_contour_map(wks,th(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;====================== -; Resources for Qv -;====================== - opts = resmap - -; General resources -;------------------- - opts@gsnFrame = False - opts@gsnDraw = False - opts@gsnSpreadColors = True - opts@gsnSpreadColorStart = 30 - opts@gsnSpreadColorEnd = -2 - -; Contour resources -;------------------- - opts@cnLinesOn = False ; no line - opts@cnFillOn = True ; filled - - contour = gsn_csm_contour_map(wks,qv(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;=============================================== -; Overlay Wind Vectors and Speed over basic map -;=============================================== - -;======================= -; 1.Create Base map plot -;======================= - resmap@gsnDraw = False ; don't draw yet - resmap@gsnFrame = False ; don't advance frame yet - - map=gsn_map(wks,"Stereographic",resmap) - -;======================= -; 2.Create Wind speed plot -;======================= - opts_ws = True - -; General resources -;------------------- - opts_ws@gsnFrame = False - opts_ws@gsnDraw = False - opts_ws@gsnSpreadColors = True - opts_ws@gsnSpreadColorStart = 30 - opts_ws@gsnSpreadColorEnd = -2 - -; Tickmark resources -;--------------------- -; No tickmark and label on axis for this plot -; They are already drawn by the basic map plot -; ------------------------------------------- - opts_ws@tmXBOn = False - opts_ws@tmYROn = False - opts_ws@tmXBLabelsOn = False - opts_ws@tmYRLabelsOn = False - - opts_ws@lbOrientation = "Vertical" - - -; Transformation resources -;--------------------------- -; Field is already on the right projection -;------------------------------------------ - opts_ws@tfDoNDCOverlay = True - -; Contour resources -; ------------------- - opts_ws@cnFillOn = True - opts_ws@cnLinesOn = False - -; PLOT -;----- - contour = gsn_csm_contour(wks,spd(level,:,:),opts_ws) - -;=========================== -; 3.Create Wind vector plot -;=========================== - opts_vec = True - - opts_vec@gsnFrame = False - opts_vec@gsnDraw = False - opts_vec@gsnLeftString = "Wind Vector" - opts_vec@gsnLeftStringParallelPosF = 0.3 - opts_vec@gsnLeftStringOrthogonalPosF = 0.018 - -; No Tickmarks/labels -;------------- - opts_vec@tmXBOn = False - opts_vec@tmYROn = False - opts_vec@tmXBLabelsOn = False - opts_vec@tmYRLabelsOn = False - - opts_vec@tfDoNDCOverlay = True - -; Vector resources -;------------------- - opts_vec@vcRefLengthF = 0.1 - opts_vec@vcRefMagnitudeF = 20 - opts_vec@vcMinDistanceF = 0.05 - - -; PLOT -;----- - vector = gsn_csm_vector(wks,u(level,:,:),v(level,:,:),opts_vec) - -;=================== -; 4.Overlay and draw -;=================== - overlay(map,contour) - overlay(map,vector) - - draw(map) - frame(wks) - - end do ; END OF LEVEL LOOP - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_PressureLevel2.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_PressureLevel2.ncl deleted file mode 100644 index ba6f30ad6d35628b3190543fa4afa69e8e2edc7b..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/mnh_PressureLevel2.ncl +++ /dev/null @@ -1,236 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -;=================================================; -; Example of script to interpolate from model to pressure level -; and to plot some fields from MESONH netcdf file generated with lfi2cdf -;=================================================; - -begin - -;=======================================================; -; Pressure levels that we want the data interpolated to -;=======================================================; - pressure_levels = (/ 850., 700., 500., 300./) - nlevels = dimsizes(pressure_levels) ; number of pressure levels - -;=================================================; -; Open file -; MESONH netcdf input file generated with lfi2cdf -;=================================================; - - mnh_file="REUNI.1.00A20.004.cdf" - a = addfile(mnh_file, "r") - -;=================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf and x11 (for debugging) -;==================================================; - - type = "x11" - wks = gsn_open_wks(type,"plt_PressureLevel2") - gsn_define_colormap(wks,"spread_15lev") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - mdims = getfilevardimsizes(a,"UT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - kmax=mdims(nd-3)-2 - -;=================================================; -; Read the variables we need -;=================================================; - - tk = a->THT(1:kmax,1:jmax,1:imax) ; potential temperature - tk@description="Potential Temperature" - - u = a->UT(1:kmax,1:jmax,1:imax+1) ; u - v = a->VT(1:kmax,1:jmax+1,1:imax) ; v - -; Unstagger u,v - u!0="Z" - u!1="Y" - u!2="X" - u_unst = wrf_user_unstagger(u,"X") - - v!0="Z" - v!1="Y" - v!2="X" - v_unst = wrf_user_unstagger(v,"Y") - - p = a->PABST(1:kmax,1:jmax,1:imax) ; pressure - p@description="Pressure" - - rv = a->RVT(1:kmax,1:jmax,1:imax)*1000 ; water vapor mixing ratio - rv@description="Water vapor mixing ratio" - - zs = a->ZS(1:jmax,1:imax) ; terrain - zh = a->ZHAT(1:kmax+1) ; heigth without terrain - -;========================================== -; Create 3D Z to be used for interpolation -;========================================== - - z=new(dimsizes(tk),double) - z@description="Height" - -; Unstag zh -;---------- - nzh=new(kmax,double) - do k=0,kmax-1 - nzh(k)=(zh(k)+zh(k+1))/2. - end do - zcoef=1.-zs/nzh(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - z(:,j,i) = nzh*zcoef(j,i)+zs(j,i) - end do - end do - -;=================================================; -; Horizontal interpolation on pressure levels -;=================================================; - - - do level = 0,nlevels-1 ; LOOP OVER LEVELS - - pressure = pressure_levels(level) - - tk_plane = wrf_user_intrp3d(tk,p,"h",pressure,0.,False) - z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) - u_plane = wrf_user_intrp3d( u_unst,p,"h",pressure,0.,False) - v_plane = wrf_user_intrp3d( v_unst,p,"h",pressure,0.,False) - rv_plane = wrf_user_intrp3d( rv,p,"h",pressure,0.,False) - - spd_plane = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec - spd_plane@description = "Wind Speed" - spd_plane@units = "m/s" - - u_plane@units = "m/s" - v_plane@units = "m/s" - -;================================== -; Create plots usinf wrf functions -;================================== - res=True - res@MainTitle = "MESONH" - res@Footer = False - -; Plotting options for Tk -;-------------------------- - opts = res - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 2.0 - - contour_tk = wrf_contour(a,wks,tk_plane,opts) - delete(opts) - -; Plotting options for RV -;-------------------------- - opts = res - opts@cnFillOn = True - opts@pmLabelBarOrthogonalPosF = -0.1 - opts@cnMissingValFillColor = "Red" - opts@cnMissingValFillPattern = 8 - - contour_rv = wrf_contour(a,wks,rv_plane,opts) - delete(opts) - -; Plotting options for Wind Speed -;-------------------------- - opts = res - opts@cnLineColor = "MediumSeaGreen" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 3.0 - - contour_spd = wrf_contour(a,wks,spd_plane,opts) - delete(opts) - - -; Plotting options for Wind Vectors -;----------------------------------- - opts = res - opts@FieldTitle = "Wind" ; overwrite Field Title - opts@NumVectors = 47 ; wind barb density - - vector = wrf_vector(a,wks,u_plane,v_plane,opts) - delete(opts) - -; Plotting options for Geopotential Heigh -;----------------------------------------- - opts_z = res - opts_z@cnLineColor = "Blue" - opts_z@gsnContourLineThicknessesScale = 2.0 - -;============= -; MAKE PLOTS -;============= - - pltres = True - -; Resources for map -;------------------- - resmap = True - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - resmap@mpGeophysicalLineThicknessF = 2.0 - resmap@mpGridLineThicknessF = 2.0 - resmap@mpLimbLineThicknessF = 2.0 - resmap@mpNationalLineThicknessF = 2.0 - resmap@mpGridAndLimbOn = False ; turn off lat/lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data - - -; Overlay rv , tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 850 ) then ; plot temp, rv, height, wind barbs - - contour_height = wrf_contour(a,wks,z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_rv,contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 700 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 500 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay wind speed , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 300 ) then ; plot windspeed, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_spd,contour_height, \ - vector/),pltres,resmap) - end if - - delete(opts_z) - -end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/run_ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/run_ncl deleted file mode 100755 index 5fd22cf3b1afccbfa394a944179561dd47f401ee..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_lfi2cdf/run_ncl +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -#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 -#### Get highres coastline data for ncl -./get_ncl_highres_files -#### MNH file to convert in netcdf -ln -sf ../003_mesonh/REUNI.1.00A20.004.lfi . -#### Conversion to netcdf using lfi2cdf -lfi2cdf REUNI.1.00A20.004 -#### Initilizing variables for ncl -path_ncl=`which ncl` -if [ "$path_ncl" == "" ] -then -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "! ERROR: NCL is not installed or the path to !" -echo "! ncl binary is not set correctly !" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -exit -fi -export NCARG_ROOT=${path_ncl%%/bin/ncl} -export PATH=$NCARG_ROOT/bin:$PATH -export NCARG_RANGS=. -#### Running ncl scripts -ncl mnh_BasicMap2.ncl -ncl mnh_ModelLevels2.ncl -ncl mnh_Cloud2.ncl -ncl mnh_CrossSection2.ncl -ncl mnh_PressureLevel2.ncl diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/MESONHtools.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/MESONHtools.ncl deleted file mode 100644 index 182df6d79d89e02ef068049311ec842988701b43..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/MESONHtools.ncl +++ /dev/null @@ -1,916 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" - -;------------------------------------------------------------- -;contains: -; procedure MESONH_map_c -;function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) -;function mnh_map_overlays(in_file[1]:file,wks:graphic,plots[*]:graphic, \ -; opt_arg[1]:logical,opt_mp[1]:logical) -;function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;------------------------------------------------------------- - -;============================================================== -; J.-P. CHABOUREAU -; This is a driver that selects the appropriate -; mapping function based upon the file variables RPK, BETA, LATOR, LONOR -; -; -; Sample usage: -; a = addfile("...", r") -; IMAX = a->IMAX -; JMAX = a->JMAX -; lat2d = new((/JMAX,IMAX/),"double") -; lat2d(:,:)=0. -; lon2d = new((/JMAX,IMAX/),"double") -; lon2d(:,:)=0. -; icorners = new((/2,2/),"integer") -; icorners(:,:)=0 -; res = True -; MESONH_map_c (a, res, lat2d, lon2d, icorners) -; -; -undef("MESONH_map_c") -;============================================================== -procedure MESONH_map_c (in_file:file, res:logical, plat, plon, icorner) -;============================================================== -;local rank, dimll, nlat, mlon, lat, lon -local rank, dimll, nlat, mlon -begin - -; Check if the variable RPK is in the file -; ---------------------------------------- -if(isfilevar(in_file,"RPK")) then - -; Read projection parameters -; ------------------------- - ZRPK = in_file->RPK - ZLATOR = in_file->LATOR - ZLONOR = in_file->LONOR - ZBETA = in_file->BETA - ZLAT0 = in_file->LAT0 - ZLON0 = in_file->LON0 - -; Case netcdf from lfi2cdf -; ------------------------- - - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - jphext = in_file->JPHEXT - IMAX= dimsizes(XHAT)-2*JPHEXT - JMAX= dimsizes(YHAT)-2*JPHEXT - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - -; unstagger - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - - else - -; Case netcdf from extractdia -; --------------------------- - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - - end if - - print ("LATOR="+ZLATOR+" - LONOR="+ZLONOR) - print ("ZLAT0="+ZLAT0+" - ZLON0="+ZLON0) - print ("ZDX="+zdx+" - RPK="+ZRPK+" - BETA="+ZBETA) - print ("IMAX="+IMAX+" - JMAX="+JMAX) - - if (ZRPK.gt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = 90. - end if - - if (ZRPK.lt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = -90. - end if - - if (ZRPK.eq.0) then - ; Mercator projection -; --------------------------- - res@mpProjection = "Mercator" - end if - - print("Map projection="+res@mpProjection) - -else - print ("MESONH_map_c: Error no RPK variable in input file") -end if - -;=================================================; -; calculate 2D lat and lon -; based on src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - -; Constants -; ----------- - if(isfilevar(in_file,"IMAX")) - XRADIUS=6371229.0d ; Earth radius (meters) - else - XRADIUS=6371.2290d ; Earth radius (km) - end if - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - -;=================================================; - if (ZRPK.eq.0) then -; MERCATOR -;=================================================; - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - plon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - plat(jj,ji)=zlat - end do - end do - -;=================================================; - else -; STEREOGRAPHIC PROJECTION -;=================================================; - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - plon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - plat(jj,ji)=zlat - end do - end do - - end if - -; Defining the corners of the domain -;==================================== - if (icorner(0,0).eq.icorner(1,1)) then - icorner(0,0)=0 - icorner(1,0)=JMAX-1 - icorner(0,1)=0 - icorner(1,1)=IMAX-1 - end if -; print ("icorner"+icorner) - - res@mpLimitMode = "Corners" - res@mpLeftCornerLatF = plat(icorner(0,0),icorner(0,1)) - res@mpLeftCornerLonF = plon(icorner(0,0),icorner(0,1)) - res@mpRightCornerLatF = plat(icorner(1,0),icorner(1,1)) - res@mpRightCornerLonF = plon(icorner(1,0),icorner(1,1)) - -; print ("Corner (0,0); Lat="+res@mpLeftCornerLatF+ \ -; ", Lon="+res@mpLeftCornerLonF) -; print ("Oppos corner; Lat="+res@mpRightCornerLatF+ \ -; ", Lon= "+res@mpRightCornerLonF) - -;========================================== -; Turn on lat / lon labeling -;========================================== - res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - res@mpOutlineBoundarySets = "AllBoundaries" ; state boundaries - res@mpPerimDrawOrder = "PostDraw" ; force map perim -;========================================== -; Needed for regional native projection -;========================================== - res@tfDoNDCOverlay = True - res@gsnAddCyclic = False ; regional data - -end - -;=========================================== -;------------------------------------------------------------------------ -undef("MESONH_pinter") -function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;************************************************************************* -; S. BIELLI -; This is a routine that interpolate fields on pressure level for plotting -; based on pinter.f90 -; The field to be interpolated must be given at the mass point (grid 1) -; usage : var_inter=MESONHfunction(var_to_interpol, 850., AbsPressure) -; Abs pressure must be in Pa -; - -begin - - dimL= dimsizes(loc_param) - -; First test for grid = 0 - - dimp=dimsizes(ppabs) - - pout=pfield(0:dimL-1,:,:) - pfield@_FillValue=999 - pout@_FillValue=999 - pout=pout@_FillValue - - do jkp = 0, dimL-1 - zref=log10(loc_param(jkp)*100.) - do jloop = 0, dimp(1)-1 - do iloop = 0, dimp(2)-1 - kloop=0 - flag=True - do while (flag .and. (kloop.lt.(dimp(2)-2))) - if (.not.ismissing(ppabs(kloop,jloop,iloop))) then - zxm=log10(ppabs(kloop,jloop,iloop)) - zxp=log10(ppabs(kloop+1,jloop,iloop)) - if ((zxp-zref)*(zref-zxm) .ge. 0) then - pout(jkp,jloop,iloop)= (pfield(kloop,jloop,iloop)*(zxp-zref)+ \ - pfield(kloop+1,jloop,iloop)*(zref-zxm))/ (zxp-zxm) - flag=False - end if - end if - kloop=kloop+1 - end do - end do - end do - end do - - return(pout) - -end - -;-------------------------------------------------------------------------------- -undef("mnh_map") -function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) - -begin -; -; This function creates a map plot, and bases the projection on -; the MAP_PROJ attribute in the given file. -; -; 1. Make a copy of the resource list, and set some resources -; common to all map projections. -; -; 2. Determine the projection being used, and set resources based -; on that projection. -; -; 3. Create the map plot, and draw and advance the frame -; (if requested). - - opts = opt_args ; Make a copy of the resource list - opts = True - -; Set some resources depending on what kind of map projection is -; chosen. -; -; ZRPK != 0 : "Stereographic" -; ZRPK = 0 : "Mercator" -;=================================================; -; src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - XRADIUS=6371229.0d ; Earth radius (meters) - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - - if(isfilevar(in_file,"RPK")) - ZRPK=in_file->RPK - ZLON0=in_file->LON0 - ZLAT0=in_file->LAT0 - ZLATOR=in_file->LATOR - ZLONOR=in_file->LONOR - ZBETA=in_file->BETA - else - print ("mnh_map: Error no RPK variable in input file") - return(new(1,graphic)) - end if - -; Case netcdf from lfi2cdf - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - else -; Case netcdf from extractdia - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - end if -; - - lat = new((/JMAX,IMAX/),"double") - lon = new((/JMAX,IMAX/),"double") - - -; Stereographic projection - if(ZRPK .gt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", 90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - - if(ZRPK .lt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", -90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - -; Mercator projection - if(ZRPK .eq. 0) - projection = "Mercator" - end if - - opts@mpNestTime = get_res_value_keep(opts, "mpNestTime",0) - - -; LAT and LON are not saved in the file - if (ZRPK.eq.0) then - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - lon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - lat(jj,ji)=zlat - end do - end do - else - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - lon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - lat(jj,ji)=zlat - end do - end do - end if - - dims = dimsizes(lat) - - do ii = 0, dims(0)-1 - do jj = 0, dims(1)-1 - if ( lon(ii,jj) .lt. 0.0) then - lon(ii,jj) = lon(ii,jj) + 360. - end if - end do - end do - - opts@start_lat = lat(0,0) - opts@start_lon = lon(0,0) - opts@end_lat = lat(dims(0)-1,dims(1)-1) - opts@end_lon = lon(dims(0)-1,dims(1)-1) - - -; Set some resources common to all map projections. - opts = set_mp_resources(opts) - - if ( isatt(opts,"ZoomIn") .and. opts@ZoomIn ) then - y1 = 0 - x1 = 0 - y2 = dims(0)-1 - x2 = dims(1)-1 - if ( isatt(opts,"Ystart") ) then - y1 = opts@Ystart - delete(opts@Ystart) - end if - if ( isatt(opts,"Xstart") ) then - x1 = opts@Xstart - delete(opts@Xstart) - end if - if ( isatt(opts,"Yend") ) then - if ( opts@Yend .le. y2 ) then - y2 = opts@Yend - end if - delete(opts@Yend) - end if - if ( isatt(opts,"Xend") ) then - if ( opts@Xend .le. x2 ) then - x2 = opts@Xend - end if - delete(opts@Xend) - end if - - opts@mpLeftCornerLatF = lat(y1,x1) - opts@mpLeftCornerLonF = lon(y1,x1) - opts@mpRightCornerLatF = lat(y2,x2) - opts@mpRightCornerLonF = lon(y2,x2) - - if ( opts@mpRightCornerLonF .lt. 0.0 ) then - opts@mpRightCornerLonF = opts@mpRightCornerLonF + 360.0 - end if - - delete(opts@ZoomIn) - end if - - -; The default is not to draw the plot or advance the frame, and -; to maximize the plot in the frame. - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", False) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", False) - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - delete_attrs(opts) ; Clean up. - mp = gsn_map(wks,projection,opts) ; Create map plot. - - return(mp) ; Return. - -end - -;-------------------------------------------------------------------------------- - -undef("mnh_map_overlays") -function mnh_map_overlays(in_file[1]:file, \ - wks:graphic, \ - plots[*]:graphic, \ - opt_arg[1]:logical, \ - opt_mp[1]:logical) - -; Based on wrf_map_overlays -; -; This procedure takes an array of plots and overlays them on a -; base plot - map background. -; -; It will advance the plot and cleanup, unless you set the -; PanelPlot resource to True. -; -; Attributes recognized by this procedure: -; FramePlot -; PanelPlot -; NoTitles (don't do any titles) -; CommonTitle & PlotTile is used to overwrite field titles -; CommonTitle will super-seed NoTitles -; -; If FramePlot False, then Draw the plot but do not Frame. -; In this case a user want to add to the drawing, and will -; have to advance the Frame manually in the script. -; -; If the "NoTitles" attribute exists and is set True, then -; don't create the top-left titles, and leave the main titles alone. -; This resource can be useful if you are planning to panel -; the plots. -; -; If PanelPlot is set to True, then this flags to wrf_map_overlays -; that these plots are going to be eventually paneled (likely -; by gsn_panel), and hence 1) draw and frame should not be called -; (unless gsnDraw and/or gsnFrame are explicitly set to True), -; and 2) the overlays and titles should not be removed with -; NhlRemoveOverlay and NhlRemoveAnnotation. -; -begin - - opts = opt_arg ; Make a copy of the resource lists - opt_mp_2 = opt_mp - - ; Let's make the map first - base = mnh_map(wks,in_file,opt_mp_2) - - no_titles = get_res_value(opts,"NoTitles",False) ; Do we want field titles? - com_title = get_res_value(opts,"CommonTitle",False) ; Do we have a common title? - if ( com_title ) then - plot_title = get_res_value(opts,"PlotTitle"," ") - no_titles = True - end if - - call_draw = True - call_frame = get_res_value(opts,"FramePlot",True) ; Do we want to frame the plot? - panel_plot = get_res_value(opts,"PanelPlot",False) ; Are we paneling? - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - nplots = dimsizes(plots) -; font_color = "Black" - - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then -; class_name = NhlClassName(plots(i)) -; print(class_name) -; if(class_name.eq."contourPlotClass") then -; getvalues plots(i) -; "cnFillOn" : fill_on -; "cnLineColor" : line_color -; end getvalues -; if (.not.fill_on) then -; font_color = line_color -; end if -; end if - if(.not.no_titles) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - if(i.eq.0) then - SubTitles = SubTitle - else - SubTitles = SubTitles + "~C~" + SubTitle - end if - end if - if(com_title .and. i .eq. nplots-1) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - SubTitles = plot_title - end if - setvalues plots(i) - "tfDoNDCOverlay" : True - "tiMainOn" : False - end setvalues - overlay(base,plots(i)) - else - print("mnh_map_overlays: Warning: overlay plot #" + i + " is not valid.") - end if - end do - - if(.not.no_titles .or. com_title) then - font_height = get_res_value_keep(opts,"FontHeightF",0.01) - txt = create "map_titles" textItemClass wks - "txString" : SubTitles - "txFontHeightF" : font_height - ;"txFontColor" : font_color - end create - anno = NhlAddAnnotation(base,txt) - setvalues anno - "amZone" : 3 - "amJust" : "BottomLeft" - "amSide" : "Top" - "amParallelPosF" : 0.005 - "amOrthogonalPosF" : 0.03 - "amResizeNotify" : False - end setvalues - base@map_titles = anno - end if -; -; gsnDraw and gsnFrame default to False if panel plot. -; - if(panel_plot) then - call_draw = False - call_frame= False - end if - - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", call_draw) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", call_frame) - - draw_and_frame(wks,base,opts@gsnDraw,opts@gsnFrame,False, \ - opts@gsnMaximize) - - if(.not.panel_plot) then - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then - NhlRemoveOverlay(base,plots(i),False) - else - print("wrf_remove_map_overlays: Warning: overlay plot #" + i + " is not valid.") - print(" Nothing to remove.") - end if - end do - end if - - if(.not.no_titles.and..not.panel_plot) then - if(isatt(base,"map_titles")) then - NhlRemoveAnnotation(base,base@map_titles) - delete(base@map_titles) - end if - end if - -return(base) -end - -;-------------------------------------------------------------------------------- -undef("wrf_user_intrp3d") -function wrf_user_intrp3d( var3d:numeric, z_in:numeric, \ - plot_type:string, \ - loc_param:numeric, angle:numeric, opts:logical ) - -; var3d - 3d field to interpolate (all input fields must be unstaggered) -; z_in - interpolate to this field (either p/z) -; plot_type - interpolate horizontally "h", or vertically "v" -; loc_param - level(s) for horizontal plots (eg. 500hPa ; 3000m - scalar), -; plane for vertical plots (2 values representing an xy point -; on the model domain through which the vertical plane will pass -; OR 4 values specifying start and end values -; angle - 0.0 for horizontal plots, and -; an angle for vertical plots - 90 represent a WE cross section -; opts Used IF opts is TRUE, else use loc_param and angle to determine crosssection - -begin - - - if(plot_type .eq. "h" ) then ; horizontal cross section needed - - dimL = dimsizes(loc_param) - - dims = dimsizes(var3d) - nd = dimsizes(dims) - - dimX = dims(nd-1) - dimY = dims(nd-2) - dimZ = dims(nd-3) - dim4 = 1 - dim5 = 1 - if ( nd .eq. 4 ) then - dim4 = dims(nd-4) - end if - if ( nd .eq. 5 ) then - dim4 = dims(nd-4) - dim5 = dims(nd-5) - end if - - var3 = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - z = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - var2d = new ( (/ dim5, dim4, dimL, dimY, dimX /) , typeof(var3d) ) - - if ( nd .eq. 5 ) then - var3 = var3d - z = z_in - end if - if ( nd .eq. 4 ) then - var3(0,:,:,:,:) = var3d(:,:,:,:) - z(0,:,:,:,:) = z_in(:,:,:,:) - end if - if ( nd .eq. 3 ) then - var3(0,0,:,:,:) = var3d(:,:,:) - z(0,0,:,:,:) = z_in(:,:,:) - end if - - - if ( z(0,0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z(0,0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z = z * 0.01 - end if - if ( loc_param(0) .gt. 2000. ) then - ; looks like the input was specified in Pa - change this - loc_param = loc_param * 0.01 - end if - end if - - do il = 0,dimL-1 - var = wrf_interp_3d_z(var3,z,loc_param(il)) - var2d(:,:,il,:,:) = var(:,:,:,:) - end do - - copy_VarAtts(var3d,var3) - if(isatt(var3,"description")) then - delete_VarAtts(var3,(/"description"/)) - end if - if(isatt(var3,"units")) then - delete_VarAtts(var3,(/"units"/)) - end if - if(isatt(var3,"MemoryOrder")) then - delete_VarAtts(var3,(/"MemoryOrder"/)) - end if - if(isatt(var3,"_FillValue")) then - delete_VarAtts(var3,(/"_FillValue"/)) - end if - copy_VarAtts(var3,var2d) - - nn = nd-2 - var2d!nn = "plevs" - - if ( dimL .gt. 1 ) then - if ( nd .eq. 5 ) then - return( var2d ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,:,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,:,:,:) ) - end if - else - if ( z(0,0,0,0,0) .gt. 500.) then - var2d@PlotLevelID = loc_param + " hPa" - else - var2d@PlotLevelID = .001*loc_param + " km" - end if - if ( nd .eq. 5 ) then - return( var2d(:,:,0,:,:) ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,0,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,0,:,:) ) - end if - end if - - - end if - - - - - if(plot_type .eq. "v" ) then ; vertical cross section needed - - dims = dimsizes(var3d) - if ( dimsizes(dims) .eq. 4 ) then - if ( z_in(0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in(0,:,:,:) - else - if ( z_in(0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in - end if - -; set vertical cross section - if (opts) then - xy = wrf_user_set_xy( z, loc_param(0)-1, loc_param(1)-1, \ ; the -1 is for NCL dimensions - loc_param(2)-1, loc_param(3)-1, \ - angle, opts ) - else - xy = wrf_user_set_xy( z, loc_param(0), loc_param(1), \ - 0.0, 0.0, angle, opts ) - end if - xp = dimsizes(xy) - - -; first we interp z - var2dz = wrf_interp_2d_xy( z, xy) - -; interp to constant z grid - if(var2dz(0,0) .gt. var2dz(1,0) ) then ; monotonically decreasing coordinate - z_max = floor(max(z)/10)*10 ; bottom value - z_min = ceil(min(z)/10)*10 ; top value - dz = 1. - nlevels = tointeger( (z_max-z_min)/dz) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_max - dz = -dz - else - z_max = max(z) - z_min = 0. -;; MODI SOLINE -; dz = 0.01 * z_max - dz = 0.001 * z_max - nlevels = tointeger( z_max/dz ) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_min - end if -; print("nlevels="+nlevels) -; print("dz="+dz) - - do i=1, nlevels-1 - z_var2d(i) = z_var2d(0)+i*dz - end do - - -; interp the variable - if ( dimsizes(dims) .eq. 4 ) then - var2d = new( (/dims(0), nlevels, xp(0)/), typeof(var2dz)) - do it = 0,dims(0)-1 - var2dtmp = wrf_interp_2d_xy( var3d(it,:,:,:), xy) - do i=0,xp(0)-1 - var2d(it,:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - end do - var2d!0 = var3d!0 - var2d!1 = "Vertical" - var2d!2 = "Horizontal" - else - var2d = new( (/nlevels, xp(0)/), typeof(var2dz)) - var2dtmp = wrf_interp_2d_xy( var3d, xy) - do i=0,xp(0)-1 - var2d(:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - var2d!0 = "Vertical" - var2d!1 = "Horizontal" - end if - - - st_x = tointeger(xy(0,0)) + 1 - st_y = tointeger(xy(0,1)) + 1 - ed_x = tointeger(xy(xp(0)-1,0)) + 1 - ed_y = tointeger(xy(xp(0)-1,1)) + 1 - if (opts) then - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ")" - else - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ") ; center=(" + \ - loc_param(0) + "," + loc_param(1) + \ - ") ; angle=" + angle - end if - - return(var2d) -end if - - -end - diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/clean_ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/clean_ncl deleted file mode 100755 index c40e649d92c62a6c76e7acaabe7b995d1b77937f..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/clean_ncl +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "!!!! WARNING :: CLEAN_RANGS_FILES !!!!" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo -echo do you real want to delete high resolution -echo -echo coastline files for ncl ????? -echo -echo "(yes/no)" -read ANSWER -set -x -if [ "X$ANSWER" = "Xyes" ] -then -rm -fr ran* gs* -fi -rm -f *.lfi *.nc diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/get_ncl_highres_files b/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/get_ncl_highres_files deleted file mode 100755 index 3b0e44937a9a0273c09a5f90f355d5601cb0011d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/get_ncl_highres_files +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -NCARG_RANGS=`pwd` -export NCARG_RANGS -echo -[ -f ~/.hluresfile ] || ( wget -c -nd http://www.ncl.ucar.edu/Document/Graphics/hluresfile ; mv hluresfile ~/.hluresfile ) -echo "You will download high resolution coastline files for NCL" -echo "in this directory:" -echo NCL_HIGHRES_FILES=$NCARG_RANGS -echo -set -x -cd $NCARG_RANGS -NCL_HIGHRES_URL="http://www2008.io-warnemuende.de/homepages/rfeistel/download" -export NCL_HIGHRES_URL -for file in rangs\(0\) rangs\(1\) rangs\(2\) \ - rangs\(3\) rangs\(4\) \ - gshhs\(0\) gshhs\(1\) gshhs\(2\) \ - gshhs\(3\) gshhs\(4\) -do -[ -f $file.zip ] || ( wget -c -nd $NCL_HIGHRES_URL/$file.zip ; unzip $file.zip ; ) -done - diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_BasicMap.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_BasicMap.ncl deleted file mode 100644 index 99e3ef4b03b9004e4d8a1d5653322c46c8ce1ba2..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_BasicMap.ncl +++ /dev/null @@ -1,180 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" - -;=============================================================; -; Example of script to plot ZS field from MESONH netcdf4 file -; Could be use with any files generated by MESONH if LCARTESIAN=False -;=============================================================; -begin -;=============================================================; -; Open file -;=============================================================; - - mnh_file="REUNI.1.00A20.004.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Get information on variable sizes -;=================================================; - - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"ZS") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext ; -2*jphext : to remove non-physical values - jmax=mdims(nd-2)-2*jphext ; -2*jphext : to remove non-physical values - -;=================================================; -; Read the variables -;=================================================; - -; Note: do not read first and last value which are non physical values -; ------------------------------------- - - lat2d=a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d=a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - - ZS = a->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) - ZS@long_name="Orography" - ZS@units="m" - -; Associate coordinates to variable -; Necessary to plot the field at the right geographical position -; ------------------------------------- - - ZS@lat2d = lat2d - ZS@lon2d = lon2d - -; Read projection parameters -; ------------------------------------- - - RPK = a->RPK - BETA =a->BETA - LON0= a->LON0 - -;=================================================; -; CREATE PLOT : Orography (ZS, filled contour) -;=================================================; -; Open workstation and define colormap -; ------------------------------------- - - type = "x11" ; open a x11 window - ; change type to png, ps or pdf to get the plot into a file - wks = gsn_open_wks(type,"plt_BasicMap") ; - gsn_define_colormap(wks,"topo_15lev") ; Choose colormap - - -;========================================== -; Map ressources -;========================================== - resmap = True - -; If there is an error on HighRes, it means that you don't have the HighRes data -; You need to download them or the change HighRes by MediumRes -; See https://www.ncl.ucar.edu/Document/Graphics/rangs.shtml for info -; ------------------------------------- - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - - resmap@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - -;=================================================; -; Set map projection ressources using projection parameters -;=================================================; - if (RPK.gt.0) -; --------------------------- - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = 1 ; projection for north hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.lt.0) -; --------------------------- - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = -1 ; projection for south hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.eq.1) -; --------------------------- - ; Stereographic projection north -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90 - end if - - if (RPK.eq.-1) -; --------------------------- - ; Stereographic projection south -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90 - end if - - if (RPK.eq.0) then -; --------------------------- - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -;========================================== -; Defining the corners for projection otherwise the plot will be global -;========================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - - print ("Corner (0,0); Lat="+resmap@mpLeftCornerLatF+ \ - ", Lon="+resmap@mpLeftCornerLonF) - print ("Oppos corner; Lat="+resmap@mpRightCornerLatF+ \ - ", Lon= "+resmap@mpRightCornerLonF) - - -;========================================== -; Create ZS plot (contour) -;========================================== -; --------------------------- -; General ressources -; --------------------------- - resmap@gsnMaximize = True ; maximize size - resmap@gsnSpreadColors = True ; use full range of colormap - -; --------------------------- -; Contour ressources -; --------------------------- - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - resmap@cnLevelSelectionMode = "ManualLevels"; Manually set contour levels. - resmap@cnMinLevelValF = 5. -; resmap@cnMaxLevelValF = 3200. -; resmap@cnLevelSpacingF = 200. - -;=================================================; -; PLOT ZS -;=================================================; - plot_zs = gsn_csm_contour_map(wks,ZS,resmap) - -end - - diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_Cloud.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_Cloud.ncl deleted file mode 100644 index 78661d9de3e233d9a5f2d685b1887c981359e33f..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_Cloud.ncl +++ /dev/null @@ -1,217 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" - -; LCARTESIAN = False - -begin -;=================================================; -; Open file -;=================================================; -; MESONH input file - mnh_file="REUNI.1.00A20.004.nc" - a = addfile(mnh_file, "r") - -;==================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use type= ps or pdf -;==================================================; - - type = "x11" ; could be png, ps , pdf ... - wks = gsn_open_wks(type,"plt_Cloud") - -; Choose the colormap you want -; See http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml -; for all the available color tables - gsn_define_colormap(wks,"WhBlGrYeRe") ; overwrite the .hluresfile color map - -;=================================================; -; Get informations on variable sizes -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"UT") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 -; -2 : to remove non-physical values - -;=================================================; -; Read the variables we will need -;=================================================; - -; Read latitude and longitude fields -; ----------------------------------------- - lat2d = a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lat2d@units="degrees_north" - lon2d = a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d@units="degrees_east" - -; Read water wapor mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RVT")) - qv = a->RVT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - qv = qv*1000. - qv@units = "g/kg" - qv@description="Water vapor mixing ratio" - qv@lat2d=lat2d - qv@lon2d=lon2d - end if - -; Read cloud mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RCT")) - qc = a->RCT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - qc = qc*1000. - qc@units = "g/kg" - qc@description="Cloud mixing ratio" - qc@lat2d=lat2d - qc@lon2d=lon2d - end if - -; Read rain mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RRT")) - qr = a->RRT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - qr = qr*1000. - qr@units = "g/kg" - qr@description="Rain mixing ratio" - qr@lat2d=lat2d - qr@lon2d=lon2d - end if - -; Read ice mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RIT")) - qi = a->RIT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - qi = qi*1000. - qi@units = "g/kg" - qi@description="Ice mixing ratio" - qi@lat2d=lat2d - qi@lon2d=lon2d - end if - -; Read projection parameters -; -------------------- - RPK = a->RPK - BETA = a->BETA - LON0 = a->LON0 - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Set map projection ressources using projection parameters -;-----------------------------------------------; - if (RPK.gt.0) -; --------------------------- - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = 1 ; projection for north hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.lt.0) -; --------------------------- - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = -1 ; projection for south hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.eq.1) -; --------------------------- - ; Stereographic projection north -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90 - end if - - if (RPK.eq.-1) -; --------------------------- - ; Stereographic projection south -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90 - end if - - if (RPK.eq.0) then -; --------------------------- - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -;=================================================; -; Set some other basic resources -;=================================================; - - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpFillOn = False - -; Defining the corners for projection -;==================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - -;=========================================================; -; Loop over levels by step of 5 -;=========================================================; - do level = 0,19,5 - - display_level = level + 1 - -; Contour resources -;-------------------- - opts = resmap - opts@cnFillOn = True - opts@cnLinesOn = False - - opts@tiMainString = "Model Level "+display_level - - -; Plot wapor mixing ratio if it exists -; ----------------------------------------- - if (isvar("qv")) - plot=gsn_csm_contour_map(wks,qv(level,:,:),opts) - end if - -; Plot cloud mixing ratio if it exists -; ----------------------------------------- - if (isvar("qc")) - plot=gsn_csm_contour_map(wks,qc(level,:,:),opts) - end if - -; Plot rain mixing ratio if it exists -; ----------------------------------------- - if (isvar("qr")) - plot=gsn_csm_contour_map(wks,qr(level,:,:),opts) - end if - -; Plot ice mixing ratio if it exists -; ----------------------------------------- - if (isvar("qi")) - plot=gsn_csm_contour_map(wks,qi(level,:,:),opts) - end if - - - end do ; END OF LEVEL LOOP -;=================================================; - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_CrossSection.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_CrossSection.ncl deleted file mode 100644 index cf07dad6d12024226518267a52f2e35ecfec6668..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_CrossSection.ncl +++ /dev/null @@ -1,315 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -begin - -;=================================================; -; Open file -;=================================================; - in_file="REUNI.1.00A20.004.nc" - a = addfile(in_file, "r") - -;=================================================; -; We generate plots, but what kind do we prefer? -; For paper quality plot do not use ncgm or eps -;=================================================; - type = "x11" - - -;=================================================; -; Open the workstation and choose colormap -;=================================================; - wks = gsn_open_wks(type,"plt_CrossSection2") - gsn_define_colormap(wks,"topo_15lev") - -;=================================================; -; Get informations on variable sizes -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"UT") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - -;=================================================; -; Read some variables from mnh_file -;=================================================; - ZS =a->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) - - th = a->THT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - th@long_name="Potential Temperature" - th@description="TH" - - um = a->UT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) - um@description="U" - - zh= a->ZHAT(0:kmax) - - lat2d = a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lat2d@units="degrees_north" - lon2d = a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d@units="degrees_east" - - ZS@lat2d=lat2d - ZS@lon2d=lon2d - - th@lat2d=lat2d - th@lon2d=lon2d - - um@lat2d=lat2d - um@lon2d=lon2d - -;=================================================; -; Take care of the Arakawa C grid -;=================================================; -; Unstagger zh (from grid 4 to 1) -;----------------------------------; - nzh=new(kmax,double) - do k=0,kmax-1 - nzh(k)=(zh(k)+zh(k+1))/2. - end do - -; Unstagger U -;----------------------------------; - um!0="Z" - um!1="Y" - um!2="X" - u_unst = wrf_user_unstagger(um,"X") - -;=================================================; -; Needed for the wrf_intrp3d function -;=================================================; -; Create Z3D -;----------------------------------; - z=new(dimsizes(th),double) - zcoef=1.-ZS/nzh(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - z(:,j,i) = nzh*zcoef(j,i)+ZS(j,i) - end do - end do - -; get height info for labels -;----------------------------------; - zmin = 0. - zmax = 6. ; We are only interested in the first 6km - nz = floattoint(zmax + 1) - - -;----------------------------------------------------------; - -; Resources for the map projection -;-----------------------------------------------; - resmap=True - -;=================================================; -; Define Other Resources for map ploting -;=================================================; - - resmap@gsnFrame = False - resmap@gsnMaximize = True - -; Map resources -;-----------------------------------------------; - resmap@mpFillOn = False - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - -; Defining the corners for projection -;==================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - -; Contour definitions -;-----------------------------------------------; - resmap@cnFillOn = True - resmap@cnLinesOn = False - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,250,500,750,1000,1250,1500,1750,2000,2250,2500,2750,3000/) - resmap@cnLevels = cnLevels - - resmap@lbOrientation = "Vertical" - - - FirstPlot = True - -;=================================================; -; Planes definition and interpolation -;=================================================; - do ip = 1, 3 ; we are doing 3 plots - ; all with the pivot point (plane) in the center of the domain - ; at angles 0, 45 and 90 - ; - ; | - ; angle=0 is | - ; | - ; - -; Define the plane where the cross-section will be done -; ------------------------------------------------------ - plane = new(2,float) - plane = (/ (imax)/2, (jmax)/2 /) ; pivot point is center of domain (x,y) - -; Resource for the interpolation -; -------------------------------- - opts = False - - if(ip .eq. 1) then - angle = 90. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - end if - if(ip .eq. 2) then - angle = 0. - X_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - X_desc = "latitude" - end if - if(ip .eq. 3) then - angle = -45. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - - end if - -; Interpolate fields onto the defined plane -; -------------------------------------------- - um_plane = wrf_user_intrp3d(u_unst,z,"v",plane,angle,opts) - th_plane = wrf_user_intrp3d(th,z,"v",plane,angle,opts) - -; Find the index where 6km is - only need to do this once -; -------------------------------------------- - if ( FirstPlot ) then - zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts) - b = ind(zz(:,0) .gt. zmax*1000. ) - zmax_pos = b(0) - 1 - if ( abs(zz(zmax_pos,0)-zmax*1000.) .lt. abs(zz(zmax_pos+1,0)-zmax*1000.) ) then - zspan = b(0) - 1 - else - zspan = b(0) - end if - delete(zz) - delete(b) - FirstPlot = False - end if - -; Define X-axis labels -;---------------------- - dimsX = dimsizes(X_plane) - xmin = X_plane(0) - xmax = X_plane(dimsX(0)-1) - xspan = dimsX(0)-1 - nx = 3 - -; Options for XY Plots -;----------------------------------------- - opts_xy = True - opts_xy@tiXAxisString = X_desc - opts_xy@tiYAxisString = "Height (km)" - opts_xy@tiXAxisFontHeightF = 0.020 - opts_xy@tiYAxisFontHeightF = 0.020 - -; Resources to plot the topography (missing values in fields) -;----------------------------------------- - opts_xy@cnMissingValPerimOn = True - opts_xy@cnMissingValFillColor = "red" - opts_xy@cnMissingValFillPattern = 8 - -; Tickmarks/labels resources -;------------------------------ - opts_xy@lbOrientation = "Vertical" - - opts_xy@tmXTOn = False - opts_xy@tmYROn = False - opts_xy@tmXBMode = "Explicit" - opts_xy@tmXBValues = fspan(0,xspan,nx) ; Create tick marks - opts_xy@tmXBLabels = sprintf("%.2f",fspan(xmin,xmax,nx)) ; Create labels - opts_xy@tmXBLabelFontHeightF = 0.015 - opts_xy@tmYLMode = "Explicit" - opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks - opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels - opts_xy@tmXBMajorLengthF = 0.02 - opts_xy@tmYLMajorLengthF = 0.02 - opts_xy@tmYLLabelFontHeightF = 0.015 - - -; Plotting options for U -;-------------------------- - opts_um = opts_xy - opts_um@cnFillOn = True - -; Plotting options for Temperature -;-------------------------- - opts_th = opts_xy - opts_th@cnInfoLabelZone = 1 - opts_th@cnInfoLabelSide = "Top" - opts_th@cnInfoLabelPerimOn = True - opts_th@cnInfoLabelOrthogonalPosF = -0.00005 - - opts_th@gsnLeftStringParallelPosF = 0.1 - opts_th@gsnLeftStringOrthogonalPosF = 0.01 - -;====================== -; MAKE PLOTS -;====================== - -; Horizontal plot with topography -;----------------------------------------------------------------------- - plot=gsn_csm_contour_map(wks,ZS,resmap) - -; Draw line that shows the position of the cross section -;----------------------------------------------------------------------- - lat_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - lon_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - - lnres = True - lnres@gsLineThicknessF = 3.0 - lnres@gsLineColor = "Red" - do ii = 0,dimsX(0)-2 - gsn_polyline(wks,plot,(/lon_plane(ii),lon_plane(ii+1)/),(/lat_plane(ii),lat_plane(ii+1)/),lnres) - end do - frame(wks) - delete(lon_plane) - delete(lat_plane) - -; Vertical cross-section -;-------------------------- - opts_th@gsnFrame = False - opts_th@gsnDraw = False - - - - opts_um@gsnFrame = False - opts_um@gsnDraw = False - - contour_th = gsn_csm_contour(wks,th_plane(0:zmax_pos,:),opts_th) - contour_um = gsn_csm_contour(wks,um_plane(0:zmax_pos,:),opts_um) - - overlay(contour_um,contour_th) ; plot x-section - draw(contour_um) - frame(wks) - - -; Delete options and fields, so we don't have carry over -;------------------------------------------------------- - delete(opts_xy) - delete(opts_th) - delete(opts_um) - delete(th_plane) - delete(um_plane) - delete(X_plane) - -end do ; make next cross section - - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_ModelLevels.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_ModelLevels.ncl deleted file mode 100644 index b3bbd2f436058a82f57e0821a4f75c1fba888a4e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_ModelLevels.ncl +++ /dev/null @@ -1,323 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -;=============================================================; -; Example of script to plot field on model levels from MESONH -; netcdf file generated with lfi2cdf -;=============================================================; - -begin - -;=================================================; -; Open file -;=================================================; -; The MESONH input file. -; ---------------------- - mnh_file="REUNI.1.00A20.004.nc" - a = addfile(mnh_file,"r") - -;==================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf or x11 (for debugging) -;==================================================; - type = "x11" - wks = gsn_open_wks(type,"plt_ModelLevels") - gsn_define_colormap(wks,"rainbow+gray") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"THT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - -;=================================================; -; Read the variables we need -;=================================================; - lat2d = a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lat2d@units="degrees_north" - lon2d = a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d@units="degrees_east" - - th = a->THT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; theta - th@long_name="Potential Temperature" - th@units = "K" - th@lat2d=lat2d - th@lon2d=lon2d - - qv = a->RVT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; Qv - qv = qv*1000. - qv@long_name="Water vapor mixing ratio" - qv@units = "g/kg" - qv@lat2d=lat2d - qv@lon2d=lon2d - - ut = a->UT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; u - ut@long_name="U" - ut@units="m/s" - ut@lat2d=lat2d - ut@lon2d=lon2d - - vt = a->VT(1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; v - vt@long_name="V" - vt@units="m/s" - vt@lat2d=lat2d - vt@lon2d=lon2d - - ; Unstagger U -; -------------------- - ut!0="Z" - ut!1="Y" - ut!2="X" - u = wrf_user_unstagger(ut,"X") - - ; Unstagger V -; -------------------- - vt!0="Z" - vt!1="Y" - vt!2="X" - v = wrf_user_unstagger(vt,"Y") - v@description="V" - -; Calculate wind speed -; -------------------- - spd = (u*u + v*v)^(0.5) ; speed in m/sec - spd@long_name = "Wind Speed" - spd@units = "m/s" - spd@lat2d = lat2d - spd@lon2d = lon2d - -; Read projection parameters -; -------------------- - RPK = a->RPK - BETA = a->BETA - LON0 = a->LON0 - - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Set map projection ressources using projection parameters -;-----------------------------------------------; - if (RPK.gt.0) -; --------------------------- - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = 1 ; projection for north hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.lt.0) -; --------------------------- - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = -1 ; projection for south hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.eq.1) -; --------------------------- - ; Stereographic projection north -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90 - end if - - if (RPK.eq.-1) -; --------------------------- - ; Stereographic projection south -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90 - end if - - if (RPK.eq.0) then -; --------------------------- - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -; Defining the corners for projection -; -------------------------------- - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - -;=================================================; -; Set some other basic resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; highres map data version - resmap@mpFillOn = False - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - - resmap@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - -;=========================================================; -; Loop over levels by step of 20 -;=========================================================; - do level =0,kmax-1,20 ; LOOP OVER LEVELS - - display_level = level + 1 - resmap@tiMainString = "Model Level " + display_level - -;======================= -; Resources for Theta -;======================= - opts = resmap - - opts@gsnFrame = False - opts@gsnDraw = False - opts@gsnContourLineThicknessesScale = 2.0 - - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = -0.05 - opts@cnInfoLabelParallelPosF = 0.97 - - contour = gsn_csm_contour_map(wks,th(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;====================== -; Resources for Qv -;====================== - opts = resmap - -; General resources -;------------------- - opts@gsnFrame = False - opts@gsnDraw = False - opts@gsnSpreadColors = True - opts@gsnSpreadColorStart = 30 - opts@gsnSpreadColorEnd = -2 - -; Contour resources -;------------------- - opts@cnLinesOn = False ; no line - opts@cnFillOn = True ; filled - - contour = gsn_csm_contour_map(wks,qv(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;=============================================== -; Overlay Wind Vectors and Speed over basic map -;=============================================== - -;======================= -; 1.Create Base map plot -;======================= - resmap@gsnDraw = False ; don't draw yet - resmap@gsnFrame = False ; don't advance frame yet - - map=gsn_map(wks,"Stereographic",resmap) - -;======================= -; 2.Create Wind speed plot -;======================= - opts_ws = True - -; General resources -;------------------- - opts_ws@gsnFrame = False - opts_ws@gsnDraw = False - opts_ws@gsnSpreadColors = True - opts_ws@gsnSpreadColorStart = 30 - opts_ws@gsnSpreadColorEnd = -2 - -; Tickmark resources -;--------------------- -; No tickmark and label on axis for this plot -; They are already drawn by the basic map plot -; ------------------------------------------- -; opts_ws@tmXBOn = False -; opts_ws@tmYROn = False -; opts_ws@tmXBLabelsOn = False -; opts_ws@tmYRLabelsOn = False - - opts_ws@lbOrientation = "Vertical" - - -; Transformation resources -;--------------------------- -; Field is already on the right projection -;------------------------------------------ -; opts_ws@tfDoNDCOverlay = True - -; Contour resources -; ------------------- - opts_ws@cnFillOn = True - opts_ws@cnLinesOn = False - -; PLOT -;----- - contour = gsn_csm_contour(wks,spd(level,:,:),opts_ws) - -;=========================== -; 3.Create Wind vector plot -;=========================== - opts_vec = True - - opts_vec@gsnFrame = False - opts_vec@gsnDraw = False - opts_vec@gsnLeftString = "Wind Vector" - opts_vec@gsnLeftStringParallelPosF = 0.3 - opts_vec@gsnLeftStringOrthogonalPosF = 0.018 - -; No Tickmarks/labels -;------------- -; opts_vec@tmXBOn = False -; opts_vec@tmYROn = False -; opts_vec@tmXBLabelsOn = False -; opts_vec@tmYRLabelsOn = False - -; opts_vec@tfDoNDCOverlay = True - -; Vector resources -;------------------- - opts_vec@vcRefLengthF = 0.1 - opts_vec@vcRefMagnitudeF = 20 - opts_vec@vcMinDistanceF = 0.05 - - -; PLOT -;----- - vector = gsn_csm_vector(wks,u(level,:,:),v(level,:,:),opts_vec) - -;=================== -; 4.Overlay and draw -;=================== - overlay(map,contour) - overlay(map,vector) - - draw(map) - frame(wks) - - end do ; END OF LEVEL LOOP - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_PressureLevel.ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_PressureLevel.ncl deleted file mode 100644 index 86f6672ef2f59a1dc27b05582abefaf0b2796bf7..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/mnh_PressureLevel.ncl +++ /dev/null @@ -1,249 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -;=================================================; -; Example of script to interpolate from model to pressure level -; and to plot some fields from MESONH netcdf4 files -;=================================================; - -begin - -;=======================================================; -; Pressure levels that we want the data interpolated to -;=======================================================; - pressure_levels = (/ 850., 700., 500., 300./) - nlevels = dimsizes(pressure_levels) ; number of pressure levels - -;=================================================; -; Open file -; MESONH netcdf4 input file -;=================================================; - - mnh_file="REUNI.1.00A20.004.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf and x11 (for debugging) -;==================================================; - - type = "x11" - wks = gsn_open_wks(type,"plt_PressureLevel") - gsn_define_colormap(wks,"spread_15lev") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - print("Reading dims") - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"UT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - - -;=================================================; -; Read the variables we need -;=================================================; - - print("Reading THT") - tk = a->THT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; potential temperature - tk@description="Potential Temperature" - - print("Reading wind") - u = a->UT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; u - v = a->VT(1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; v - -; Unstagger u,v - u!0="Z" - u!1="Y" - u!2="X" - u_unst = wrf_user_unstagger(u,"X") - - v!0="Z" - v!1="Y" - v!2="X" - v_unst = wrf_user_unstagger(v,"Y") - - print("Reading pressure") - p = a->PABST(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; pressure - p@description="Pressure" - - print("Reading water vapor mixing ratio") - rv = a->RVT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; water vapor mixing ratio - rv = rv*1000. ; water vapor mixing ratio - rv@description="Water vapor mixing ratio" - - print("Reading orography") - zs = a->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) ; terrain - zh = a->ZHAT(1:kmax+1) ; heigth without terrain - - print("End of variables reading") - -;========================================== -; Create 3D Z to be used for interpolation -;========================================== - - z=new(dimsizes(tk),double) - z@description="Height" - -; Unstag zh -;---------- - nzh=new(kmax,double) - do k=0,kmax-1 - nzh(k)=(zh(k)+zh(k+1))/2. - end do - zcoef=1.-zs/nzh(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - z(:,j,i) = nzh*zcoef(j,i)+zs(j,i) - end do - end do - -;=================================================; -; Horizontal interpolation on pressure levels -;=================================================; - - - do level = 0,nlevels-1 ; LOOP OVER LEVELS - - pressure = pressure_levels(level) - - tk_plane = wrf_user_intrp3d(tk,p,"h",pressure,0.,False) - z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) - u_plane = wrf_user_intrp3d( u_unst,p,"h",pressure,0.,False) - v_plane = wrf_user_intrp3d( v_unst,p,"h",pressure,0.,False) - rv_plane = wrf_user_intrp3d( rv,p,"h",pressure,0.,False) - - spd_plane = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec - spd_plane@description = "Wind Speed" - spd_plane@units = "m/s" - - u_plane@units = "m/s" - v_plane@units = "m/s" - -;================================== -; Create plots usinf wrf functions -;================================== - res=True - res@MainTitle = "MESONH" - res@Footer = False - -; Plotting options for Tk -;-------------------------- - opts = res - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 2.0 - - contour_tk = wrf_contour(a,wks,tk_plane,opts) - delete(opts) - -; Plotting options for RV -;-------------------------- - opts = res - opts@cnFillOn = True - opts@pmLabelBarOrthogonalPosF = -0.1 - opts@cnMissingValFillColor = "Red" - opts@cnMissingValFillPattern = 8 - - contour_rv = wrf_contour(a,wks,rv_plane,opts) - delete(opts) - -; Plotting options for Wind Speed -;-------------------------- - opts = res - opts@cnLineColor = "MediumSeaGreen" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 3.0 - - contour_spd = wrf_contour(a,wks,spd_plane,opts) - delete(opts) - - -; Plotting options for Wind Vectors -;----------------------------------- - opts = res - opts@FieldTitle = "Wind" ; overwrite Field Title - opts@NumVectors = 47 ; wind barb density - - vector = wrf_vector(a,wks,u_plane,v_plane,opts) - delete(opts) - -; Plotting options for Geopotential Heigh -;----------------------------------------- - opts_z = res - opts_z@cnLineColor = "Blue" - opts_z@gsnContourLineThicknessesScale = 2.0 - -;============= -; MAKE PLOTS -;============= - - pltres = True - -; Resources for map -;------------------- - resmap = True - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - resmap@mpGeophysicalLineThicknessF = 2.0 - resmap@mpGridLineThicknessF = 2.0 - resmap@mpLimbLineThicknessF = 2.0 - resmap@mpNationalLineThicknessF = 2.0 - resmap@mpGridAndLimbOn = False ; turn off lat/lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data - - -; Overlay rv , tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 850 ) then ; plot temp, rv, height, wind barbs - - contour_height = wrf_contour(a,wks,z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_rv,contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 700 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 500 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay wind speed , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 300 ) then ; plot windspeed, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_spd,contour_height, \ - vector/),pltres,resmap) - end if - - delete(opts_z) - -end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/run_ncl b/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/run_ncl deleted file mode 100755 index 2916f43936c6c7f2b55c9c5325cc61b8b3fc8a57..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_ncl_nc4/run_ncl +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -set -x -#### Get highres coastline data for ncl -# If you don't have internet connexion, comment the next line -# And change in the ncl script HighRes by MediumRes -./get_ncl_highres_files -#### nc file to plot -ln -sf ../003_mesonh/REUNI.1.00A20.004.nc . -#### Initilizing variables for ncl -path_ncl=`which ncl` -if [ "$path_ncl" == "" ] -then -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "! ERROR: NCL is not installed or the path to !" -echo "! ncl binary is not set correctly !" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -exit -fi -export NCARG_ROOT=${path_ncl%%/bin/ncl} -export PATH=$NCARG_ROOT/bin:$PATH -export NCARG_RANGS=. -#### Running ncl scripts -ncl mnh_BasicMap.ncl -ncl mnh_ModelLevels.ncl -ncl mnh_Cloud.ncl -ncl mnh_CrossSection.ncl -ncl mnh_PressureLevel.ncl diff --git a/MY_RUN/KTEST/004_Reunion/007_python/clean_python b/MY_RUN/KTEST/004_Reunion/005_python/clean_python similarity index 100% rename from MY_RUN/KTEST/004_Reunion/007_python/clean_python rename to MY_RUN/KTEST/004_Reunion/005_python/clean_python diff --git a/MY_RUN/KTEST/004_Reunion/007_python/plot_004_Reunion.py b/MY_RUN/KTEST/004_Reunion/005_python/plot_004_Reunion.py similarity index 100% rename from MY_RUN/KTEST/004_Reunion/007_python/plot_004_Reunion.py rename to MY_RUN/KTEST/004_Reunion/005_python/plot_004_Reunion.py diff --git a/MY_RUN/KTEST/004_Reunion/007_python/run_python b/MY_RUN/KTEST/004_Reunion/005_python/run_python similarity index 100% rename from MY_RUN/KTEST/004_Reunion/007_python/run_python rename to MY_RUN/KTEST/004_Reunion/005_python/run_python diff --git a/MY_RUN/KTEST/004_Reunion/006_ncl/clean_ncl b/MY_RUN/KTEST/004_Reunion/006_ncl/clean_ncl deleted file mode 100755 index bbfe25caaa31a2e1aae687110d888e9805b34569..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/006_ncl/clean_ncl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/004_Reunion/006_ncl/plot_Reunion.ncl b/MY_RUN/KTEST/004_Reunion/006_ncl/plot_Reunion.ncl deleted file mode 100644 index f13d0b901dfa169c109a999f0d0beb14e2cc1e49..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/006_ncl/plot_Reunion.ncl +++ /dev/null @@ -1,342 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; - begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("REUNI.1.00A20.004.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_Reunion") -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = fichier1->JPHEXT - mdims = getfilevardimsizes(fichier1,"UT") - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - - -;=================================================; -; Set map projection -;=================================================; - lat2d=fichier1->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d=fichier1->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - -; Resources for the map projection -;-----------------------------------------------; - resmap=True -;-----------------------------------------------; -; Get global attributes to set map projection -;-----------------------------------------------; - RPK = fichier1->RPK ; ZS - LON0 = fichier1->LON0 - BETA = fichier1->BETA - if (RPK.gt.0) - ; Lambert projection from north pole - ; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - resmap@mpLambertParallel1F = 42 ; to be adjusted !! - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; Parallel1 = PArallel2 - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.lt.0) - ; Lambert projection from south pole - ; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - resmap@mpLambertParallel1F = -42 ; to be adjusted !! - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.eq.1) - ; Stereographic projection - ; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90. - end if - - if (RPK.eq.-1) - ; Stereographic projection - ; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90. - end if - - if (RPK.eq.0) then - ; Mercator projection - ; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -;==================================== -; Defining the corners for projection -;==================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - -;=================================================; -; lecture des différents champs -;=================================================; - zs = fichier1->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) ; ZS - zs@lat2d = lat2d - zs@lon2d = lon2d - - vtype = typeof(zs) - - wt= fichier1->WT(0,1:kmax+1,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; WT - vt= fichier1->VT(0,1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1); VT - ut= fichier1->UT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; UT - tht= fichier1->THT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; THT - tht@long_name="Potential Temperature" - tht@units="K" - tht@lat2d = lat2d - tht@lon2d = lon2d - - lsthm= fichier1->LSTHM(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ;LSTHM - lsthm@long_name="Large SCale Potential Temperature" - lsthm@units="K" - lsthm@lat2d = lat2d - lsthm@lon2d = lon2d - - lsvm= fichier1->LSVM(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; LSVM - lsvm@long_name="Large SCale Merdian Wind" - lsvm@units="m/s" - lsvm@lat2d = lat2d - lsvm@lon2d = lon2d - - pabst= fichier1->PABST(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; PABST - pabst@long_name="Pressure" - pabst@units="Pa" - pabst@lat2d = lat2d - pabst@lon2d = lon2d - - -;=================================================; -; 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" - - ut1@lat2d = lat2d - ut1@lon2d = lon2d - vt1@lat2d = lat2d - vt1@lon2d = lon2d - wt1@lat2d = lat2d - wt1@lon2d = lon2d -;=================================================; -; On calcule l'altitude des champs modèle -;=================================================; - - zhat= fichier1->ZHAT(1:kmax+1) - -; Unstagger zhat (from grid 4 to 1) - nzhat=new(kmax,vtype) - do k=0,kmax-1 - nzhat(k)=(zhat(k)+zhat(k+1))/2. - end do - -; Create Z3D == ALT - alt=new(dimsizes(tht),vtype) - zcoef=1.-zs/nzhat(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - alt(:,j,i) = nzhat*zcoef(j,i)+zs(j,i) - end do - end do - -;=================================================; -; 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 - resmap@lbLabelStride = 3. - resmap@tmXBLabelStride = 3 - -; If there is an error on HighRes, it means that you don't have the HighRes data -; You need to download them or the change HighRes by MediumRes -; See https://www.ncl.ucar.edu/Document/Graphics/rangs.shtml for info -; ------------------------------------- - resmap@mpDataBaseVersion = "MediumRes" ; choose highres map data version (must be donwloaded) - - gsn_define_colormap(wks,"rainbow") - -;=================================================; -; TRACE -;=================================================; - -; module du vent + vecteur vent pour k=2 - -; calcul module du vent - mod_utvt=sqrt(ut1(1,:,:)*ut1(1,:,:)+vt1(1,:,:)*vt1(1,:,:)) - - mod_utvt@long_name="Module of horizontal wind" - mod_utvt@lat2d = lat2d - mod_utvt@lon2d = lon2d - mod_utvt@units="m/s" - -; options de tracé - res2=resmap - res2@cnLevelSelectionMode = "ManualLevels" - res2@cnLevelSpacingF =0.5 - res2@cnMinLevelValF = 11 - res2@cnMaxLevelValF = 26 - res2@gsnScalarContour=True - res2@vcMinDistanceF = 0.04 - res2@vcRefLengthF=0.1 - res2@mpFillOn = False ; turn off map fill -; res2@mpOutlineDrawOrder = "PostDraw" ; draw continental outline last - - print("plot1") - plot=gsn_csm_vector_scalar_map(wks,ut1(1,:,:),vt1(1,:,:),mod_utvt(:,:),res2) - draw(plot) - frame(wks) - -; temperature potentielle a 1500m - tht_1500m = wrf_user_intrp3d(tht,alt,"h",1500,0.,False) - res3=resmap - res3@cnLevelSelectionMode = "ManualLevels" - res3@cnLevelSpacingF =0.1 - res3@cnMinLevelValF = 302.4 - res3@cnMaxLevelValF = 304 - - print("plot2") - plot_tht = gsn_csm_contour_map(wks,tht_1500m,res3) - draw(plot_tht) - frame(wks) - - -; pression +vent 1500m - pabst_1500m = wrf_user_intrp3d(pabst,alt,"h",1500,0.,False) - ut_1500m = wrf_user_intrp3d(ut1,alt,"h",1500,0.,False) - vt_1500m = wrf_user_intrp3d(vt1,alt,"h",1500,0.,False) - - res4=resmap - res4@cnLevelSelectionMode = "ManualLevels" - res4@cnLevelSpacingF=10 - res4@cnMinLevelValF= 83800 - res4@cnMaxLevelValF= 84030 - res4@gsnScalarContour=True - res4@vcMinDistanceF = 0.04 - res4@vcRefLengthF=0.1 - res4@mpFillOn= False - res4@mpOutlineDrawOrder= "PostDraw" - res4@vcMinDistanceF = 0.03 - res4@vcRefLengthF=0.03 - - print("plot3") - plot_pabst=gsn_csm_vector_scalar_map(wks,ut_1500m,vt_1500m,pabst_1500m,res4) - draw(plot_pabst) - frame(wks) - -;=================================================; -; Definition du plan de la coupe verticale -;=================================================; - opts=False - plane = new(2,float) - plane =(/33,0/) - angle=0 - X_plane=wrf_user_intrp2d(lat2d,plane,angle,opts) - X_desc="latitude" - -;=================================================; -; Coupe verticale de THT -;=================================================; -; inteprolation du champ sur la coupe verticale - tht_plane=wrf_user_intrp3d(tht,alt,"v",plane,angle,opts) - lsthm_plane=wrf_user_intrp3d(lsthm,alt,"v",plane,angle,opts) - vt_plane=wrf_user_intrp3d(vt1,alt,"v",plane,angle,opts) - wt_plane=wrf_user_intrp3d(wt1,alt,"v",plane,angle,opts) - lsvm_plane=wrf_user_intrp3d(lsvm,alt,"v",plane,angle,opts) - - ;opts_cv=resmap - opts_cv = True - opts_cv@cnLinesOn = False - opts_cv@cnFillOn = True - opts_cv@gsnSpreadColors = True - opts_cv@gsnFrame = False - opts_cv@gsnDraw = False - opts_cv@lbLabelStride = 5. - - opts_cv@tiXAxisString = X_desc - opts_cv@tiYAxisString = "Height (km)" - opts_cv@tiXAxisFontHeightF = 0.020 - opts_cv@tiYAxisFontHeightF = 0.020 - opts_cv@cnMissingValPerimOn = True - opts_cv@cnMissingValFillColor = "gray" - opts_cv@cnMissingValFillPattern = 17 - - opts_cv@cnLevelSelectionMode = "ManualLevels" - opts_cv@cnLevelSpacingF =2.5 - opts_cv@cnMinLevelValF = 300 - opts_cv@cnMaxLevelValF = 355 - opts_cv@tiMainString="THT" - cv_tht = gsn_csm_contour(wks,tht_plane(:,:),opts_cv) - draw(cv_tht) - frame(wks) - - opts_cv@cnLevelSelectionMode = "ManualLevels" - opts_cv@cnLevelSpacingF =0.1 - opts_cv@cnMinLevelValF = -1 - opts_cv@cnMaxLevelValF = 1 - opts_cv@tiMainString="THT-LSTHM" - print("plot4") - cv_tht_lsthm = gsn_csm_contour(wks,tht_plane(:,:)-lsthm_plane(:,:),opts_cv) - draw(cv_tht_lsthm) - frame(wks) - - opts_cv@cnLevelSelectionMode = "ManualLevels" - opts_cv@cnLevelSpacingF =0.5 - opts_cv@cnMinLevelValF = -5 - opts_cv@cnMaxLevelValF = 6 - opts_cv@tiMainString="VT-LSVM" - print("plot5") - cv_vt = gsn_csm_contour(wks,vt_plane(:,:)-lsvm_plane(:,:),opts_cv) - draw(cv_vt) - frame(wks) - - opts_cv@cnLevelSelectionMode = "ManualLevels" - opts_cv@cnLevelSpacingF =0.5 - opts_cv@cnMinLevelValF = -6 - opts_cv@cnMaxLevelValF = 9 - opts_cv@tiMainString="WT" - cv_wt = gsn_csm_contour(wks,wt_plane(:,:),opts_cv) - draw(cv_wt) - frame(wks) - -end diff --git a/MY_RUN/KTEST/004_Reunion/006_ncl/run_ncl b/MY_RUN/KTEST/004_Reunion/006_ncl/run_ncl deleted file mode 100755 index 4fc11d993821eeaaa02d0f78d0eaab29bc450176..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/006_ncl/run_ncl +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -#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 - -ln -sf ../003_mesonh/REUNI.1.00A20.004.nc . - -rm -f visu_Reunion.*.png - -ncl plot_Reunion.ncl -${POSTRUN} display visu_Reunion.000001.png -${POSTRUN} display visu_Reunion.000002.png -${POSTRUN} display visu_Reunion.000003.png -${POSTRUN} display visu_Reunion.000004.png -${POSTRUN} display visu_Reunion.000005.png -${POSTRUN} display visu_Reunion.000006.png -${POSTRUN} display visu_Reunion.000007.png -exit 0 diff --git a/MY_RUN/KTEST/004_Reunion/Makefile b/MY_RUN/KTEST/004_Reunion/Makefile index 694409947ef64635be86920b347b3df7e27b81a0..8c3ed4d35ac4b91a2498863eb447c2d42fa153b2 100644 --- a/MY_RUN/KTEST/004_Reunion/Makefile +++ b/MY_RUN/KTEST/004_Reunion/Makefile @@ -4,46 +4,19 @@ all: cd 002_prep_ideal_case && run_prep_ideal_case_xyz cd 003_mesonh && run_mesonh_xyz cd 004_diag && run_diag_xyz - cd 006_ncl && run_ncl ifneq "$(MNH_PYTHON)" "NO" - cd 007_python && run_python + cd 005_python && run_python endif -all_ncl_lfi2cdf: - cd 001_prep_pgd && get_pgd_files - cd 001_prep_pgd && run_prep_pgd_xyz - cd 002_prep_ideal_case && run_prep_ideal_case_xyz - cd 003_mesonh && run_mesonh_xyz - cd 005_ncl_lfi2cdf && run_ncl - -all_ncl_extractdia: - cd 001_prep_pgd && get_pgd_files - cd 001_prep_pgd && run_prep_pgd_xyz - cd 002_prep_ideal_case && run_prep_ideal_case_xyz - cd 003_mesonh && run_mesonh_xyz - cd 005_ncl_extractdia && run_ncl - -all_ncl_nc4: - cd 001_prep_pgd && get_pgd_files - cd 001_prep_pgd && run_prep_pgd_xyz - cd 002_prep_ideal_case && run_prep_ideal_case_xyz - cd 003_mesonh && run_mesonh_xyz - cd 005_ncl_nc4 && run_ncl - cd 006_ncl && run_ncl - clean: cd 001_prep_pgd && clean_get_pgd_files cd 001_prep_pgd && clean_prep_pgd_xyz cd 002_prep_ideal_case && clean_prep_ideal_case_xyz cd 003_mesonh && clean_mesonh_xyz cd 004_diag && clean_diag_xyz - cd 005_ncl_lfi2cdf && clean_ncl - cd 005_ncl_extractdia && clean_ncl - cd 005_ncl_nc4 && clean_ncl - cd 006_ncl && clean_ncl ifneq "$(MNH_PYTHON)" "NO" - cd 007_python && clean_python + cd 005_python && clean_python endif python: - cd 007_python && run_python + cd 005_python && run_python diff --git a/MY_RUN/KTEST/005_ARM/004_ncl/clean_ncl b/MY_RUN/KTEST/005_ARM/004_ncl/clean_ncl deleted file mode 100755 index 12eeedc8e2098dd3b9af358058400b0dc719d700..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/005_ARM/004_ncl/clean_ncl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -rm -f ARM__.1.CEN4T.000* *.png diff --git a/MY_RUN/KTEST/005_ARM/004_ncl/plot_arm.ncl b/MY_RUN/KTEST/005_ARM/004_ncl/plot_arm.ncl deleted file mode 100644 index db891ad2bf53fe8e109ed891a3869417a180d428..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/005_ARM/004_ncl/plot_arm.ncl +++ /dev/null @@ -1,513 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; -begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("ARM__.1.CEN4T.000.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_ARM") -;=================================================; -; lecture des différents champs -;=================================================; -kmax=100 -zhat = fichier1->ZHAT(:) ; ZHAT -; Unstagger zhat (from grid 4 to 1) - nzh=new(kmax,double) - do k=0,kmax-2 - nzh(k)=(zhat(k)+zhat(k+1))/2. - end do - nzh(kmax-1)=2*zhat(kmax-1)-zhat(kmax-2) -TIME=new((/180/),double) -TIME(0)=300 -do j=1,179 - TIME(j)=TIME(j-1)+300 -end do - -group_LES_budgets_SBG = fichier1=>LES_budgets/Subgrid/Cartesian/Not_time_averaged/Not_normalized/cart -group_LES_budgets_MEAN = fichier1=>LES_budgets/Mean/Cartesian/Not_time_averaged/Not_normalized/cart - -vname="SBG_TKE" -SBGTKE = group_LES_budgets_SBG->$vname$(:,:) -SBGTKE@long_name="SBG_TKE" -SBGTKE!1="nzh" -SBGTKE!0="TIME" -SBG_TKE=transpose(SBGTKE) - -vname="MEAN_TH" -MEANTH = group_LES_budgets_MEAN->$vname$(:,:) ; MEAN_TH -MEANTH@long_name="MEAN_TH" -MEANTH@units="K" -MEANTH!1="nzh" -MEANTH!0="TIME" -MEAN_TH=transpose(MEANTH) - -vname="MEAN_U" -MEANU = group_LES_budgets_MEAN->$vname$(:,:) -MEANU!1="nzh" -MEANU!0="TIME" -MEAN_U=transpose(MEANU) -MEAN_U@long_name="MEAN_U" - -vname="MEAN_V" -MEANV = group_LES_budgets_MEAN->$vname$(:,:) -MEANV!1="nzh" -MEANV!0="TIME" -MEAN_V=transpose(MEANV) -MEAN_V@long_name="MEAN_V" - -vname="MEAN_RC" -MEANRC = group_LES_budgets_MEAN->$vname$(:,:) -MEANRC!1="nzh" -MEANRC!0="TIME" -MEAN_RC=transpose(MEANRC) -MEAN_RC@long_name="MEAN_RC" - -vname="MEAN_RR" -MEANRR = group_LES_budgets_MEAN->$vname$(:,:) -MEANRR!1="nzh" -MEANRR!0="TIME" -MEAN_RR=transpose(MEANRR) -MEAN_RR@long_name="MEAN_RR" - -vname="SBG_WTHL" -SBGWTHL = group_LES_budgets_SBG->$vname$(:,:) -SBGWTHL!1="nzh" -SBGWTHL!0="TIME" -SBG_WTHL=transpose(SBGWTHL) -SBG_WTHL@long_name="SBG_WTHL" - -vname="SBG_WRT" -SBGWRT = group_LES_budgets_SBG->$vname$(:,:) -SBGWRT!1="nzh" -SBGWRT!0="TIME" -SBG_WRT=transpose(SBGWRT) -SBG_WRT@long_name="SBG_WRT" - - -vname="THLUP_MF" - THLUPMF= group_LES_budgets_SBG->$vname$(:,:) -THLUPMF!1="nzh" -THLUPMF!0="TIME" -THLUP_MF=transpose(THLUPMF) -THLUP_MF@long_name="THLUP_MF" - -vname="RTUP_MF" -RTUPMF = group_LES_budgets_SBG->$vname$(:,:) -RTUPMF!1="nzh" -RTUPMF!0="TIME" -RTUP_MF=transpose(RTUPMF) -RTUP_MF@long_name="RTUP_MF" - -vname="RVUP_MF" -RVUPMF = group_LES_budgets_SBG->$vname$(:,:) -RVUPMF!1="nzh" -RVUPMF!0="TIME" -RVUP_MF=transpose(RVUPMF) -RVUP_MF@long_name="RVUP_MF" - -vname="RCUP_MF" -RCUPMF = group_LES_budgets_SBG->$vname$(:,:) -RCUPMF!1="nzh" -RCUPMF!0="TIME" -RCUP_MF=transpose(RCUPMF) -RCUP_MF@long_name="RCUP_MF" - -vname="RIUP_MF" -RIUPMF = group_LES_budgets_SBG->$vname$(:,:) -RIUPMF!1="nzh" -RIUPMF!0="TIME" -RIUP_MF=transpose(RIUPMF) -RIUP_MF@long_name="RIUP_MF" - -vname="WUP_MF" -WUPMF = group_LES_budgets_SBG->$vname$(:,:) -WUPMF!1="nzh" -WUPMF!0="TIME" -WUP_MF=transpose(WUPMF) -WUP_MF@long_name="WUP_MF" - -vname="MAFLX_MF" -MAFLXMF = group_LES_budgets_SBG->$vname$(:,:) -MAFLXMF!1="nzh" -MAFLXMF!0="TIME" -MAFLX_MF=transpose(MAFLXMF) -MAFLX_MF@long_name="MAFLX_MF" - -vname="DETR_MF" -DETRMF = group_LES_budgets_SBG->$vname$(:,:) -DETRMF!1="nzh" -DETRMF!0="TIME" -DETR_MF=transpose(DETRMF) -DETR_MF@long_name="DETR_MF" - -vname="ENTR_MF" -ENTRMF = group_LES_budgets_SBG->$vname$(:,:) -ENTRMF!1="nzh" -ENTRMF!0="TIME" -ENTR_MF=transpose(ENTRMF) -ENTR_MF@long_name="ENTR_MF" - -vname="FRCUP_MF" -FRCUPMF = group_LES_budgets_SBG->$vname$(:,:) -FRCUPMF!1="nzh" -FRCUPMF!0="TIME" -FRCUP_MF=transpose(FRCUPMF) -FRCUP_MF@long_name="FRCUP_MF" - -vname="THVUP_MF" -THVUPMF = group_LES_budgets_SBG->$vname$(:,:) -THVUPMF!1="nzh" -THVUPMF!0="TIME" -THVUP_MF=transpose(THVUPMF) -THVUP_MF@long_name="THVUP_MF" - -vname="WTHL_MF" -WTHLMF = group_LES_budgets_SBG->$vname$(:,:) -WTHLMF!1="nzh" -WTHLMF!0="TIME" -WTHL_MF=transpose(WTHLMF) -WTHL_MF@long_name="WTHL_MF" - -vname="WRT_MF" -WRTMF = group_LES_budgets_SBG->$vname$(:,:) -WRTMF!1="nzh" -WRTMF!0="TIME" -WRT_MF=transpose(WRTMF) -WRT_MF@long_name="WRT_MF" - - -vname="WTHV_MF" -WTHVMF = group_LES_budgets_SBG->$vname$(:,:) -WTHVMF!1="nzh" -WTHVMF!0="TIME" -WTHV_MF=transpose(WTHVMF) -WTHV_MF@long_name="WTHV_MF" - - -vname="WU_MF" -WUMF = group_LES_budgets_SBG->$vname$(:,:) -WUMF!1="nzh" -WUMF!0="TIME" -WU_MF=transpose(WUMF) -WU_MF@long_name="WU_MF" - - -vname="WV_MF" -WVMF = group_LES_budgets_SBG->$vname$(:,:) -WVMF!1="nzh" -WVMF!0="TIME" -WV_MF=transpose(WVMF) -WV_MF@long_name="WV_MF" - -;=================================================; -; Altitude des niveaux modèles -;=================================================; -; Unstagger zhat (from grid 4 to 1) - nzh=new(kmax,double) - do k=0,kmax-2 - nzh(k)=(zhat(k)+zhat(k+1))/2. - end do - nzh(kmax-1)=2*zhat(kmax-1)-zhat(kmax-2) -;=================================================; -; Set some other basic resources -;=================================================; - resmap = True - resmap@gsnFrame = False - resmap@gsnDraw = False - resmap@gsnMaximize = True - resmap@gsnPaperOrientation = "portrait" - resmap@gsnSpreadColors = True ; use full range of colormap - resmap@tiYAxisString =" " - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - ;resmap@tmXBLabelStride = 2 ; to reduce the number of labels on xaxis - ;resmap@lbLabelStride = 2. ; to reduce the number of labels on labelbar - resmap@sfYArray = nzh(0:76) - resmap@sfXArray = TIME - resmap@tmXBTickSpacingF = 10800. - resmap@tmXBMode = "Explicit" - resmap@tmXBValues = (/10800,21600,32400,43200,54000/) - resmap@tmXBLabels =(/3,6,9,12,15/) -resmap@tiXAxisPosition="Left" -resmap@tiXAxisFontHeightF=0.015 -;=================================================; -; TRACE -;=================================================; - gsn_define_colormap(wks,"rainbow") ; Choose colormap - colors = gsn_retrieve_colormap(wks) ; retrieve color map for editing - colors(2,:) = (/ 1, 1, 1 /) ; replace the first color with white color (les deux premières sont background /foreground donc c'est bien la 2 qu'il faut changer) - gsn_define_colormap(wks,colors) ; redefine colormap to workstation, color map now includes a gray - - - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.25 -opts@cnMinLevelValF=0 -opts@cnMaxLevelValF=2.5 - -plot = gsn_csm_contour(wks,SBG_TKE(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=1 -opts@cnMinLevelValF=298 -opts@cnMaxLevelValF=316 - -plot = gsn_csm_contour(wks,MEAN_TH(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.5 -opts@cnMinLevelValF=3 -opts@cnMaxLevelValF=11 - -plot = gsn_csm_contour(wks,MEAN_U(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.2 -opts@cnMinLevelValF=0. -opts@cnMaxLevelValF=3.2 - -plot = gsn_csm_contour(wks,MEAN_V(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.00001 -opts@cnMinLevelValF=0 -opts@cnMaxLevelValF=0.0002 - -plot = gsn_csm_contour(wks,MEAN_RC(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.000001 -opts@cnMinLevelValF=0 -opts@cnMaxLevelValF=0.00002 - -plot = gsn_csm_contour(wks,MEAN_RR(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.02 -opts@cnMinLevelValF=-0.3 -opts@cnMaxLevelValF=0.12 - -plot = gsn_csm_contour(wks,SBG_WTHL(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.00005 -opts@cnMinLevelValF=-0.0001 -opts@cnMaxLevelValF=0.0004 - -plot = gsn_csm_contour(wks,SBG_WRT(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=1 -opts@cnMinLevelValF=301 -opts@cnMaxLevelValF=318 - -plot = gsn_csm_contour(wks,THLUP_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.001 -opts@cnMinLevelValF=0.0035 -opts@cnMaxLevelValF=0.017 -plot = gsn_csm_contour(wks,RTUP_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.001 -opts@cnMinLevelValF=0.001 -opts@cnMaxLevelValF=0.017 - -plot = gsn_csm_contour(wks,RVUP_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.00025 -opts@cnMinLevelValF=0.00025 -opts@cnMaxLevelValF=0.00425 - -plot = gsn_csm_contour(wks,RCUP_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "AutomaticLevels" -plot = gsn_csm_contour(wks,RIUP_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.25 -opts@cnMinLevelValF=0.250 -opts@cnMaxLevelValF=5.5 - -plot = gsn_csm_contour(wks,WUP_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.02 -opts@cnMinLevelValF=0.02 -opts@cnMaxLevelValF=0.32 - -plot = gsn_csm_contour(wks,MAFLX_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.025 -opts@cnMinLevelValF=0.025 -opts@cnMaxLevelValF=0.45 - -plot = gsn_csm_contour(wks,DETR_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.00025 -opts@cnMinLevelValF=0.00025 -opts@cnMaxLevelValF=0.005 - -plot = gsn_csm_contour(wks,ENTR_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.01 -opts@cnMinLevelValF=0.01 -opts@cnMaxLevelValF=0.16 - -plot = gsn_csm_contour(wks,FRCUP_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=1 -opts@cnMinLevelValF=303 -opts@cnMaxLevelValF=319 - -plot = gsn_csm_contour(wks,THVUP_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.005 -opts@cnMinLevelValF=-0.075 -opts@cnMaxLevelValF=0.055 - -plot = gsn_csm_contour(wks,WTHL_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.00001 -opts@cnMinLevelValF=0.00001 -opts@cnMaxLevelValF=0.00019 - -plot = gsn_csm_contour(wks,WRT_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.005 -opts@cnMinLevelValF=-0.016 -opts@cnMaxLevelValF=0.075 -plot = gsn_csm_contour(wks,WTHV_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.005 -opts@cnMinLevelValF=-0.120 -opts@cnMaxLevelValF=-0.005 - -plot = gsn_csm_contour(wks,WU_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -opts=resmap -opts@cnLevelSelectionMode = "ManualLevels" -opts@cnLevelSpacingF=0.004 -opts@cnMinLevelValF=-0.024 -opts@cnMaxLevelValF=0.048 -plot = gsn_csm_contour(wks,WV_MF(0:76,:),opts) -draw(plot) -frame(wks) -delete(opts) - -end diff --git a/MY_RUN/KTEST/005_ARM/004_ncl/run_ncl b/MY_RUN/KTEST/005_ARM/004_ncl/run_ncl deleted file mode 100755 index 7fa36570be699763a33bdad50638a95b35f01eb7..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/005_ARM/004_ncl/run_ncl +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -#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 - -ln -sf ../002_mesonh/ARM__.1.CEN4T.000.* . - -rm -f visu_ARM.*.png - -ncl plot_arm.ncl -${POSTRUN} display visu_ARM.000001.png -${POSTRUN} display visu_ARM.000002.png -${POSTRUN} display visu_ARM.000003.png -${POSTRUN} display visu_ARM.000004.png -${POSTRUN} display visu_ARM.000005.png -${POSTRUN} display visu_ARM.000006.png -${POSTRUN} display visu_ARM.000007.png -${POSTRUN} display visu_ARM.000008.png -${POSTRUN} display visu_ARM.000009.png -${POSTRUN} display visu_ARM.000010.png -${POSTRUN} display visu_ARM.000011.png -${POSTRUN} display visu_ARM.000012.png -${POSTRUN} display visu_ARM.000013.png -${POSTRUN} display visu_ARM.000014.png -${POSTRUN} display visu_ARM.000015.png -${POSTRUN} display visu_ARM.000016.png -${POSTRUN} display visu_ARM.000017.png -${POSTRUN} display visu_ARM.000018.png -${POSTRUN} display visu_ARM.000019.png -${POSTRUN} display visu_ARM.000020.png -${POSTRUN} display visu_ARM.000021.png -${POSTRUN} display visu_ARM.000022.png -${POSTRUN} display visu_ARM.000023.png -${POSTRUN} display visu_ARM.000024.png -exit 0 diff --git a/MY_RUN/KTEST/005_ARM/Makefile b/MY_RUN/KTEST/005_ARM/Makefile index 1bc0a343ccea47bac3e46f0c9626312f51860176..11d0758f994f051b84a82549fab05d1d877c3d7f 100644 --- a/MY_RUN/KTEST/005_ARM/Makefile +++ b/MY_RUN/KTEST/005_ARM/Makefile @@ -4,7 +4,6 @@ all: ifneq "$(MNH_PYTHON)" "NO" cd 003_python && run_python endif - cd 004_ncl && run_ncl clean: cd 001_prep_ideal && clean_prep_ideal_case_xyz @@ -12,7 +11,6 @@ clean: ifneq "$(MNH_PYTHON)" "NO" cd 003_python && clean_python endif - cd 004_ncl && clean_ncl python: cd 003_python && run_python diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl/clean_ncl b/MY_RUN/KTEST/007_16janvier/011_ncl/clean_ncl deleted file mode 100755 index 6315552cfe80a90710153aeb3028b2678b968ab9..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl/clean_ncl +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -x -rm -f 16JAN* -rm -f *.ps diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl/plot_16j.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl/plot_16j.ncl deleted file mode 100644 index 50f595e0a6188cada27d5373278d957613e07e9b..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl/plot_16j.ncl +++ /dev/null @@ -1,263 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; -begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("16JAN.1.12B18.001.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_16j") -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = fichier1->JPHEXT - mdims = getfilevardimsizes(fichier1,"UT") - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - - -;=================================================; -; Set map projection -;=================================================; - lat2d=fichier1->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d=fichier1->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) -; Resources for the map projection -;-----------------------------------------------; - resmap=True -;-----------------------------------------------; -; Get global attributes to set map projection -;-----------------------------------------------; -RPK = fichier1->RPK -LON0 = fichier1->LON0 -BETA = fichier1->BETA - - if (RPK.gt.0) - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - resmap@mpLambertParallel1F = 42 ; to be adjusted !! - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; Parallel1 = PArallel2 - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.lt.0) - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - resmap@mpLambertParallel1F = -42 ; to be adjusted !! - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.eq.1) - ; Stereographic projection -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90. - end if - - if (RPK.eq.-1) - ; Stereographic projection -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90. - end if - - if (RPK.eq.0) then - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -;==================================== -; Defining the corners for projection -;==================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - print ("Corner (0,0); Lat="+resmap@mpLeftCornerLatF+ \ - ", Lon="+resmap@mpLeftCornerLonF) - print ("Oppos corner; Lat="+resmap@mpRightCornerLatF+ \ - ", Lon= "+resmap@mpRightCornerLonF) - -;=================================================; -; lecture des différents champs -;=================================================; -zs = fichier1->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) ; ZS -zs@long_name="Orography" -zs@units="m" -zs@lat2d = lat2d -zs@lon2d = lon2d - - -wt= fichier1->WT(0,1:kmax+1,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; WT -vt= fichier1->VT(0,1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; VT -ut= fichier1->UT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; UT - -tht1= fichier1->THT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; THT -tht1@long_name="Potential Temperature" -tht1@units="K" -tht1@lat2d = lat2d -tht1@lon2d = lon2d - - - -pabst1= fichier1->PABST(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; PABST -pabst1@long_name="Pressure" -pabst1@units="Pa" -pabst1@lat2d = lat2d -pabst1@lon2d = lon2d - -rvt1= fichier1->RVT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RVT -rvt1=rvt1*1000 -rvt1@long_name="Vapor mixing ratio" -rvt1@units="kg/kg" -rvt1@lat2d = lat2d -rvt1@lon2d = lon2d - -;=================================================; -; 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" - -ut1@lat2d = lat2d -ut1@lon2d = lon2d -vt1@lat2d = lat2d -vt1@lon2d = lon2d -wt1@lat2d = lat2d -wt1@lon2d = lon2d -;=================================================; -; On calcule l'altitude des champs modèle -;=================================================; - -zhat= fichier1->ZHAT(1:kmax+1) - -; Unstagger zhat (from grid 4 to 1) - nzhat=new(kmax,typeof(pabst1)) - do k=0,kmax-1 - nzhat(k)=(zhat(k)+zhat(k+1))/2. - end do - -; Create Z3D == ALT - alt=new(dimsizes(tht1),typeof(pabst1)) - zcoef=1.-zs/nzhat(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - alt(:,j,i) = nzhat*zcoef(j,i)+zs(j,i) - end do - end do - -alt@lat2d = lat2d -alt@lon2d = lon2d - -;=================================================; -; Set some other basic resources -;=================================================; - resmap = True - resmap@gsnFrame = False - resmap@gsnDraw = False - resmap@gsnMaximize = True - resmap@gsnPaperOrientation = "portrait" - resmap@gsnSpreadColors = True ; use full range of colormap - resmap@tiYAxisString =" " - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - resmap@mpFillOn = False ; couleur grise des continents - resmap@mpGeophysicalLineThicknessF = 2.0 - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@tmXBLabelStride = 2 ; to reduce the number of labels on xaxis - resmap@lbLabelStride = 2. ; to reduce the number of labels on labelbar - -;=================================================; -; OROGRAPHIE -;=================================================; -gsn_define_colormap(wks,"topo_15lev") -resmap@cnLevelSelectionMode = "ExplicitLevels" -cnLevels = (/1,25,50,75,100,125,150,175,200,225,250,275,300/) -resmap@cnLevels = cnLevels -plot_as = gsn_csm_contour_map(wks,zs,resmap) -draw(plot_as) -frame(wks) - - -;=================================================; -; THT + vecteurs vent a 850 hPa -;=================================================; - -gsn_define_colormap(wks,"rainbow") ; Choose colormap - -; interpolation des champs a 850 hPa -tht_plane = wrf_user_intrp3d(tht1,pabst1,"h",850,0.,False) -ut_plane = wrf_user_intrp3d(ut1,pabst1,"h",850,0.,False) -vt_plane = wrf_user_intrp3d(vt1,pabst1,"h",850,0.,False) - -; options de tracé -res2=resmap -res2@cnLevelSelectionMode = "AutomaticLevels" -res2@gsnScalarContour=True -res2@vcMinDistanceF = 0.04 -res2@vcRefLengthF=0.1 -res2@tiXAxisString = "850 hPa" - - -plot=gsn_csm_vector_scalar_map(wks,ut_plane(:,:),vt_plane(:,:),tht_plane(:,:),res2) -draw(plot) -frame(wks) - -;=================================================; -; RVT + vecteurs vent a 700 hPa -;=================================================; - -rvt_plane = wrf_user_intrp3d(rvt1,pabst1,"h",700,0.,False) - -res2@tiXAxisString = "700 hPa" - -plot=gsn_csm_vector_scalar_map(wks,ut_plane(:,:),vt_plane(:,:),rvt_plane(:,:),res2) -draw(plot) -frame(wks) - -;=================================================; -; PABST + vecteurs vent a 9000 m -;=================================================; - -pabst9000_plane = wrf_user_intrp3d(pabst1,alt,"h",9000,0.,False) -ut9000_plane = wrf_user_intrp3d(ut1,alt,"h",9000,0.,False) -vt9000_plane = wrf_user_intrp3d(vt1,alt,"h",9000,0.,False) - -res2@tiXAxisString = "Z=9000m" - -plot=gsn_csm_vector_scalar_map(wks,ut9000_plane,vt9000_plane,pabst9000_plane,res2) -draw(plot) -frame(wks) - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl/plot_16j_2.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl/plot_16j_2.ncl deleted file mode 100644 index 0fedb8530ca39ec1886b44d8ea159efc98bca4c6..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl/plot_16j_2.ncl +++ /dev/null @@ -1,253 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; -begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("16JAN.2.12B18.001.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_16j_2") -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = fichier1->JPHEXT - mdims = getfilevardimsizes(fichier1,"UT") - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - -;=================================================; -; Set map projection -;=================================================; - lat2d=fichier1->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d=fichier1->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) -; Resources for the map projection -;-----------------------------------------------; - resmap=True -;-----------------------------------------------; -; Get global attributes to set map projection -;-----------------------------------------------; -RPK = fichier1->RPK -LON0 = fichier1->LON0 -BETA = fichier1->BETA - - if (RPK.gt.0) - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - resmap@mpLambertParallel1F = 42 ; to be adjusted !! - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; Parallel1 = PArallel2 - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.lt.0) - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - resmap@mpLambertParallel1F = -42 ; to be adjusted !! - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.eq.1) - ; Stereographic projection -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90. - end if - - if (RPK.eq.-1) - ; Stereographic projection -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90. - end if - - if (RPK.eq.0) then - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -;==================================== -; Defining the corners for projection -;==================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - print ("Corner (0,0); Lat="+resmap@mpLeftCornerLatF+ \ - ", Lon="+resmap@mpLeftCornerLonF) - print ("Oppos corner; Lat="+resmap@mpRightCornerLatF+ \ - ", Lon= "+resmap@mpRightCornerLonF) - -;=================================================; -; lecture des différents champs -;=================================================; -zs = fichier1->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) ; ZS -zs@long_name="Orography" -zs@units="m" -zs@lat2d = lat2d -zs@lon2d = lon2d - -vtype = typeof(zs) - -wt= fichier1->WT(0,1:kmax+1,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; WT -vt= fichier1->VT(0,1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; VT -ut= fichier1->UT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; UT - -tht1= fichier1->THT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; THT -tht1@long_name="Potential Temperature" -tht1@units="K" -tht1@lat2d = lat2d -tht1@lon2d = lon2d - - - -pabst1= fichier1->PABST(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; PABST -pabst1@long_name="Pressure" -pabst1@units="Pa" -pabst1@lat2d = lat2d -pabst1@lon2d = lon2d - -rvt1= fichier1->RVT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RVT -rvt1=rvt1*1000 -rvt1@long_name="Vapor mixing ratio" -rvt1@units="kg/kg" -rvt1@lat2d = lat2d -rvt1@lon2d = lon2d - -;=================================================; -; 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" - -ut1@lat2d = lat2d -ut1@lon2d = lon2d -vt1@lat2d = lat2d -vt1@lon2d = lon2d -wt1@lat2d = lat2d -wt1@lon2d = lon2d -;=================================================; -; On calcule l'altitude des champs modèle -;=================================================; - -zhat= fichier1->ZHAT(1:kmax+1) - -; Unstagger zhat (from grid 4 to 1) - nzhat=new(kmax,vtype) - do k=0,kmax-1 - nzhat(k)=(zhat(k)+zhat(k+1))/2. - end do - -; Create Z3D == ALT - alt=new(dimsizes(tht1),vtype) - zcoef=1.-zs/nzhat(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - alt(:,j,i) = nzhat*zcoef(j,i)+zs(j,i) - end do - end do - -alt@lat2d = lat2d -alt@lon2d = lon2d - -;=================================================; -; Set some other basic resources -;=================================================; - resmap = True - resmap@gsnFrame = False - resmap@gsnDraw = False - resmap@gsnMaximize = True - resmap@gsnPaperOrientation = "portrait" - resmap@gsnSpreadColors = True ; use full range of colormap - resmap@tiYAxisString =" " - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - resmap@mpFillOn = False ; couleur grise des continents - resmap@mpGeophysicalLineThicknessF = 2.0 - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - - resmap@tmXBLabelStride = 2 ; to reduce the number of labels on xaxis - resmap@lbLabelStride = 2. ; to reduce the number of labels on labelbar - - -;=================================================; -; THT + vecteurs vent a 850 hPa -;=================================================; - -gsn_define_colormap(wks,"rainbow") ; Choose colormap - -; interpolation des champs a 850 hPa -tht_plane = wrf_user_intrp3d(tht1,pabst1,"h",850,0.,False) -ut_plane = wrf_user_intrp3d(ut1,pabst1,"h",850,0.,False) -vt_plane = wrf_user_intrp3d(vt1,pabst1,"h",850,0.,False) - -; options de tracé -res2=resmap -res2@cnLevelSelectionMode = "AutomaticLevels" -res2@gsnScalarContour=True -res2@vcMinDistanceF = 0.04 -res2@vcRefLengthF=0.1 -res2@tiXAxisString = "850 hPa" - - -plot=gsn_csm_vector_scalar_map(wks,ut_plane(:,:),vt_plane(:,:),tht_plane(:,:),res2) -draw(plot) -frame(wks) - -;=================================================; -; RVT + vecteurs vent a 700 hPa -;=================================================; - -rvt_plane = wrf_user_intrp3d(rvt1,pabst1,"h",700,0.,False) - -res2@tiXAxisString = "700 hPa" - -plot=gsn_csm_vector_scalar_map(wks,ut_plane(:,:),vt_plane(:,:),rvt_plane(:,:),res2) -draw(plot) -frame(wks) - -;=================================================; -; PABST + vecteurs vent a 9000 m -;=================================================; - -pabst9000_plane = wrf_user_intrp3d(pabst1,alt,"h",9000,0.,False) -ut9000_plane = wrf_user_intrp3d(ut1,alt,"h",9000,0.,False) -vt9000_plane = wrf_user_intrp3d(vt1,alt,"h",9000,0.,False) - -res2@tiXAxisString = "Z=9000m" - -plot=gsn_csm_vector_scalar_map(wks,ut9000_plane,vt9000_plane,pabst9000_plane,res2) -draw(plot) -frame(wks) - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl/run_ncl b/MY_RUN/KTEST/007_16janvier/011_ncl/run_ncl deleted file mode 100755 index beb2e3605d766566b89aa01912aa5eab38354a73..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl/run_ncl +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -x - -rm -f visu_16j*.png - -ln -sf ../008_run2/16JAN.1.12B18.001.nc . -ln -sf ../008_run2/16JAN.2.12B18.001.nc . -ncl plot_16j.ncl - -${POSTRUN} display visu_16j.000001.png -${POSTRUN} display visu_16j.000002.png -${POSTRUN} display visu_16j.000003.png -${POSTRUN} display visu_16j.000004.png - -ncl plot_16j_2.ncl -${POSTRUN} display visu_16j_2.000001.png -${POSTRUN} display visu_16j_2.000002.png -${POSTRUN} display visu_16j_2.000003.png -exit 0 - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/MESONHtools.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/MESONHtools.ncl deleted file mode 100644 index 9cae6400a0dade82e20ba68463722fbb13d4c81d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/MESONHtools.ncl +++ /dev/null @@ -1,915 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" - -;------------------------------------------------------------- -;contains: -; procedure MESONH_map_c -;function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) -;function mnh_map_overlays(in_file[1]:file,wks:graphic,plots[*]:graphic, \ -; opt_arg[1]:logical,opt_mp[1]:logical) -;function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;------------------------------------------------------------- - -;============================================================== -; J.-P. CHABOUREAU -; This is a driver that selects the appropriate -; mapping function based upon the file variables RPK, BETA, LATOR, LONOR -; -; -; Sample usage: -; a = addfile("...", r") -; IMAX = a->IMAX -; JMAX = a->JMAX -; lat2d = new((/JMAX,IMAX/),"double") -; lat2d(:,:)=0. -; lon2d = new((/JMAX,IMAX/),"double") -; lon2d(:,:)=0. -; icorners = new((/2,2/),"integer") -; icorners(:,:)=0 -; res = True -; MESONH_map_c (a, res, lat2d, lon2d, icorners) -; -; -undef("MESONH_map_c") -;============================================================== -procedure MESONH_map_c (in_file:file, res:logical, plat, plon, icorner) -;============================================================== -;local rank, dimll, nlat, mlon, lat, lon -local rank, dimll, nlat, mlon -begin - -; Check if the variable RPK is in the file -; ---------------------------------------- -if(isfilevar(in_file,"RPK")) then - -; Read projection parameters -; ------------------------- - ZRPK = in_file->RPK - ZLATOR = in_file->LATOR - ZLONOR = in_file->LONOR - ZBETA = in_file->BETA - ZLAT0 = in_file->LAT0 - ZLON0 = in_file->LON0 - -; Case netcdf from lfi2cdf -; ------------------------- - - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - -; unstagger - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - - else - -; Case netcdf from extractdia -; --------------------------- - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - - end if - - print ("LATOR="+ZLATOR+" - LONOR="+ZLONOR) - print ("ZLAT0="+ZLAT0+" - ZLON0="+ZLON0) - print ("ZDX="+zdx+" - RPK="+ZRPK+" - BETA="+ZBETA) - print ("IMAX="+IMAX+" - JMAX="+JMAX) - - if (ZRPK.gt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = 90. - end if - - if (ZRPK.lt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = -90. - end if - - if (ZRPK.eq.0) then - ; Mercator projection -; --------------------------- - res@mpProjection = "Mercator" - end if - - print("Map projection="+res@mpProjection) - -else - print ("MESONH_map_c: Error no RPK variable in input file") -end if - -;=================================================; -; calculate 2D lat and lon -; based on src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - -; Constants -; ----------- - if(isfilevar(in_file,"IMAX")) - XRADIUS=6371229.0d ; Earth radius (meters) - else - XRADIUS=6371.2290d ; Earth radius (km) - end if - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - -;=================================================; - if (ZRPK.eq.0) then -; MERCATOR -;=================================================; - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - plon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - plat(jj,ji)=zlat - end do - end do - -;=================================================; - else -; STEREOGRAPHIC PROJECTION -;=================================================; - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - plon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - plat(jj,ji)=zlat - end do - end do - - end if - -; Defining the corners of the domain -;==================================== - if (icorner(0,0).eq.icorner(1,1)) then - icorner(0,0)=0 - icorner(1,0)=JMAX-1 - icorner(0,1)=0 - icorner(1,1)=IMAX-1 - end if -; print ("icorner"+icorner) - - res@mpLimitMode = "Corners" - res@mpLeftCornerLatF = plat(icorner(0,0),icorner(0,1)) - res@mpLeftCornerLonF = plon(icorner(0,0),icorner(0,1)) - res@mpRightCornerLatF = plat(icorner(1,0),icorner(1,1)) - res@mpRightCornerLonF = plon(icorner(1,0),icorner(1,1)) - -; print ("Corner (0,0); Lat="+res@mpLeftCornerLatF+ \ -; ", Lon="+res@mpLeftCornerLonF) -; print ("Oppos corner; Lat="+res@mpRightCornerLatF+ \ -; ", Lon= "+res@mpRightCornerLonF) - -;========================================== -; Turn on lat / lon labeling -;========================================== - res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - res@mpOutlineBoundarySets = "AllBoundaries" ; state boundaries - res@mpPerimDrawOrder = "PostDraw" ; force map perim -;========================================== -; Needed for regional native projection -;========================================== - res@tfDoNDCOverlay = True - res@gsnAddCyclic = False ; regional data - -end - -;=========================================== -;------------------------------------------------------------------------ -undef("MESONH_pinter") -function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;************************************************************************* -; S. BIELLI -; This is a routine that interpolate fields on pressure level for plotting -; based on pinter.f90 -; The field to be interpolated must be given at the mass point (grid 1) -; usage : var_inter=MESONHfunction(var_to_interpol, 850., AbsPressure) -; Abs pressure must be in Pa -; - -begin - - dimL= dimsizes(loc_param) - -; First test for grid = 0 - - dimp=dimsizes(ppabs) - - pout=pfield(0:dimL-1,:,:) - pfield@_FillValue=999 - pout@_FillValue=999 - pout=pout@_FillValue - - do jkp = 0, dimL-1 - zref=log10(loc_param(jkp)*100.) - do jloop = 0, dimp(1)-1 - do iloop = 0, dimp(2)-1 - kloop=0 - flag=True - do while (flag .and. (kloop.lt.(dimp(2)-2))) - if (.not.ismissing(ppabs(kloop,jloop,iloop))) then - zxm=log10(ppabs(kloop,jloop,iloop)) - zxp=log10(ppabs(kloop+1,jloop,iloop)) - if ((zxp-zref)*(zref-zxm) .ge. 0) then - pout(jkp,jloop,iloop)= (pfield(kloop,jloop,iloop)*(zxp-zref)+ \ - pfield(kloop+1,jloop,iloop)*(zref-zxm))/ (zxp-zxm) - flag=False - end if - end if - kloop=kloop+1 - end do - end do - end do - end do - - return(pout) - -end - -;-------------------------------------------------------------------------------- -undef("mnh_map") -function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) - -begin -; -; This function creates a map plot, and bases the projection on -; the MAP_PROJ attribute in the given file. -; -; 1. Make a copy of the resource list, and set some resources -; common to all map projections. -; -; 2. Determine the projection being used, and set resources based -; on that projection. -; -; 3. Create the map plot, and draw and advance the frame -; (if requested). - - opts = opt_args ; Make a copy of the resource list - opts = True - -; Set some resources depending on what kind of map projection is -; chosen. -; -; ZRPK != 0 : "Stereographic" -; ZRPK = 0 : "Mercator" -;=================================================; -; src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - XRADIUS=6371229.0d ; Earth radius (meters) - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - - if(isfilevar(in_file,"RPK")) - ZRPK=in_file->RPK - ZLON0=in_file->LON0 - ZLAT0=in_file->LAT0 - ZLATOR=in_file->LATOR - ZLONOR=in_file->LONOR - ZBETA=in_file->BETA - else - print ("mnh_map: Error no RPK variable in input file") - return(new(1,graphic)) - end if - -; Case netcdf from lfi2cdf - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - else -; Case netcdf from extractdia - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - end if -; - - lat = new((/JMAX,IMAX/),"double") - lon = new((/JMAX,IMAX/),"double") - - -; Stereographic projection - if(ZRPK .gt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", 90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - - if(ZRPK .lt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", -90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - -; Mercator projection - if(ZRPK .eq. 0) - projection = "Mercator" - end if - - opts@mpNestTime = get_res_value_keep(opts, "mpNestTime",0) - - -; LAT and LON are not saved in the file - if (ZRPK.eq.0) then - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - lon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - lat(jj,ji)=zlat - end do - end do - else - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - lon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - lat(jj,ji)=zlat - end do - end do - end if - - dims = dimsizes(lat) - - do ii = 0, dims(0)-1 - do jj = 0, dims(1)-1 - if ( lon(ii,jj) .lt. 0.0) then - lon(ii,jj) = lon(ii,jj) + 360. - end if - end do - end do - - opts@start_lat = lat(0,0) - opts@start_lon = lon(0,0) - opts@end_lat = lat(dims(0)-1,dims(1)-1) - opts@end_lon = lon(dims(0)-1,dims(1)-1) - - -; Set some resources common to all map projections. - opts = set_mp_resources(opts) - - if ( isatt(opts,"ZoomIn") .and. opts@ZoomIn ) then - y1 = 0 - x1 = 0 - y2 = dims(0)-1 - x2 = dims(1)-1 - if ( isatt(opts,"Ystart") ) then - y1 = opts@Ystart - delete(opts@Ystart) - end if - if ( isatt(opts,"Xstart") ) then - x1 = opts@Xstart - delete(opts@Xstart) - end if - if ( isatt(opts,"Yend") ) then - if ( opts@Yend .le. y2 ) then - y2 = opts@Yend - end if - delete(opts@Yend) - end if - if ( isatt(opts,"Xend") ) then - if ( opts@Xend .le. x2 ) then - x2 = opts@Xend - end if - delete(opts@Xend) - end if - - opts@mpLeftCornerLatF = lat(y1,x1) - opts@mpLeftCornerLonF = lon(y1,x1) - opts@mpRightCornerLatF = lat(y2,x2) - opts@mpRightCornerLonF = lon(y2,x2) - - if ( opts@mpRightCornerLonF .lt. 0.0 ) then - opts@mpRightCornerLonF = opts@mpRightCornerLonF + 360.0 - end if - - delete(opts@ZoomIn) - end if - - -; The default is not to draw the plot or advance the frame, and -; to maximize the plot in the frame. - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", False) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", False) - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - delete_attrs(opts) ; Clean up. - mp = gsn_map(wks,projection,opts) ; Create map plot. - - return(mp) ; Return. - -end - -;-------------------------------------------------------------------------------- - -undef("mnh_map_overlays") -function mnh_map_overlays(in_file[1]:file, \ - wks:graphic, \ - plots[*]:graphic, \ - opt_arg[1]:logical, \ - opt_mp[1]:logical) - -; Based on wrf_map_overlays -; -; This procedure takes an array of plots and overlays them on a -; base plot - map background. -; -; It will advance the plot and cleanup, unless you set the -; PanelPlot resource to True. -; -; Attributes recognized by this procedure: -; FramePlot -; PanelPlot -; NoTitles (don't do any titles) -; CommonTitle & PlotTile is used to overwrite field titles -; CommonTitle will super-seed NoTitles -; -; If FramePlot False, then Draw the plot but do not Frame. -; In this case a user want to add to the drawing, and will -; have to advance the Frame manually in the script. -; -; If the "NoTitles" attribute exists and is set True, then -; don't create the top-left titles, and leave the main titles alone. -; This resource can be useful if you are planning to panel -; the plots. -; -; If PanelPlot is set to True, then this flags to wrf_map_overlays -; that these plots are going to be eventually paneled (likely -; by gsn_panel), and hence 1) draw and frame should not be called -; (unless gsnDraw and/or gsnFrame are explicitly set to True), -; and 2) the overlays and titles should not be removed with -; NhlRemoveOverlay and NhlRemoveAnnotation. -; -begin - - opts = opt_arg ; Make a copy of the resource lists - opt_mp_2 = opt_mp - - ; Let's make the map first - base = mnh_map(wks,in_file,opt_mp_2) - - no_titles = get_res_value(opts,"NoTitles",False) ; Do we want field titles? - com_title = get_res_value(opts,"CommonTitle",False) ; Do we have a common title? - if ( com_title ) then - plot_title = get_res_value(opts,"PlotTitle"," ") - no_titles = True - end if - - call_draw = True - call_frame = get_res_value(opts,"FramePlot",True) ; Do we want to frame the plot? - panel_plot = get_res_value(opts,"PanelPlot",False) ; Are we paneling? - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - nplots = dimsizes(plots) -; font_color = "Black" - - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then -; class_name = NhlClassName(plots(i)) -; print(class_name) -; if(class_name.eq."contourPlotClass") then -; getvalues plots(i) -; "cnFillOn" : fill_on -; "cnLineColor" : line_color -; end getvalues -; if (.not.fill_on) then -; font_color = line_color -; end if -; end if - if(.not.no_titles) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - if(i.eq.0) then - SubTitles = SubTitle - else - SubTitles = SubTitles + "~C~" + SubTitle - end if - end if - if(com_title .and. i .eq. nplots-1) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - SubTitles = plot_title - end if - setvalues plots(i) - "tfDoNDCOverlay" : True - "tiMainOn" : False - end setvalues - overlay(base,plots(i)) - else - print("mnh_map_overlays: Warning: overlay plot #" + i + " is not valid.") - end if - end do - - if(.not.no_titles .or. com_title) then - font_height = get_res_value_keep(opts,"FontHeightF",0.01) - txt = create "map_titles" textItemClass wks - "txString" : SubTitles - "txFontHeightF" : font_height - ;"txFontColor" : font_color - end create - anno = NhlAddAnnotation(base,txt) - setvalues anno - "amZone" : 3 - "amJust" : "BottomLeft" - "amSide" : "Top" - "amParallelPosF" : 0.005 - "amOrthogonalPosF" : 0.03 - "amResizeNotify" : False - end setvalues - base@map_titles = anno - end if -; -; gsnDraw and gsnFrame default to False if panel plot. -; - if(panel_plot) then - call_draw = False - call_frame= False - end if - - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", call_draw) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", call_frame) - - draw_and_frame(wks,base,opts@gsnDraw,opts@gsnFrame,False, \ - opts@gsnMaximize) - - if(.not.panel_plot) then - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then - NhlRemoveOverlay(base,plots(i),False) - else - print("wrf_remove_map_overlays: Warning: overlay plot #" + i + " is not valid.") - print(" Nothing to remove.") - end if - end do - end if - - if(.not.no_titles.and..not.panel_plot) then - if(isatt(base,"map_titles")) then - NhlRemoveAnnotation(base,base@map_titles) - delete(base@map_titles) - end if - end if - -return(base) -end - -;-------------------------------------------------------------------------------- -undef("wrf_user_intrp3d") -function wrf_user_intrp3d( var3d:numeric, z_in:numeric, \ - plot_type:string, \ - loc_param:numeric, angle:numeric, opts:logical ) - -; var3d - 3d field to interpolate (all input fields must be unstaggered) -; z_in - interpolate to this field (either p/z) -; plot_type - interpolate horizontally "h", or vertically "v" -; loc_param - level(s) for horizontal plots (eg. 500hPa ; 3000m - scalar), -; plane for vertical plots (2 values representing an xy point -; on the model domain through which the vertical plane will pass -; OR 4 values specifying start and end values -; angle - 0.0 for horizontal plots, and -; an angle for vertical plots - 90 represent a WE cross section -; opts Used IF opts is TRUE, else use loc_param and angle to determine crosssection - -begin - - - if(plot_type .eq. "h" ) then ; horizontal cross section needed - - dimL = dimsizes(loc_param) - - dims = dimsizes(var3d) - nd = dimsizes(dims) - - dimX = dims(nd-1) - dimY = dims(nd-2) - dimZ = dims(nd-3) - dim4 = 1 - dim5 = 1 - if ( nd .eq. 4 ) then - dim4 = dims(nd-4) - end if - if ( nd .eq. 5 ) then - dim4 = dims(nd-4) - dim5 = dims(nd-5) - end if - - var3 = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - z = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - var2d = new ( (/ dim5, dim4, dimL, dimY, dimX /) , typeof(var3d) ) - - if ( nd .eq. 5 ) then - var3 = var3d - z = z_in - end if - if ( nd .eq. 4 ) then - var3(0,:,:,:,:) = var3d(:,:,:,:) - z(0,:,:,:,:) = z_in(:,:,:,:) - end if - if ( nd .eq. 3 ) then - var3(0,0,:,:,:) = var3d(:,:,:) - z(0,0,:,:,:) = z_in(:,:,:) - end if - - - if ( z(0,0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z(0,0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z = z * 0.01 - end if - if ( loc_param(0) .gt. 2000. ) then - ; looks like the input was specified in Pa - change this - loc_param = loc_param * 0.01 - end if - end if - - do il = 0,dimL-1 - var = wrf_interp_3d_z(var3,z,loc_param(il)) - var2d(:,:,il,:,:) = var(:,:,:,:) - end do - - copy_VarAtts(var3d,var3) - if(isatt(var3,"description")) then - delete_VarAtts(var3,(/"description"/)) - end if - if(isatt(var3,"units")) then - delete_VarAtts(var3,(/"units"/)) - end if - if(isatt(var3,"MemoryOrder")) then - delete_VarAtts(var3,(/"MemoryOrder"/)) - end if - if(isatt(var3,"_FillValue")) then - delete_VarAtts(var3,(/"_FillValue"/)) - end if - copy_VarAtts(var3,var2d) - - nn = nd-2 - var2d!nn = "plevs" - - if ( dimL .gt. 1 ) then - if ( nd .eq. 5 ) then - return( var2d ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,:,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,:,:,:) ) - end if - else - if ( z(0,0,0,0,0) .gt. 500.) then - var2d@PlotLevelID = loc_param + " hPa" - else - var2d@PlotLevelID = .001*loc_param + " km" - end if - if ( nd .eq. 5 ) then - return( var2d(:,:,0,:,:) ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,0,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,0,:,:) ) - end if - end if - - - end if - - - - - if(plot_type .eq. "v" ) then ; vertical cross section needed - - dims = dimsizes(var3d) - if ( dimsizes(dims) .eq. 4 ) then - if ( z_in(0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in(0,:,:,:) - else - if ( z_in(0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in - end if - -; set vertical cross section - if (opts) then - xy = wrf_user_set_xy( z, loc_param(0)-1, loc_param(1)-1, \ ; the -1 is for NCL dimensions - loc_param(2)-1, loc_param(3)-1, \ - angle, opts ) - else - xy = wrf_user_set_xy( z, loc_param(0), loc_param(1), \ - 0.0, 0.0, angle, opts ) - end if - xp = dimsizes(xy) - - -; first we interp z - var2dz = wrf_interp_2d_xy( z, xy) - -; interp to constant z grid - if(var2dz(0,0) .gt. var2dz(1,0) ) then ; monotonically decreasing coordinate - z_max = floor(max(z)/10)*10 ; bottom value - z_min = ceil(min(z)/10)*10 ; top value - dz = 1. - nlevels = tointeger( (z_max-z_min)/dz) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_max - dz = -dz - else - z_max = max(z) - z_min = 0. -;; MODI SOLINE -; dz = 0.01 * z_max - dz = 0.001 * z_max - nlevels = tointeger( z_max/dz ) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_min - end if -; print("nlevels="+nlevels) -; print("dz="+dz) - - do i=1, nlevels-1 - z_var2d(i) = z_var2d(0)+i*dz - end do - - -; interp the variable - if ( dimsizes(dims) .eq. 4 ) then - var2d = new( (/dims(0), nlevels, xp(0)/), typeof(var2dz)) - do it = 0,dims(0)-1 - var2dtmp = wrf_interp_2d_xy( var3d(it,:,:,:), xy) - do i=0,xp(0)-1 - var2d(it,:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - end do - var2d!0 = var3d!0 - var2d!1 = "Vertical" - var2d!2 = "Horizontal" - else - var2d = new( (/nlevels, xp(0)/), typeof(var2dz)) - var2dtmp = wrf_interp_2d_xy( var3d, xy) - do i=0,xp(0)-1 - var2d(:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - var2d!0 = "Vertical" - var2d!1 = "Horizontal" - end if - - - st_x = tointeger(xy(0,0)) + 1 - st_y = tointeger(xy(0,1)) + 1 - ed_x = tointeger(xy(xp(0)-1,0)) + 1 - ed_y = tointeger(xy(xp(0)-1,1)) + 1 - if (opts) then - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ")" - else - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ") ; center=(" + \ - loc_param(0) + "," + loc_param(1) + \ - ") ; angle=" + angle - end if - - return(var2d) -end if - - -end - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/clean_ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/clean_ncl deleted file mode 100755 index 3a0b73ae44942a2454ba2e68db4cb894106dd4f0..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/clean_ncl +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "!!!! WARNING :: CLEAN_RANGS_FILES !!!!" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo -echo do you real want to delete high resolution -echo -echo coastline files for ncl ????? -echo -echo "(yes/no)" -read ANSWER -set -x -if [ "X$ANSWER" = "Xyes" ] -then -rm -fr ran* gs* -fi -rm -f *.lfi *.des *.nc -rm -f dirextract *cdl OUT* diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/dir_exnetcdf b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/dir_exnetcdf deleted file mode 100644 index 8f095894b9e202475f5a71954841fd0f925a65ad..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/dir_exnetcdf +++ /dev/null @@ -1,29 +0,0 @@ -16JAN.1.12B18.001cv -KCDL - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 -CONF - UT - VT - WT -ALT -THT -PABST -RVT -MRC -MRR -RIT -ACPRR -ZSBIS -END diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/get_ncl_highres_files b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/get_ncl_highres_files deleted file mode 100755 index 3b0e44937a9a0273c09a5f90f355d5601cb0011d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/get_ncl_highres_files +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -NCARG_RANGS=`pwd` -export NCARG_RANGS -echo -[ -f ~/.hluresfile ] || ( wget -c -nd http://www.ncl.ucar.edu/Document/Graphics/hluresfile ; mv hluresfile ~/.hluresfile ) -echo "You will download high resolution coastline files for NCL" -echo "in this directory:" -echo NCL_HIGHRES_FILES=$NCARG_RANGS -echo -set -x -cd $NCARG_RANGS -NCL_HIGHRES_URL="http://www2008.io-warnemuende.de/homepages/rfeistel/download" -export NCL_HIGHRES_URL -for file in rangs\(0\) rangs\(1\) rangs\(2\) \ - rangs\(3\) rangs\(4\) \ - gshhs\(0\) gshhs\(1\) gshhs\(2\) \ - gshhs\(3\) gshhs\(4\) -do -[ -f $file.zip ] || ( wget -c -nd $NCL_HIGHRES_URL/$file.zip ; unzip $file.zip ; ) -done - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_BasicMap1.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_BasicMap1.ncl deleted file mode 100644 index d5d82ee51d38b9232cdfd5b73b3276f8a7b92364..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_BasicMap1.ncl +++ /dev/null @@ -1,85 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -; ================================================; -begin -;=================================================; -; Open MESONH file -;=================================================; - mnh_file="16JAN.1.12B18.001cvKCL.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"ZSBIS") ; get some dimension sizes for the file - nd = dimsizes(mdims) - IMAX=mdims(nd-1) - JMAX=mdims(nd-2) - -;=================================================; -; Read some variables -;=================================================; - ZS = a->ZSBIS(0,:,:) - ZS@long_name="Orography" - ZS@units="m" - -;============================================== -; Use MESONHtools procedure to set projection -;============================================== - resmap = True - - lat2d = new((/JMAX,IMAX/),"double") - lat2d(:,:)=0. - lon2d = new((/JMAX,IMAX/),"double") - lon2d(:,:)=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; More map resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; highres version (must be donwloaded) - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 1. ; spacing for lat lines - resmap@mpGridLonSpacingF = 1. ; spacing for lon lines - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - -;=================================================; -; PLOT Orography (filled contour) -;=================================================; - -; Open workstation and define colormap -; ------------------------------------- - wks = gsn_open_wks("X11","plt_BasicMap1") ; open a ncgm file - gsn_define_colormap(wks,"topo_15lev") ; Choose colormap - -; General resources -; -------------------- - resmap@gsnMaximize = True ; to maximize size - resmap@gsnSpreadColors = True ; use full range of colormap - -; Contour resources -;------------------- - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,25,50,75,100,125,150,175,200,225,250,275,300/) - resmap@cnLevels = cnLevels - - -;=================================================; -; PLOT ZS -;=================================================; - plot = gsn_csm_contour_map(wks,ZS,resmap) - -end - - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_Cloud1.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_Cloud1.ncl deleted file mode 100644 index bacb0c30be93d65504984d48937173e31d7dae9f..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_Cloud1.ncl +++ /dev/null @@ -1,156 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -;===================================================================== -; Example of script to plot RVM, RCM, RRM and RIM on model levels -; from MESONH netcdf file generated with extractdia -;===================================================================== - -begin - -;=================================================; -; Open file -;=================================================; -; MESONH input file - mnh_file="16JAN.1.12B18.001cvKCL.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"ZSBIS") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1) - jmax=mdims(nd-2) - -;=================================================; -; We generate plots, but what kind do we prefer? -; For paper quality plot do not use ncgm or eps -; ps , pdf , x11 -;=================================================; -; type = "ps" - type = "x11" - -;=================================================; -; Open the workstation and choose colormap -;=================================================; - wks = gsn_open_wks(type,"plt_Cloud") - gsn_define_colormap(wks,"WhBlGrYeRe") ; overwrite the .hluresfile color map - -;=================================================; -; Read the variables we will need -;=================================================; -; Read water wapor mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RVT")) - qv = a->RVT(0,:,:,:) - qv = qv*1000. - qv@units = "g/kg" - qv@description="Water vapor mixing ratio" - end if - -; Read cloud mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"MRC")) - qc = a->MRC(0,:,:,:) - qc = qc - qc@units = "g/kg" - qc@description="Cloud mixing ratio" - end if - -; Read rain mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"MRR")) - qr = a->MRR(0,:,:,:) - qr = qr - qr@units = "g/kg" - qr@description="Rain mixing ratio" - end if - -; Read ice mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RIT")) - qi = a->RIT(0,:,:,:) - qi = qi*1000. - qi@units = "g/kg" - qi@description="Ice mixing ratio" - end if - -;============================================== -; Use MESONHtools procedure to set projection -;============================================== -; Define lat and lon before calling procedure MESONH_map_c -; It is also important to define correctly the units -;----------------------------------------------------------; - lat2d = new((/jmax,imax/),"double") - lat2d@units="degrees_north" - lat2d(:,:)=0. - lon2d = new((/jmax,imax/),"double") - lon2d@units="degrees_east" - lon2d(:,:)=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Call MESONH_map_c to define automatically map projection parameters -; Return lat2d, lon2d and corners variables -;-----------------------------------------------; - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Additional map resources -;=================================================; - - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpFillOn = False - -;=========================================================; -; Loop over levels by step of 5 -;=========================================================; - -do level = 0,19,5 ; LOOP OVER LEVELS - - display_level = level + 1 - -; Contour resources -;------------------- - opts = resmap - opts@cnFillOn = True - opts@cnLinesOn = False - - opts@tiMainString = "Model Level " + display_level - - -; Plot wapor mixing ratio if it exists -; ----------------------------------------- - if (isvar("qv")) - plot = gsn_csm_contour_map(wks,qv(level,:,:),opts) - end if - -; Plot cloud mixing ratio if it exists -; ----------------------------------------- - if (isvar("qc")) - plot = gsn_csm_contour_map(wks,qc(level,:,:),opts) - end if - -; Plot rain mixing ratio if it exists -; ----------------------------------------- - if (isvar("qr")) - plot = gsn_csm_contour_map(wks,qr(level,:,:),opts) - end if - -; Plot ice mixing ratio if it exists -; ----------------------------------------- - if (isvar("qi")) - plot = gsn_csm_contour_map(wks,qi(level,:,:),opts) - end if - - -end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_CrossSection1.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_CrossSection1.ncl deleted file mode 100644 index 296df7bfd077ad6e38b6783b7688ce5fc302ccf9..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_CrossSection1.ncl +++ /dev/null @@ -1,274 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -;========================================================================; -; Example script to plot vertical cross-section along a defined line from -; MESONH netcdf file generated with extractdia -;========================================================================; - - -begin - -;=================================================; -; Open file -;=================================================; -; MESONH netcdf input file generated by extractdia - mnh_file="16JAN.1.12B18.001cvKCL.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; We generate plots, but what kind do we prefer? -; For paper quality plot do not use ncgm or eps -;=================================================; - type = "x11" -; type = "ps" -; type = "pdf" -; type = "ps" - -;=================================================; -; Open the workstation and choose colormap -;=================================================; - wks = gsn_open_wks(type,"plt_CrossSection1") - gsn_define_colormap(wks,"topo_15lev") - - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"UT") ; get some dimension sizes for the file - nd = dimsizes(mdims) - -;=================================================; -; Read some variables from mnh_file -;=================================================; - ZS =a->ZSBIS(0,:,:) - - th = a->THT(0,:,:,:) - th@long_name="Potential Temperature" - th@description="TH" - - um = a->UT(0,:,:,:) - um@description="U" - - z= a->ALT(0,:,:,:) - z@description="Height" - - zmin = 0. - zmax = 6. ; We are only interested in the first 6km - nz = floattoint(zmax + 1) - -;=================================================; -; Use MESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; - - resmap=True - - lat2d = new(dimsizes(ZS),"double") - lat2d@units="degrees_north" - lat2d=0. - lon2d = new(dimsizes(ZS),"double") - lon2d@units="degrees_east" - lon2d=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Define Other Resources for map ploting -;=================================================; - resmap@gsnFrame = False - - resmap@mpFillOn = False - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - - resmap@cnFillOn = True - resmap@cnLinesOn = False - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,25,50,75,100,125,150,175,200,225,250,275,300/) - resmap@cnLevels = cnLevels - - FirstPlot = True - -;=================================================; -; Planes definition and interpolation -;=================================================; - do ip = 1, 3 ; we are doing 3 plots - ; all with the pivot point (plane) in the center of the domain - ; at angles 0, 45 and 90 - ; - ; | - ; angle=0 is | - ; | - ; -; Define the plane where the cross-section will be done -; ------------------------------------------------------ - plane = new(2,float) - plane = (/ mdims(nd-1)/2, mdims(nd-2)/2 /) ; pivot point is center of domain (x,y) - - opts = False - - if(ip .eq. 1) then - angle = 90. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - end if - if(ip .eq. 2) then - angle = 0. - X_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - X_desc = "latitude" - end if - if(ip .eq. 3) then - angle = 45. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - end if - -; Interpolate fields onto the defined plane -; -------------------------------------------- - um_plane = wrf_user_intrp3d(um,z,"v",plane,angle,opts) - th_plane = wrf_user_intrp3d(th,z,"v",plane,angle,opts) - - -; Find the index where 6km is - only need to do this once -;-------------------------------------------------------- - if ( FirstPlot ) then - zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts) - printVarSummary(zz) - b = ind(zz(:,0) .gt. zmax*1000. ) - zmax_pos = b(0) - 1 - if ( abs(zz(zmax_pos,0)-zmax*1000.) .lt. abs(zz(zmax_pos+1,0)-zmax*1000.) ) then - zspan = b(0) - 1 - else - zspan = b(0) - end if - delete(zz) - delete(b) - FirstPlot = False - end if - -; X-axis labels -;-------------- - dimsX = dimsizes(X_plane) - xmin = X_plane(0) - xmax = X_plane(dimsX(0)-1) - xspan = dimsX(0)-1 - nx = 2 - -; Options for XY Plots -;----------------------- - opts_xy = True - - opts_xy@gsnFrame = False - opts_xy@gsnDraw = False - - opts_xy@tiXAxisString = X_desc - opts_xy@tiYAxisString = "Height (km)" - opts_xy@tiXAxisFontHeightF = 0.020 - opts_xy@tiYAxisFontHeightF = 0.020 - -; Resources to plot the topography (missing values in fields) -;------------------------------------------------------------- - opts_xy@cnMissingValPerimOn = True - opts_xy@cnMissingValFillColor = "red" - opts_xy@cnMissingValFillPattern = 8 - -; Tickmarks / Labels -;--------------------- - opts_xy@tmXTOn = False - opts_xy@tmYROn = False - opts_xy@tmXBMode = "Explicit" - opts_xy@tmXBValues = fspan(0,xspan,nx) ; Create tick marks - opts_xy@tmXBLabels = sprintf("%.1f",fspan(xmin,xmax,nx)) ; Create labels - opts_xy@tmXBLabelFontHeightF = 0.015 - opts_xy@tmYLMode = "Explicit" - opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks - opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels - opts_xy@tmXBMajorLengthF = 0.02 - opts_xy@tmYLMajorLengthF = 0.02 - opts_xy@tmYLLabelFontHeightF = 0.015 - - opts_xy@lbAutoManage = False ; we control label bar - opts_xy@pmLabelBarWidthF = 0.5 ; - opts_xy@pmLabelBarHeightF = 0.1 ; - - -; Plotting options for U -;----------------------- - opts_um = opts_xy - opts_um@pmLabelBarOrthogonalPosF = -0.1 - opts_um@cnFillOn = True - opts_um@gsnRightStringParallelPosF = 0.1 - opts_um@gsnRightStringOrthogonalPosF = 0.01 - - -; Plotting options for Temperature -;--------------------------------- - opts_th = opts_xy - opts_th@cnInfoLabelZone = 1 - opts_th@cnInfoLabelSide = "Top" - opts_th@cnInfoLabelPerimOn = True - opts_th@cnInfoLabelOrthogonalPosF= -0.00005 - - opts_th@gsnLeftStringParallelPosF = 0.9 - opts_th@gsnLeftStringOrthogonalPosF = 0.01 - - -; Get the contour info for the th and um -;---------------------------------------- - contour_th = gsn_csm_contour(wks,th_plane(0:zmax_pos,:),opts_th) - contour_um = gsn_csm_contour(wks,um_plane(0:zmax_pos,:),opts_um) - -;================ -; MAKE PLOTS -;================ - -; Horizontal plot with topography -;----------------------------------------------------------------------- - plot=gsn_csm_contour_map(wks,ZS,resmap) - -; Draw line that shows the position of the cross section -;-------------------------------------------------------- - lat_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - lon_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - - lnres = True - lnres@gsLineThicknessF = 3.0 - lnres@gsLineColor = "Red" - do ii = 0,dimsX(0)-2 - gsn_polyline(wks,plot,(/lon_plane(ii),lon_plane(ii+1)/),(/lat_plane(ii),lat_plane(ii+1)/),lnres) - end do - frame(wks) - delete(lon_plane) - delete(lat_plane) - - pltres = True - pltres@FramePlot = True - - -; Draw Vertical cross-section -;-------------------------- - - overlay(contour_um,contour_th) ; plot x-section - draw(contour_um) - frame(wks) - - -; Delete options and fields, so we don't have carry over -;------------------------------------------------------ - delete(opts_xy) - delete(opts_th) - delete(opts_um) - delete(th_plane) - delete(um_plane) - delete(X_plane) - -end do ; make next cross section - - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_ModelLevels1.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_ModelLevels1.ncl deleted file mode 100644 index 33f908fbf4345033191cc182b73ef9a669e7cde2..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_ModelLevels1.ncl +++ /dev/null @@ -1,229 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "MESONHtools.ncl" - -;=================================================; -; Example of script to plot field on model levels from MESONH netcdf file -; generated with extractdia -;=================================================; - -begin -;=================================================; -; Open file -;=================================================; -; The MESONH input file. - mnh_file="16JAN.1.12B18.001cvKCL.nc" - a = addfile(mnh_file,"r") - -;==================================================; -; Open the workstation and choose colormap -;==================================================; - type = "x11" - wks = gsn_open_wks(type,"plt_ModelLevels1") - gsn_define_colormap(wks,"rainbow+gray") - -;=================================================; -; Read the variables we need -;=================================================; - th = a->THT(0,:,:,:) ; theta - th@description="Potential Temperature" - - qv = a->RVT(0,:,:,:) ; Qv - qv = qv*1000. - qv@units = "g/kg" - qv@description="Water vapor mixing ratio" - - u = a->UT(0,:,:,:) ; u - u@description="U" - - v = a->VT(0,:,:,:) ; v - v@description="V" - -; Calculate wind speed -;------------------------ - spd = (u*u + v*v)^(0.5) ; speed in m/sec - spd@description = "Wind Speed" - spd@units = "m/s" - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = dimsizes(th) - nd=dimsizes(mdims) - imax=mdims(nd-1) - jmax=mdims(nd-2) - kmax=mdims(nd-3) - -;=================================================; -; Use MESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; - lat2d = new((/jmax,imax/),"double") - lat2d@units="degrees_north" - lat2d=0. - - lon2d = new((/jmax,imax/),"double") - lon2d@units="degrees_east" - lon2d=0. - - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - - resmap=True - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Set some other basic resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; highres map data version - resmap@mpFillOn = False - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - -;=========================================================; -; Loop over levels by step of 20 -;=========================================================; - dimsv = dimsizes(th) ; Get number of levels - do level =0,dimsv(0)-1,20 ; LOOP OVER LEVELS - -; Title -;-------- - display_level = level + 1 - resmap@tiMainString = "Model Level " + display_level - - -;======================= -; Resources for Theta -;======================= - opts = resmap - opts@gsnDraw = False ; don't draw yet - opts@gsnFrame = False ; don't advance frame yet - - opts@gsnContourLineThicknessesScale = 2.0 - - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = -0.05 - opts@cnInfoLabelParallelPosF = 0.97 - - contour = gsn_csm_contour_map(wks,th(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;====================== -; Resources for Qv -;====================== - opts = resmap - - opts@gsnFrame = False - opts@gsnDraw = False - - opts@gsnSpreadColors = True - opts@gsnSpreadColorStart = 30 - opts@gsnSpreadColorEnd = -2 - - opts@cnLineColor = "Blue" - opts@cnFillOn = True - - contour = gsn_csm_contour_map(wks,qv(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;=============================================== -; Overlay Wind Vectors and Speed over basic map -;=============================================== - -;======================= -; 1.Create Base map plot -;======================= - - resmap@gsnDraw = False ; don't draw yet - resmap@gsnFrame = False ; don't advance frame yet - - map=gsn_map(wks,"Stereographic",resmap) - -;======================= -; 2.Create Wind speed plot -;======================= - opts_ws = True - -; General resources -;------------------- - opts_ws@gsnFrame = False - opts_ws@gsnDraw = False - opts_ws@gsnSpreadColors = True - opts_ws@gsnSpreadColorStart = 30 - opts_ws@gsnSpreadColorEnd = -2 - -; Tickmark resources -;--------------------- -; No tickmark and label on axis for this plot -; They are already drawn by the basic map plot -; ------------------------------------------- - opts_ws@tmXBOn = False - opts_ws@tmYROn = False - opts_ws@tmXBLabelsOn = False - opts_ws@tmYRLabelsOn = False - - opts_ws@lbOrientation = "Vertical" - -; Transformation resources -;--------------------------- -; Field is already on the right projection -;------------------------------------------ - opts_ws@tfDoNDCOverlay = True - -; Contour resources -; ------------------- - opts_ws@cnFillOn = True - opts_ws@cnLinesOn = False - -; PLOT -;----- - contour = gsn_csm_contour(wks,spd(level,:,:),opts_ws) - -;=========================== -; 3.Create Wind vector plot -;=========================== - opts_vec = True - - opts_vec@gsnFrame = False - opts_vec@gsnDraw = False - opts_vec@gsnLeftString = "Wind Vector" - opts_vec@gsnLeftStringParallelPosF = 0.3 - opts_vec@gsnLeftStringOrthogonalPosF = 0.018 - -; No Tickmarks/labels -;------------- - opts_vec@tmXBOn = False - opts_vec@tmYROn = False - opts_vec@tmXBLabelsOn = False - opts_vec@tmYRLabelsOn = False - - opts_vec@tfDoNDCOverlay = True - -; Vector resources -;------------------- - opts_vec@vcRefLengthF = 0.1 - opts_vec@vcRefMagnitudeF = 25 - opts_vec@vcMinDistanceF = 0.05 - - -; PLOT -;----- - vector = gsn_csm_vector(wks,u(level,:,:),v(level,:,:),opts_vec) - -;=================== -; 4.Overlay and draw -;=================== - overlay(map,contour) - overlay(map,vector) - - draw(map) - frame(wks) - - - end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_PressureLevel1.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_PressureLevel1.ncl deleted file mode 100644 index 6cb84caef690c632db1c2e06fa1576f0ceda8ed2..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/mnh_PressureLevel1.ncl +++ /dev/null @@ -1,203 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -;======================================================================; -; Example script to interpolate from model to pressure level and -; to plot some fields from MESONH netcdf file generated with extractdia -;======================================================================; - -begin - -;=======================================================; -; Pressure levels that we want the data interpolated to -;=======================================================; - pressure_levels = (/ 850., 700., 500., 300./) - nlevels = dimsizes(pressure_levels) ; number of pressure levels - -;=================================================; -; Open file -; MESONH netcdf input file generated with extractdia -;=================================================; - mnh_file="16JAN.1.12B18.001cvKCL.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf and x11 (for debugging) -;==================================================; - type = "x11" - wks = gsn_open_wks(type,"plt_PressureLevel2") - gsn_define_colormap(wks,"spread_15lev") - -;=================================================; -; Read the variables we need -;=================================================; - tk = a->THT(0,:,:,:) ; potential temperature - tk@description="Potential Temperature" - - u = a->UT(0,:,:,:) ; u - - v = a->VT(0,:,:,:) ; v - - p = a->PABST(0,:,:,:) ; pressure - p@description="Pressure" - - rv = a->RVT(0,:,:,:)*1000 ; water vapor mixing ratio - rv@description="Water vapor mixing ratio" - - ZS = a->ZSBIS(0,:,:) ; terrain - - z = a->ALT(0,:,:,:) ; heigth - z@description="Height" - - -;=================================================; -; Horizontal interpolation on pressure levels -;=================================================; - do level = 0,nlevels-1 ; LOOP OVER LEVELS - - pressure = pressure_levels(level) - - tk_plane = wrf_user_intrp3d(tk,p,"h",pressure,0.,False) - z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) - u_plane = wrf_user_intrp3d( u,p,"h",pressure,0.,False) - v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False) - rv_plane = wrf_user_intrp3d( rv,p,"h",pressure,0.,False) - - spd_plane = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec - spd_plane@description = "Wind Speed" - spd_plane@units = "m/s" - - u_plane@units = "m/s" - v_plane@units = "m/s" - - -;================================== -; Create plots using wrf functions -;================================== - res=True - res@MainTitle = "MESONH" - res@Footer = False - - -; Plotting options for Tk -;------------------------ - opts = res - opts@cnLineColor = "Red" -; opts@ContourParameters = (/ 0.1 /) - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 2.0 - contour_tk = wrf_contour(a,wks,tk_plane,opts) - delete(opts) - - -; Plotting options for RV -;-------------------------- - opts = res - - opts@cnFillOn = True - opts@cnMissingValFillColor = "Red" - opts@cnMissingValFillPattern = 8 - - opts@pmLabelBarOrthogonalPosF = -0.1 - - contour_rv = wrf_contour(a,wks,rv_plane,opts) - delete(opts) - - -; Plotting options for Wind Speed -;-------------------------------- - opts = res - - opts@gsnContourLineThicknessesScale = 3.0 - - opts@cnLineColor = "MediumSeaGreen" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - - contour_spd = wrf_contour(a,wks,spd_plane,opts) - delete(opts) - - -; Plotting options for Wind Vectors -;---------------------------------- - opts = res - - opts@FieldTitle = "Wind" ; overwrite Field Title - opts@NumVectors = 47 ; wind barb density - - vector = wrf_vector(a,wks,u_plane,v_plane,opts) - delete(opts) - - -; Plotting options for Geopotential Heigh -;---------------------------------------- - opts_z = res - opts_z@gsnContourLineThicknessesScale = 2.0 - opts_z@cnLineColor = "Blue" - - -;============ -; MAKE PLOTS -;============ - pltres = True - -; Resources for map -;--------------------- - resmap = True - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - resmap@mpGeophysicalLineThicknessF = 2.0 - resmap@mpGridLineThicknessF = 2.0 - resmap@mpLimbLineThicknessF = 2.0 - resmap@mpNationalLineThicknessF = 2.0 - resmap@mpGridAndLimbOn = False ; turn off lat/lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data - - -; Overlay rv , tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 850 ) then ; plot temp, rv, height, wind barbs - - contour_height = wrf_contour(a,wks,z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_rv,contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 700 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 500 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay wind speed , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 300 ) then ; plot windspeed, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_spd,contour_height, \ - vector/),pltres,resmap) - end if - - delete(opts_z) - - end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/run_ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/run_ncl deleted file mode 100755 index 9174f368ac2931dfdf8614b102757af1fa2c14e1..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_extractdia/run_ncl +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -#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 -#### Get highres coastline data for ncl -./get_ncl_highres_files -#### MNH file to convert in netcdf -ln -sf ../010_conv2dia/16JAN.1.12B18.001cv.lfi . -#### Conversion to netcdf using extractdia -${POSTRUN} extractdia < dir_exnetcdf -# Initializing ncl variables and path -path_ncl=`which ncl` -if [ "$path_ncl" == "" ] -then -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "! ERROR: NCL is not installed or the path to !" -echo "! ncl binary is not set correctly !" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -exit -fi -export NCARG_ROOT=${path_ncl%%/bin/ncl} -export PATH=$NCARG_ROOT/bin:$PATH -export NCARG_RANGS=. -#### Running ncl scripts -ncl mnh_BasicMap1.ncl -ncl mnh_ModelLevels1.ncl -ncl mnh_Cloud1.ncl -ncl mnh_CrossSection1.ncl -ncl mnh_PressureLevel1.ncl diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/MESONHtools.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/MESONHtools.ncl deleted file mode 100644 index 9cae6400a0dade82e20ba68463722fbb13d4c81d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/MESONHtools.ncl +++ /dev/null @@ -1,915 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" - -;------------------------------------------------------------- -;contains: -; procedure MESONH_map_c -;function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) -;function mnh_map_overlays(in_file[1]:file,wks:graphic,plots[*]:graphic, \ -; opt_arg[1]:logical,opt_mp[1]:logical) -;function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;------------------------------------------------------------- - -;============================================================== -; J.-P. CHABOUREAU -; This is a driver that selects the appropriate -; mapping function based upon the file variables RPK, BETA, LATOR, LONOR -; -; -; Sample usage: -; a = addfile("...", r") -; IMAX = a->IMAX -; JMAX = a->JMAX -; lat2d = new((/JMAX,IMAX/),"double") -; lat2d(:,:)=0. -; lon2d = new((/JMAX,IMAX/),"double") -; lon2d(:,:)=0. -; icorners = new((/2,2/),"integer") -; icorners(:,:)=0 -; res = True -; MESONH_map_c (a, res, lat2d, lon2d, icorners) -; -; -undef("MESONH_map_c") -;============================================================== -procedure MESONH_map_c (in_file:file, res:logical, plat, plon, icorner) -;============================================================== -;local rank, dimll, nlat, mlon, lat, lon -local rank, dimll, nlat, mlon -begin - -; Check if the variable RPK is in the file -; ---------------------------------------- -if(isfilevar(in_file,"RPK")) then - -; Read projection parameters -; ------------------------- - ZRPK = in_file->RPK - ZLATOR = in_file->LATOR - ZLONOR = in_file->LONOR - ZBETA = in_file->BETA - ZLAT0 = in_file->LAT0 - ZLON0 = in_file->LON0 - -; Case netcdf from lfi2cdf -; ------------------------- - - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - -; unstagger - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - - else - -; Case netcdf from extractdia -; --------------------------- - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - - end if - - print ("LATOR="+ZLATOR+" - LONOR="+ZLONOR) - print ("ZLAT0="+ZLAT0+" - ZLON0="+ZLON0) - print ("ZDX="+zdx+" - RPK="+ZRPK+" - BETA="+ZBETA) - print ("IMAX="+IMAX+" - JMAX="+JMAX) - - if (ZRPK.gt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = 90. - end if - - if (ZRPK.lt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = -90. - end if - - if (ZRPK.eq.0) then - ; Mercator projection -; --------------------------- - res@mpProjection = "Mercator" - end if - - print("Map projection="+res@mpProjection) - -else - print ("MESONH_map_c: Error no RPK variable in input file") -end if - -;=================================================; -; calculate 2D lat and lon -; based on src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - -; Constants -; ----------- - if(isfilevar(in_file,"IMAX")) - XRADIUS=6371229.0d ; Earth radius (meters) - else - XRADIUS=6371.2290d ; Earth radius (km) - end if - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - -;=================================================; - if (ZRPK.eq.0) then -; MERCATOR -;=================================================; - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - plon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - plat(jj,ji)=zlat - end do - end do - -;=================================================; - else -; STEREOGRAPHIC PROJECTION -;=================================================; - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - plon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - plat(jj,ji)=zlat - end do - end do - - end if - -; Defining the corners of the domain -;==================================== - if (icorner(0,0).eq.icorner(1,1)) then - icorner(0,0)=0 - icorner(1,0)=JMAX-1 - icorner(0,1)=0 - icorner(1,1)=IMAX-1 - end if -; print ("icorner"+icorner) - - res@mpLimitMode = "Corners" - res@mpLeftCornerLatF = plat(icorner(0,0),icorner(0,1)) - res@mpLeftCornerLonF = plon(icorner(0,0),icorner(0,1)) - res@mpRightCornerLatF = plat(icorner(1,0),icorner(1,1)) - res@mpRightCornerLonF = plon(icorner(1,0),icorner(1,1)) - -; print ("Corner (0,0); Lat="+res@mpLeftCornerLatF+ \ -; ", Lon="+res@mpLeftCornerLonF) -; print ("Oppos corner; Lat="+res@mpRightCornerLatF+ \ -; ", Lon= "+res@mpRightCornerLonF) - -;========================================== -; Turn on lat / lon labeling -;========================================== - res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - res@mpOutlineBoundarySets = "AllBoundaries" ; state boundaries - res@mpPerimDrawOrder = "PostDraw" ; force map perim -;========================================== -; Needed for regional native projection -;========================================== - res@tfDoNDCOverlay = True - res@gsnAddCyclic = False ; regional data - -end - -;=========================================== -;------------------------------------------------------------------------ -undef("MESONH_pinter") -function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;************************************************************************* -; S. BIELLI -; This is a routine that interpolate fields on pressure level for plotting -; based on pinter.f90 -; The field to be interpolated must be given at the mass point (grid 1) -; usage : var_inter=MESONHfunction(var_to_interpol, 850., AbsPressure) -; Abs pressure must be in Pa -; - -begin - - dimL= dimsizes(loc_param) - -; First test for grid = 0 - - dimp=dimsizes(ppabs) - - pout=pfield(0:dimL-1,:,:) - pfield@_FillValue=999 - pout@_FillValue=999 - pout=pout@_FillValue - - do jkp = 0, dimL-1 - zref=log10(loc_param(jkp)*100.) - do jloop = 0, dimp(1)-1 - do iloop = 0, dimp(2)-1 - kloop=0 - flag=True - do while (flag .and. (kloop.lt.(dimp(2)-2))) - if (.not.ismissing(ppabs(kloop,jloop,iloop))) then - zxm=log10(ppabs(kloop,jloop,iloop)) - zxp=log10(ppabs(kloop+1,jloop,iloop)) - if ((zxp-zref)*(zref-zxm) .ge. 0) then - pout(jkp,jloop,iloop)= (pfield(kloop,jloop,iloop)*(zxp-zref)+ \ - pfield(kloop+1,jloop,iloop)*(zref-zxm))/ (zxp-zxm) - flag=False - end if - end if - kloop=kloop+1 - end do - end do - end do - end do - - return(pout) - -end - -;-------------------------------------------------------------------------------- -undef("mnh_map") -function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) - -begin -; -; This function creates a map plot, and bases the projection on -; the MAP_PROJ attribute in the given file. -; -; 1. Make a copy of the resource list, and set some resources -; common to all map projections. -; -; 2. Determine the projection being used, and set resources based -; on that projection. -; -; 3. Create the map plot, and draw and advance the frame -; (if requested). - - opts = opt_args ; Make a copy of the resource list - opts = True - -; Set some resources depending on what kind of map projection is -; chosen. -; -; ZRPK != 0 : "Stereographic" -; ZRPK = 0 : "Mercator" -;=================================================; -; src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - XRADIUS=6371229.0d ; Earth radius (meters) - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - - if(isfilevar(in_file,"RPK")) - ZRPK=in_file->RPK - ZLON0=in_file->LON0 - ZLAT0=in_file->LAT0 - ZLATOR=in_file->LATOR - ZLONOR=in_file->LONOR - ZBETA=in_file->BETA - else - print ("mnh_map: Error no RPK variable in input file") - return(new(1,graphic)) - end if - -; Case netcdf from lfi2cdf - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - else -; Case netcdf from extractdia - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - end if -; - - lat = new((/JMAX,IMAX/),"double") - lon = new((/JMAX,IMAX/),"double") - - -; Stereographic projection - if(ZRPK .gt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", 90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - - if(ZRPK .lt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", -90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - -; Mercator projection - if(ZRPK .eq. 0) - projection = "Mercator" - end if - - opts@mpNestTime = get_res_value_keep(opts, "mpNestTime",0) - - -; LAT and LON are not saved in the file - if (ZRPK.eq.0) then - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - lon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - lat(jj,ji)=zlat - end do - end do - else - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - lon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - lat(jj,ji)=zlat - end do - end do - end if - - dims = dimsizes(lat) - - do ii = 0, dims(0)-1 - do jj = 0, dims(1)-1 - if ( lon(ii,jj) .lt. 0.0) then - lon(ii,jj) = lon(ii,jj) + 360. - end if - end do - end do - - opts@start_lat = lat(0,0) - opts@start_lon = lon(0,0) - opts@end_lat = lat(dims(0)-1,dims(1)-1) - opts@end_lon = lon(dims(0)-1,dims(1)-1) - - -; Set some resources common to all map projections. - opts = set_mp_resources(opts) - - if ( isatt(opts,"ZoomIn") .and. opts@ZoomIn ) then - y1 = 0 - x1 = 0 - y2 = dims(0)-1 - x2 = dims(1)-1 - if ( isatt(opts,"Ystart") ) then - y1 = opts@Ystart - delete(opts@Ystart) - end if - if ( isatt(opts,"Xstart") ) then - x1 = opts@Xstart - delete(opts@Xstart) - end if - if ( isatt(opts,"Yend") ) then - if ( opts@Yend .le. y2 ) then - y2 = opts@Yend - end if - delete(opts@Yend) - end if - if ( isatt(opts,"Xend") ) then - if ( opts@Xend .le. x2 ) then - x2 = opts@Xend - end if - delete(opts@Xend) - end if - - opts@mpLeftCornerLatF = lat(y1,x1) - opts@mpLeftCornerLonF = lon(y1,x1) - opts@mpRightCornerLatF = lat(y2,x2) - opts@mpRightCornerLonF = lon(y2,x2) - - if ( opts@mpRightCornerLonF .lt. 0.0 ) then - opts@mpRightCornerLonF = opts@mpRightCornerLonF + 360.0 - end if - - delete(opts@ZoomIn) - end if - - -; The default is not to draw the plot or advance the frame, and -; to maximize the plot in the frame. - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", False) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", False) - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - delete_attrs(opts) ; Clean up. - mp = gsn_map(wks,projection,opts) ; Create map plot. - - return(mp) ; Return. - -end - -;-------------------------------------------------------------------------------- - -undef("mnh_map_overlays") -function mnh_map_overlays(in_file[1]:file, \ - wks:graphic, \ - plots[*]:graphic, \ - opt_arg[1]:logical, \ - opt_mp[1]:logical) - -; Based on wrf_map_overlays -; -; This procedure takes an array of plots and overlays them on a -; base plot - map background. -; -; It will advance the plot and cleanup, unless you set the -; PanelPlot resource to True. -; -; Attributes recognized by this procedure: -; FramePlot -; PanelPlot -; NoTitles (don't do any titles) -; CommonTitle & PlotTile is used to overwrite field titles -; CommonTitle will super-seed NoTitles -; -; If FramePlot False, then Draw the plot but do not Frame. -; In this case a user want to add to the drawing, and will -; have to advance the Frame manually in the script. -; -; If the "NoTitles" attribute exists and is set True, then -; don't create the top-left titles, and leave the main titles alone. -; This resource can be useful if you are planning to panel -; the plots. -; -; If PanelPlot is set to True, then this flags to wrf_map_overlays -; that these plots are going to be eventually paneled (likely -; by gsn_panel), and hence 1) draw and frame should not be called -; (unless gsnDraw and/or gsnFrame are explicitly set to True), -; and 2) the overlays and titles should not be removed with -; NhlRemoveOverlay and NhlRemoveAnnotation. -; -begin - - opts = opt_arg ; Make a copy of the resource lists - opt_mp_2 = opt_mp - - ; Let's make the map first - base = mnh_map(wks,in_file,opt_mp_2) - - no_titles = get_res_value(opts,"NoTitles",False) ; Do we want field titles? - com_title = get_res_value(opts,"CommonTitle",False) ; Do we have a common title? - if ( com_title ) then - plot_title = get_res_value(opts,"PlotTitle"," ") - no_titles = True - end if - - call_draw = True - call_frame = get_res_value(opts,"FramePlot",True) ; Do we want to frame the plot? - panel_plot = get_res_value(opts,"PanelPlot",False) ; Are we paneling? - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - nplots = dimsizes(plots) -; font_color = "Black" - - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then -; class_name = NhlClassName(plots(i)) -; print(class_name) -; if(class_name.eq."contourPlotClass") then -; getvalues plots(i) -; "cnFillOn" : fill_on -; "cnLineColor" : line_color -; end getvalues -; if (.not.fill_on) then -; font_color = line_color -; end if -; end if - if(.not.no_titles) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - if(i.eq.0) then - SubTitles = SubTitle - else - SubTitles = SubTitles + "~C~" + SubTitle - end if - end if - if(com_title .and. i .eq. nplots-1) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - SubTitles = plot_title - end if - setvalues plots(i) - "tfDoNDCOverlay" : True - "tiMainOn" : False - end setvalues - overlay(base,plots(i)) - else - print("mnh_map_overlays: Warning: overlay plot #" + i + " is not valid.") - end if - end do - - if(.not.no_titles .or. com_title) then - font_height = get_res_value_keep(opts,"FontHeightF",0.01) - txt = create "map_titles" textItemClass wks - "txString" : SubTitles - "txFontHeightF" : font_height - ;"txFontColor" : font_color - end create - anno = NhlAddAnnotation(base,txt) - setvalues anno - "amZone" : 3 - "amJust" : "BottomLeft" - "amSide" : "Top" - "amParallelPosF" : 0.005 - "amOrthogonalPosF" : 0.03 - "amResizeNotify" : False - end setvalues - base@map_titles = anno - end if -; -; gsnDraw and gsnFrame default to False if panel plot. -; - if(panel_plot) then - call_draw = False - call_frame= False - end if - - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", call_draw) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", call_frame) - - draw_and_frame(wks,base,opts@gsnDraw,opts@gsnFrame,False, \ - opts@gsnMaximize) - - if(.not.panel_plot) then - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then - NhlRemoveOverlay(base,plots(i),False) - else - print("wrf_remove_map_overlays: Warning: overlay plot #" + i + " is not valid.") - print(" Nothing to remove.") - end if - end do - end if - - if(.not.no_titles.and..not.panel_plot) then - if(isatt(base,"map_titles")) then - NhlRemoveAnnotation(base,base@map_titles) - delete(base@map_titles) - end if - end if - -return(base) -end - -;-------------------------------------------------------------------------------- -undef("wrf_user_intrp3d") -function wrf_user_intrp3d( var3d:numeric, z_in:numeric, \ - plot_type:string, \ - loc_param:numeric, angle:numeric, opts:logical ) - -; var3d - 3d field to interpolate (all input fields must be unstaggered) -; z_in - interpolate to this field (either p/z) -; plot_type - interpolate horizontally "h", or vertically "v" -; loc_param - level(s) for horizontal plots (eg. 500hPa ; 3000m - scalar), -; plane for vertical plots (2 values representing an xy point -; on the model domain through which the vertical plane will pass -; OR 4 values specifying start and end values -; angle - 0.0 for horizontal plots, and -; an angle for vertical plots - 90 represent a WE cross section -; opts Used IF opts is TRUE, else use loc_param and angle to determine crosssection - -begin - - - if(plot_type .eq. "h" ) then ; horizontal cross section needed - - dimL = dimsizes(loc_param) - - dims = dimsizes(var3d) - nd = dimsizes(dims) - - dimX = dims(nd-1) - dimY = dims(nd-2) - dimZ = dims(nd-3) - dim4 = 1 - dim5 = 1 - if ( nd .eq. 4 ) then - dim4 = dims(nd-4) - end if - if ( nd .eq. 5 ) then - dim4 = dims(nd-4) - dim5 = dims(nd-5) - end if - - var3 = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - z = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - var2d = new ( (/ dim5, dim4, dimL, dimY, dimX /) , typeof(var3d) ) - - if ( nd .eq. 5 ) then - var3 = var3d - z = z_in - end if - if ( nd .eq. 4 ) then - var3(0,:,:,:,:) = var3d(:,:,:,:) - z(0,:,:,:,:) = z_in(:,:,:,:) - end if - if ( nd .eq. 3 ) then - var3(0,0,:,:,:) = var3d(:,:,:) - z(0,0,:,:,:) = z_in(:,:,:) - end if - - - if ( z(0,0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z(0,0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z = z * 0.01 - end if - if ( loc_param(0) .gt. 2000. ) then - ; looks like the input was specified in Pa - change this - loc_param = loc_param * 0.01 - end if - end if - - do il = 0,dimL-1 - var = wrf_interp_3d_z(var3,z,loc_param(il)) - var2d(:,:,il,:,:) = var(:,:,:,:) - end do - - copy_VarAtts(var3d,var3) - if(isatt(var3,"description")) then - delete_VarAtts(var3,(/"description"/)) - end if - if(isatt(var3,"units")) then - delete_VarAtts(var3,(/"units"/)) - end if - if(isatt(var3,"MemoryOrder")) then - delete_VarAtts(var3,(/"MemoryOrder"/)) - end if - if(isatt(var3,"_FillValue")) then - delete_VarAtts(var3,(/"_FillValue"/)) - end if - copy_VarAtts(var3,var2d) - - nn = nd-2 - var2d!nn = "plevs" - - if ( dimL .gt. 1 ) then - if ( nd .eq. 5 ) then - return( var2d ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,:,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,:,:,:) ) - end if - else - if ( z(0,0,0,0,0) .gt. 500.) then - var2d@PlotLevelID = loc_param + " hPa" - else - var2d@PlotLevelID = .001*loc_param + " km" - end if - if ( nd .eq. 5 ) then - return( var2d(:,:,0,:,:) ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,0,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,0,:,:) ) - end if - end if - - - end if - - - - - if(plot_type .eq. "v" ) then ; vertical cross section needed - - dims = dimsizes(var3d) - if ( dimsizes(dims) .eq. 4 ) then - if ( z_in(0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in(0,:,:,:) - else - if ( z_in(0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in - end if - -; set vertical cross section - if (opts) then - xy = wrf_user_set_xy( z, loc_param(0)-1, loc_param(1)-1, \ ; the -1 is for NCL dimensions - loc_param(2)-1, loc_param(3)-1, \ - angle, opts ) - else - xy = wrf_user_set_xy( z, loc_param(0), loc_param(1), \ - 0.0, 0.0, angle, opts ) - end if - xp = dimsizes(xy) - - -; first we interp z - var2dz = wrf_interp_2d_xy( z, xy) - -; interp to constant z grid - if(var2dz(0,0) .gt. var2dz(1,0) ) then ; monotonically decreasing coordinate - z_max = floor(max(z)/10)*10 ; bottom value - z_min = ceil(min(z)/10)*10 ; top value - dz = 1. - nlevels = tointeger( (z_max-z_min)/dz) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_max - dz = -dz - else - z_max = max(z) - z_min = 0. -;; MODI SOLINE -; dz = 0.01 * z_max - dz = 0.001 * z_max - nlevels = tointeger( z_max/dz ) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_min - end if -; print("nlevels="+nlevels) -; print("dz="+dz) - - do i=1, nlevels-1 - z_var2d(i) = z_var2d(0)+i*dz - end do - - -; interp the variable - if ( dimsizes(dims) .eq. 4 ) then - var2d = new( (/dims(0), nlevels, xp(0)/), typeof(var2dz)) - do it = 0,dims(0)-1 - var2dtmp = wrf_interp_2d_xy( var3d(it,:,:,:), xy) - do i=0,xp(0)-1 - var2d(it,:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - end do - var2d!0 = var3d!0 - var2d!1 = "Vertical" - var2d!2 = "Horizontal" - else - var2d = new( (/nlevels, xp(0)/), typeof(var2dz)) - var2dtmp = wrf_interp_2d_xy( var3d, xy) - do i=0,xp(0)-1 - var2d(:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - var2d!0 = "Vertical" - var2d!1 = "Horizontal" - end if - - - st_x = tointeger(xy(0,0)) + 1 - st_y = tointeger(xy(0,1)) + 1 - ed_x = tointeger(xy(xp(0)-1,0)) + 1 - ed_y = tointeger(xy(xp(0)-1,1)) + 1 - if (opts) then - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ")" - else - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ") ; center=(" + \ - loc_param(0) + "," + loc_param(1) + \ - ") ; angle=" + angle - end if - - return(var2d) -end if - - -end - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/clean_ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/clean_ncl deleted file mode 100755 index bb0f6a460def102235c5996a0665357b2d569eb9..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/clean_ncl +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "!!!! WARNING :: CLEAN_RANGS_FILES !!!!" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo -echo do you real want to delete high resolution -echo -echo coastline files for ncl ????? -echo -echo "(yes/no)" -read ANSWER -set -x -if [ "X$ANSWER" = "Xyes" ] -then -rm -fr ran* gs* -fi -rm -f *.lfi *.cdf diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/get_ncl_highres_files b/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/get_ncl_highres_files deleted file mode 100755 index 3b0e44937a9a0273c09a5f90f355d5601cb0011d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/get_ncl_highres_files +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -NCARG_RANGS=`pwd` -export NCARG_RANGS -echo -[ -f ~/.hluresfile ] || ( wget -c -nd http://www.ncl.ucar.edu/Document/Graphics/hluresfile ; mv hluresfile ~/.hluresfile ) -echo "You will download high resolution coastline files for NCL" -echo "in this directory:" -echo NCL_HIGHRES_FILES=$NCARG_RANGS -echo -set -x -cd $NCARG_RANGS -NCL_HIGHRES_URL="http://www2008.io-warnemuende.de/homepages/rfeistel/download" -export NCL_HIGHRES_URL -for file in rangs\(0\) rangs\(1\) rangs\(2\) \ - rangs\(3\) rangs\(4\) \ - gshhs\(0\) gshhs\(1\) gshhs\(2\) \ - gshhs\(3\) gshhs\(4\) -do -[ -f $file.zip ] || ( wget -c -nd $NCL_HIGHRES_URL/$file.zip ; unzip $file.zip ; ) -done - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_BasicMap2.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_BasicMap2.ncl deleted file mode 100644 index a62d71ec055b971f498dafcad8cb2ada60d4377e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_BasicMap2.ncl +++ /dev/null @@ -1,94 +0,0 @@ -;================================================; -; Always load these files in the same order -; ----------------------------------------- -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -begin -;=================================================; -; Open file -;=================================================; - mnh_file="16JAN.1.12B18.001.cdf" - a = addfile(mnh_file, "r") - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"ZS") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - -;=================================================; -; Read some variables frm mnh_file -;=================================================; - ZS = a->ZS(1:jmax,1:imax) - ZS@long_name="Orography" - ZS@units="m" - - Z=a->ZHAT - Y=a->YHAT(1:jmax) - X=a->XHAT(1:imax) - -;=================================================; -; Use MESONHtools procedure to set projection info -;=================================================; - resmap = True ; plot mods desired - - imax = a->IMAX - jmax = a->JMAX - lat2d = new((/jmax,imax/),"double") - lat2d(:,:)=0. - lon2d = new((/jmax,imax/),"double") - lon2d(:,:)=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Map resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - - resmap@mpGeophysicalLineThicknessF = 2.0 - -;=================================================; -; Plot Orography (ZS) (filled contour) -;=================================================; - -; Open workstation and define colormap -; ------------------------------------- - wks = gsn_open_wks("x11","plt_BasicMap2") ; open a X11 - gsn_define_colormap(wks,"topo_15lev") ; Choose colormap - -; General resources -; -------------------- - resmap@gsnMaximize = True ; to maximize size - resmap@gsnSpreadColors = True ; use full range of colormap - -; Contour resources -; -------------------- - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,25,50,75,100,125,150,175,200,225,250,275,300/) - resmap@cnLevels = cnLevels - - resmap@lbOrientation = "Vertical" - -; Plot -; ----- - plot = gsn_csm_contour_map(wks,ZS,resmap) - -end - - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_Cloud2.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_Cloud2.ncl deleted file mode 100644 index a46a6512923ecfdd69d73f1bcdd7a2898c6f1cb8..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_Cloud2.ncl +++ /dev/null @@ -1,155 +0,0 @@ - -; Example script to produce plots for a WRF real-data run, -; with the ARW coordinate dynamics option. - -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -begin -;=================================================; -; Open file -;=================================================; -; MESONH input file - mnh_file="16JAN.1.12B18.001.cdf" - a = addfile(mnh_file, "r") - -;==================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use type= ps or pdf or x11 (for debugging) -;==================================================; - - type = "x11" - wks = gsn_open_wks(type,"plt_Cloud2") - gsn_define_colormap(wks,"WhBlGrYeRe") ; overwrite the .hluresfile color map - -;=================================================; -; Get informations on variable sizes -;=================================================; - - mdims = getfilevardimsizes(a,"RVT") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - kmax=mdims(nd-3)-2 -; -2 : to remove non-physical values - -;=================================================; -; Read the variables we will need -;=================================================; - -; Read water wapor mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RVT")) - qv = a->RVT(1:kmax,1:jmax,1:imax) - qv = qv*1000. - qv@units = "g/kg" - qv@description="Water vapor mixing ratio" - end if - -; Read cloud mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RCT")) - qc = a->RCT(1:kmax,1:jmax,1:imax) - qc = qc*1000. - qc@units = "g/kg" - qc@description="Cloud mixing ratio" - end if - -; Read rain mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RRT")) - qr = a->RRT(1:kmax,1:jmax,1:imax) - qr = qr*1000. - qr@units = "g/kg" - qr@description="Rain mixing ratio" - end if - -; Read ice mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RIT")) - qi = a->RIT(1:kmax,1:jmax,1:imax) - qi = qi*1000. - qi@units = "g/kg" - qi@description="Ice mixing ratio" - end if - -;=================================================; -; Use MESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; - -; Define lat and lon before calling procedure MESONH_map_c -; It is also important to define correctly the units -;----------------------------------------------------------; - lat2d = new((/jmax,imax/),"double") - lat2d@units="degrees_north" - lat2d=0. - lon2d = new((/jmax,imax/),"double") - lon2d@units="degrees_east" - lon2d=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Call MESONH_map_c to define automatically map projection parameters -; And return lat2d, lon2d and cormap (corners) variables -;-----------------------------------------------; - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Set some other basic resources -;=================================================; - - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpFillOn = False - -;=========================================================; -; Loop over levels by step of 5 -;=========================================================; - do level = 0,19,5 - - display_level = level + 1 - -; Contour resources -;-------------------- - opts = resmap - opts@cnFillOn = True - opts@cnLinesOn = False - - opts@tiMainString = "Model Level "+display_level - - -; Plot wapor mixing ratio if it exists -; ----------------------------------------- - if (isvar("qv")) - plot=gsn_csm_contour_map(wks,qv(level,:,:),opts) - end if - -; Plot cloud mixing ratio if it exists -; ----------------------------------------- - if (isvar("qc")) - plot=gsn_csm_contour_map(wks,qc(level,:,:),opts) - end if - -; Plot rain mixing ratio if it exists -; ----------------------------------------- - if (isvar("qr")) - plot=gsn_csm_contour_map(wks,qr(level,:,:),opts) - end if - -; Plot ice mixing ratio if it exists -; ----------------------------------------- - if (isvar("qi")) - plot=gsn_csm_contour_map(wks,qi(level,:,:),opts) - end if - - - end do ; END OF LEVEL LOOP -;=================================================; - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_CrossSection2.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_CrossSection2.ncl deleted file mode 100644 index 86f3062fd91e737d8844d41692377d28c826e72c..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_CrossSection2.ncl +++ /dev/null @@ -1,309 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -begin - -;=================================================; -; Open file -;=================================================; - mnh_file="16JAN.1.12B18.001.cdf" - a = addfile(mnh_file, "r") - -;=================================================; -; We generate plots, but what kind do we prefer? -; For paper quality plot do not use ncgm or eps -;=================================================; - type = "x11" -; type = "ps" -; type = "pdf" -; type = "ps" - -;=================================================; -; Open the workstation and choose colormap -;=================================================; - wks = gsn_open_wks(type,"plt_CrossSection2") - gsn_define_colormap(wks,"topo_15lev") - -;=================================================; -; Get informations on variable sizes -;=================================================; - mdims = getfilevardimsizes(a,"UT") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - kmax=mdims(nd-3)-2 - -;=================================================; -; Read some variables from mnh_file -;=================================================; - ZS =a->ZS(1:jmax,1:imax) - - th = a->THT(1:kmax,1:jmax,1:imax) - th@long_name="Potential Temperature" - th@description="TH" - - um = a->UT(1:kmax,1:jmax,1:imax+1) - um@description="U" - - zh= a->ZHAT(1:kmax+1) - -;=================================================; -; Take care of the Arakawa C grid -;=================================================; -; Unstagger zh (from grid 4 to 1) -;----------------------------------; - nzh=new(kmax,double) - do k=0,kmax-1 - nzh(k)=(zh(k)+zh(k+1))/2. - end do - -; Unstagger U -;----------------------------------; - um!0="Z" - um!1="Y" - um!2="X" - u_unst = wrf_user_unstagger(um,"X") - -;=================================================; -; Needed for the wrf_intrp3d function -;=================================================; -; Create Z3D -;----------------------------------; - z=new(dimsizes(th),double) - zcoef=1.-ZS/nzh(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - z(:,j,i) = nzh*zcoef(j,i)+ZS(j,i) - end do - end do - -; get height info for labels -;----------------------------------; - zmin = 0. - zmax = 6. ; We are only interested in the first 6km - nz = floattoint(zmax + 1) - -;=================================================; -; Use TESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; - -; Define lat and lon before calling procedure MESONH_map_c -; It is also important to define correctly the units -;----------------------------------------------------------; - lat2d = new(dimsizes(ZS),"double") - lat2d@units="degrees_north" - lat2d=0. - lon2d = new(dimsizes(ZS),"double") - lon2d@units="degrees_east" - lon2d=0. - cormap = new((/2,2/),"integer") - cormap(:,:)=0 - -; Resources for the map projection -;-----------------------------------------------; - resmap=True - -; Call MESONH_map_c to define automatically -; map projection parameters -;-----------------------------------------------; - MESONH_map_c (a, resmap, lat2d, lon2d, cormap) - -;=================================================; -; Define Other Resources for map ploting -;=================================================; - - resmap@gsnFrame = False - resmap@gsnMaximize = True - -; Map resources -;-----------------------------------------------; - resmap@mpFillOn = False - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - -; Contour definitions -;-----------------------------------------------; - resmap@cnFillOn = True - resmap@cnLinesOn = False - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,25,50,75,100,125,150,175,200,225,250,275,300/) - resmap@cnLevels = cnLevels - - resmap@lbOrientation = "Vertical" - - - FirstPlot = True - -;=================================================; -; Planes definition and interpolation -;=================================================; - do ip = 1, 3 ; we are doing 3 plots - ; all with the pivot point (plane) in the center of the domain - ; at angles 0, 45 and 90 - ; - ; | - ; angle=0 is | - ; | - ; - -; Define the plane where the cross-section will be done -; ------------------------------------------------------ - plane = new(2,float) - plane = (/ (mdims(nd-1)-2)/2, (mdims(nd-2)-2)/2 /) ; pivot point is center of domain (x,y) - -; Resource for the interpolation -; -------------------------------- - opts = False - - if(ip .eq. 1) then - angle = 90. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - end if - if(ip .eq. 2) then - angle = 0. - X_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - X_desc = "latitude" - end if - if(ip .eq. 3) then - angle = -45. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - - end if - -; Interpolate fields onto the defined plane -; -------------------------------------------- - um_plane = wrf_user_intrp3d(u_unst,z,"v",plane,angle,opts) - th_plane = wrf_user_intrp3d(th,z,"v",plane,angle,opts) - -; Find the index where 6km is - only need to do this once -; -------------------------------------------- - if ( FirstPlot ) then - zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts) - b = ind(zz(:,0) .gt. zmax*1000. ) - zmax_pos = b(0) - 1 - if ( abs(zz(zmax_pos,0)-zmax*1000.) .lt. abs(zz(zmax_pos+1,0)-zmax*1000.) ) then - zspan = b(0) - 1 - else - zspan = b(0) - end if - delete(zz) - delete(b) - FirstPlot = False - end if - -; Define X-axis labels -;---------------------- - dimsX = dimsizes(X_plane) - xmin = X_plane(0) - xmax = X_plane(dimsX(0)-1) - xspan = dimsX(0)-1 - nx = 3 - -; Options for XY Plots -;----------------------------------------- - opts_xy = True - opts_xy@tiXAxisString = X_desc - opts_xy@tiYAxisString = "Height (km)" - opts_xy@tiXAxisFontHeightF = 0.020 - opts_xy@tiYAxisFontHeightF = 0.020 - -; Resources to plot the topography (missing values in fields) -;----------------------------------------- - opts_xy@cnMissingValPerimOn = True - opts_xy@cnMissingValFillColor = "red" - opts_xy@cnMissingValFillPattern = 8 - -; Tickmarks/labels resources -;------------------------------ - opts_xy@lbOrientation = "Vertical" - - opts_xy@tmXTOn = False - opts_xy@tmYROn = False - opts_xy@tmXBMode = "Explicit" - opts_xy@tmXBValues = fspan(0,xspan,nx) ; Create tick marks - opts_xy@tmXBLabels = sprintf("%.2f",fspan(xmin,xmax,nx)) ; Create labels - opts_xy@tmXBLabelFontHeightF = 0.015 - opts_xy@tmYLMode = "Explicit" - opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks - opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels - opts_xy@tmXBMajorLengthF = 0.02 - opts_xy@tmYLMajorLengthF = 0.02 - opts_xy@tmYLLabelFontHeightF = 0.015 - - -; Plotting options for U -;-------------------------- - opts_um = opts_xy - opts_um@cnFillOn = True - -; Plotting options for Temperature -;-------------------------- - opts_th = opts_xy - opts_th@cnInfoLabelZone = 1 - opts_th@cnInfoLabelSide = "Top" - opts_th@cnInfoLabelPerimOn = True - opts_th@cnInfoLabelOrthogonalPosF = -0.00005 - - opts_th@gsnLeftStringParallelPosF = 0.1 - opts_th@gsnLeftStringOrthogonalPosF = 0.01 - -;====================== -; MAKE PLOTS -;====================== - -; Horizontal plot with topography -;----------------------------------------------------------------------- - plot=gsn_csm_contour_map(wks,ZS,resmap) - -; Draw line that shows the position of the cross section -;----------------------------------------------------------------------- - lat_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - lon_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - - lnres = True - lnres@gsLineThicknessF = 3.0 - lnres@gsLineColor = "Red" - do ii = 0,dimsX(0)-2 - gsn_polyline(wks,plot,(/lon_plane(ii),lon_plane(ii+1)/),(/lat_plane(ii),lat_plane(ii+1)/),lnres) - end do - frame(wks) - delete(lon_plane) - delete(lat_plane) - -; Vertical cross-section -;-------------------------- - opts_th@gsnFrame = False - opts_th@gsnDraw = False - - - - opts_um@gsnFrame = False - opts_um@gsnDraw = False - - contour_th = gsn_csm_contour(wks,th_plane(0:zmax_pos,:),opts_th) - contour_um = gsn_csm_contour(wks,um_plane(0:zmax_pos,:),opts_um) - - overlay(contour_um,contour_th) ; plot x-section - draw(contour_um) - frame(wks) - - -; Delete options and fields, so we don't have carry over -;------------------------------------------------------- - delete(opts_xy) - delete(opts_th) - delete(opts_um) - delete(th_plane) - delete(um_plane) - delete(X_plane) - -end do ; make next cross section - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_ModelLevels2.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_ModelLevels2.ncl deleted file mode 100644 index 110fd69a806d8203cc082b6a466e55ad45758411..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_ModelLevels2.ncl +++ /dev/null @@ -1,257 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "MESONHtools.ncl" - -;=============================================================; -; Example of script to plot field on model levels from MESONH -; netcdf file generated with lfi2cdf -;=============================================================; - -begin - -;=================================================; -; Open file -;=================================================; -; The MESONH input file. -; ---------------------- - mnh_file="16JAN.1.12B18.001.cdf" - a = addfile(mnh_file,"r") - -;==================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf or x11 (for debugging) -;==================================================; - type = "x11" - wks = gsn_open_wks(type,"plt_ModelLevels2") - gsn_define_colormap(wks,"rainbow+gray") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - mdims = getfilevardimsizes(a,"THT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - kmax=mdims(nd-3)-2 - -;=================================================; -; Read the variables we need -;=================================================; - th = a->THT(1:kmax,1:jmax,1:imax) ; theta - th@long_name="Potential Temperature" - th@units = "K" - - qv = a->RVT(1:kmax,1:jmax,1:imax) ; Qv - qv = qv*1000. - qv@long_name="Water vapor mixing ratio" - qv@units = "g/kg" - - um = a->UT(1:kmax,1:jmax,1:imax+1) ; u - um@long_name="U" - um@units="m/s" - - vm = a->VT(1:kmax,1:jmax+1,1:imax) ; v - vm@long_name="V" - vm@units="m/s" - - ; Unstagger U -; -------------------- - um!0="Z" - um!1="Y" - um!2="X" - u = wrf_user_unstagger(um,"X") - - ; Unstagger V -; -------------------- - vm!0="Z" - vm!1="Y" - vm!2="X" - v = wrf_user_unstagger(vm,"Y") - v@description="V" - -; Calculate wind speed -; -------------------- - spd = (u*u + v*v)^(0.5) ; speed in m/sec - spd@long_name = "Wind Speed" - spd@units = "m/s" - -;=================================================; -; Use MESONHtools procedure to set map projection -; and return latitude and longitude values -;=================================================; -; Define lat and lon before calling procedure MESONH_map_c -; It is also important to define correctly the units -;----------------------------------------------------------; - lat2d = new((/jmax,imax/),"double") - lat2d@units="degrees_north" - lat2d=0. - lon2d = new((/jmax,imax/),"double") - lon2d@units="degrees_east" - lon2d=0. - icornerMap = new((/2,2/),"integer") - icornerMap(:,:)=0 - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Call MESONH_map_c to define automatically map projection parameters -; And return lat2d, lon2d and cormap (corners) variables -;-----------------------------------------------------------------; - MESONH_map_c (a, resmap, lat2d, lon2d, icornerMap) - -;=================================================; -; Set some other basic resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; highres map data version - resmap@mpFillOn = False - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - - -;=========================================================; -; Loop over levels by step of 20 -;=========================================================; - do level =0,kmax-1,20 ; LOOP OVER LEVELS - - display_level = level + 1 - resmap@tiMainString = "Model Level " + display_level - -;======================= -; Resources for Theta -;======================= - opts = resmap - - opts@gsnFrame = False - opts@gsnDraw = False - opts@gsnContourLineThicknessesScale = 2.0 - - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = -0.05 - opts@cnInfoLabelParallelPosF = 0.97 - - contour = gsn_csm_contour_map(wks,th(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;====================== -; Resources for Qv -;====================== - opts = resmap - -; General resources -;------------------- - opts@gsnFrame = False - opts@gsnDraw = False - opts@gsnSpreadColors = True - opts@gsnSpreadColorStart = 30 - opts@gsnSpreadColorEnd = -2 - -; Contour resources -;------------------- - opts@cnLinesOn = False ; no line - opts@cnFillOn = True ; filled - - contour = gsn_csm_contour_map(wks,qv(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;=============================================== -; Overlay Wind Vectors and Speed over basic map -;=============================================== - -;======================= -; 1.Create Base map plot -;======================= - resmap@gsnDraw = False ; don't draw yet - resmap@gsnFrame = False ; don't advance frame yet - - map=gsn_map(wks,"Stereographic",resmap) - -;======================= -; 2.Create Wind speed plot -;======================= - opts_ws = True - -; General resources -;------------------- - opts_ws@gsnFrame = False - opts_ws@gsnDraw = False - opts_ws@gsnSpreadColors = True - opts_ws@gsnSpreadColorStart = 30 - opts_ws@gsnSpreadColorEnd = -2 - -; Tickmark resources -;--------------------- -; No tickmark and label on axis for this plot -; They are already drawn by the basic map plot -; ------------------------------------------- - opts_ws@tmXBOn = False - opts_ws@tmYROn = False - opts_ws@tmXBLabelsOn = False - opts_ws@tmYRLabelsOn = False - - opts_ws@lbOrientation = "Vertical" - - -; Transformation resources -;--------------------------- -; Field is already on the right projection -;------------------------------------------ - opts_ws@tfDoNDCOverlay = True - -; Contour resources -; ------------------- - opts_ws@cnFillOn = True - opts_ws@cnLinesOn = False - -; PLOT -;----- - contour = gsn_csm_contour(wks,spd(level,:,:),opts_ws) - -;=========================== -; 3.Create Wind vector plot -;=========================== - opts_vec = True - - opts_vec@gsnFrame = False - opts_vec@gsnDraw = False - opts_vec@gsnLeftString = "Wind Vector" - opts_vec@gsnLeftStringParallelPosF = 0.3 - opts_vec@gsnLeftStringOrthogonalPosF = 0.018 - -; No Tickmarks/labels -;------------- - opts_vec@tmXBOn = False - opts_vec@tmYROn = False - opts_vec@tmXBLabelsOn = False - opts_vec@tmYRLabelsOn = False - - opts_vec@tfDoNDCOverlay = True - -; Vector resources -;------------------- - opts_vec@vcRefLengthF = 0.1 - opts_vec@vcRefMagnitudeF = 20 - opts_vec@vcMinDistanceF = 0.05 - - -; PLOT -;----- - vector = gsn_csm_vector(wks,u(level,:,:),v(level,:,:),opts_vec) - -;=================== -; 4.Overlay and draw -;=================== - overlay(map,contour) - overlay(map,vector) - - draw(map) - frame(wks) - - end do ; END OF LEVEL LOOP - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_PressureLevel2.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_PressureLevel2.ncl deleted file mode 100644 index f4eb2129ac56fc8e97e3f84ba246f1156b7d99e7..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/mnh_PressureLevel2.ncl +++ /dev/null @@ -1,236 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -;=================================================; -; Example of script to interpolate from model to pressure level -; and to plot some fields from MESONH netcdf file generated with lfi2cdf -;=================================================; - -begin - -;=======================================================; -; Pressure levels that we want the data interpolated to -;=======================================================; - pressure_levels = (/ 850., 700., 500., 300./) - nlevels = dimsizes(pressure_levels) ; number of pressure levels - -;=================================================; -; Open file -; MESONH netcdf input file generated with lfi2cdf -;=================================================; - - mnh_file="16JAN.1.12B18.001.cdf" - a = addfile(mnh_file, "r") - -;=================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf and x11 (for debugging) -;==================================================; - - type = "x11" - wks = gsn_open_wks(type,"plt_PressureLevel2") - gsn_define_colormap(wks,"spread_15lev") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - mdims = getfilevardimsizes(a,"UT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2 - jmax=mdims(nd-2)-2 - kmax=mdims(nd-3)-2 - -;=================================================; -; Read the variables we need -;=================================================; - - tk = a->THT(1:kmax,1:jmax,1:imax) ; potential temperature - tk@description="Potential Temperature" - - u = a->UT(1:kmax,1:jmax,1:imax+1) ; u - v = a->VT(1:kmax,1:jmax+1,1:imax) ; v - -; Unstagger u,v - u!0="Z" - u!1="Y" - u!2="X" - u_unst = wrf_user_unstagger(u,"X") - - v!0="Z" - v!1="Y" - v!2="X" - v_unst = wrf_user_unstagger(v,"Y") - - p = a->PABST(1:kmax,1:jmax,1:imax) ; pressure - p@description="Pressure" - - rv = a->RVT(1:kmax,1:jmax,1:imax)*1000 ; water vapor mixing ratio - rv@description="Water vapor mixing ratio" - - zs = a->ZS(1:jmax,1:imax) ; terrain - zh = a->ZHAT(1:kmax+1) ; heigth without terrain - -;========================================== -; Create 3D Z to be used for interpolation -;========================================== - - z=new(dimsizes(tk),double) - z@description="Height" - -; Unstag zh -;---------- - nzh=new(kmax,double) - do k=0,kmax-1 - nzh(k)=(zh(k)+zh(k+1))/2. - end do - zcoef=1.-zs/nzh(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - z(:,j,i) = nzh*zcoef(j,i)+zs(j,i) - end do - end do - -;=================================================; -; Horizontal interpolation on pressure levels -;=================================================; - - - do level = 0,nlevels-1 ; LOOP OVER LEVELS - - pressure = pressure_levels(level) - - tk_plane = wrf_user_intrp3d(tk,p,"h",pressure,0.,False) - z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) - u_plane = wrf_user_intrp3d( u_unst,p,"h",pressure,0.,False) - v_plane = wrf_user_intrp3d( v_unst,p,"h",pressure,0.,False) - rv_plane = wrf_user_intrp3d( rv,p,"h",pressure,0.,False) - - spd_plane = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec - spd_plane@description = "Wind Speed" - spd_plane@units = "m/s" - - u_plane@units = "m/s" - v_plane@units = "m/s" - -;================================== -; Create plots usinf wrf functions -;================================== - res=True - res@MainTitle = "MESONH" - res@Footer = False - -; Plotting options for Tk -;-------------------------- - opts = res - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 2.0 - - contour_tk = wrf_contour(a,wks,tk_plane,opts) - delete(opts) - -; Plotting options for RV -;-------------------------- - opts = res - opts@cnFillOn = True - opts@pmLabelBarOrthogonalPosF = -0.1 - opts@cnMissingValFillColor = "Red" - opts@cnMissingValFillPattern = 8 - - contour_rv = wrf_contour(a,wks,rv_plane,opts) - delete(opts) - -; Plotting options for Wind Speed -;-------------------------- - opts = res - opts@cnLineColor = "MediumSeaGreen" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 3.0 - - contour_spd = wrf_contour(a,wks,spd_plane,opts) - delete(opts) - - -; Plotting options for Wind Vectors -;----------------------------------- - opts = res - opts@FieldTitle = "Wind" ; overwrite Field Title - opts@NumVectors = 47 ; wind barb density - - vector = wrf_vector(a,wks,u_plane,v_plane,opts) - delete(opts) - -; Plotting options for Geopotential Heigh -;----------------------------------------- - opts_z = res - opts_z@cnLineColor = "Blue" - opts_z@gsnContourLineThicknessesScale = 2.0 - -;============= -; MAKE PLOTS -;============= - - pltres = True - -; Resources for map -;------------------- - resmap = True - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - resmap@mpGeophysicalLineThicknessF = 2.0 - resmap@mpGridLineThicknessF = 2.0 - resmap@mpLimbLineThicknessF = 2.0 - resmap@mpNationalLineThicknessF = 2.0 - resmap@mpGridAndLimbOn = False ; turn off lat/lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data - - -; Overlay rv , tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 850 ) then ; plot temp, rv, height, wind barbs - - contour_height = wrf_contour(a,wks,z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_rv,contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 700 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 500 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay wind speed , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 300 ) then ; plot windspeed, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_spd,contour_height, \ - vector/),pltres,resmap) - end if - - delete(opts_z) - -end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/run_ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/run_ncl deleted file mode 100755 index 4ba228ec6df2a85b353847f2af4bc280b7a710fe..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_lfi2cdf/run_ncl +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -#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 -#### Get highres coastline data for ncl -./get_ncl_highres_files -#### MNH file to convert in netcdf -ln -sf ../008_run2/16JAN.1.12B18.001.lfi . -#### Conversion to netcdf using lfi2cdf -lfi2cdf 16JAN.1.12B18.001 -#### Initilizing variables for ncl -path_ncl=`which ncl` -if [ "$path_ncl" == "" ] -then -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "! ERROR: NCL is not installed of the path to !" -echo "! ncl binary is not set correctly !" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -exit -fi -export NCARG_ROOT=${path_ncl%%/bin/ncl} -export PATH=$NCARG_ROOT/bin:$PATH -export NCARG_RANGS=. -#### Running ncl scripts -ncl mnh_BasicMap2.ncl -ncl mnh_ModelLevels2.ncl -ncl mnh_Cloud2.ncl -ncl mnh_CrossSection2.ncl -ncl mnh_PressureLevel2.ncl diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/MESONHtools.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/MESONHtools.ncl deleted file mode 100644 index 182df6d79d89e02ef068049311ec842988701b43..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/MESONHtools.ncl +++ /dev/null @@ -1,916 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" - -;------------------------------------------------------------- -;contains: -; procedure MESONH_map_c -;function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) -;function mnh_map_overlays(in_file[1]:file,wks:graphic,plots[*]:graphic, \ -; opt_arg[1]:logical,opt_mp[1]:logical) -;function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;------------------------------------------------------------- - -;============================================================== -; J.-P. CHABOUREAU -; This is a driver that selects the appropriate -; mapping function based upon the file variables RPK, BETA, LATOR, LONOR -; -; -; Sample usage: -; a = addfile("...", r") -; IMAX = a->IMAX -; JMAX = a->JMAX -; lat2d = new((/JMAX,IMAX/),"double") -; lat2d(:,:)=0. -; lon2d = new((/JMAX,IMAX/),"double") -; lon2d(:,:)=0. -; icorners = new((/2,2/),"integer") -; icorners(:,:)=0 -; res = True -; MESONH_map_c (a, res, lat2d, lon2d, icorners) -; -; -undef("MESONH_map_c") -;============================================================== -procedure MESONH_map_c (in_file:file, res:logical, plat, plon, icorner) -;============================================================== -;local rank, dimll, nlat, mlon, lat, lon -local rank, dimll, nlat, mlon -begin - -; Check if the variable RPK is in the file -; ---------------------------------------- -if(isfilevar(in_file,"RPK")) then - -; Read projection parameters -; ------------------------- - ZRPK = in_file->RPK - ZLATOR = in_file->LATOR - ZLONOR = in_file->LONOR - ZBETA = in_file->BETA - ZLAT0 = in_file->LAT0 - ZLON0 = in_file->LON0 - -; Case netcdf from lfi2cdf -; ------------------------- - - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - jphext = in_file->JPHEXT - IMAX= dimsizes(XHAT)-2*JPHEXT - JMAX= dimsizes(YHAT)-2*JPHEXT - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - -; unstagger - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - - else - -; Case netcdf from extractdia -; --------------------------- - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - - end if - - print ("LATOR="+ZLATOR+" - LONOR="+ZLONOR) - print ("ZLAT0="+ZLAT0+" - ZLON0="+ZLON0) - print ("ZDX="+zdx+" - RPK="+ZRPK+" - BETA="+ZBETA) - print ("IMAX="+IMAX+" - JMAX="+JMAX) - - if (ZRPK.gt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = 90. - end if - - if (ZRPK.lt.0) - ; Stereographic projection -; --------------------------- - res@mpProjection = "Stereographic" - res@mpCenterLonF = ZLON0 - res@mpCenterRotF = ZBETA - res@mpCenterLatF = -90. - end if - - if (ZRPK.eq.0) then - ; Mercator projection -; --------------------------- - res@mpProjection = "Mercator" - end if - - print("Map projection="+res@mpProjection) - -else - print ("MESONH_map_c: Error no RPK variable in input file") -end if - -;=================================================; -; calculate 2D lat and lon -; based on src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - -; Constants -; ----------- - if(isfilevar(in_file,"IMAX")) - XRADIUS=6371229.0d ; Earth radius (meters) - else - XRADIUS=6371.2290d ; Earth radius (km) - end if - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - -;=================================================; - if (ZRPK.eq.0) then -; MERCATOR -;=================================================; - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - plon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - plat(jj,ji)=zlat - end do - end do - -;=================================================; - else -; STEREOGRAPHIC PROJECTION -;=================================================; - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - plon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - plat(jj,ji)=zlat - end do - end do - - end if - -; Defining the corners of the domain -;==================================== - if (icorner(0,0).eq.icorner(1,1)) then - icorner(0,0)=0 - icorner(1,0)=JMAX-1 - icorner(0,1)=0 - icorner(1,1)=IMAX-1 - end if -; print ("icorner"+icorner) - - res@mpLimitMode = "Corners" - res@mpLeftCornerLatF = plat(icorner(0,0),icorner(0,1)) - res@mpLeftCornerLonF = plon(icorner(0,0),icorner(0,1)) - res@mpRightCornerLatF = plat(icorner(1,0),icorner(1,1)) - res@mpRightCornerLonF = plon(icorner(1,0),icorner(1,1)) - -; print ("Corner (0,0); Lat="+res@mpLeftCornerLatF+ \ -; ", Lon="+res@mpLeftCornerLonF) -; print ("Oppos corner; Lat="+res@mpRightCornerLatF+ \ -; ", Lon= "+res@mpRightCornerLonF) - -;========================================== -; Turn on lat / lon labeling -;========================================== - res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - res@mpOutlineBoundarySets = "AllBoundaries" ; state boundaries - res@mpPerimDrawOrder = "PostDraw" ; force map perim -;========================================== -; Needed for regional native projection -;========================================== - res@tfDoNDCOverlay = True - res@gsnAddCyclic = False ; regional data - -end - -;=========================================== -;------------------------------------------------------------------------ -undef("MESONH_pinter") -function MESONH_pinter( pfield:numeric, loc_param:numeric, ppabs:numeric ) -;************************************************************************* -; S. BIELLI -; This is a routine that interpolate fields on pressure level for plotting -; based on pinter.f90 -; The field to be interpolated must be given at the mass point (grid 1) -; usage : var_inter=MESONHfunction(var_to_interpol, 850., AbsPressure) -; Abs pressure must be in Pa -; - -begin - - dimL= dimsizes(loc_param) - -; First test for grid = 0 - - dimp=dimsizes(ppabs) - - pout=pfield(0:dimL-1,:,:) - pfield@_FillValue=999 - pout@_FillValue=999 - pout=pout@_FillValue - - do jkp = 0, dimL-1 - zref=log10(loc_param(jkp)*100.) - do jloop = 0, dimp(1)-1 - do iloop = 0, dimp(2)-1 - kloop=0 - flag=True - do while (flag .and. (kloop.lt.(dimp(2)-2))) - if (.not.ismissing(ppabs(kloop,jloop,iloop))) then - zxm=log10(ppabs(kloop,jloop,iloop)) - zxp=log10(ppabs(kloop+1,jloop,iloop)) - if ((zxp-zref)*(zref-zxm) .ge. 0) then - pout(jkp,jloop,iloop)= (pfield(kloop,jloop,iloop)*(zxp-zref)+ \ - pfield(kloop+1,jloop,iloop)*(zref-zxm))/ (zxp-zxm) - flag=False - end if - end if - kloop=kloop+1 - end do - end do - end do - end do - - return(pout) - -end - -;-------------------------------------------------------------------------------- -undef("mnh_map") -function mnh_map(wks[1]:graphic,in_file[1]:file,opt_args[1]:logical) - -begin -; -; This function creates a map plot, and bases the projection on -; the MAP_PROJ attribute in the given file. -; -; 1. Make a copy of the resource list, and set some resources -; common to all map projections. -; -; 2. Determine the projection being used, and set resources based -; on that projection. -; -; 3. Create the map plot, and draw and advance the frame -; (if requested). - - opts = opt_args ; Make a copy of the resource list - opts = True - -; Set some resources depending on what kind of map projection is -; chosen. -; -; ZRPK != 0 : "Stereographic" -; ZRPK = 0 : "Mercator" -;=================================================; -; src/mesonh_MOD/mode_gridproj.f90 -;=================================================; - XRADIUS=6371229.0d ; Earth radius (meters) - XPI=2.0d*asin(1.) ; Pi - ZRDSDG= XPI/180.0d ; Radian to Degree conversion factor - ZXBM0 = 0.0d - ZYBM0 = 0.0d - - if(isfilevar(in_file,"RPK")) - ZRPK=in_file->RPK - ZLON0=in_file->LON0 - ZLAT0=in_file->LAT0 - ZLATOR=in_file->LATOR - ZLONOR=in_file->LONOR - ZBETA=in_file->BETA - else - print ("mnh_map: Error no RPK variable in input file") - return(new(1,graphic)) - end if - -; Case netcdf from lfi2cdf - if(isfilevar(in_file,"IMAX")) - XHAT=in_file->XHAT - YHAT=in_file->YHAT - IMAX= dimsizes(XHAT)-2 - JMAX= dimsizes(YHAT)-2 - zdx=XHAT(2)-XHAT(1) - zdy=YHAT(2)-YHAT(1) - do ji=0,IMAX-1 - XHAT(ji)=XHAT(ji)+zdx*1.5 - end do - do jj=0,JMAX-1 - YHAT(jj)=YHAT(jj)+zdy*1.5 - end do - else -; Case netcdf from extractdia - XHAT=in_file->W_E_direction - YHAT=in_file->S_N_direction - IMAX= dimsizes(XHAT) - JMAX= dimsizes(YHAT) - end if -; - - lat = new((/JMAX,IMAX/),"double") - lon = new((/JMAX,IMAX/),"double") - - -; Stereographic projection - if(ZRPK .gt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", 90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - - if(ZRPK .lt. 0) - projection = "Stereographic" - opts@mpCenterLatF = get_res_value_keep(opts, "mpCenterLatF", -90) - opts@mpCenterLonF = get_res_value_keep(opts, "mpCenterLonF",ZLON0) - opts@mpCenterRotF = get_res_value_keep(opts, "mpCenterRotF",ZBETA) - end if - -; Mercator projection - if(ZRPK .eq. 0) - projection = "Mercator" - end if - - opts@mpNestTime = get_res_value_keep(opts, "mpNestTime",0) - - -; LAT and LON are not saved in the file - if (ZRPK.eq.0) then - XBETA=0. - XLAT0=0. ; map reference latitude (degrees) - ZXBM0 = 0. - ZYBM0 = 0. - ZCGAM = cos(-ZRDSDG*XBETA) - ZSGAM = sin(-ZRDSDG*XBETA) - ZRACLAT0 = XRADIUS*cos(ZRDSDG*ZLAT0) - do ji=0,IMAX-1 - jj=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - zlon = (ZXMI0*ZCGAM+ZYMI0*ZSGAM)/(ZRACLAT0*ZRDSDG)+ZLONOR - do jj=0,JMAX-1 - lon(jj,ji)=zlon - end do - end do - do jj=0,JMAX-1 - ji=0 - ZXMI0 = XHAT(ji)-ZXBM0 - ZYMI0 = YHAT(jj)-ZYBM0 - ZT1 = log(tan(XPI/4.+ZLATOR*ZRDSDG/2.)) - ZT2 = (-ZXMI0*ZSGAM+ZYMI0*ZCGAM)/ZRACLAT0 - zlat = (-XPI/2.+2.*atan(exp(ZT1+ZT2)))/ZRDSDG - do ji=0,IMAX-1 - lat(jj,ji)=zlat - end do - end do - else - ZCLAT0 = cos(ZRDSDG*ZLAT0) - ZSLAT0 = sin(ZRDSDG*ZLAT0) - ZCLATOR = cos(ZRDSDG*ZLATOR) - ZSLATOR = sin(ZRDSDG*ZLATOR) - ZRO0 = (XRADIUS/ZRPK)*(abs(ZCLAT0))^(1.-ZRPK) * \ - ((1.+ZSLAT0)*abs(ZCLATOR)/(1.+ZSLATOR))^ZRPK - ZGA0 = (ZRPK*(ZLONOR-ZLON0)-ZBETA)*ZRDSDG - ZXP = ZXBM0-ZRO0*sin(ZGA0) - ZYP = ZYBM0+ZRO0*cos(ZGA0) - do ji=0,IMAX-1 - do jj=0,JMAX-1 - ZATA = atan2( -(ZXP-XHAT(ji)) , (ZYP-YHAT(jj)) )/ZRDSDG - zlon = (ZBETA+ZATA)/ZRPK+ZLON0 - lon(jj,ji)=zlon - ZRO2 = (XHAT(ji)-ZXP)^2+(YHAT(jj)-ZYP)^2 - ZJD1 = XRADIUS*(abs(ZCLAT0))^(1.-ZRPK) - ZT1 = (ZJD1)^(2./ZRPK)* (1+ZSLAT0)^2 - ZJD3 = (ZRPK^2*ZRO2) - ZT2 = ZJD3 - ZT2 = ZT2^(1./ZRPK) - ZJD1 = (ZT1-ZT2)/(ZT1+ZT2) - ZJD1 = acos(ZJD1) - ZJD3 = ZJD1 - zlat = (XPI/2.-ZJD3)/ZRDSDG - lat(jj,ji)=zlat - end do - end do - end if - - dims = dimsizes(lat) - - do ii = 0, dims(0)-1 - do jj = 0, dims(1)-1 - if ( lon(ii,jj) .lt. 0.0) then - lon(ii,jj) = lon(ii,jj) + 360. - end if - end do - end do - - opts@start_lat = lat(0,0) - opts@start_lon = lon(0,0) - opts@end_lat = lat(dims(0)-1,dims(1)-1) - opts@end_lon = lon(dims(0)-1,dims(1)-1) - - -; Set some resources common to all map projections. - opts = set_mp_resources(opts) - - if ( isatt(opts,"ZoomIn") .and. opts@ZoomIn ) then - y1 = 0 - x1 = 0 - y2 = dims(0)-1 - x2 = dims(1)-1 - if ( isatt(opts,"Ystart") ) then - y1 = opts@Ystart - delete(opts@Ystart) - end if - if ( isatt(opts,"Xstart") ) then - x1 = opts@Xstart - delete(opts@Xstart) - end if - if ( isatt(opts,"Yend") ) then - if ( opts@Yend .le. y2 ) then - y2 = opts@Yend - end if - delete(opts@Yend) - end if - if ( isatt(opts,"Xend") ) then - if ( opts@Xend .le. x2 ) then - x2 = opts@Xend - end if - delete(opts@Xend) - end if - - opts@mpLeftCornerLatF = lat(y1,x1) - opts@mpLeftCornerLonF = lon(y1,x1) - opts@mpRightCornerLatF = lat(y2,x2) - opts@mpRightCornerLonF = lon(y2,x2) - - if ( opts@mpRightCornerLonF .lt. 0.0 ) then - opts@mpRightCornerLonF = opts@mpRightCornerLonF + 360.0 - end if - - delete(opts@ZoomIn) - end if - - -; The default is not to draw the plot or advance the frame, and -; to maximize the plot in the frame. - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", False) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", False) - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - delete_attrs(opts) ; Clean up. - mp = gsn_map(wks,projection,opts) ; Create map plot. - - return(mp) ; Return. - -end - -;-------------------------------------------------------------------------------- - -undef("mnh_map_overlays") -function mnh_map_overlays(in_file[1]:file, \ - wks:graphic, \ - plots[*]:graphic, \ - opt_arg[1]:logical, \ - opt_mp[1]:logical) - -; Based on wrf_map_overlays -; -; This procedure takes an array of plots and overlays them on a -; base plot - map background. -; -; It will advance the plot and cleanup, unless you set the -; PanelPlot resource to True. -; -; Attributes recognized by this procedure: -; FramePlot -; PanelPlot -; NoTitles (don't do any titles) -; CommonTitle & PlotTile is used to overwrite field titles -; CommonTitle will super-seed NoTitles -; -; If FramePlot False, then Draw the plot but do not Frame. -; In this case a user want to add to the drawing, and will -; have to advance the Frame manually in the script. -; -; If the "NoTitles" attribute exists and is set True, then -; don't create the top-left titles, and leave the main titles alone. -; This resource can be useful if you are planning to panel -; the plots. -; -; If PanelPlot is set to True, then this flags to wrf_map_overlays -; that these plots are going to be eventually paneled (likely -; by gsn_panel), and hence 1) draw and frame should not be called -; (unless gsnDraw and/or gsnFrame are explicitly set to True), -; and 2) the overlays and titles should not be removed with -; NhlRemoveOverlay and NhlRemoveAnnotation. -; -begin - - opts = opt_arg ; Make a copy of the resource lists - opt_mp_2 = opt_mp - - ; Let's make the map first - base = mnh_map(wks,in_file,opt_mp_2) - - no_titles = get_res_value(opts,"NoTitles",False) ; Do we want field titles? - com_title = get_res_value(opts,"CommonTitle",False) ; Do we have a common title? - if ( com_title ) then - plot_title = get_res_value(opts,"PlotTitle"," ") - no_titles = True - end if - - call_draw = True - call_frame = get_res_value(opts,"FramePlot",True) ; Do we want to frame the plot? - panel_plot = get_res_value(opts,"PanelPlot",False) ; Are we paneling? - opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) - - nplots = dimsizes(plots) -; font_color = "Black" - - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then -; class_name = NhlClassName(plots(i)) -; print(class_name) -; if(class_name.eq."contourPlotClass") then -; getvalues plots(i) -; "cnFillOn" : fill_on -; "cnLineColor" : line_color -; end getvalues -; if (.not.fill_on) then -; font_color = line_color -; end if -; end if - if(.not.no_titles) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - if(i.eq.0) then - SubTitles = SubTitle - else - SubTitles = SubTitles + "~C~" + SubTitle - end if - end if - if(com_title .and. i .eq. nplots-1) then - getvalues plots(i) - "tiMainString" : SubTitle - end getvalues - SubTitles = plot_title - end if - setvalues plots(i) - "tfDoNDCOverlay" : True - "tiMainOn" : False - end setvalues - overlay(base,plots(i)) - else - print("mnh_map_overlays: Warning: overlay plot #" + i + " is not valid.") - end if - end do - - if(.not.no_titles .or. com_title) then - font_height = get_res_value_keep(opts,"FontHeightF",0.01) - txt = create "map_titles" textItemClass wks - "txString" : SubTitles - "txFontHeightF" : font_height - ;"txFontColor" : font_color - end create - anno = NhlAddAnnotation(base,txt) - setvalues anno - "amZone" : 3 - "amJust" : "BottomLeft" - "amSide" : "Top" - "amParallelPosF" : 0.005 - "amOrthogonalPosF" : 0.03 - "amResizeNotify" : False - end setvalues - base@map_titles = anno - end if -; -; gsnDraw and gsnFrame default to False if panel plot. -; - if(panel_plot) then - call_draw = False - call_frame= False - end if - - - opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", call_draw) - opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", call_frame) - - draw_and_frame(wks,base,opts@gsnDraw,opts@gsnFrame,False, \ - opts@gsnMaximize) - - if(.not.panel_plot) then - do i=0,nplots-1 - if(.not.ismissing(plots(i))) then - NhlRemoveOverlay(base,plots(i),False) - else - print("wrf_remove_map_overlays: Warning: overlay plot #" + i + " is not valid.") - print(" Nothing to remove.") - end if - end do - end if - - if(.not.no_titles.and..not.panel_plot) then - if(isatt(base,"map_titles")) then - NhlRemoveAnnotation(base,base@map_titles) - delete(base@map_titles) - end if - end if - -return(base) -end - -;-------------------------------------------------------------------------------- -undef("wrf_user_intrp3d") -function wrf_user_intrp3d( var3d:numeric, z_in:numeric, \ - plot_type:string, \ - loc_param:numeric, angle:numeric, opts:logical ) - -; var3d - 3d field to interpolate (all input fields must be unstaggered) -; z_in - interpolate to this field (either p/z) -; plot_type - interpolate horizontally "h", or vertically "v" -; loc_param - level(s) for horizontal plots (eg. 500hPa ; 3000m - scalar), -; plane for vertical plots (2 values representing an xy point -; on the model domain through which the vertical plane will pass -; OR 4 values specifying start and end values -; angle - 0.0 for horizontal plots, and -; an angle for vertical plots - 90 represent a WE cross section -; opts Used IF opts is TRUE, else use loc_param and angle to determine crosssection - -begin - - - if(plot_type .eq. "h" ) then ; horizontal cross section needed - - dimL = dimsizes(loc_param) - - dims = dimsizes(var3d) - nd = dimsizes(dims) - - dimX = dims(nd-1) - dimY = dims(nd-2) - dimZ = dims(nd-3) - dim4 = 1 - dim5 = 1 - if ( nd .eq. 4 ) then - dim4 = dims(nd-4) - end if - if ( nd .eq. 5 ) then - dim4 = dims(nd-4) - dim5 = dims(nd-5) - end if - - var3 = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - z = new ( (/ dim5, dim4, dimZ, dimY, dimX /) , typeof(var3d) ) - var2d = new ( (/ dim5, dim4, dimL, dimY, dimX /) , typeof(var3d) ) - - if ( nd .eq. 5 ) then - var3 = var3d - z = z_in - end if - if ( nd .eq. 4 ) then - var3(0,:,:,:,:) = var3d(:,:,:,:) - z(0,:,:,:,:) = z_in(:,:,:,:) - end if - if ( nd .eq. 3 ) then - var3(0,0,:,:,:) = var3d(:,:,:) - z(0,0,:,:,:) = z_in(:,:,:) - end if - - - if ( z(0,0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z(0,0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z = z * 0.01 - end if - if ( loc_param(0) .gt. 2000. ) then - ; looks like the input was specified in Pa - change this - loc_param = loc_param * 0.01 - end if - end if - - do il = 0,dimL-1 - var = wrf_interp_3d_z(var3,z,loc_param(il)) - var2d(:,:,il,:,:) = var(:,:,:,:) - end do - - copy_VarAtts(var3d,var3) - if(isatt(var3,"description")) then - delete_VarAtts(var3,(/"description"/)) - end if - if(isatt(var3,"units")) then - delete_VarAtts(var3,(/"units"/)) - end if - if(isatt(var3,"MemoryOrder")) then - delete_VarAtts(var3,(/"MemoryOrder"/)) - end if - if(isatt(var3,"_FillValue")) then - delete_VarAtts(var3,(/"_FillValue"/)) - end if - copy_VarAtts(var3,var2d) - - nn = nd-2 - var2d!nn = "plevs" - - if ( dimL .gt. 1 ) then - if ( nd .eq. 5 ) then - return( var2d ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,:,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,:,:,:) ) - end if - else - if ( z(0,0,0,0,0) .gt. 500.) then - var2d@PlotLevelID = loc_param + " hPa" - else - var2d@PlotLevelID = .001*loc_param + " km" - end if - if ( nd .eq. 5 ) then - return( var2d(:,:,0,:,:) ) - end if - if ( nd .eq. 4 ) then - return( var2d(0,:,0,:,:) ) - end if - if ( nd .eq. 3 ) then - return( var2d(0,0,0,:,:) ) - end if - end if - - - end if - - - - - if(plot_type .eq. "v" ) then ; vertical cross section needed - - dims = dimsizes(var3d) - if ( dimsizes(dims) .eq. 4 ) then - if ( z_in(0,0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in(0,:,:,:) - else - if ( z_in(0,0,0) .gt. 500.) then - ; We must be interpolating to pressure - ; This routine needs input field and level in hPa - lets make sure of this - if ( z_in(0,0,0) .gt. 2000. ) then - ; looks like we have Pa as input - make this hPa - z_in = z_in * 0.01 - end if - end if - z = z_in - end if - -; set vertical cross section - if (opts) then - xy = wrf_user_set_xy( z, loc_param(0)-1, loc_param(1)-1, \ ; the -1 is for NCL dimensions - loc_param(2)-1, loc_param(3)-1, \ - angle, opts ) - else - xy = wrf_user_set_xy( z, loc_param(0), loc_param(1), \ - 0.0, 0.0, angle, opts ) - end if - xp = dimsizes(xy) - - -; first we interp z - var2dz = wrf_interp_2d_xy( z, xy) - -; interp to constant z grid - if(var2dz(0,0) .gt. var2dz(1,0) ) then ; monotonically decreasing coordinate - z_max = floor(max(z)/10)*10 ; bottom value - z_min = ceil(min(z)/10)*10 ; top value - dz = 1. - nlevels = tointeger( (z_max-z_min)/dz) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_max - dz = -dz - else - z_max = max(z) - z_min = 0. -;; MODI SOLINE -; dz = 0.01 * z_max - dz = 0.001 * z_max - nlevels = tointeger( z_max/dz ) - z_var2d = new( (/nlevels/), typeof(z)) - z_var2d(0) = z_min - end if -; print("nlevels="+nlevels) -; print("dz="+dz) - - do i=1, nlevels-1 - z_var2d(i) = z_var2d(0)+i*dz - end do - - -; interp the variable - if ( dimsizes(dims) .eq. 4 ) then - var2d = new( (/dims(0), nlevels, xp(0)/), typeof(var2dz)) - do it = 0,dims(0)-1 - var2dtmp = wrf_interp_2d_xy( var3d(it,:,:,:), xy) - do i=0,xp(0)-1 - var2d(it,:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - end do - var2d!0 = var3d!0 - var2d!1 = "Vertical" - var2d!2 = "Horizontal" - else - var2d = new( (/nlevels, xp(0)/), typeof(var2dz)) - var2dtmp = wrf_interp_2d_xy( var3d, xy) - do i=0,xp(0)-1 - var2d(:,i) = wrf_interp_1d( var2dtmp(:,i), var2dz(:,i), z_var2d) - end do - var2d!0 = "Vertical" - var2d!1 = "Horizontal" - end if - - - st_x = tointeger(xy(0,0)) + 1 - st_y = tointeger(xy(0,1)) + 1 - ed_x = tointeger(xy(xp(0)-1,0)) + 1 - ed_y = tointeger(xy(xp(0)-1,1)) + 1 - if (opts) then - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ")" - else - var2d@Orientation = "Cross-Sesion: (" + \ - st_x + "," + st_y + ") to (" + \ - ed_x + "," + ed_y + ") ; center=(" + \ - loc_param(0) + "," + loc_param(1) + \ - ") ; angle=" + angle - end if - - return(var2d) -end if - - -end - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/clean_ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/clean_ncl deleted file mode 100755 index fd14d4432591be2c055acdc24d3bd14661a83f1b..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/clean_ncl +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "!!!! WARNING :: CLEAN_RANGS_FILES !!!!" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo -echo do you real want to delete high resolution -echo -echo coastline files for ncl ????? -echo -echo "(yes/no)" -read ANSWER -set -x -if [ "X$ANSWER" = "Xyes" ] -then -rm -fr ran* gs* -fi -rm -f *.lfi *.nc diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/get_ncl_highres_files b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/get_ncl_highres_files deleted file mode 100755 index 3b0e44937a9a0273c09a5f90f355d5601cb0011d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/get_ncl_highres_files +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -NCARG_RANGS=`pwd` -export NCARG_RANGS -echo -[ -f ~/.hluresfile ] || ( wget -c -nd http://www.ncl.ucar.edu/Document/Graphics/hluresfile ; mv hluresfile ~/.hluresfile ) -echo "You will download high resolution coastline files for NCL" -echo "in this directory:" -echo NCL_HIGHRES_FILES=$NCARG_RANGS -echo -set -x -cd $NCARG_RANGS -NCL_HIGHRES_URL="http://www2008.io-warnemuende.de/homepages/rfeistel/download" -export NCL_HIGHRES_URL -for file in rangs\(0\) rangs\(1\) rangs\(2\) \ - rangs\(3\) rangs\(4\) \ - gshhs\(0\) gshhs\(1\) gshhs\(2\) \ - gshhs\(3\) gshhs\(4\) -do -[ -f $file.zip ] || ( wget -c -nd $NCL_HIGHRES_URL/$file.zip ; unzip $file.zip ; ) -done - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_BasicMap.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_BasicMap.ncl deleted file mode 100644 index a16dfa079d57cc46c3ea949eeeb5c59ad73b744f..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_BasicMap.ncl +++ /dev/null @@ -1,180 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" - -;=============================================================; -; Example of script to plot ZS field from MESONH netcdf4 file -; Could be use with any files generated by MESONH if LCARTESIAN=False -;=============================================================; -begin -;=============================================================; -; Open file -;=============================================================; - - mnh_file="16JAN.1.12B18.001.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Get information on variable sizes -;=================================================; - - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"ZS") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext ; -2*jphext : to remove non-physical values - jmax=mdims(nd-2)-2*jphext ; -2*jphext : to remove non-physical values - -;=================================================; -; Read the variables -;=================================================; - -; Note: do not read first and last value which are non physical values -; ------------------------------------- - - lat2d=a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d=a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - - ZS = a->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) - ZS@long_name="Orography" - ZS@units="m" - -; Associate coordinates to variable -; Necessary to plot the field at the right geographical position -; ------------------------------------- - - ZS@lat2d = lat2d - ZS@lon2d = lon2d - -; Read projection parameters -; ------------------------------------- - - RPK = a->RPK - BETA =a->BETA - LON0= a->LON0 - -;=================================================; -; CREATE PLOT : Orography (ZS, filled contour) -;=================================================; -; Open workstation and define colormap -; ------------------------------------- - - type = "x11" ; open a x11 window - ; change type to png, ps or pdf to get the plot into a file - wks = gsn_open_wks(type,"plt_BasicMap") ; - gsn_define_colormap(wks,"topo_15lev") ; Choose colormap - - -;========================================== -; Map ressources -;========================================== - resmap = True - -; If there is an error on HighRes, it means that you don't have the HighRes data -; You need to download them or the change HighRes by MediumRes -; See https://www.ncl.ucar.edu/Document/Graphics/rangs.shtml for info -; ------------------------------------- - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - - resmap@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - -;=================================================; -; Set map projection ressources using projection parameters -;=================================================; - if (RPK.gt.0) -; --------------------------- - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = 1 ; projection for north hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.lt.0) -; --------------------------- - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = -1 ; projection for south hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.eq.1) -; --------------------------- - ; Stereographic projection north -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90 - end if - - if (RPK.eq.-1) -; --------------------------- - ; Stereographic projection south -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90 - end if - - if (RPK.eq.0) then -; --------------------------- - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -;========================================== -; Defining the corners for projection otherwise the plot will be global -;========================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - - print ("Corner (0,0); Lat="+resmap@mpLeftCornerLatF+ \ - ", Lon="+resmap@mpLeftCornerLonF) - print ("Oppos corner; Lat="+resmap@mpRightCornerLatF+ \ - ", Lon= "+resmap@mpRightCornerLonF) - - -;========================================== -; Create ZS plot (contour) -;========================================== -; --------------------------- -; General ressources -; --------------------------- - resmap@gsnMaximize = True ; maximize size - resmap@gsnSpreadColors = True ; use full range of colormap - -; --------------------------- -; Contour ressources -; --------------------------- - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - resmap@cnLevelSelectionMode = "ManualLevels"; Manually set contour levels. - resmap@cnMinLevelValF = 5. -; resmap@cnMaxLevelValF = 3200. -; resmap@cnLevelSpacingF = 200. - -;=================================================; -; PLOT ZS -;=================================================; - plot_zs = gsn_csm_contour_map(wks,ZS,resmap) - -end - - diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_Cloud.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_Cloud.ncl deleted file mode 100644 index 9782e6805371913e438fb2df754b049459e5d2c2..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_Cloud.ncl +++ /dev/null @@ -1,202 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" - -; LCARTESIAN = False - -begin -;=================================================; -; Open file -;=================================================; -; MESONH input file - mnh_file="16JAN.1.12B18.001.nc" - a = addfile(mnh_file, "r") - -;==================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use type= ps or pdf -;==================================================; - - type = "x11" ; could be png, ps , pdf ... - wks = gsn_open_wks(type,"plt_Cloud") - -; Choose the colormap you want -; See http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml -; for all the available color tables - gsn_define_colormap(wks,"WhBlGrYeRe") ; overwrite the .hluresfile color map - -;=================================================; -; Get informations on variable sizes -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"UT") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 -; -2 : to remove non-physical values - -;=================================================; -; Read the variables we will need -;=================================================; - -; Read latitude and longitude fields -; ----------------------------------------- - lat2d = a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lat2d@units="degrees_north" - lon2d = a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d@units="degrees_east" - -; Read cloud mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RCT")) - qc = a->RCT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - qc = qc*1000. - qc@units = "g/kg" - qc@description="Cloud mixing ratio" - qc@lat2d=lat2d - qc@lon2d=lon2d - end if - -; Read rain mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RRT")) - qr = a->RRT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - qr = qr*1000. - qr@units = "g/kg" - qr@description="Rain mixing ratio" - qr@lat2d=lat2d - qr@lon2d=lon2d - end if - -; Read ice mixing ratio if it exists -; ----------------------------------------- - if(isfilevar(a,"RIT")) - qi = a->RIT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - qi = qi*1000. - qi@units = "g/kg" - qi@description="Ice mixing ratio" - qi@lat2d=lat2d - qi@lon2d=lon2d - end if - -; Read projection parameters -; -------------------- - RPK = a->RPK - BETA = a->BETA - LON0 = a->LON0 - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Set map projection ressources using projection parameters -;-----------------------------------------------; - if (RPK.gt.0) -; --------------------------- - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = 1 ; projection for north hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.lt.0) -; --------------------------- - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = -1 ; projection for south hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.eq.1) -; --------------------------- - ; Stereographic projection north -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90 - end if - - if (RPK.eq.-1) -; --------------------------- - ; Stereographic projection south -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90 - end if - - if (RPK.eq.0) then -; --------------------------- - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -;=================================================; -; Set some other basic resources -;=================================================; - - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@mpFillOn = False - -; Defining the corners for projection -;==================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - resmap@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - - -;=========================================================; -; Loop over levels by step of 5 -;=========================================================; - do level = 0,19,19 - - display_level = level + 1 - -; Contour resources -;-------------------- - opts = resmap - opts@cnFillOn = True - opts@cnLinesOn = False - - opts@tiMainString = "Model Level "+display_level - - -; Plot cloud mixing ratio if it exists -; ----------------------------------------- - if (isvar("qc")) - plot=gsn_csm_contour_map(wks,qc(level,:,:),opts) - end if - -; Plot rain mixing ratio if it exists -; ----------------------------------------- - if (isvar("qr")) - plot=gsn_csm_contour_map(wks,qr(level,:,:),opts) - end if - -; Plot ice mixing ratio if it exists -; ----------------------------------------- - if (isvar("qi")) - plot=gsn_csm_contour_map(wks,qi(level,:,:),opts) - end if - - - end do ; END OF LEVEL LOOP -;=================================================; - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_CrossSection.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_CrossSection.ncl deleted file mode 100644 index 17296582229f4b050e69fa71ec7d30c6be138da1..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_CrossSection.ncl +++ /dev/null @@ -1,315 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -begin - -;=================================================; -; Open file -;=================================================; - in_file="16JAN.1.12B18.001.nc" - a = addfile(in_file, "r") - -;=================================================; -; We generate plots, but what kind do we prefer? -; For paper quality plot do not use ncgm or eps -;=================================================; - type = "x11" - -;=================================================; -; Open the workstation and choose colormap -;=================================================; - wks = gsn_open_wks(type,"plt_CrossSection2") -; gsn_define_colormap(wks,"topo_15lev") - gsn_define_colormap(wks,"wind_17lev") - -;=================================================; -; Get informations on variable sizes -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"UT") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - -;=================================================; -; Read some variables from mnh_file -;=================================================; - ZS =a->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) - - th = a->THT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - th@long_name="Potential Temperature" - th@description="TH" - - um = a->UT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) - um@description="U" - - zh= a->ZHAT(0:kmax) - - lat2d = a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lat2d@units="degrees_north" - lon2d = a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d@units="degrees_east" - - ZS@lat2d=lat2d - ZS@lon2d=lon2d - - th@lat2d=lat2d - th@lon2d=lon2d - - um@lat2d=lat2d - um@lon2d=lon2d - -;=================================================; -; Take care of the Arakawa C grid -;=================================================; -; Unstagger zh (from grid 4 to 1) -;----------------------------------; - nzh=new(kmax,double) - do k=0,kmax-1 - nzh(k)=(zh(k)+zh(k+1))/2. - end do - -; Unstagger U -;----------------------------------; - um!0="Z" - um!1="Y" - um!2="X" - u_unst = wrf_user_unstagger(um,"X") - -;=================================================; -; Needed for the wrf_intrp3d function -;=================================================; -; Create Z3D -;----------------------------------; - z=new(dimsizes(th),double) - zcoef=1.-ZS/nzh(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - z(:,j,i) = nzh*zcoef(j,i)+ZS(j,i) - end do - end do - -; get height info for labels -;----------------------------------; - zmin = 0. - zmax = 6. ; We are only interested in the first 6km - nz = floattoint(zmax + 1) - - -;----------------------------------------------------------; - -; Resources for the map projection -;-----------------------------------------------; - resmap=True - -;=================================================; -; Define Other Resources for map ploting -;=================================================; - - resmap@gsnFrame = False - resmap@gsnMaximize = True - -; Map resources -;-----------------------------------------------; - resmap@mpFillOn = False - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - -; Defining the corners for projection -;==================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - -; Contour definitions -;-----------------------------------------------; - resmap@cnFillOn = True - resmap@cnLinesOn = False - resmap@cnLevelSelectionMode = "ExplicitLevels" - cnLevels = (/1,250,500,750,1000,1250,1500,1750,2000,2250,2500,2750,3000/) - resmap@cnLevels = cnLevels - - resmap@lbOrientation = "Vertical" - - - FirstPlot = True - -;=================================================; -; Planes definition and interpolation -;=================================================; - do ip = 1, 3 ; we are doing 3 plots - ; all with the pivot point (plane) in the center of the domain - ; at angles 0, 45 and 90 - ; - ; | - ; angle=0 is | - ; | - ; - -; Define the plane where the cross-section will be done -; ------------------------------------------------------ - plane = new(2,float) - plane = (/ (imax)/2, (jmax)/2 /) ; pivot point is center of domain (x,y) - -; Resource for the interpolation -; -------------------------------- - opts = False - - if(ip .eq. 1) then - angle = 90. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - end if - if(ip .eq. 2) then - angle = 0. - X_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - X_desc = "latitude" - end if - if(ip .eq. 3) then - angle = -45. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - - end if - -; Interpolate fields onto the defined plane -; -------------------------------------------- - um_plane = wrf_user_intrp3d(u_unst,z,"v",plane,angle,opts) - th_plane = wrf_user_intrp3d(th,z,"v",plane,angle,opts) - -; Find the index where 6km is - only need to do this once -; -------------------------------------------- - if ( FirstPlot ) then - zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts) - b = ind(zz(:,0) .gt. zmax*1000. ) - zmax_pos = b(0) - 1 - if ( abs(zz(zmax_pos,0)-zmax*1000.) .lt. abs(zz(zmax_pos+1,0)-zmax*1000.) ) then - zspan = b(0) - 1 - else - zspan = b(0) - end if - delete(zz) - delete(b) - FirstPlot = False - end if - -; Define X-axis labels -;---------------------- - dimsX = dimsizes(X_plane) - xmin = X_plane(0) - xmax = X_plane(dimsX(0)-1) - xspan = dimsX(0)-1 - nx = 3 - -; Options for XY Plots -;----------------------------------------- - opts_xy = True - opts_xy@tiXAxisString = X_desc - opts_xy@tiYAxisString = "Height (km)" - opts_xy@tiXAxisFontHeightF = 0.020 - opts_xy@tiYAxisFontHeightF = 0.020 - -; Resources to plot the topography (missing values in fields) -;----------------------------------------- - opts_xy@cnMissingValPerimOn = True - opts_xy@cnMissingValFillColor = "red" - opts_xy@cnMissingValFillPattern = 8 - -; Tickmarks/labels resources -;------------------------------ - opts_xy@lbOrientation = "Vertical" - - opts_xy@tmXTOn = False - opts_xy@tmYROn = False - opts_xy@tmXBMode = "Explicit" - opts_xy@tmXBValues = fspan(0,xspan,nx) ; Create tick marks - opts_xy@tmXBLabels = sprintf("%.2f",fspan(xmin,xmax,nx)) ; Create labels - opts_xy@tmXBLabelFontHeightF = 0.015 - opts_xy@tmYLMode = "Explicit" - opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks - opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels - opts_xy@tmXBMajorLengthF = 0.02 - opts_xy@tmYLMajorLengthF = 0.02 - opts_xy@tmYLLabelFontHeightF = 0.015 - - -; Plotting options for U -;-------------------------- - opts_um = opts_xy - opts_um@cnFillOn = True - -; Plotting options for Temperature -;-------------------------- - opts_th = opts_xy - opts_th@cnInfoLabelZone = 1 - opts_th@cnInfoLabelSide = "Top" - opts_th@cnInfoLabelPerimOn = True - opts_th@cnInfoLabelOrthogonalPosF = -0.00005 - - opts_th@gsnLeftStringParallelPosF = 0.1 - opts_th@gsnLeftStringOrthogonalPosF = 0.01 - -;====================== -; MAKE PLOTS -;====================== - -; Horizontal plot with topography -;----------------------------------------------------------------------- - plot=gsn_csm_contour_map(wks,ZS,resmap) - -; Draw line that shows the position of the cross section -;----------------------------------------------------------------------- - lat_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - lon_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - - lnres = True - lnres@gsLineThicknessF = 3.0 - lnres@gsLineColor = "Red" - do ii = 0,dimsX(0)-2 - gsn_polyline(wks,plot,(/lon_plane(ii),lon_plane(ii+1)/),(/lat_plane(ii),lat_plane(ii+1)/),lnres) - end do - frame(wks) - delete(lon_plane) - delete(lat_plane) - -; Vertical cross-section -;-------------------------- - opts_th@gsnFrame = False - opts_th@gsnDraw = False - - - - opts_um@gsnFrame = False - opts_um@gsnDraw = False - - contour_th = gsn_csm_contour(wks,th_plane(0:zmax_pos,:),opts_th) - contour_um = gsn_csm_contour(wks,um_plane(0:zmax_pos,:),opts_um) - - overlay(contour_um,contour_th) ; plot x-section - draw(contour_um) - frame(wks) - - -; Delete options and fields, so we don't have carry over -;------------------------------------------------------- - delete(opts_xy) - delete(opts_th) - delete(opts_um) - delete(th_plane) - delete(um_plane) - delete(X_plane) - -end do ; make next cross section - - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_CrossSection_bis.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_CrossSection_bis.ncl deleted file mode 100644 index d4514465a6704d7c92291793130de354293b8699..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_CrossSection_bis.ncl +++ /dev/null @@ -1,353 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -begin - -;=================================================; -; Open file -;=================================================; - mnh_file="16JAN.1.12B18.001.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; We generate plots, but what kind do we prefer? -; For paper quality plot do not use ncgm or eps -;=================================================; - type = "x11" - -;=================================================; -; Open the workstation and choose colormap -;=================================================; - wks = gsn_open_wks(type,"mnh_CrossSection_bis") -; gsn_define_colormap(wks,"rainbow") - -;=================================================; -; Get informations on variable sizes -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"UT") ; get some dimension sizes for the file - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - -;=================================================; -; Read some variables from mnh_file -;=================================================; - lat2d = a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lat2d@units="degrees_north" - lon2d = a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d@units="degrees_east" - - ZS =a->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) - ZS@lat2d = lat2d - ZS@lon2d = lon2d - - rv = a->RVT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - rv = rv*1000. - rv@description="RVT" - rv@lat2d = lat2d - rv@lon2d = lon2d - -; zh= a->ZHAT(1:kmax+1) - zh= a->ZHAT(0:kmax) - -; Read parameter for projection - - RPK = a->RPK - BETA = a->BETA - LON0 = a->LON0 - -;=================================================; -; Take care of the Arakawa C grid -;=================================================; -; Unstagger zh (from grid 4 to 1) -;----------------------------------; - nzh=new(kmax,double) - do k=0,kmax-1 - nzh(k)=(zh(k)+zh(k+1))/2. - end do - -;=================================================; -; Needed for the wrf_intrp3d function -;=================================================; -; Create Z3D -;----------------------------------; - z=new(dimsizes(rv),double) - zcoef=1.-ZS/nzh(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - z(:,j,i) = nzh*zcoef(j,i)+ZS(j,i) - end do - end do - -; get height info for labels -;----------------------------------; - zmin = 0. - zmax = 6. ; We are only interested in the first 6km - nz = floattoint(zmax + 1) - -;=================================================; -; Set map projection -;=================================================; - -; Resources for the map projection -;-----------------------------------------------; - resmap=True -;-----------------------------------------------; -; Get global attributes to set map projection -;-----------------------------------------------; - - if (RPK.gt.0) - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = 1 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; Parallel1 = PArallel2 - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.lt.0) - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = -1 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.eq.1) - ; Stereographic projection -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90. - end if - - if (RPK.eq.-1) - ; Stereographic projection -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90. - end if - - if (RPK.eq.0) then - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -;==================================== -; Defining the corners for projection -;==================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - print ("Corner (0,0); Lat="+resmap@mpLeftCornerLatF+ \ - ", Lon="+resmap@mpLeftCornerLonF) - print ("Oppos corner; Lat="+resmap@mpRightCornerLatF+ \ - ", Lon= "+resmap@mpRightCornerLonF) - -;========================================== -; Needed for regional native projection -;========================================== - resmap@gsnAddCyclic = False ; regional data - -;=================================================; -; Define Other Resources for map ploting -;=================================================; - - resmap@gsnFrame = False - resmap@gsnMaximize = True - -; Map resources -;-----------------------------------------------; - resmap@mpFillOn = False - resmap@mpGridAndLimbOn = True ; turn on lat/lon lines - resmap@mpGridLatSpacingF = 10. ; spacing for lat lines - resmap@mpGridLonSpacingF = 10. ; spacing for lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) - resmap@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - resmap@mpOutlineBoundarySets = "AllBoundaries" ; state boundaries - resmap@mpPerimDrawOrder = "PostDraw" ; force map perim - - -; Contour definitions -;-----------------------------------------------; - resmap@cnFillOn = True - resmap@cnLinesOn = False -; resmap@cnLevelSelectionMode = "ExplicitLevels" -; cnLevels = (/1,25,50,75,100,125,150,175,200,225,250,275,300/) -; resmap@cnLevels = cnLevels - - resmap@lbOrientation = "Vertical" - - - FirstPlot = True - -;=================================================; -; Planes definition and interpolation -;=================================================; - do ip = 1, 3 ; we are doing 3 plots - ; all with the pivot point (plane) in the center of the domain - ; at angles 0, 45 and 90 - ; - ; | - ; angle=0 is | - ; | - ; - -; Define the plane where the cross-section will be done -; ------------------------------------------------------ - plane = new(2,float) - plane = (/ (imax/2)+10, (jmax)/2 /) -; Resource for the interpolation -; -------------------------------- - opts = False - - if(ip .eq. 1) then - angle = 90. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - end if - if(ip .eq. 2) then - angle = 0. - X_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - X_desc = "latitude" - end if - if(ip .eq. 3) then - angle = -35. - X_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - X_desc = "longitude" - - end if - -; Interpolate fields onto the defined plane -; -------------------------------------------- - rv_plane = wrf_user_intrp3d(rv,z,"v",plane,angle,opts) - -; Find the index where 6km is - only need to do this once -; -------------------------------------------- - if ( FirstPlot ) then - zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts) - b = ind(zz(:,0) .gt. zmax*1000. ) - zmax_pos = b(0) - 1 - if ( abs(zz(zmax_pos,0)-zmax*1000.) .lt. abs(zz(zmax_pos+1,0)-zmax*1000.) ) then - zspan = b(0) - 1 - else - zspan = b(0) - end if - delete(zz) - delete(b) - FirstPlot = False - end if - -; Define X-axis labels -;---------------------- - dimsX = dimsizes(X_plane) - xmin = X_plane(0) - xmax = X_plane(dimsX(0)-1) - xspan = dimsX(0)-1 - nx = 3 - -; Options for XY Plots -;----------------------------------------- - opts_xy = True - opts_xy@tiXAxisString = X_desc - opts_xy@tiYAxisString = "Height (km)" - opts_xy@tiXAxisFontHeightF = 0.020 - opts_xy@tiYAxisFontHeightF = 0.020 - -; Resources to plot the topography (missing values in fields) -;----------------------------------------- - opts_xy@cnMissingValPerimOn = True - opts_xy@cnMissingValFillColor = "red" - opts_xy@cnMissingValFillPattern = 8 - -; Tickmarks/labels resources -;------------------------------ - opts_xy@lbOrientation = "Vertical" - - opts_xy@tmXTOn = False - opts_xy@tmYROn = False - opts_xy@tmXBMode = "Explicit" - opts_xy@tmXBValues = fspan(0,xspan,nx) ; Create tick marks - opts_xy@tmXBLabels = sprintf("%.2f",fspan(xmin,xmax,nx)) ; Create labels - opts_xy@tmXBLabelFontHeightF = 0.015 - opts_xy@tmYLMode = "Explicit" - opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks - opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels - opts_xy@tmXBMajorLengthF = 0.02 - opts_xy@tmYLMajorLengthF = 0.02 - opts_xy@tmYLLabelFontHeightF = 0.015 - - -; Plotting options for RV -;-------------------------- - opts_rv = opts_xy - opts_rv@cnFillOn = True - opts_rv@gsnFrame = False - opts_rv@gsnDraw = False - opts_rv@cnLevelSelectionMode = "ManualLevels" - opts_rv@cnMinLevelValF = 0. - opts_rv@cnMaxLevelValF = 10. - opts_rv@cnLevelSpacingF = 0.5 - -;====================== -; MAKE PLOTS -;====================== - -; Horizontal plot with topography -;----------------------------------------------------------------------- - plot=gsn_csm_contour_map(wks,ZS,resmap) - -; Draw line that shows the position of the cross section -;----------------------------------------------------------------------- - lat_plane = wrf_user_intrp2d(lat2d,plane,angle,opts) - lon_plane = wrf_user_intrp2d(lon2d,plane,angle,opts) - - lnres = True - lnres@gsLineThicknessF = 3.0 - lnres@gsLineColor = "Red" - do ii = 0,dimsX(0)-2 - gsn_polyline(wks,plot,(/lon_plane(ii),lon_plane(ii+1)/),(/lat_plane(ii),lat_plane(ii+1)/),lnres) - end do - frame(wks) - delete(lon_plane) - delete(lat_plane) - -; Vertical cross-section -;-------------------------- - - - - contour_rv = gsn_csm_contour(wks,rv_plane(0:zmax_pos,:),opts_rv) - - draw(contour_rv) - frame(wks) - - -; Delete options and fields, so we don't have carry over -;------------------------------------------------------- - delete(opts_xy) - delete(opts_rv) - delete(rv_plane) - delete(X_plane) - -end do ; make next cross section - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_ModelLevels.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_ModelLevels.ncl deleted file mode 100644 index 83ddea4422d5adc633d603663b4f6465e2c9c33b..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_ModelLevels.ncl +++ /dev/null @@ -1,321 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -load "MESONHtools.ncl" - -;=============================================================; -; Example of script to plot field on model levels from MESONH -; netcdf file generated with lfi2cdf -;=============================================================; - -begin - -;=================================================; -; Open file -;=================================================; -; The MESONH input file. -; ---------------------- - mnh_file="16JAN.1.12B18.001.nc" - a = addfile(mnh_file,"r") - -;==================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf or x11 (for debugging) -;==================================================; - type = "x11" - wks = gsn_open_wks(type,"plt_ModelLevels") - gsn_define_colormap(wks,"rainbow+gray") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"THT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - -;=================================================; -; Read the variables we need -;=================================================; - lat2d = a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lat2d@units="degrees_north" - lon2d = a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d@units="degrees_east" - - th = a->THT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; theta - th@long_name="Potential Temperature" - th@units = "K" - th@lat2d=lat2d - th@lon2d=lon2d - - qv = a->RVT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; Qv - qv = qv*1000. - qv@long_name="Water vapor mixing ratio" - qv@units = "g/kg" - qv@lat2d=lat2d - qv@lon2d=lon2d - - ut = a->UT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; u - ut@long_name="U" - ut@units="m/s" - ut@lat2d=lat2d - ut@lon2d=lon2d - - vt = a->VT(1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; v - vt@long_name="V" - vt@units="m/s" - vt@lat2d=lat2d - vt@lon2d=lon2d - - ; Unstagger U -; -------------------- - ut!0="Z" - ut!1="Y" - ut!2="X" - u = wrf_user_unstagger(ut,"X") - - ; Unstagger V -; -------------------- - vt!0="Z" - vt!1="Y" - vt!2="X" - v = wrf_user_unstagger(vt,"Y") - v@description="V" - -; Calculate wind speed -; -------------------- - spd = (u*u + v*v)^(0.5) ; speed in m/sec - spd@long_name = "Wind Speed" - spd@units = "m/s" - -; Read projection parameters -; -------------------- - RPK = a->RPK - BETA = a->BETA - LON0 = a->LON0 - - -; Set resource for the map projection -;-----------------------------------------------; - resmap=True - -; Set map projection ressources using projection parameters -;-----------------------------------------------; - if (RPK.gt.0) -; --------------------------- - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = 1 ; projection for north hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.lt.0) -; --------------------------- - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = -1 ; projection for south hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.eq.1) -; --------------------------- - ; Stereographic projection north -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90 - end if - - if (RPK.eq.-1) -; --------------------------- - ; Stereographic projection south -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90 - end if - - if (RPK.eq.0) then -; --------------------------- - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -; Defining the corners for projection -; -------------------------------- - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - -;=================================================; -; Set some other basic resources -;=================================================; - resmap@mpDataBaseVersion = "HighRes" ; highres map data version - resmap@mpFillOn = False - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - - resmap@pmTickMarkDisplayMode = "Always" ; turn on tickmarks - -;=========================================================; -; Loop over levels by step of 20 -;=========================================================; - do level =0,kmax-1,20 ; LOOP OVER LEVELS - - display_level = level + 1 - resmap@tiMainString = "Model Level " + display_level - -;======================= -; Resources for Theta -;======================= - opts = resmap - - opts@gsnFrame = False - opts@gsnDraw = False - opts@gsnContourLineThicknessesScale = 2.0 - - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = -0.05 - opts@cnInfoLabelParallelPosF = 0.97 - - contour = gsn_csm_contour_map(wks,th(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;====================== -; Resources for Qv -;====================== - opts = resmap - -; General resources -;------------------- - opts@gsnFrame = False - opts@gsnDraw = False - opts@gsnSpreadColors = True - opts@gsnSpreadColorStart = 30 - opts@gsnSpreadColorEnd = -2 - -; Contour resources -;------------------- - opts@cnLinesOn = False ; no line - opts@cnFillOn = True ; filled - - contour = gsn_csm_contour_map(wks,qv(level,:,:),opts) - draw(contour) - frame(wks) - delete(opts) - -;=============================================== -; Overlay Wind Vectors and Speed over basic map -;=============================================== - -;======================= -; 1.Create Base map plot -;======================= - resmap@gsnDraw = False ; don't draw yet - resmap@gsnFrame = False ; don't advance frame yet - - map=gsn_map(wks,"Stereographic",resmap) - -;======================= -; 2.Create Wind speed plot -;======================= - opts_ws = True - -; General resources -;------------------- - opts_ws@gsnFrame = False - opts_ws@gsnDraw = False - opts_ws@gsnSpreadColors = True - opts_ws@gsnSpreadColorStart = 30 - opts_ws@gsnSpreadColorEnd = -2 - -; Tickmark resources -;--------------------- -; No tickmark and label on axis for this plot -; They are already drawn by the basic map plot -; ------------------------------------------- - opts_ws@tmXBOn = False - opts_ws@tmYROn = False - opts_ws@tmXBLabelsOn = False - opts_ws@tmYRLabelsOn = False - - opts_ws@lbOrientation = "Vertical" - - -; Transformation resources -;--------------------------- -; Field is already on the right projection -;------------------------------------------ - opts_ws@tfDoNDCOverlay = True - -; Contour resources -; ------------------- - opts_ws@cnFillOn = True - opts_ws@cnLinesOn = False - -; PLOT -;----- - contour = gsn_csm_contour(wks,spd(level,:,:),opts_ws) - -;=========================== -; 3.Create Wind vector plot -;=========================== - opts_vec = True - - opts_vec@gsnFrame = False - opts_vec@gsnDraw = False - opts_vec@gsnLeftString = "Wind Vector" - opts_vec@gsnLeftStringParallelPosF = 0.3 - opts_vec@gsnLeftStringOrthogonalPosF = 0.018 - -; No Tickmarks/labels -;------------- - opts_vec@tmXBOn = False - opts_vec@tmYROn = False - opts_vec@tmXBLabelsOn = False - opts_vec@tmYRLabelsOn = False - - opts_vec@tfDoNDCOverlay = True - -; Vector resources -;------------------- - opts_vec@vcRefLengthF = 0.1 - opts_vec@vcRefMagnitudeF = 20 - opts_vec@vcMinDistanceF = 0.05 - - -; PLOT -;----- - vector = gsn_csm_vector(wks,u(level,:,:),v(level,:,:),opts_vec) - -;=================== -; 4.Overlay and draw -;=================== - overlay(map,contour) - overlay(map,vector) - - draw(map) - frame(wks) - - end do ; END OF LEVEL LOOP - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_PressureLevel.ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_PressureLevel.ncl deleted file mode 100644 index c553f552187098cec5d89dcbb223cb0230510386..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/mnh_PressureLevel.ncl +++ /dev/null @@ -1,240 +0,0 @@ -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "MESONHtools.ncl" - -;=================================================; -; Example of script to interpolate from model to pressure level -; and to plot some fields from MESONH netcdf4 files -;=================================================; - -begin - -;=======================================================; -; Pressure levels that we want the data interpolated to -;=======================================================; - pressure_levels = (/ 850., 700., 500., 300./) - nlevels = dimsizes(pressure_levels) ; number of pressure levels - -;=================================================; -; Open file -; MESONH netcdf4 input file -;=================================================; - - mnh_file="16JAN.1.12B18.001.nc" - a = addfile(mnh_file, "r") - -;=================================================; -; Open the workstation and choose colormap -; For paper quality plot do not use type ncgm or eps -; Use ps or pdf and x11 (for debugging) -;==================================================; - - type = "x11" - wks = gsn_open_wks(type,"plt_PressureLevel") - gsn_define_colormap(wks,"spread_15lev") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"UT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - - -;=================================================; -; Read the variables we need -;=================================================; - - tk = a->THT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; potential temperature - tk@description="Potential Temperature" - - u = a->UT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; u - v = a->VT(1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; v - - -; Unstagger u,v - u!0="Z" - u!1="Y" - u!2="X" - u_unst = wrf_user_unstagger(u,"X") - - v!0="Z" - v!1="Y" - v!2="X" - v_unst = wrf_user_unstagger(v,"Y") - - p = a->PABST(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; pressure - p@description="Pressure" - - rv = a->RVT(1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; water vapor mixing ratio - rv = rv*1000. ; water vapor mixing ratio - rv@description="Water vapor mixing ratio" - - zs = a->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) ; terrain - zh = a->ZHAT(1:kmax+1) ; heigth without terrain - -;========================================== -; Create 3D Z to be used for interpolation -;========================================== - - z=new(dimsizes(tk),double) - z@description="Height" - -; Unstag zh -;---------- - nzh=new(kmax,double) - do k=0,kmax-1 - nzh(k)=(zh(k)+zh(k+1))/2. - end do - zcoef=1.-zs/nzh(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - z(:,j,i) = nzh*zcoef(j,i)+zs(j,i) - end do - end do - -;=================================================; -; Horizontal interpolation on pressure levels -;=================================================; - - - do level = 0,nlevels-1 ; LOOP OVER LEVELS - - pressure = pressure_levels(level) - - tk_plane = wrf_user_intrp3d(tk,p,"h",pressure,0.,False) - z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) - u_plane = wrf_user_intrp3d( u_unst,p,"h",pressure,0.,False) - v_plane = wrf_user_intrp3d( v_unst,p,"h",pressure,0.,False) - rv_plane = wrf_user_intrp3d( rv,p,"h",pressure,0.,False) - - spd_plane = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec - spd_plane@description = "Wind Speed" - spd_plane@units = "m/s" - - u_plane@units = "m/s" - v_plane@units = "m/s" - -;================================== -; Create plots usinf wrf functions -;================================== - res=True - res@MainTitle = "MESONH" - res@Footer = False - -; Plotting options for Tk -;-------------------------- - opts = res - opts@cnLineColor = "Red" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 2.0 - - contour_tk = wrf_contour(a,wks,tk_plane,opts) - delete(opts) - -; Plotting options for RV -;-------------------------- - opts = res - opts@cnFillOn = True - opts@pmLabelBarOrthogonalPosF = -0.1 - opts@cnMissingValFillColor = "Red" - opts@cnMissingValFillPattern = 8 - - contour_rv = wrf_contour(a,wks,rv_plane,opts) - delete(opts) - -; Plotting options for Wind Speed -;-------------------------- - opts = res - opts@cnLineColor = "MediumSeaGreen" - opts@cnInfoLabelOrthogonalPosF = 0.07 ; offset second label information - opts@gsnContourLineThicknessesScale = 3.0 - - contour_spd = wrf_contour(a,wks,spd_plane,opts) - delete(opts) - - -; Plotting options for Wind Vectors -;----------------------------------- - opts = res - opts@FieldTitle = "Wind" ; overwrite Field Title - opts@NumVectors = 47 ; wind barb density - - vector = wrf_vector(a,wks,u_plane,v_plane,opts) - delete(opts) - -; Plotting options for Geopotential Heigh -;----------------------------------------- - opts_z = res - opts_z@cnLineColor = "Blue" - opts_z@gsnContourLineThicknessesScale = 2.0 - -;============= -; MAKE PLOTS -;============= - - pltres = True - -; Resources for map -;------------------- - resmap = True - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - resmap@mpGridLineColor = "Black" - resmap@mpLimbLineColor = "Black" - resmap@mpPerimLineColor = "Black" - resmap@mpGeophysicalLineThicknessF = 2.0 - resmap@mpGridLineThicknessF = 2.0 - resmap@mpLimbLineThicknessF = 2.0 - resmap@mpNationalLineThicknessF = 2.0 - resmap@mpGridAndLimbOn = False ; turn off lat/lon lines - resmap@mpDataBaseVersion = "HighRes" ; choose highres map data - - -; Overlay rv , tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 850 ) then ; plot temp, rv, height, wind barbs - - contour_height = wrf_contour(a,wks,z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_rv,contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 700 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay tk , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 500 ) then ; plot temp, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_tk,contour_height, \ - vector/),pltres,resmap) - end if - -; Overlay wind speed , height and wind barbs -;------------------------------------------ - if ( pressure .eq. 300 ) then ; plot windspeed, height, wind barbs - - contour_height = wrf_contour(a,wks, z_plane,opts_z) - plot = mnh_map_overlays(a,wks,(/contour_spd,contour_height, \ - vector/),pltres,resmap) - end if - - delete(opts_z) - -end do ; END OF LEVEL LOOP - - -end diff --git a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/run_ncl b/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/run_ncl deleted file mode 100755 index 186f6b1056c88923c36632248211d9333947934e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_ncl_nc4/run_ncl +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -set -x -#### Get highres coastline data for ncl -./get_ncl_highres_files -#### nc4 file to plot -ln -sf ../008_run2/16JAN.1.12B18.001.nc -#### Initilizing variables for ncl -path_ncl=`which ncl` -if [ "$path_ncl" == "" ] -then -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -echo "! ERROR: NCL is not installed or the path to !" -echo "! ncl binary is not set correctly !" -echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -exit -fi -export NCARG_ROOT=${path_ncl%%/bin/ncl} -export PATH=$NCARG_ROOT/bin:$PATH -export NCARG_RANGS=. -#### Running ncl scripts -ncl mnh_BasicMap.ncl -ncl mnh_ModelLevels.ncl -ncl mnh_Cloud.ncl -ncl mnh_CrossSection.ncl -ncl mnh_CrossSection_bis.ncl -ncl mnh_PressureLevel.ncl diff --git a/MY_RUN/KTEST/007_16janvier/012_spectre/SPEC1.nam b/MY_RUN/KTEST/007_16janvier/011_spectre/SPEC1.nam similarity index 100% rename from MY_RUN/KTEST/007_16janvier/012_spectre/SPEC1.nam rename to MY_RUN/KTEST/007_16janvier/011_spectre/SPEC1.nam diff --git a/MY_RUN/KTEST/007_16janvier/012_spectre/clean_spectre_xyz b/MY_RUN/KTEST/007_16janvier/011_spectre/clean_spectre_xyz similarity index 100% rename from MY_RUN/KTEST/007_16janvier/012_spectre/clean_spectre_xyz rename to MY_RUN/KTEST/007_16janvier/011_spectre/clean_spectre_xyz diff --git a/MY_RUN/KTEST/007_16janvier/012_spectre/run_spectre_xyz b/MY_RUN/KTEST/007_16janvier/011_spectre/run_spectre_xyz similarity index 100% rename from MY_RUN/KTEST/007_16janvier/012_spectre/run_spectre_xyz rename to MY_RUN/KTEST/007_16janvier/011_spectre/run_spectre_xyz diff --git a/MY_RUN/KTEST/007_16janvier/012_spectre/trace_EC.sh b/MY_RUN/KTEST/007_16janvier/011_spectre/trace_EC.sh similarity index 100% rename from MY_RUN/KTEST/007_16janvier/012_spectre/trace_EC.sh rename to MY_RUN/KTEST/007_16janvier/011_spectre/trace_EC.sh diff --git a/MY_RUN/KTEST/007_16janvier/Makefile b/MY_RUN/KTEST/007_16janvier/Makefile index cc7eebb12360a407fb6d67908c22c0c00930274d..e33f6b5e37cd5168f13f2f47c8d3da2fbb31b3ff 100644 --- a/MY_RUN/KTEST/007_16janvier/Makefile +++ b/MY_RUN/KTEST/007_16janvier/Makefile @@ -2,13 +2,7 @@ all: E001_pgd1 E002_pgd2 E003_nest E004_arp2lfi E005_spa_mod1_mod2 E006_preal E0 ifneq "$(MNH_PYTHON)" "NO" all: E010_python endif -all: E011_ncl E012_spectre - -all_ncl_nc4: E001_pgd1 E002_pgd2 E003_nest E004_arp2lfi E005_spa_mod1_mod2 E006_preal E008_run2 E009_diag E011_ncl_nc4 - -all_ncl_lfi2cdf: E001_pgd1 E002_pgd2 E003_nest E004_arp2lfi E005_spa_mod1_mod2 E006_preal E008_run2 E009_diag E010_python E011_ncl_lfi2cdf - -all_ncl_extractdia: E001_pgd1 E002_pgd2 E003_nest E004_arp2lfi E005_spa_mod1_mod2 E006_preal E008_run2 E009_diag E010_python E011_ncl_extractdia +all: E011_spectre E001_pgd1 : cd 001_pgd1 && get_pgd_files @@ -29,16 +23,8 @@ E009_diag: cd 009_diag && run_diag_xyz E010_python: cd 010_python && run_python -E011_ncl: - cd 011_ncl && run_ncl -E011_ncl_nc4: - cd 011_ncl_nc4 && run_ncl -E011_ncl_lfi2cdf: - cd 011_ncl_lfi2cdf && run_ncl -E011_ncl_extractdia: - cd 011_ncl_extractdia && run_ncl -E012_spectre: - cd 012_spectre && run_spectre_xyz +E011_spectre: + cd 011_spectre && run_spectre_xyz clean: cd 001_pgd1 && clean_prep_pgd_xyz @@ -52,10 +38,5 @@ clean: ifneq "$(MNH_PYTHON)" "NO" cd 010_python && clean_python endif - cd 011_ncl_lfi2cdf && clean_ncl - cd 011_ncl_extractdia && clean_ncl - cd 011_ncl_nc4 && clean_ncl - cd 011_ncl && clean_ncl - cd 012_spectre && clean_spectre_xyz python: cd 010_python && run_python diff --git a/MY_RUN/KTEST/009_ICARTT/006_ncl/clean_ncl b/MY_RUN/KTEST/009_ICARTT/006_ncl/clean_ncl deleted file mode 100755 index 5d5fb32b602cb7eb68f7c19161242a3e361832a9..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/009_ICARTT/006_ncl/clean_ncl +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f *.png *.nc diff --git a/MY_RUN/KTEST/009_ICARTT/006_ncl/plot_ICARTT.ncl b/MY_RUN/KTEST/009_ICARTT/006_ncl/plot_ICARTT.ncl deleted file mode 100644 index 0ae28c72ec5bb27cfb1d27a1e79a14c22fba0c68..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/009_ICARTT/006_ncl/plot_ICARTT.ncl +++ /dev/null @@ -1,474 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -begin -;=================================================; -; open file and read in data -;=================================================; - a = addfile("ICART.1.SEG01.001dg.nc", "r") - a2 = addfile("ICART.1.SEG01.002dg.nc", "r") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"UT") - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - -;-------------------------------------------------; -; Read data. -;-------------------------------------------------; - lat2d = a->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lat2d@units="degrees_north" - lon2d = a->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d@units="degrees_east" - -zs = a->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) ; ZS -zs@long_name="Orography" -zs@units="m" -zs@lat2d = lat2d -zs@lon2d = lon2d - -printMinMax(zs,0) - - rc_t1 = a->MRC(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - rc_t1@long_name="Cloud mixing ratio" - rc_t1@units="g/kg" - rc_t1@lat2d=lat2d - rc_t1@lon2d=lon2d -printMinMax(rc_t1,0) - -; - o3_t1 = a->O3T(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - o3_t1@long_name="Ozone" - o3_t1@units="ppbv" - o3_t1@lat2d=lat2d - o3_t1@lon2d=lon2d - -; - co_t1 = a->COT(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - co_t1@long_name="carbon monoxide" - co_t1@units="ppbv" - co_t1@lat2d=lat2d - co_t1@lon2d=lon2d - -; - o3p_t1=a->O3_PROD(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - o3p_t1 = o3p_t1*1e9*3600 - o3p_t1@long_name="ozone production" - o3p_t1@units="ppbv/h" - o3p_t1@lat2d=lat2d - o3p_t1@lon2d=lon2d - -; - o3l_t1=a->O3_LOSS(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - o3l_t1 = o3l_t1*1e9*3600 - o3l_t1@long_name="ozone loss" - o3l_t1@units="ppbv/h" - o3l_t1@lat2d=lat2d - o3l_t1@lon2d=lon2d - -; - cop_t1=a->CO_PROD(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - cop_t1 = cop_t1*1e9*3600 - cop_t1@long_name="carbon monoxide production" - cop_t1@units="ppbv/h" - cop_t1@lat2d=lat2d - cop_t1@lon2d=lon2d - -; - col_t1=a->CO_LOSS(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - col_t1 = col_t1*1e9*3600 - col_t1@long_name="carbon monoxide loss" - col_t1@units="ppbv/h" - col_t1@lat2d=lat2d - col_t1@lon2d=lon2d - - -; -; - rc_t2 = a2->MRC(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - rc_t2@long_name="Cloud mixing ratio" - rc_t2@units="g/kg" - rc_t2@lat2d=lat2d - rc_t2@lon2d=lon2d - -; - o3_t2 = a2->O3T(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - o3_t2@long_name="Ozone" - o3_t2@units="ppbv" - o3_t2@lat2d=lat2d - o3_t2@lon2d=lon2d - -; - co_t2 = a2->COT(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - co_t2@long_name="carbon monoxide" - co_t2@units="ppbv" - co_t2@lat2d=lat2d - co_t2@lon2d=lon2d - -; - o3p_t2=a2->O3_PROD(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - o3p_t2=o3p_t2*1e9*3600 - o3p_t2@long_name="ozone production" - o3p_t2@units="pptv/h" - o3p_t2@lat2d=lat2d - o3p_t2@lon2d=lon2d - -; - o3l_t2=a2->O3_LOSS(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - o3l_t2=o3l_t2*1e9*3600 - o3l_t2@long_name="ozone loss" - o3l_t2@units="pptv/h" - o3l_t2@lat2d=lat2d - o3l_t2@lon2d=lon2d - -; - cop_t2=a2->CO_PROD(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - cop_t2=cop_t2*1e9*3600 - cop_t2@long_name="carbon monoxide production" - cop_t2@units="pptv/h" - cop_t2@lat2d=lat2d - cop_t2@lon2d=lon2d - -; - col_t2=a2->CO_LOSS(:,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) - col_t2=col_t2*1e9*3600 - col_t2@long_name="carbon monoxide loss" - col_t2@units="ppbv/h" - col_t2@lat2d=lat2d - col_t2@lon2d=lon2d - - - -;-----------------------------------------------; -;=================================================; -; On calcule l'altitude des champs modèle -;=================================================; - -zhat= a2->ZHAT(1:kmax+1) - -; Unstagger zhat (from grid 4 to 1) - nzhat=new(kmax,double) - do k=0,kmax-1 - nzhat(k)=(zhat(k)+zhat(k+1))/2. - end do - -; Create Z3D == ALT - alt=new(dimsizes(o3_t2),double) - zcoef=1.-zs/nzhat(kmax-1) - - do i=0,imax-1 - do j=0,jmax-1 - alt(0,:,j,i) = nzhat*zcoef(j,i)+zs(j,i) - end do - end do - -alt@lat2d = lat2d -alt@lon2d = lon2d - - - - -;-----------------------------------------------; -; Set map projection ressources using projection parameters -;-----------------------------------------------; -; Read projection parameters -; -------------------- - RPK = a2->RPK - BETA = a2->BETA - LON0 = a2->LON0 - - resmap=True - if (RPK.gt.0) -; --------------------------- - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = 1 ; projection for north hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.lt.0) -; --------------------------- - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - pole = -1 ; projection for south hemisphere - resmap@mpLambertParallel1F = pole*asin(RPK)*180/3.14 ; with pole=1 for north hemisphere and -1 for south hemisphere - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; ncl adds from grib file - end if - - if (RPK.eq.1) -; --------------------------- - ; Stereographic projection north -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90 - end if - - if (RPK.eq.-1) -; --------------------------- - ; Stereographic projection south -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90 - end if - - if (RPK.eq.0) then -; --------------------------- - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -; Defining the corners for projection -; -------------------------------- - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - -;=================================================; -; PLOT -;=================================================; -; interpolation des champs a 1250 m -rc_t1_plane = wrf_user_intrp3d(rc_t1(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -printMinMax(rc_t1_plane,0) -printMinMax(alt,0) - -rc_t2_plane = wrf_user_intrp3d(rc_t2(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -co_t1_plane = wrf_user_intrp3d(co_t1(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -co_t2_plane = wrf_user_intrp3d(co_t2(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -cop_t1_plane= wrf_user_intrp3d(cop_t1(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -cop_t2_plane= wrf_user_intrp3d(cop_t2(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -col_t1_plane= wrf_user_intrp3d(col_t1(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -col_t2_plane= wrf_user_intrp3d(col_t2(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -o3_t1_plane = wrf_user_intrp3d(o3_t1(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -o3_t2_plane = wrf_user_intrp3d(o3_t2(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -o3l_t1_plane= wrf_user_intrp3d(o3l_t1(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -o3l_t2_plane= wrf_user_intrp3d(o3l_t2(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -o3p_t1_plane= wrf_user_intrp3d(o3p_t1(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) -o3p_t2_plane= wrf_user_intrp3d(o3p_t2(0,:,:,:),alt(0,:,:,:),"h",1250,0.,False) - - - figname ="zsection_1250" - wks = gsn_open_wks("png",figname) ; open a ncgm file - gsn_define_colormap(wks,"WhBlGrYeRe") ; Choose colormap - - res = resmap - res@gsnDraw = False ; don't draw yet - res@gsnFrame = False ; don't advance frame yet - -; X-axis title (tiY) - res@tiXAxisFontHeightF = 0.018 ; font height - res@tiXAxisFont = 21 ; font index - res@tiXAxisString = "longitude" ; string to use as the X-Axis title - -; Y-axis title (tiY) - res@tiYAxisFontHeightF = 0.018 ; font height - res@tiYAxisFont = 21 ; font index - res@tiYAxisString = "latitude" ; string to use as the Y-Axis title - -; BW - res@cnLinesOn = False - res@cnFillOn = True - res@gsnSpreadColors = True -; -; label bar (lb) -; res@lbAutoManage = False -; res@lbBottomMarginF = 0.4 ; offset -; res@lbOrientation = "Vertical" - -; Map ressources -; res@mpDataBaseVersion = "HighRes" ; choose highres map data version (must be donwloaded) -; res@mpDataBaseVersion = "MediumRes" ; choose highres map data version (must be donwloaded) - res@mpGridAndLimbOn = True ; turn on lat/lon lines - res@mpGridLatSpacingF = 10. ; spacing for lat lines - res@mpGridLonSpacingF = 10. ; spacing for lon lines - - res@mpGeophysicalLineColor = "Black" ; default value in lowres - res@mpNationalLineColor = "Black" ; idem - res@mpUSStateLineColor = "Black" ; idem - res@mpGridLineColor = "Black" - res@mpLimbLineColor = "Black" - res@mpPerimLineColor = "Black" - - - res@gsnCenterString="heure=19" - -; plot cloud mixing ratio - res@cnLevelSelectionMode = "ExplicitLevels" - res@cnLevels = (/0.01,0.015,0.02,0.025,0.03,0.035,0.04,0.045,0.05,0.055,0.06/) - res@cnFillColors = (/2,6,12,40,45,51,62,72,80,89,96,101/) ; color of a contour - plot_rc = gsn_csm_contour_map(wks,rc_t1_plane(:,:),res) - draw(plot_rc) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot ozone - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/15.,20., 25., 35., 40., 45., 50., 55., 60., 65./) - res@cnFillColors = (/2,6,12,40,45,51,62,72,80,89,96/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_o3 = gsn_csm_contour_map(wks,o3_t1_plane(:,:),res) - draw(plot_o3) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot co - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/110.,112.5,115.,117.5,120.,122.5,125.,127.5,130.,132.5,135./) - res@cnFillColors = (/2,6,12,40,45,51,62,72,80,89,96,101/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_co = gsn_csm_contour_map(wks,co_t1_plane(:,:),res) - draw(plot_co) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot ozone production - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/75,80,85,90,95,100,105,110,115,120,125/) - res@cnFillColors = (/75,80,85,90,95,100,105,110,115,120,125,130/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_o3p = gsn_csm_contour_map(wks,o3p_t1_plane(:,:),res) - draw(plot_o3p) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot ozone loss - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/75,80,85,90,95,100,105,110,115,120,125/) - res@cnFillColors = (/75,80,85,90,95,100,105,110,115,120,125,130/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_o3l = gsn_csm_contour_map(wks,o3l_t1_plane(:,:),res) - draw(plot_o3l) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot carbon monoxide production - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6/) - res@cnFillColors := (/0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_cop = gsn_csm_contour_map(wks,cop_t1_plane(:,:),res) - draw(plot_cop) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot carbon monoxide loss - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6/) - res@cnFillColors := (/0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_col = gsn_csm_contour_map(wks,col_t1_plane(:,:),res) - draw(plot_col) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - - res@gsnCenterString="heure=20" - -; plot cloud mixing ratio - res@cnLevelSelectionMode = "ExplicitLevels" - res@cnLevels = (/0.01,0.015,0.02,0.025,0.03,0.035,0.04,0.045,0.05,0.055,0.06/) - res@cnFillColors = (/2,6,12,40,45,51,62,72,80,89,96,101/) ; color of a contour - plot_rc1 = gsn_csm_contour_map(wks,rc_t2_plane(:,:),res) - draw(plot_rc1) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot ozone - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/15.,20., 25., 35., 40., 45., 50., 55., 60., 65./) - res@cnFillColors = (/2,6,12,40,45,51,62,72,80,89,96/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_o31 = gsn_csm_contour_map(wks,o3_t2_plane(:,:),res) - draw(plot_o31) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot co - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/110.,112.5,115.,117.5,120.,122.5,125.,127.5,130.,132.5,135./) - res@cnFillColors = (/2,6,12,40,45,51,62,72,80,89,96,101/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_co1 = gsn_csm_contour_map(wks,co_t2_plane(:,:),res) - draw(plot_co1) - frame(wks) - -; plot ozone production - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/75,80,85,90,95,100,105,110,115,120,125/) - res@cnFillColors = (/75,80,85,90,95,100,105,110,115,120,125,130/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_o3p1 = gsn_csm_contour_map(wks,o3p_t2_plane(:,:),res) - draw(plot_o3p1) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot ozone loss - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/75,80,85,90,95,100,105,110,115,120,125/) - res@cnFillColors = (/75,80,85,90,95,100,105,110,115,120,125,130/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_o3l1 = gsn_csm_contour_map(wks,o3l_t2_plane(:,:),res) - draw(plot_o3l1) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot carbon monoxide production - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6/) - res@cnFillColors := (/0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_cop1 = gsn_csm_contour_map(wks,cop_t2_plane(:,:),res) - draw(plot_cop1) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -; plot carbon monoxide loss - res@cnLevelSelectionMode = "ExplicitLevels" ; method for selecting the contour - res@cnLevels = (/0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6/) - res@cnFillColors := (/0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6/) ; color of a contour -; res@cnLevelSelectionMode = "AutomaticLevels" - plot_col1 = gsn_csm_contour_map(wks,col_t2_plane(:,:),res) - draw(plot_col1) - frame(wks) - delete(res@cnLevels) - delete(res@cnFillColors) - -;;;;;;;;;;;;;;;;;;;;;;;; - -end - - - diff --git a/MY_RUN/KTEST/009_ICARTT/006_ncl/plot_ICARTT_budget.ncl b/MY_RUN/KTEST/009_ICARTT/006_ncl/plot_ICARTT_budget.ncl deleted file mode 100644 index b3c9aac40e727d318d788fffe35aceb4741a2efc..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/009_ICARTT/006_ncl/plot_ICARTT_budget.ncl +++ /dev/null @@ -1,152 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -begin -;=================================================; -; open file and read in data -;=================================================; - a = addfile("ICART.1.SEG01.001dg.nc", "r") - a2 = addfile("ICART.1.SEG01.002dg.nc", "r") - -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = a->JPHEXT - mdims = getfilevardimsizes(a,"THT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - -;-------------------------------------------------; -; Read data. -;-------------------------------------------------; - -; Liste de toutes les réactions impliquant O3 - o3_list_t1=a->O3_CHREACLIST(0,:) - -; Tableau 4D (reac,Z,Y,X) regroupant les termes de prod. et destr. de O3 -; Niveau k=13 approx. 1250m - o3_budget_t1=a->O3_BUDGET(0,:,13,jphext:jmax+jphext-1,jphext:imax+jphext-1) - printVarSummary(o3_budget_t1) - o3_bud_t1=dim_avg_n(o3_budget_t1,(/1,2/)) - printVarSummary(o3_bud_t1) - - o3_bud_t1=o3_bud_t1*1e9*3600 - o3_bud_t1@units="ppbv/h" - -; Liste de toutes les réactions impliquant CO - co_list_t1=a->CO_CHREACLIST(0,:) - -; Tableau 4D (reac,Z,Y,X) regroupant les termes de prod. et destr. de CO -; Niveau k=13 approx. 1250m - co_budget_t1=a->CO_BUDGET(0,:,13,jphext:jmax+jphext-1,jphext:imax+jphext-1) - co_bud_t1=dim_avg_n(co_budget_t1,(/1,2/)) - co_bud_t1=co_bud_t1*1e9*3600 - co_bud_t1@units="ppbv/h" - -; Liste de toutes les réactions impliquant O3 - o3_list_t2=a2->O3_CHREACLIST(0,:) - -; Tableau 4D (reac,Z,Y,X) regroupant les termes de prod. et destr. de O3 -; Niveau k=13 approx. 1250m - o3_budget_t2=a2->O3_BUDGET(0,:,13,jphext:jmax+jphext-1,jphext:imax+jphext-1) - o3_bud_t2=dim_avg_n(o3_budget_t2,(/1,2/)) - o3_bud_t2=o3_bud_t2*1e9*3600 - o3_bud_t2@units="ppbv/h" - -; Liste de toutes les réactions impliquant CO - co_list_t2=a2->CO_CHREACLIST(0,:) - -; Tableau 4D (reac,Z,Y,X) regroupant les termes de prod. et destr. de CO -; Niveau k=13 approx. 1250m - co_budget_t2=a2->CO_BUDGET(0,:,13,jphext:jmax+jphext-1,jphext:imax+jphext-1) - co_bud_t2=dim_avg_n(co_budget_t2,(/1,2/)) - co_bud_t2=co_bud_t2*1e9*3600 - co_bud_t2@units="ppbv/h" - -;=================================================; -; PLOT -;=================================================; -; interpolation des champs a 1250 m - - figname ="zsection_1250_bud" - wks = gsn_open_wks("png",figname) ; open a ncgm file - gsn_define_colormap(wks,"WhBlGrYeRe") ; Choose colormap - - res = True - res@gsnDraw = False ; don't draw yet - res@gsnFrame = False ; don't advance frame yet - -; X-axis title (tiY) - res@tiXAxisFontHeightF = 0.018 ; font height - res@tiXAxisFont = 21 ; font index - res@tiXAxisString = "Chemical reactions" ; string to use as the X-Axis title - -; Y-axis title (tiY) - res@tiYAxisFontHeightF = 0.018 ; font height - res@tiYAxisFont = 21 ; font index - -; Bar plot - res@gsnXYBarChart = True ; turn on bar chat - res@gsnYRefLine = 0. ; reference line - res@gsnAboveYRefLineColor = "red" ; above ref line fill red - res@gsnBelowYRefLineColor = "blue" ; below ref line fill blue - res@xyCurveDrawOrder = "PreDraw" - res@tmYLFormat = "0@*+^sg" - res@tmYLPrecision = 2 - res@tmXBOn=False - - txres = True ; text mods desired - txres@txFontHeightF = 0.018 - txres@txAngleF = 90 ; text angle - txres@txJust = "TopCenter" ; puts text on top of bars - - res@gsnCenterString="heure=19" - -; plot ozone production - res@tiYAxisString = "ozone budget (ppbv/h)" ; string to use as the Y-Axis title - x=ispan(0,dimsizes(o3_bud_t1)-1,1) - plot_o3_t1 = gsn_csm_xy(wks,x,o3_bud_t1(:),res) - text=gsn_add_text(wks,plot_o3_t1,tostring(o3_list_t1(:)),x,o3_bud_t1(:),txres) ; add label - draw(plot_o3_t1) - frame(wks) - -; plot ozone production - res@tiYAxisString = "carbon monoxide budget (ppbv/h)" ; string to use as the Y-Axis title - x:=ispan(0,dimsizes(co_bud_t1)-1,1) - plot_co_t1 = gsn_csm_xy(wks,x,co_bud_t1(:),res) - text:=gsn_add_text(wks,plot_co_t1,tostring(co_list_t1(:)),x,co_bud_t1(:),txres) ; add label - draw(plot_co_t1) - frame(wks) - - res@gsnCenterString="heure=20" - -; plot ozone production - res@tiYAxisString = "ozone budget (ppbv/h)" ; string to use as the Y-Axis title - x:=ispan(0,dimsizes(o3_bud_t2)-1,1) - plot_o3_t2 = gsn_csm_xy(wks,x,o3_bud_t2(:),res) - text:=gsn_add_text(wks,plot_o3_t1,tostring(o3_list_t2(:)),x,o3_bud_t2(:),txres) ; add label - draw(plot_o3_t2) - frame(wks) - -; plot ozone production - res@tiYAxisString = "carbon monoxide budget (ppbv/h)" ; string to use as the Y-Axis title - x:=ispan(0,dimsizes(co_bud_t2)-1,1) - plot_co_t2 = gsn_csm_xy(wks,x,co_bud_t2(:),res) - text:=gsn_add_text(wks,plot_co_t2,tostring(co_list_t2(:)),x,co_bud_t2(:),txres) ; add label - draw(plot_co_t2) - frame(wks) - - - -;;;;;;;;;;;;;;;;;;;;;;;; - -end - - - diff --git a/MY_RUN/KTEST/009_ICARTT/006_ncl/run_ncl b/MY_RUN/KTEST/009_ICARTT/006_ncl/run_ncl deleted file mode 100755 index bbcf7df2e4bdfc0ea0a3c39ace71d1ea1075d80a..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/009_ICARTT/006_ncl/run_ncl +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -#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 ../004_diag/ICART.1.SEG01.001dg.nc . -ln -sf ../004_diag/ICART.1.SEG01.002dg.nc . - -rm -f *.png -ncl plot_ICARTT.ncl -ncl plot_ICARTT_budget.ncl - -${POSTRUN} display zsection_1250.*.png -${POSTRUN} display zsection_1250_bud.*.png - -exit 0 diff --git a/MY_RUN/KTEST/009_ICARTT/Makefile b/MY_RUN/KTEST/009_ICARTT/Makefile index 19532716375c8f1a87a27e687aff3a610f5f69ab..0f94ae0d8b592ad5168b5a84aa350fbeabb2a5c7 100644 --- a/MY_RUN/KTEST/009_ICARTT/Makefile +++ b/MY_RUN/KTEST/009_ICARTT/Makefile @@ -2,7 +2,6 @@ all: E001_pgd1 E002_arp2lfi E003_mesonh E004_diag ifneq "$(MNH_PYTHON)" "NO" all: E005_python endif -all: E006_ncl E001_pgd1 : cd 001_pgd1 && get_chimie_files @@ -16,9 +15,6 @@ E004_diag: E005_python: cd 005_python && run_python -E006_ncl: - cd 006_ncl && run_ncl - clean: cd 001_pgd1 && clean_prep_pgd_xyz cd 002_arp2lfi && clean_arp2lfi_xyz @@ -27,7 +23,6 @@ clean: ifneq "$(MNH_PYTHON)" "NO" cd 005_python && clean_python endif - cd 006_ncl && clean_ncl python: cd 005_python && run_python diff --git a/MY_RUN/KTEST/011_KW78CHEM/005_ncl/clean_ncl b/MY_RUN/KTEST/011_KW78CHEM/005_ncl/clean_ncl deleted file mode 100755 index 6d1fcfec203cbd90b4693d08c68964108cd43968..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/011_KW78CHEM/005_ncl/clean_ncl +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -#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. -rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/011_KW78CHEM/005_ncl/plot_KW78_chem.ncl b/MY_RUN/KTEST/011_KW78CHEM/005_ncl/plot_KW78_chem.ncl deleted file mode 100644 index 9c7bdef5b0762456276e9dfa77c48df67f792bcd..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/011_KW78CHEM/005_ncl/plot_KW78_chem.ncl +++ /dev/null @@ -1,525 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" - load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; -begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("KWRAI.1.SEGCH.004.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_KW78_chem") -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = fichier1->JPHEXT - mdims = getfilevardimsizes(fichier1,"UT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 -;=================================================; -; lecture des différents champs -;=================================================; -zs = fichier1->ZS(jphext:jmax+jphext-1,jphext:imax+jphext-1) ; ZS -zhat = fichier1->ZHAT(1:kmax+1) ; ZHAT -yhat = fichier1->YHAT(1:jmax+jphext-1+1) ; YHAT -xhat = fichier1->XHAT(1:imax+jphext-1+1) ; XHAT - -wt= fichier1->WT(0,1:kmax+1,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; WT -vt= fichier1->VT(0,1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; VT -ut= fichier1->UT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; UT -tht1= fichier1->THT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; THT -tht1@long_name="Potential Temperature" -tht1@units="K" - lsthm1= fichier1->LSTHM(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -lsthm1@long_name="Large SCale Potential Temperature" -lsthm1@units="K" - -pabst1= fichier1->PABST(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; PABST -pabst1@long_name="Pressure" -pabst1@units="Pa" -rvt1= fichier1->RVT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RVT -rvt1@long_name="Vapor mixing ratio" -rvt1@units="kg/kg" -rct1= fichier1->RCT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RCT -rct1@long_name="Cloud mixing ratio" -rct1@units="kg/kg" -rrt1= fichier1->RRT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RRT -rrt1@long_name="Rain mixing ratio" -rrt1@units="kg/kg" -rst1= fichier1->RST(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RRT -rst1@long_name="Snow mixing ratio" -rst1@units="kg/kg" -rgt1= fichier1->RGT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; RRT -rgt1@long_name="Graupel mixing ratio" -rgt1@units="kg/kg" - -inprr= fichier1->INPRR(0,jphext:jmax+jphext-1,jphext:imax+jphext-1) -inprr@long_name="Instantaneous Precipitation Rain Rate" -inprr@units="mm/h" -acprr= fichier1->ACPRR(0,jphext:jmax+jphext-1,jphext:imax+jphext-1) -acprr@long_name="Accumulated Precipitation Rain Rate" -acprr@units="mm" - - -cot1= fichier1->COT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; COT -cot1@long_name="carbon monoxide" -cot1@units="ppp" -o3t1= fichier1->O3T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; O3T -o3t1@long_name="Ozone" -o3t1@units="ppp" - -hchot1= fichier1->HCHOT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; HCHOT -hchot1@long_name="HCHO" -hchot1@units="ppp" -wc_hchot1= fichier1->WC_HCHOT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -wc_hchot1@long_name="WC_HCHO" -wc_hchot1@units="ppp" -wr_hchot1= fichier1->WR_HCHOT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -wr_hchot1@long_name="WR_HCHO" -wr_hchot1@units="ppp" -ic_hchot1= fichier1->IC_HCHOT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -ic_hchot1@long_name="IC_HCHO" -ic_hchot1@units="ppp" - -so2t1= fichier1->SO2T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; SO2T -so2t1@long_name="SO2" -so2t1@units="ppp" -wc_so2t1= fichier1->WC_SO2T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -wc_so2t1@long_name="WC_SO2" -wc_so2t1@units="ppp" -wr_so2t1= fichier1->WR_SO2T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -wr_so2t1@long_name="WR_SO2" -wr_so2t1@units="ppp" -ic_so2t1= fichier1->IC_SO2T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -ic_so2t1@long_name="IC_SO2" -ic_so2t1@units="ppp" - -hno3t1= fichier1->HNO3T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; HNO3T -hno3t1@long_name="HNO3" -hno3t1@units="ppp" -wc_hno3t1= fichier1->WC_HNO3T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -wc_hno3t1@long_name="WC_HNO3" -wc_hno3t1@units="ppp" -wr_hno3t1= fichier1->WR_HNO3T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -wr_hno3t1@long_name="WR_HNO3" -wr_hno3t1@units="ppp" -ic_hno3t1= fichier1->IC_HNO3T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -ic_hno3t1@long_name="IC_HNO3" -ic_hno3t1@units="ppp" - -phc1= fichier1->PHC(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -phc1@long_name="PHC" -phc1@units=" " - -phr1= fichier1->PHR(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -phr1@long_name="PHR" -phr1@units=" " - -;YYYYDDMM1= fichier1->DTCUR__TDATE -SS1=fichier1->DTCUR - -;=================================================; -; 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 -;=================================================; -; rq : cas cartésien -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 ; use full range of colormap - resmap@tiYAxisString =" " - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines -;=================================================; -; 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 a (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 -;=================================================; - 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 ; espacement des fleches -res@vcRefLengthF=0.1 ; taille des flèches -plot=gsn_csm_vector_scalar(wks,ut1(0,:,:),vt1(0,:,:),pabst1(0,:,:),res) -draw(plot) -frame(wks) - - -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) - -res2=resmap -res2@gsnScalarContour=True -res2@vcMinDistanceF = 0.04 ; espacement des fleches -res2@vcRefLengthF=0.1 ; taille des flèches -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) - -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@tiXAxisString = "Z=5000m" -plot=gsn_csm_vector_scalar(wks,ut5000_plane(:,:),vt5000_plane(:,:),rct5000_plane(:,:),res2) -draw(plot) -frame(wks) - - -cot3000_plane = wrf_user_intrp3d(cot1,alt,"h",3000,0.,False) -o3t3000_plane = wrf_user_intrp3d(o3t1,alt,"h",3000,0.,False) -cot5000_plane = wrf_user_intrp3d(cot1,alt,"h",5000,0.,False) -o3t5000_plane = wrf_user_intrp3d(o3t1,alt,"h",5000,0.,False) -res@cnLevelSelectionMode = "AutomaticLevels" -res2@tiXAxisString = "Z=3000m" -plot=gsn_csm_contour(wks,cot3000_plane(:,:),res2) -draw(plot) -frame(wks) -plot=gsn_csm_contour(wks,o3t3000_plane(:,:),res2) -draw(plot) -frame(wks) -res2@tiXAxisString = "Z=5000m" -plot=gsn_csm_contour(wks,cot5000_plane(:,:),res2) -draw(plot) -frame(wks) -plot=gsn_csm_contour(wks,o3t5000_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 - - -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) -rst_cv=wrf_user_intrp3d(rst1,alt,"v",plane,angle,False) -rgt_cv=wrf_user_intrp3d(rgt1,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) - - -rvt_cv@long_name="Vapor mixing ratio" -rct_cv@long_name="Cloud mixing ratio" -rrt_cv@long_name="Rain mixing ratio" -rgt_cv@long_name="Graupel mixing ratio" -rst_cv@long_name="Snow mixing ratio" -rgst_cv=rgt_cv+rst_cv -rgst_cv@long_name="Graupel + Snow 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) - - -; projection chimie - -cot_cv=wrf_user_intrp3d(cot1,alt,"v",plane,angle,False) -hchot_cv=wrf_user_intrp3d(hchot1,alt,"v",plane,angle,False) -wc_hchot_cv=wrf_user_intrp3d(wc_hchot1,alt,"v",plane,angle,False) -wr_hchot_cv=wrf_user_intrp3d(wr_hchot1,alt,"v",plane,angle,False) -ic_hchot_cv=wrf_user_intrp3d(ic_hchot1,alt,"v",plane,angle,False) -so2t_cv=wrf_user_intrp3d(so2t1,alt,"v",plane,angle,False) -wc_so2t_cv=wrf_user_intrp3d(wc_so2t1,alt,"v",plane,angle,False) -wr_so2t_cv=wrf_user_intrp3d(wr_so2t1,alt,"v",plane,angle,False) -ic_so2t_cv=wrf_user_intrp3d(ic_so2t1,alt,"v",plane,angle,False) -hno3t_cv=wrf_user_intrp3d(hno3t1,alt,"v",plane,angle,False) -wc_hno3t_cv=wrf_user_intrp3d(wc_hno3t1,alt,"v",plane,angle,False) -wr_hno3t_cv=wrf_user_intrp3d(wr_hno3t1,alt,"v",plane,angle,False) -ic_hno3t_cv=wrf_user_intrp3d(ic_hno3t1,alt,"v",plane,angle,False) -phc_cv=wrf_user_intrp3d(phc1,alt,"v",plane,angle,False) -phr_cv=wrf_user_intrp3d(phr1,alt,"v",plane,angle,False) - - -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 off color fill -res_rr@cnLinesOn = True ; turn on 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) - -tht_cv=wrf_user_intrp3d(tht1,alt,"v",plane,angle,False) -lsthm_cv=wrf_user_intrp3d(lsthm1,alt,"v",plane,angle,False) -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) - - - gsn_define_colormap(wks,"rainbow") ; Choose colormap - -res_cot=resmap -res_cot@tiMainString="Carbon Monoxyde" -plot_cot=gsn_csm_contour(wks,cot_cv,res_cot) - -res_hchot=resmap -res_hchot@tiMainString="HCHO" -plot_hchot=gsn_csm_contour(wks,hchot_cv,res_hchot) - -res_wc_hchot=resmap -res_wc_hchot@gsnLeftString =" " -res_wc_hchot@gsnRightString =" " -res_wc_hchot@tiMainString="WC_HCHO (ppp) + Cloud mixing ratio (kg/kg) " -plot_wc_hchot=gsn_csm_contour(wks,wc_hchot_cv,res_wc_hchot) - -res_wr_hchot=resmap -res_wr_hchot@gsnLeftString =" " -res_wr_hchot@gsnRightString =" " -res_wr_hchot@tiMainString="WR_HCHO (ppp) + rain mixing ratio (kg/kg) " -plot_wr_hchot=gsn_csm_contour(wks,wr_hchot_cv,res_wr_hchot) -res_ic_hchot=resmap -res_ic_hchot@gsnLeftString =" " -res_ic_hchot@gsnRightString =" " -res_ic_hchot@tiMainString="IC_HCHO (ppp) + snow and graupel mixing ratio (kg/kg) " -plot_ic_hchot=gsn_csm_contour(wks,ic_hchot_cv,res_ic_hchot) - - - -res_rc2=resmap -res_rc2@cnFillOn = False ; turn on color fill -res_rc2@cnLinesOn = True ; turn off contour lines -res_rc2@cnLevelSpacingF = 0.00005 -res_rc2@cnMinLevelValF = 0. -res_rc2@gsnLeftString =" " -res_rc2@gsnRightString =" " -plot_rc2=gsn_csm_contour(wks,rct_cv,res_rc2) - - -res_rr2=resmap -res_rr2@cnFillOn = False ; turn off color fill -res_rr2@cnLinesOn = True ; turn on contour lines -res_rr2@cnLevelSpacingF = 0.00025 -res_rr2@cnMinLevelValF = 0.00025 -res_rr2@gsnLeftString =" " -res_rr2@gsnRightString =" " -plot_rr2=gsn_csm_contour(wks,rrt_cv,res_rr2) - -res_rgs2=resmap -res_rgs2@cnFillOn = False ; turn on color fill -res_rgs2@cnLinesOn = True ; turn off contour lines -res_rgs2@gsnLeftString =" " -res_rgs2@gsnRightString =" " -plot_rgs2=gsn_csm_contour(wks,rgst_cv,res_rgs2) - - -draw(plot_hchot) -frame(wks) -overlay(plot_wc_hchot,plot_rc2) -draw(plot_wc_hchot) -frame(wks) -overlay(plot_wr_hchot,plot_rr2) -draw(plot_wr_hchot) -frame(wks) -overlay(plot_ic_hchot,plot_rgs2) -draw(plot_ic_hchot) -frame(wks) - -res_so2t=resmap -res_so2t@tiMainString="SO2" -plot_so2t=gsn_csm_contour(wks,so2t_cv,res_so2t) - -res_wc_so2t=resmap -res_wc_so2t@gsnLeftString =" " -res_wc_so2t@gsnRightString =" " -res_wc_so2t@tiMainString="WC_SO2 (ppp) + Cloud mixing ratio (kg/kg) " -plot_wc_so2t=gsn_csm_contour(wks,wc_so2t_cv,res_wc_so2t) - -res_wr_so2t=resmap -res_wr_so2t@gsnLeftString =" " -res_wr_so2t@gsnRightString =" " -res_wr_so2t@tiMainString="WR_SO2 (ppp) + rain mixing ratio (kg/kg) " -plot_wr_so2t=gsn_csm_contour(wks,wr_so2t_cv,res_wr_so2t) -res_ic_so2t=resmap -res_ic_so2t@gsnLeftString =" " -res_ic_so2t@gsnRightString =" " -res_ic_so2t@tiMainString="IC_SO2 (ppp) + snow and graupel mixing ratio (kg/kg) " -plot_ic_so2t=gsn_csm_contour(wks,ic_so2t_cv,res_ic_so2t) - -plot_rc3=gsn_csm_contour(wks,rct_cv,res_rc2) -plot_rr3=gsn_csm_contour(wks,rrt_cv,res_rr2) -plot_rgs3=gsn_csm_contour(wks,rgst_cv,res_rgs2) - - -draw(plot_so2t) -frame(wks) -overlay(plot_wc_so2t,plot_rc3) -draw(plot_wc_so2t) -frame(wks) -overlay(plot_wr_so2t,plot_rr3) -draw(plot_wr_so2t) -frame(wks) -overlay(plot_ic_so2t,plot_rgs3) -draw(plot_ic_so2t) -frame(wks) - -res_hno3t=resmap -res_hno3t@tiMainString="HNO3" -plot_hno3t=gsn_csm_contour(wks,hno3t_cv,res_hno3t) - -res_wc_hno3t=resmap -res_wc_hno3t@gsnLeftString =" " -res_wc_hno3t@gsnRightString =" " -res_wc_hno3t@tiMainString="WC_HNO3 (ppp) + Cloud mixing ratio (kg/kg) " -plot_wc_hno3t=gsn_csm_contour(wks,wc_hno3t_cv,res_wc_hno3t) -res_wr_hno3t=resmap -res_wr_hno3t@gsnLeftString =" " -res_wr_hno3t@gsnRightString =" " -res_wr_hno3t@tiMainString="WR_HNO3 (ppp) + rain mixing ratio (kg/kg) " -plot_wr_hno3t=gsn_csm_contour(wks,wr_hno3t_cv,res_wr_hno3t) -res_ic_hno3t=resmap -res_ic_hno3t@gsnLeftString =" " -res_ic_hno3t@gsnRightString =" " -res_ic_hno3t@tiMainString="IC_HNO3 (ppp) + snow and graupel mixing ratio (kg/kg) " -plot_ic_hno3t=gsn_csm_contour(wks,ic_hno3t_cv,res_ic_hno3t) - -plot_rc4=gsn_csm_contour(wks,rct_cv,res_rc2) -plot_rr4=gsn_csm_contour(wks,rrt_cv,res_rr2) -plot_rgs4=gsn_csm_contour(wks,rgst_cv,res_rgs2) - - -draw(plot_hno3t) -frame(wks) -overlay(plot_wc_hno3t,plot_rc4) -draw(plot_wc_hno3t) -frame(wks) -overlay(plot_wr_hno3t,plot_rr4) -draw(plot_wr_hno3t) -frame(wks) -overlay(plot_ic_hno3t,plot_rgs4) -draw(plot_ic_hno3t) -frame(wks) - -res_phc=resmap -res_phc@tiMainString="PHC" -plot_phc=gsn_csm_contour(wks,phc_cv,res_phc) -draw(plot_phc) -frame(wks) - -res_phr=resmap -res_phr@tiMainString="PHR" -plot_phr=gsn_csm_contour(wks,phr_cv,res_phr) -draw(plot_phr) -frame(wks) - - -end diff --git a/MY_RUN/KTEST/011_KW78CHEM/005_ncl/run_ncl b/MY_RUN/KTEST/011_KW78CHEM/005_ncl/run_ncl deleted file mode 100755 index d4d91b3c1568fe65698b9519d9c40b8270cbe021..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/011_KW78CHEM/005_ncl/run_ncl +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -#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.SEGCH.004.nc . - -rm -f visu_KW78_chem.*.png - -ncl plot_KW78_chem.ncl -for ECH in '000001' '000002' '000003' '000004' '000005' '000006' '000007' '000008' '000009' '000010' '000011' '000012' '000013' '000014' '000015' '000016' '000017' '000018' '000019' '000020' '000021' '000022' '000023' '000024' '000025' '000026' '000027' -do -${POSTRUN} display visu_KW78_chem.${ECH}.png -done -exit 0 diff --git a/MY_RUN/KTEST/011_KW78CHEM/Makefile b/MY_RUN/KTEST/011_KW78CHEM/Makefile index 5bc36bf838c3b99458ec02e0b9dd4d912c5cd58e..793e1223286e4f04e395c251c7bac91161548db8 100644 --- a/MY_RUN/KTEST/011_KW78CHEM/Makefile +++ b/MY_RUN/KTEST/011_KW78CHEM/Makefile @@ -5,7 +5,6 @@ all: ifneq "$(MNH_PYTHON)" "NO" cd 004_python && run_python endif - cd 005_ncl && run_ncl clean: cd 001_prep_ideal_case && clean_prep_ideal_case_xyz @@ -14,7 +13,6 @@ clean: ifneq "$(MNH_PYTHON)" "NO" cd 004_python && clean_python endif - cd 005_ncl && clean_ncl python: cd 004_python && run_python diff --git a/MY_RUN/KTEST/012_dust/006_ncl/clean_ncl b/MY_RUN/KTEST/012_dust/006_ncl/clean_ncl deleted file mode 100755 index 2bb66b885adab3b3c4eef7b62c3fc348e2b5b54d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/006_ncl/clean_ncl +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/012_dust/006_ncl/plot_dust.ncl b/MY_RUN/KTEST/012_dust/006_ncl/plot_dust.ncl deleted file mode 100644 index 48570d40c753c8b17d701abb9504191b3e1c9ce3..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/006_ncl/plot_dust.ncl +++ /dev/null @@ -1,283 +0,0 @@ -;================================================; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" -; ================================================; -;================================================; -begin -;=================================================; -; open file and read in data -;=================================================; - fichier1 = addfile("DUST7.1.SEG02.004.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_dust") -;=================================================; -; Get informations on variable sizes -; dims are dims-2 to remove non-physical values -;=================================================; - jphext = fichier1->JPHEXT - mdims = getfilevardimsizes(fichier1,"UT") ; get dimension sizes - nd = dimsizes(mdims) - imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 - -;=================================================; -; Set map projection -;=================================================; - lat2d=fichier1->LAT(jphext:jmax+jphext-1,jphext:imax+jphext-1) - lon2d=fichier1->LON(jphext:jmax+jphext-1,jphext:imax+jphext-1) -; Resources for the map projection -;-----------------------------------------------; - resmap=True -;-----------------------------------------------; -; Get global attributes to set map projection -;-----------------------------------------------; -RPK = fichier1->RPK -LON0 = fichier1->LON0 -BETA = fichier1->BETA - - if (RPK.gt.0) - ; Lambert projection from north pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - resmap@mpLambertParallel1F = 42 ; to be adjusted !! - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; Parallel1 = PArallel2 - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.lt.0) - ; Lambert projection from south pole -; --------------------------- - resmap@mpProjection = "LambertConformal" ; projection - resmap@mpLambertParallel1F = -42 ; to be adjusted !! - resmap@mpLambertParallel2F = resmap@mpLambertParallel1F ; ncl adds from grib file - resmap@mpLambertMeridianF = LON0 ; get value from globla attribute - end if - - if (RPK.eq.1) - ; Stereographic projection -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = 90. - end if - - if (RPK.eq.-1) - ; Stereographic projection -; --------------------------- - resmap@mpProjection = "Stereographic" - resmap@mpCenterLonF = LON0 - resmap@mpCenterRotF = BETA - resmap@mpCenterLatF = -90. - end if - - if (RPK.eq.0) then - ; Mercator projection -; --------------------------- - resmap@mpProjection = "Mercator" - end if - - print("Map projection="+resmap@mpProjection) - -;==================================== -; Defining the corners for projection -;==================================== - resmap@mpLimitMode = "Corners" - resmap@mpLeftCornerLatF = lat2d(0,0) - resmap@mpLeftCornerLonF = lon2d(0,0) - resmap@mpRightCornerLatF = lat2d(jmax-1,imax-1) - resmap@mpRightCornerLonF = lon2d(jmax-1,imax-1) - - print ("Corner (0,0); Lat="+resmap@mpLeftCornerLatF+ \ - ", Lon="+resmap@mpLeftCornerLonF) - print ("Oppos corner; Lat="+resmap@mpRightCornerLatF+ \ - ", Lon= "+resmap@mpRightCornerLonF) - - - - - - - - - - -;=================================================; -; lecture des différents champs -;=================================================; -wt= fichier1->WT(0,1:kmax+1,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; WT -vt= fichier1->VT(0,1:kmax,jphext:jmax+jphext-1+1,jphext:imax+jphext-1) ; VT -ut= fichier1->UT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1+1) ; UT - -tht= fichier1->THT(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) ; THT -tht@long_name="Potential Temperature" -tht@units="K" -tht@lat2d = lat2d -tht@lon2d = lon2d - - - -dstm03t= fichier1->DSTM03T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -dstm03t@long_name="DSTM03T" -dstm03t@units="ppp" -dstm03t@lat2d = lat2d -dstm03t@lon2d = lon2d - -dstm33t= fichier1->DSTM33T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -dstm33t@long_name="DSTM33T" -dstm33t@units="ppp" -dstm33t@lat2d = lat2d -dstm33t@lon2d = lon2d - -dstm02t= fichier1->DSTM02T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -dstm02t@long_name="DSTM02T" -dstm02t@units="ppp" -dstm02t@lat2d = lat2d -dstm02t@lon2d = lon2d - -dstm32t= fichier1->DSTM32T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -dstm32t@long_name="DSTM32T" -dstm32t@units="ppp" -dstm32t@lat2d = lat2d -dstm32t@lon2d = lon2d - -dstm01t= fichier1->DSTM01T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -dstm01t@long_name="DSTM01T" -dstm01t@units="ppp" -dstm01t@lat2d = lat2d -dstm01t@lon2d = lon2d - -dstm31t= fichier1->DSTM31T(0,1:kmax,jphext:jmax+jphext-1,jphext:imax+jphext-1) -dstm31t@long_name="DSTM31T" -dstm31t@units="ppp" -dstm31t@lat2d = lat2d -dstm31t@lon2d = lon2d - -flx_dst001= fichier1->F_DST001P1(jphext:jmax+jphext-1,jphext:imax+jphext-1) -flx_dst001@long_name="F_DST001P1" -flx_dst001@units="kg/m2/s" -flx_dst001@lat2d = lat2d -flx_dst001@lon2d = lon2d - - -flx_dst002= fichier1->F_DST002P1(jphext:jmax+jphext-1,jphext:imax+jphext-1) -flx_dst002@long_name="F_DST002P1" -flx_dst002@units="kg/m2/s" -flx_dst002@lat2d = lat2d -flx_dst002@lon2d = lon2d - -flx_dst003= fichier1->F_DST003P1(jphext:jmax+jphext-1,jphext:imax+jphext-1) -flx_dst003@long_name="F_DST003P1" -flx_dst003@units="kg/m2/s" -flx_dst003@lat2d = lat2d -flx_dst003@lon2d = lon2d - -;=================================================; -; 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" - -ut1@lat2d = lat2d -ut1@lon2d = lon2d -vt1@lat2d = lat2d -vt1@lon2d = lon2d -wt1@lat2d = lat2d -wt1@lon2d = lon2d - -;=================================================; -; Set some other basic resources -;=================================================; - resmap = True - resmap@gsnFrame = False - resmap@gsnDraw = False - resmap@gsnMaximize = True - resmap@gsnPaperOrientation = "portrait" - resmap@gsnSpreadColors = True ; use full range of colormap - resmap@tiYAxisString =" " - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - resmap@mpFillOn = False ; couleur grise des continents - resmap@mpGeophysicalLineThicknessF = 2.0 - resmap@mpGeophysicalLineColor = "Black" - resmap@mpNationalLineColor = "Black" - -;=================================================; -; module + vecteurs vent au premier niveau -;=================================================; - -gsn_define_colormap(wks,"rainbow") ; Choose colormap - -; options de tracé -res2=resmap -res2@cnLevelSelectionMode = "AutomaticLevels" -res2@gsnScalarContour=True -res2@vcMinDistanceF = 0.01 -res2@vcRefLengthF=0.04 -res2@cnLevelSpacingF = 0.00005 -res2@cnMinLevelValF = 0 - -mutvt=(ut1*ut1+vt1*vt1)^(0.5) -mutvt@lat2d=lat2d -mutvt@lon2d=lon2d - -plot=gsn_csm_vector_scalar_map(wks,ut1(0,:,:),vt1(0,:,:),mutvt(0,:,:),res2) -draw(plot) -frame(wks) - -plot=gsn_csm_contour_map(wks,tht(0,:,:),res2) -draw(plot) -frame(wks) - - -res2@gsnSpreadColorStart = 0 ; force la première couleur en blanc(= couleur 0 de la palette) -plot=gsn_csm_contour_map(wks,dstm03t(0,:,:),res2) -draw(plot) -frame(wks) -plot=gsn_csm_contour_map(wks,dstm33t(0,:,:),res2) -draw(plot) -frame(wks) - -plot=gsn_csm_contour_map(wks,dstm02t(0,:,:),res2) -draw(plot) -frame(wks) -plot=gsn_csm_contour_map(wks,dstm32t(0,:,:),res2) -draw(plot) -frame(wks) - -plot=gsn_csm_contour_map(wks,dstm01t(0,:,:),res2) -draw(plot) -frame(wks) -plot=gsn_csm_contour_map(wks,dstm31t(0,:,:),res2) -draw(plot) -frame(wks) - - -flx_dst001@_FillValue = 999. -plot=gsn_csm_contour_map(wks,flx_dst001(:,:),res2) -draw(plot) -frame(wks) -flx_dst002@_FillValue = 999. -plot=gsn_csm_contour_map(wks,flx_dst002(:,:),res2) -draw(plot) -frame(wks) -flx_dst003@_FillValue = 999. -plot=gsn_csm_contour_map(wks,flx_dst003(:,:),res2) -draw(plot) -frame(wks) - - -end diff --git a/MY_RUN/KTEST/012_dust/006_ncl/run_ncl b/MY_RUN/KTEST/012_dust/006_ncl/run_ncl deleted file mode 100755 index 533773346b6b442abeb5b03f0e53297bdb5c3f76..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/006_ncl/run_ncl +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -x -ln -sf ../004_restart/DUST7.1.SEG02.004.nc . - -rm -f visu_dust.*.png - -ncl plot_dust.ncl - -for ECH in '000001' '000002' '000003' '000004' '000005' '000006' '000007' '000008' '000009' '000010' '000011' - - - -do -${POSTRUN} display visu_dust.${ECH}.png -done diff --git a/MY_RUN/KTEST/012_dust/Makefile b/MY_RUN/KTEST/012_dust/Makefile index 79b127fcf2a7d72df95f6b39d5ec13c27c07ba09..1ddee4d9338dd3eecc400e51ae88d843f029f542 100644 --- a/MY_RUN/KTEST/012_dust/Makefile +++ b/MY_RUN/KTEST/012_dust/Makefile @@ -2,7 +2,6 @@ all: E001_pgd1 E002_ecmwf2lfi E003_run E004_restart ifneq "$(MNH_PYTHON)" "NO" all: E005_python endif -all: E006_ncl E001_pgd1 : cd 001_pgd1 && run_prep_pgd_xyz @@ -14,8 +13,6 @@ E004_restart: cd 004_restart && run_mesonh_xyz E005_python: cd 005_python && run_python -E006_ncl: - cd 006_ncl && run_ncl clean: cd 001_pgd1 && clean_prep_pgd_xyz cd 002_ecmwf2lfi && clean_ecmwf2lfi_xyz @@ -24,7 +21,6 @@ clean: ifneq "$(MNH_PYTHON)" "NO" cd 005_python && clean_python endif - cd 006_ncl && clean_ncl python: cd 005_python && run_python diff --git a/MY_RUN/KTEST/014_LIMA/003_ncl/clean_ncl b/MY_RUN/KTEST/014_LIMA/003_ncl/clean_ncl deleted file mode 100755 index ef83c16a5de17b683dd873050ef83dedfa0a005d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/014_LIMA/003_ncl/clean_ncl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -rm -f *.nc *.png diff --git a/MY_RUN/KTEST/014_LIMA/003_ncl/plot_LIMA.ncl b/MY_RUN/KTEST/014_LIMA/003_ncl/plot_LIMA.ncl deleted file mode 100644 index 753a1d2ec97a0c960d674b36dea14f611165c718..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/014_LIMA/003_ncl/plot_LIMA.ncl +++ /dev/null @@ -1,126 +0,0 @@ -;================================================; -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("XPREF.1.SEG01.000.nc", "r") -;==================================================; -; Open the workstation -;==================================================; - type = "png" - wks = gsn_open_wks(type,"visu_LIMA") -;=================================================; -; lecture des différents champs -;=================================================; - -group_Budgets = fichier1=>Budgets -group_RI = group_Budgets=>RI -group_RS = group_Budgets=>RS -group_RG = group_Budgets=>RG -group_CICE = group_Budgets=>CICE -group_CIFNFREE01 = group_Budgets=>CIFNFREE01 -group_CIFNNUCL01 = group_Budgets=>CIFNNUCL01 - - -vname = "AVEF" -RI= group_RI->$vname$(0,:,0,:) -RI@long_name="ice water content" -RI@units="g/kg" - -NI= group_CICE->$vname$(0,:,0,:) -NI@long_name="ice concentration" -NI@units="/kg" - -RS= group_RS->$vname$(0,:,0,:) -RS@long_name="snow water content" -RS@units="g/kg" - -RG= group_RG->$vname$(0,:,0,:) -RG@long_name="graupel water content" -RG@units="g/kg" - -N_IFN_FREE= group_CIFNFREE01->$vname$(0,:,0,:) -N_IFN_FREE@long_name="concentration of free IFN" -N_IFN_FREE@units="/kg" - -N_IFN_NUCL= group_CIFNNUCL01->$vname$(0,:,0,:) -N_IFN_NUCL@long_name="concentration of nucleated IFN" -N_IFN_NUCL@units="/kg" - - -zhat = fichier1->ZHAT(1:50) -xhat = fichier1->XHAT(1:180) -zs = fichier1->ZS(1:180) ; ZS - -xconf=conform(RI,xhat(0:179),1) - -;=================================================; -; Altitude des niveaux modèles -;=================================================; -; Unstagger zhat (from grid 4 to 1) - nzh=new(50,double) - do k=0,48 - nzh(k)=(zhat(k)+zhat(k+1))/2. - end do - nzh(49)=2*zhat(49)-zhat(48) - -; Create z (altitude des niveaux modèle) - z=new((/50,180/),double) - zcoef=new(180,double) - zcoef=1.-zs/nzh(49) - - do i=0,179 - z(:,i) = nzh*zcoef(i)+zs(i) - end do -;=================================================; -; Set some other basic resources -;=================================================; - resmap = True - resmap@gsnFrame = False - resmap@gsnDraw = False - resmap@gsnMaximize = True - resmap@gsnPaperOrientation = "portrait" - resmap@gsnSpreadColors = True ; use full range of colormap - resmap@tiYAxisString =" " - resmap@cnFillOn = True ; turn on color fill - resmap@cnLinesOn = False ; turn off contour lines - - resmap@tiXAxisPosition="Left" - resmap@tiXAxisFontHeightF=0.015 -; resmap@gsnSpreadColorStart = 0 ; force la première couleur en blanc(= couleur 0 de la palette) - resmap@sfYArray = z ; 2D - resmap@sfXArray = xconf ; 2D - resmap@trGridType = "TriangularMesh" -;=================================================; -; TRACE -;=================================================; - gsn_define_colormap(wks,"rainbow") ; Choose colormap - res=resmap - res@cnLevelSelectionMode = "AutomaticLevels" - plot = gsn_csm_contour(wks,RI(:,:),res) - draw(plot) - frame(wks) - - plot2 = gsn_csm_contour(wks,NI(:,:),res) - draw(plot2) - frame(wks) - - plot3 = gsn_csm_contour(wks,RS(:,:),res) - draw(plot3) - frame(wks) - - plot4 = gsn_csm_contour(wks,RG(:,:),res) - draw(plot4) - frame(wks) - plot5 = gsn_csm_contour(wks,N_IFN_FREE(:,:),res) - draw(plot5) - frame(wks) - plot6 = gsn_csm_contour(wks,N_IFN_NUCL(:,:),res) - draw(plot6) - frame(wks) - -end diff --git a/MY_RUN/KTEST/014_LIMA/003_ncl/run_ncl b/MY_RUN/KTEST/014_LIMA/003_ncl/run_ncl deleted file mode 100755 index 2444be340eda2cb7a5a846cb44cd71694626e1c0..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/014_LIMA/003_ncl/run_ncl +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -#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 - -ln -sf ../002_mesonh/XPREF.1.SEG01.000.nc . - -rm -f visu_LIMA.*.png - -ncl plot_LIMA.ncl - -${POSTRUN} display visu_LIMA.000001.png -${POSTRUN} display visu_LIMA.000002.png -${POSTRUN} display visu_LIMA.000003.png -${POSTRUN} display visu_LIMA.000004.png -${POSTRUN} display visu_LIMA.000005.png -${POSTRUN} display visu_LIMA.000006.png -exit 0 diff --git a/MY_RUN/KTEST/014_LIMA/004_python/clean_python b/MY_RUN/KTEST/014_LIMA/003_python/clean_python similarity index 100% rename from MY_RUN/KTEST/014_LIMA/004_python/clean_python rename to MY_RUN/KTEST/014_LIMA/003_python/clean_python diff --git a/MY_RUN/KTEST/014_LIMA/004_python/plot_014_LIMA.py b/MY_RUN/KTEST/014_LIMA/003_python/plot_014_LIMA.py similarity index 100% rename from MY_RUN/KTEST/014_LIMA/004_python/plot_014_LIMA.py rename to MY_RUN/KTEST/014_LIMA/003_python/plot_014_LIMA.py diff --git a/MY_RUN/KTEST/014_LIMA/004_python/run_python b/MY_RUN/KTEST/014_LIMA/003_python/run_python similarity index 100% rename from MY_RUN/KTEST/014_LIMA/004_python/run_python rename to MY_RUN/KTEST/014_LIMA/003_python/run_python diff --git a/MY_RUN/KTEST/014_LIMA/Makefile b/MY_RUN/KTEST/014_LIMA/Makefile index c9647fc057655aedccfee8e4f9ab9f8858a79190..8c110f943629e2ed897844b0a7033e889f0fb3f5 100644 --- a/MY_RUN/KTEST/014_LIMA/Makefile +++ b/MY_RUN/KTEST/014_LIMA/Makefile @@ -1,17 +1,15 @@ all: cd 001_prep_ideal_case && run_prep_ideal_case_xyz cd 002_mesonh && run_mesonh_xyz - cd 003_ncl && run_ncl ifneq "$(MNH_PYTHON)" "NO" - cd 004_python && run_python + cd 003_python && run_python endif clean: cd 001_prep_ideal_case && clean_prep_ideal_case_xyz cd 002_mesonh && clean_mesonh_xyz - cd 003_ncl && clean_ncl ifneq "$(MNH_PYTHON)" "NO" - cd 004_python && clean_python + cd 003_python && clean_python endif python: - cd 004_python && run_python + cd 003_python && run_python diff --git a/pub/ncl-6.4.0.tar.gz b/pub/ncl-6.4.0.tar.gz deleted file mode 100644 index ddc40984bc572e56619156897a7b7043c443cd1a..0000000000000000000000000000000000000000 --- a/pub/ncl-6.4.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1ae930159cb4d1050c8a1e6b69b9b9661d5a21490cad233abc0655d02bf3e1b8 -size 88827595 diff --git a/src/Makefile b/src/Makefile index acc2117f11087c274ff460848d6f4b8ad3287f55..79fbf72e605c7219a83d80a952c97166fd5df9ed 100644 --- a/src/Makefile +++ b/src/Makefile @@ -454,21 +454,9 @@ chimie : $(EXAMPLES_CHIMIE) $(EXAMPLES) $(EXAMPLES_CHIMIE) 012_dust : cd $(PWD_KTEST)/$@ ; run_$@ -EXAMPLES_NCL=004_Reunion 007_16janvier - -ncl1_examples : $(patsubst %,%_ncl1,$(EXAMPLES_NCL)) - -ncl2_examples : $(patsubst %,%_ncl2,$(EXAMPLES_NCL)) - examplesclean : $(patsubst %,%_clean,$(EXAMPLES)) -%_ncl1 : - cd $(PWD_KTEST)/$(*F) ; run_$(*F) all_ncl_extractdia - -%_ncl2 : - cd $(PWD_KTEST)/$(*F) ; run_$(*F) all_ncl_lfi2cdf - %_clean : cd $(PWD_KTEST)/$(*F) ; $(MAKE) clean diff --git a/src/configure b/src/configure index 4d2a43eeb273cc1f94b071cc26e29e944bd35085..6e2a4ab8e572628da668d601bfd5900d5ec31731 100755 --- a/src/configure +++ b/src/configure @@ -27,7 +27,6 @@ export MNH_IOCDF4=${MNH_IOCDF4:-1} export VERSION_OASIS=${VERSION_OASIS:-"mct_v3"} export VERSION_TOY=${VERSION_TOY:-"v1-0"} -export VERSION_NCL=${VERSION_NCL:-"ncl-6.4.0"} export VERSION_ECRAD=${VERSION_ECRAD:-"1.4.0"} export VER_ECRAD=${VERSION_ECRAD//./} @@ -169,7 +168,6 @@ export I_MPI_CC=gcc 'Linux service'*) export ARCH=${ARCH:-LXifort} export VER_MPI=${VER_MPI:-MPIICE} - export NEED_NCARG=${NEED_NCARG:-YES} export MVWORK=${MVWORK:-NO} domain=$(grep .fr /etc/hosts | head -1 ) case "${domain}" in @@ -177,7 +175,6 @@ export I_MPI_CC=gcc export OPTLEVEL=${OPTLEVEL:-O2} export MVWORK=${MVWORK:-NO} export VER_CDF=${VER_CDF:-CDFICE} - export NEED_NCARG=${NEED_NCARG:-YES} export MNHENV=${MNHENV:-" module rm netcdf ; module load netcdf/4.0 module rm MPT ; module load MPT/2.02 @@ -205,7 +202,6 @@ export MPI_DSM_CPULIST=0-7:allhosts export MVWORK=${MVWORK:-NO} export VER_CDF=${VER_CDF:-CDFAUTO} export MNHENV=${MNHENV:-" -module load ncl_ncarg/6.3.0 "} ;; 'Linux irene'*) @@ -258,7 +254,6 @@ export ARMCI_SHR_BUF_METHOD=COPY export OPTLEVEL=${OPTLEVEL:-O3} export MVWORK=${MVWORK:-NO} export VER_CDF=${VER_CDF:-CDFAUTO} - export NEED_NCARG=${NEED_NCARG:-YES} export NEED_TOOLS=YES export MNHENV=${MNHENV:-" module purge @@ -266,22 +261,6 @@ module load intel/2019.5.281 module load openmpi/intel/4.0.2.2 module load cmake/3.15.4 unset CC CXX -"} - ;; -'Linux beaufix'*|'Linux prolix'*) - export ARCH=${ARCH:-LXifort} - export VER_MPI=${VER_MPI:-MPIINTEL} - export OPTLEVEL=${OPTLEVEL:-O3} - export MVWORK=${MVWORK:-NO} - export VER_CDF=${VER_CDF:-CDFBFIX} - export NEED_NCARG=${NEED_NCARG:-NO} - export NEED_TOOLS=NO - export MNHENV=${MNHENV:-" -module rm intel ; module load intel/16.1.150 ; -module rm intelmpi ; module load intelmpi/5.1.2.150 ; -module rm netcdf ; module load netcdf/4.4.0 ; -module rm grib_api ; module load grib_api/1.14.5 ; -export GRIBAPI_PATH=/opt/softs/libraries/ICC16.1.150/grib_api-1.14.5 "} ;; 'Linux login0'*|'Linux compute'*) @@ -421,7 +400,6 @@ export CC=gcc export OPTLEVEL=${OPTLEVEL:-DEBUG} export MVWORK=${MVWORK:-NO} export VER_CDF=${VER_CDF:-CDFCTI} - export NEED_NCARG=${NEED_NCARG:-NO} export NEED_TOOLS=NO ;; 'Linux lxenm'*) #PC Linux ENM @@ -431,7 +409,6 @@ export CC=gcc export OPTLEVEL=${OPTLEVEL:-DEBUG} export MVWORK=${MVWORK:-NO} export VER_CDF=${VER_CDF:-CDFAUTO} - export NEED_NCARG=${NEED_NCARG:-YES} export NEED_TOOLS=NO export MNHENV=${MNHENV:-" export PATH=/opt/gcc-9.4.0/bin:\$PATH @@ -444,7 +421,6 @@ export PATH=/opt/gcc-9.4.0/bin:\$PATH export OPTLEVEL=${OPTLEVEL:-DEBUG} export MVWORK=${MVWORK:-NO} export VER_CDF=${VER_CDF:-CDFCTI} - export NEED_NCARG=${NEED_NCARG:-YES} export NEED_TOOLS=NO ;; 'Linux nuwa'*) @@ -453,7 +429,6 @@ export PATH=/opt/gcc-9.4.0/bin:\$PATH export OPTLEVEL=${OPTLEVEL:-O2} export MVWORK=${MVWORK:-NO} export VER_CDF=${VER_CDF:-CDFAUTO} - export NEED_NCARG=${NEED_NCARG:-YES} export MNHENV=${MNHENV:-" . /home/tools/intel/psxe2018/bin/ifortvars.sh intel64 export MPI_ROOT=/usr/local/openmpi/3.1.4/ifort18.0.2.199 @@ -472,7 +447,7 @@ conda activate mnh-env_nuwa export VER_CDF=${VER_CDF:-CDFAUTO} export MNHENV=${MNHENV:-" module purge -module load intel/17.0.4 intelmpi/2017.3.196 ncl/6.2.0 +module load intel/17.0.4 intelmpi/2017.3.196 export SLURM_CPU_BIND=none export I_MPI_PIN_PROCESSOR_LIST=all:map=spread "} @@ -498,7 +473,6 @@ Linux*) export MVWORK=${MVWORK:-NO} #export VER_CDF=${VER_CDF:-CDFGFOR} export VER_CDF=${VER_CDF:-CDFAUTO} - export NEED_NCARG=${NEED_NCARG:-YES} ;; Darwin*) echo "WARNING:: Darwin for Mac not tested " @@ -507,7 +481,6 @@ Darwin*) export OPTLEVEL=${OPTLEVEL:-DEBUG} export MVWORK=${MVWORK:-NO} export VER_CDF=${VER_CDF:-CDFAUTO} - export NEED_NCARG=${NEED_NCARG:-NO} ;; *) echo "WARNING ; system not yet tested " @@ -642,10 +615,6 @@ if [ "x${MVWORK}" == "xYES" ] ; then done fi fi -if [ "x${NEED_NCARG}" != "xNO" ] ; then -( cd $LOCAL/pub ; [ ! -d ${VERSION_NCL} ] && ( tar xvfz ${VERSION_NCL}.tar.gz ) ) -fi - # # Install CDF if VER_CDF=CDFAUTO #