diff --git a/MY_RUN/KTEST/001_2Drelief/003_convdia/clean_conv2dia b/MY_RUN/KTEST/001_2Drelief/003_convdia/clean_conv2dia deleted file mode 100755 index b7471298dbe4522965b9351903c8fbf301b341e5..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/001_2Drelief/003_convdia/clean_conv2dia +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -f dirconv.elim FICJD LISTING_DIA OUT_DIA pipe_name -rm -f EXPER.1.HYD2D* - diff --git a/MY_RUN/KTEST/001_2Drelief/003_convdia/dir_conv2dia b/MY_RUN/KTEST/001_2Drelief/003_convdia/dir_conv2dia deleted file mode 100644 index 5706e5c9bdc1e19643e39a8561ecd1629906e305..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/001_2Drelief/003_convdia/dir_conv2dia +++ /dev/null @@ -1,6 +0,0 @@ -2 -EXPER.1.HYD2D.002 -EXPER.1.HYD2D.003 -EXPER.1.HYD2D.002-3d -n -0 diff --git a/MY_RUN/KTEST/001_2Drelief/003_convdia/run_conv2dia b/MY_RUN/KTEST/001_2Drelief/003_convdia/run_conv2dia deleted file mode 100755 index b9a9c88712be5b10353d9b5475711b94cfda1bcd..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/001_2Drelief/003_convdia/run_conv2dia +++ /dev/null @@ -1,11 +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/EXPER.1.HYD2D.00?.{des,lfi,nc} . -rm -f EXPER.1.HYD2D.002-3d.{des,lfi,nc} -time ${POSTRUN} conv2dia < dir_conv2dia - diff --git a/MY_RUN/KTEST/001_2Drelief/003_python/clean_python b/MY_RUN/KTEST/001_2Drelief/003_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/001_2Drelief/003_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/001_2Drelief/003_python/plot_001_2DRelief.py b/MY_RUN/KTEST/001_2Drelief/003_python/plot_001_2DRelief.py new file mode 100644 index 0000000000000000000000000000000000000000..5dcaac4da7f51863a636489e918b519ce31d95a5 --- /dev/null +++ b/MY_RUN/KTEST/001_2Drelief/003_python/plot_001_2DRelief.py @@ -0,0 +1,267 @@ +#!/usr/bin/env python3 +""" +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" +import matplotlib as mpl +mpl.use('Agg') +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +from misc_functions import comp_altitude1DVar +import os +import copy + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +path="" +LnameFiles = ['EXPER.1.HYD2D.002.nc', 'EXPER.1.HYD2D.003.nc'] + +Dvar_input = { +'f1':['ZS', 'UT', 'WT', 'THT', 'RVT','LSUM','LSTHM','CFLU','CFLW','ni_u','level','ZTOP', 'ni','level_w','time'], +'f2':['ZS', 'UT', 'WT', 'THT', 'RVT','LSUM','LSTHM','CFLU','CFLW','ni_u','level','ZTOP', 'ni', 'level_w', 'time'] +} + +# Read the variables in the files +Dvar = {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=True) + +# Compute altitude variable in 2D with a 1D topography +Dvar['f1']['altitude'], Dvar['f1']['ni_u_2D'] = comp_altitude1DVar(Dvar['f1']['UT'], Dvar['f1']['ZS'],Dvar['f1']['ZTOP'], Dvar['f1']['level'],Dvar['f1']['ni_u']) +Dvar['f1']['altitude_w'], Dvar['f1']['ni_2D'] = comp_altitude1DVar(Dvar['f1']['WT'], Dvar['f1']['ZS'],Dvar['f1']['ZTOP'], Dvar['f1']['level_w'],Dvar['f1']['ni']) + +orog = Dvar['f1']['ZS'][101:158] + +################################################################ +######### PANEL 1 & 2 +############################################################### +Panel1 = PanelPlot(2,2, [20,20],'001_2DRelief zoomed plots') + +Lplot = [ Dvar['f1']['UT'][:,101:158], Dvar['f2']['UT'][:,101:158], Dvar['f1']['THT'][:,101:158], Dvar['f2']['THT'][:,101:158] , + Dvar['f1']['WT'][:,101:158], Dvar['f2']['WT'][:,101:158], Dvar['f1']['RVT'][:,101:158], Dvar['f2']['RVT'][:,101:158] ] + +LaxeX = [Dvar['f1']['ni_u_2D'][:,101:158]]*2 +LaxeX.extend([Dvar['f1']['ni_2D'][:,101:158] for i in range(6)]) #ni for all except UT + +LaxeZ = [Dvar['f1']['altitude'][:,101:158]]*4 +LaxeZ.extend([Dvar['f1']['altitude_w'][:,101:158] for i in range(2)]) #altitude_w only for WT +LaxeZ.extend([Dvar['f1']['altitude'][:,101:158] for i in range(2)]) + +Ltitle = ['u-wind UT', 'u-wind UT', 'Potential temperature THT', 'Potential temperature THT', + 'Vertical velocity WT','Vertical velocity WT','Water vapor mixing ratio RVT', 'Water vapor mixing ratio RVT'] +Lcbarlabel = ['m/s', 'm/s', 'K', 'K', 'm/s','m/s','g/kg','g/kg'] +Lxlab = ['x (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,8000.1)]*len(Lplot) +Lminval = [5.2, 5.2, 285, 285, -0.4, -0.4, 0.2, 0.2] +Lmaxval = [12.4, 12.4, 330, 330, 0.28, 0.28, 4.0, 4.0] +Lstep = [0.4, 0.4, 2.5, 2.5, 0.04, 0.04, 0.2, 0.2] +Lstepticks = Lstep +Lfacconv = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1000.0, 1000.0] +Ltime = [Dvar['f1']['time'], Dvar['f2']['time']]*4 +LcolorLine = ['gist_rainbow_r']*len(Lplot) +Lpltype = ['c']*len(Lplot) +fig1 = Panel1.psectionV(Lxx=LaxeX[0:4], Lzz=LaxeZ[0:4], Lvar=Lplot[0:4], Lxlab=Lxlab[0:4], Lylab=Lylab[0:4], Ltitle=Ltitle[0:4],Lpltype=Lpltype, + Lminval=Lminval[0:4], Lmaxval=Lmaxval[0:4], Lstep=Lstep[0:4], Lstepticks=Lstepticks[0:4], LcolorLine=LcolorLine[0:4], + Lcbarlabel=Lcbarlabel[0:4], Lfacconv=Lfacconv[0:4], orog=orog, Lylim=Lylim[0:4], colorbar=False, Ltime=Ltime[0:4]) + +Panel1.save_graph(1,fig1) + +Panel2 = PanelPlot(2,2, [20,20],'001_2DRelief zoomed plots') +Lcolormap = ['gist_rainbow_r']*len(Lplot) + +fig2 = Panel2.psectionV(Lxx=LaxeX[:4], Lzz=LaxeZ[:4], Lvar=Lplot[:4], Lxlab=Lxlab[:4], Lylab=Lylab[:4], Ltitle=Ltitle[:4], + Lminval=Lminval[:4], Lmaxval=Lmaxval[:4], Lstep=Lstep[:4], Lstepticks=Lstepticks[:4], Lcolormap=Lcolormap[:4], + Lcbarlabel=Lcbarlabel[:4], Lfacconv=Lfacconv[:4], orog=orog, Lylim=Lylim[:4], colorbar=True, Ltime=Ltime[:4]) +Panel2.save_graph(2,fig2) + +################################################################ +######### PANEL 3 & 4 +############################################################### +Panel3 = PanelPlot(2,2, [20,20],'001_2DRelief full domain') + +Lplot = [ Dvar['f1']['UT'][:,:], Dvar['f2']['UT'][:,:], Dvar['f1']['THT'][:,:], Dvar['f2']['THT'][:,:] , + Dvar['f1']['WT'][:,:], Dvar['f2']['WT'][:,:], Dvar['f1']['RVT'][:,:], Dvar['f2']['RVT'][:,:] ] + +orog = Dvar['f1']['ZS'][:] +Lylim = [(0,15000.1)]*len(Lplot) +LaxeX = [Dvar['f1']['ni_u_2D'][:,:]]*2 +LaxeX.extend([Dvar['f1']['ni_2D'][:,:] for i in range(6)]) #ni for all except UT + +LaxeZ = [Dvar['f1']['altitude'][:,:]]*4 +LaxeZ.extend([Dvar['f1']['altitude_w'][:,:] for i in range(2)]) #altitude_w only for WT +LaxeZ.extend([Dvar['f1']['altitude'][:,:] for i in range(2)]) +Lpltype = ['c']*len(Lplot) + +fig3 = Panel3.psectionV(Lxx=LaxeX[0:4], Lzz=LaxeZ[0:4], Lvar=Lplot[0:4], Lxlab=Lxlab[0:4], Lylab=Lylab[0:4], Ltitle=Ltitle[0:4], Lpltype=Lpltype, + Lminval=Lminval[0:4], Lmaxval=Lmaxval[0:4], Lstep=Lstep[0:4], Lstepticks=Lstepticks[0:4], LcolorLine=LcolorLine[0:4], + Lcbarlabel=Lcbarlabel[0:4], Lfacconv=Lfacconv[0:4], orog=orog, Lylim=Lylim[0:4], colorbar=False, Ltime=Ltime[0:4]) + +Panel3.save_graph(3,fig3) + +Panel4 = PanelPlot(2,2, [20,20],'001_2DRelief full domain') +fig4 = Panel4.psectionV(Lxx=LaxeX[:4], Lzz=LaxeZ[:4], Lvar=Lplot[:4], Lxlab=Lxlab[:4], Lylab=Lylab[:4], Ltitle=Ltitle[:4], + Lminval=Lminval[:4], Lmaxval=Lmaxval[:4], Lstep=Lstep[:4], Lstepticks=Lstepticks[:4], Lcolormap=Lcolormap[:4], + Lcbarlabel=Lcbarlabel[:4], Lfacconv=Lfacconv[:4], orog=orog, Lylim=Lylim[:4], colorbar=True, Ltime=Ltime[:4]) +Panel4.save_graph(4,fig4) + +################################################################ +######### PANEL 5 +############################################################### +Panel5 = PanelPlot(2,2, [20,20],'001_2DRelief') +Lplot = [ Dvar['f1']['CFLU'][:,:], Dvar['f2']['CFLU'][:,:], Dvar['f1']['CFLW'][:,:], Dvar['f2']['CFLW'][:,:]] +LaxeX = [Dvar['f1']['ni_2D'][:,:]]*4 +LaxeZ = [Dvar['f1']['altitude'][:,:]]*4 +Ltitle = ['CFLU','CFLU','CFLW','CFLW'] +Lcbarlabel = ['-']*len(Lplot) +Lxlab = ['x (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,15000.1)]*len(Lplot) +Lminval = [0.03,0.03,0.004,0.004] +Lmaxval = [0.078,0.078,0.072,0.072] +Lstep = [0.003, 0.003, 0.004,0.004] +Lstepticks = Lstep +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Ltime = [Dvar['f1']['time'], Dvar['f2']['time']]*2 + +fig5 = Panel5.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, + orog=orog, Lylim=Lylim, colorbar=True, Ltime=Ltime) +Panel5.save_graph(5,fig5) + +################################################################ +######### PANEL 6 +############################################################### +Dvar['f1']['altitude'], Dvar['f1']['ni_u_2D'] = comp_altitude1DVar(Dvar['f1']['UT'], Dvar['f1']['ZS'],Dvar['f1']['ZTOP'], Dvar['f1']['level'],Dvar['f1']['ni_u']) +Dvar['f1']['THT-LSTHM'] = copy.deepcopy(Dvar['f1']['THT']) +Dvar['f1']['THT-LSTHM'] = Dvar['f1']['THT'] - Dvar['f1']['LSTHM'] + +Dvar['f2']['altitude'], Dvar['f2']['ni_u_2D'] = comp_altitude1DVar(Dvar['f2']['UT'], Dvar['f2']['ZS'],Dvar['f2']['ZTOP'], Dvar['f2']['level'],Dvar['f2']['ni_u']) +Dvar['f2']['THT-LSTHM'] = copy.deepcopy(Dvar['f2']['THT']) +Dvar['f2']['THT-LSTHM'] = Dvar['f2']['THT'] - Dvar['f2']['LSTHM'] + +Dvar['f1']['UT-LSUM'] = copy.deepcopy(Dvar['f1']['UT']) +Dvar['f1']['UT-LSUM'] = Dvar['f1']['UT'] - Dvar['f1']['LSUM'] + +Dvar['f2']['UT-LSUM'] = copy.deepcopy(Dvar['f2']['UT']) +Dvar['f2']['UT-LSUM'] = Dvar['f2']['UT'] - Dvar['f2']['LSUM'] + +Panel6 = PanelPlot(2,2, [20,20],'Profiles at the center (top of the topography)') + +Lplot = [ Dvar['f1']['WT'][:,127]] +LaxeZ = [Dvar['f1']['altitude'][:,127]]*len(Lplot) +Ltitle = ['WT and THT-LSTHM']*len(Lplot) +Llinelabel = ['WT'] +Lxlab = ['velocity (m/s)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,15000.1)]*len(Lplot) +Lxlim = [(-0.3,0.3)] +Llinecolor = ['r'] +LaxisColor = Llinecolor +Llvl = [0]*len(Lplot) +Ltime = [Dvar['f1']['time']] +fig6 = Panel6.pXY_lines(Lyy=LaxeZ, Lxx=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lylim=Lylim, Lxlim=Lxlim, Llinelabel=Llinelabel, + Llinecolor=Llinecolor, LaxisColor=LaxisColor, Ltime=Ltime) + +Lplot = [ Dvar['f1']['THT-LSTHM'][:,127]] +Ltitle = [] +Llinelabel = ['THT - LSTHM '] +Lxlab = ['theta perturb (K)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,15000.1)]*len(Lplot) +Lxlim = [(-0.8,0.1)] +Llinecolor = ['g'] +LaxisColor = Llinecolor +Llvl = [0]*len(Lplot) +fig7 = Panel6.pXY_lines(Lyy=LaxeZ, Lxx=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle,ax=fig6.axes, id_overlap=1, + Lylim=Lylim, Lxlim=Lxlim, Llinelabel=Llinelabel, Llinecolor=Llinecolor,LaxisColor=LaxisColor, Ltime=Ltime) + +Lplot = [ Dvar['f2']['WT'][:,127]] +LaxeZ = [Dvar['f2']['altitude'][:,127]]*len(Lplot) +Ltitle = ['WT and THT-LSTHM']*len(Lplot) +Llinelabel = ['WT'] +Lxlab = ['velocity (m/s)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,15000.1)]*len(Lplot) +Lxlim = [(-0.3,0.3)] +Llinecolor = ['r'] +LaxisColor = Llinecolor +Llvl = [0]*len(Lplot) +Ltime = [Dvar['f2']['time']] +fig8 = Panel6.pXY_lines(Lyy=LaxeZ, Lxx=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lylim=Lylim, Lxlim=Lxlim, Llinelabel=Llinelabel, + Llinecolor=Llinecolor, LaxisColor=LaxisColor, Ltime=Ltime, ax=fig7.axes) + +Lplot = [ Dvar['f2']['THT-LSTHM'][:,127]] +Ltitle = [] +Llinelabel = ['THT - LSTHM '] +Lxlab = ['theta perturb (K)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,15000.1)]*len(Lplot) +Lxlim = [(-0.1,0.2)] +Llinecolor = ['g'] +LaxisColor = Llinecolor +Llvl = [0]*len(Lplot) +fig9 = Panel6.pXY_lines(Lyy=LaxeZ, Lxx=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, ax=fig8.axes, id_overlap=1, + Lylim=Lylim, Lxlim=Lxlim, Llinelabel=Llinelabel, Llinecolor=Llinecolor, LaxisColor=LaxisColor, Ltime=Ltime) + +# WT and UT-LSUM +Lplot = [ Dvar['f1']['WT'][:,127]] +LaxeZ = [Dvar['f1']['altitude'][:,127]]*len(Lplot) +Ltitle = ['WT and UT-LSUM']*len(Lplot) +Llinelabel = ['WT'] +Lxlab = ['velocity (m/s)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,15000.1)]*len(Lplot) +Lxlim = [(-0.3,0.3)] +Llinecolor = ['r'] +LaxisColor = Llinecolor +Llvl = [0]*len(Lplot) +Ltime = [Dvar['f1']['time']] +fig10 = Panel6.pXY_lines(Lyy=LaxeZ, Lxx=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lylim=Lylim, Lxlim=Lxlim, Llinelabel=Llinelabel, + Llinecolor=Llinecolor, LaxisColor=LaxisColor, Ltime=Ltime, ax=fig9.axes) + +Lplot = [ Dvar['f1']['UT-LSUM'][:,127]] +Ltitle = [] +Llinelabel = ['UT - LSUM '] +Lxlab = ['u perturb (K)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,15000.1)]*len(Lplot) +Lxlim = [(-0.2,0.8)] +Llinecolor = ['g'] +LaxisColor = Llinecolor +Llvl = [0]*len(Lplot) +fig11 = Panel6.pXY_lines(Lyy=LaxeZ, Lxx=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, ax=fig10.axes, id_overlap=1, + Lylim=Lylim, Lxlim=Lxlim, Llinelabel=Llinelabel, Llinecolor=Llinecolor,LaxisColor=LaxisColor, Ltime=Ltime) + +Lplot = [ Dvar['f2']['WT'][:,127]] +LaxeZ = [Dvar['f2']['altitude'][:,127]]*len(Lplot) +Ltitle = ['WT and UT-LSUM']*len(Lplot) +Llinelabel = ['WT'] +Lxlab = ['velocity (m/s)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,15000.1)]*len(Lplot) +Lxlim = [(-0.3,0.3)] +Llinecolor = ['r'] +LaxisColor = Llinecolor +Llvl = [0]*len(Lplot) +Ltime = [Dvar['f2']['time']] +fig12 = Panel6.pXY_lines(Lyy=LaxeZ, Lxx=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lylim=Lylim, Lxlim=Lxlim, Llinelabel=Llinelabel, + Llinecolor=Llinecolor, LaxisColor=LaxisColor, Ltime=Ltime, ax=fig11.axes) + +Lplot = [ Dvar['f2']['UT-LSUM'][:,127]] +Ltitle = [] +Llinelabel = ['UT - LSUM '] +Lxlab = ['u perturb (K)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,15000.1)]*len(Lplot) +Lxlim = [(-2.0,2.0)] +Llinecolor = ['g'] +LaxisColor = Llinecolor +Llvl = [0]*len(Lplot) +fig13 = Panel6.pXY_lines(Lyy=LaxeZ, Lxx=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle,ax=fig12.axes, id_overlap=1, + Lylim=Lylim, Lxlim=Lxlim, Llinelabel=Llinelabel, Llinecolor=Llinecolor, LaxisColor=LaxisColor, Ltime=Ltime) + +Panel6.save_graph(6,fig13) diff --git a/MY_RUN/KTEST/001_2Drelief/003_python/run_python b/MY_RUN/KTEST/001_2Drelief/003_python/run_python new file mode 100755 index 0000000000000000000000000000000000000000..19a55602d8dfa2a0a58421bc177ad2661b9e3e7e --- /dev/null +++ b/MY_RUN/KTEST/001_2Drelief/003_python/run_python @@ -0,0 +1,21 @@ +#!/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 ${SRC_MESONH}/src/LIB/Python/* . + +ln -sf ../002_mesonh/EXPER.1.HYD2D.002.nc . +ln -sf ../002_mesonh/EXPER.1.HYD2D.003.nc . + +python3 plot_001_2DRelief.py +${POSTRUN} display tempgraph1.png +${POSTRUN} display tempgraph2.png +${POSTRUN} display tempgraph3.png +${POSTRUN} display tempgraph4.png +${POSTRUN} display tempgraph5.png +${POSTRUN} display tempgraph6.png +#${POSTRUN} convert *.png 001_2DRelief.pdf +#${POSTRUN} evince 001_2DRelief.pdf diff --git a/MY_RUN/KTEST/001_2Drelief/004_diaprog/clean_diaprog b/MY_RUN/KTEST/001_2Drelief/004_diaprog/clean_diaprog deleted file mode 100755 index fc74351aa873e3b64453331da8378d7fddf1b329..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/001_2Drelief/004_diaprog/clean_diaprog +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -f EXPER.1.HYD2D* -rm -f gmeta OUT* -rm -f rm dir.*:* diff --git a/MY_RUN/KTEST/001_2Drelief/004_diaprog/dir.2Drelief b/MY_RUN/KTEST/001_2Drelief/004_diaprog/dir.2Drelief deleted file mode 100644 index 9e18e8271f7926ab8437f679b6005120345f83f8..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/001_2Drelief/004_diaprog/dir.2Drelief +++ /dev/null @@ -1,60 +0,0 @@ -visu -! directives generales -LINVWB=T -! plages de couleur -LCOLAREA=T LISO=F -XLWCONT=2 -LMINMAX=T -! label de toutes les iso -NULBLL=0 -! pour obtenir des labels d isolignes -XSIZEL=0.012 -! localisation du minmax dans le print minmax -LMNMXLOC=T -! High&Low -NHI=0 -! label des axes en indices plutot que km en CH -LINDAX=T -NIGRNC=10 -! vecteur -XVRL=0.15 -NISKIP=4 -! pas de dilatation de la composante W -LDILW=F -! min max vecteur -LVECTMNMX=T -! min max du zoom si NIMNMX<=0 -LCVZOOM=T -! normaliser la longueur des vecteurs a 20m/s et tracer tous les vecteurs -XVHC=-20 -LVSUPSCA=T -! pour agrandir la legende a droite -LVPTUSER=T -XVPTL=0.1 XVPTR=0.9 !XVPTT=0.8 -!LVPTVUSER=T -!XVPTVL=0.08 XVPTVR=0.78 XVPTVT=0.8 -!LVPTPVUSER=T -!XVPTPVL=0.08 XVPTPVR=0.78 XVPTPVT=0.8 -!LVPTXYUSER=T -!XVPTXYL=0.08 XVPTXYR=0.78 XVPTXYT=0.8 - -_file_'EXPER.1.HYD2D.002-3d' -LCOLINE=T LCOLAREA=F -! coupe verticale -nidebcou=2 njdebcou=1 nlangle=0 xhmin=0 xhmax=15000 nlmax=256 lpointg=.T. -UT_CV_ -THT_CV_ -WT_CV_ -RVT_CV_ -CFLU_CV_ -CFLV_CV_ -CFLW_CV_ -!profile -PROFILE=128 -WT_T_time1_PV__ON_THT_T_time1_PV__MINUS_LSTHM_T_time1_PV_ -WT_T_time2_PV__ON_THT_T_time1_PV__MINUS_LSTHM_T_time2_PV_ -WT_T_time1_PV__ON_UT_T_time2_PV__MINUS_LSUM_T_time1_PV_ -WT_T_time2_PV__ON_UT_T_time2_PV__MINUS_LSUM_T_time2_PV_ -! -! a vous d indiquer vos directives -quit diff --git a/MY_RUN/KTEST/001_2Drelief/004_diaprog/run_diaprog b/MY_RUN/KTEST/001_2Drelief/004_diaprog/run_diaprog deleted file mode 100755 index 03431de5cdfd18131b22dd89fef23b6c6cd3c2c3..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/001_2Drelief/004_diaprog/run_diaprog +++ /dev/null @@ -1,10 +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 ../003_convdia/EXPER.1.HYD2D.002-3d.{des,lfi} . -rm -f dir.0* -${POSTRUN} diaprog < dir.2Drelief diff --git a/MY_RUN/KTEST/001_2Drelief/005_ncl/clean_ncl b/MY_RUN/KTEST/001_2Drelief/004_ncl/clean_ncl similarity index 100% rename from MY_RUN/KTEST/001_2Drelief/005_ncl/clean_ncl rename to MY_RUN/KTEST/001_2Drelief/004_ncl/clean_ncl diff --git a/MY_RUN/KTEST/001_2Drelief/005_ncl/plot_2Drelief.ncl b/MY_RUN/KTEST/001_2Drelief/004_ncl/plot_2Drelief.ncl similarity index 89% rename from MY_RUN/KTEST/001_2Drelief/005_ncl/plot_2Drelief.ncl rename to MY_RUN/KTEST/001_2Drelief/004_ncl/plot_2Drelief.ncl index 41eb6d0eabd1d0c4bba10d705dac87a3bd68e58b..bfeaa593ef6d570f496d8ae85a8a249fdbe9c8c2 100644 --- a/MY_RUN/KTEST/001_2Drelief/005_ncl/plot_2Drelief.ncl +++ b/MY_RUN/KTEST/001_2Drelief/004_ncl/plot_2Drelief.ncl @@ -23,35 +23,33 @@ begin mdims = getfilevardimsizes(fichier1,"UT") nd = dimsizes(mdims) imax=mdims(nd-1)-2*jphext - jmax=mdims(nd-2)-2*jphext - kmax=mdims(nd-3)-2 + kmax=mdims(nd-2)-2 - -zs = fichier1->ZS(0,jphext:imax+jphext-1) ; ZS +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,0,jphext:imax+jphext-1) ; LSTHM +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,0,jphext:imax+jphext-1+1) ; LSUM -wt1_old= fichier1->WT(0,1:kmax+1,0,jphext:imax+jphext-1) ; WT -ut1_old= fichier1->UT(0,1:kmax,0,jphext:imax+jphext-1+1) ; UT +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,0,jphext:imax+jphext-1) ; THT +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,0,jphext:imax+jphext-1) ; RVT +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,0,jphext:imax+jphext-1) ; CFLU +cflu1= fichier1->CFLU(0,1:kmax,jphext:imax+jphext-1) ; CFLU cflu1@long_name="CFLU" cflu1@units="-" -cflw1= fichier1->CFLW(0,1:kmax,0,jphext:imax+jphext-1) ; CFLW +cflw1= fichier1->CFLW(0,1:kmax,jphext:imax+jphext-1) ; CFLW cflw1@long_name="CFLW" cflw1@units=" " @@ -60,27 +58,27 @@ SS1=fichier1->DTCUR ;YYYYDDMM2= fichier2->DTCUR__TDATE SS2=fichier2->DTCUR -lsthm2 = fichier2->LSTHM(0,1:kmax,0,jphext:imax+jphext-1) ; LSTHM +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,0,jphext:imax+jphext-1+1) ; LSUM -wt2_old= fichier2->WT(0,1:kmax+1,0,jphext:imax+jphext-1) ; WT -ut2_old= fichier2->UT(0,1:kmax,0,jphext:imax+jphext-1+1) ; UT +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,0,jphext:imax+jphext-1) ; THT +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,0,jphext:imax+jphext-1) ; RVT +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,0,jphext:imax+jphext-1) ; CFLU +cflu2= fichier2->CFLU(0,1:kmax,jphext:imax+jphext-1) ; CFLU cflu2@long_name="CFLU" cflu2@units="-" -cflw2= fichier2->CFLW(0,1:kmax,0,jphext:imax+jphext-1) ; CFLW +cflw2= fichier2->CFLW(0,1:kmax,jphext:imax+jphext-1) ; CFLW cflw2@long_name="CFLW" cflw2@units=" " diff --git a/MY_RUN/KTEST/001_2Drelief/005_ncl/run_ncl b/MY_RUN/KTEST/001_2Drelief/004_ncl/run_ncl similarity index 100% rename from MY_RUN/KTEST/001_2Drelief/005_ncl/run_ncl rename to MY_RUN/KTEST/001_2Drelief/004_ncl/run_ncl diff --git a/MY_RUN/KTEST/001_2Drelief/Makefile b/MY_RUN/KTEST/001_2Drelief/Makefile index e50e3b333d17d9505c803b9ba51ca34fcdcaafea..be7225be45a1711f84abfa0cf06804dc78b7d5e1 100644 --- a/MY_RUN/KTEST/001_2Drelief/Makefile +++ b/MY_RUN/KTEST/001_2Drelief/Makefile @@ -1,13 +1,15 @@ all: cd 001_prep_ideal_case && run_prep_ideal_case_xyz cd 002_mesonh && run_mesonh_xyz - cd 003_convdia && run_conv2dia - cd 004_diaprog && run_diaprog - cd 005_ncl && run_ncl +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 cd 002_mesonh && clean_mesonh_xyz - cd 003_convdia && clean_conv2dia - cd 004_diaprog && clean_diaprog - cd 005_ncl && clean_ncl +ifneq "$(MNH_PYTHON)" "NO" + cd 003_python && clean_python +endif + cd 004_ncl && clean_ncl diff --git a/MY_RUN/KTEST/002_3Drelief/003_convdia/clean_conv2dia b/MY_RUN/KTEST/002_3Drelief/003_convdia/clean_conv2dia deleted file mode 100755 index 4736bbeef2a40269d80176c3795d819bb2a8878b..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/002_3Drelief/003_convdia/clean_conv2dia +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -x -rm -f REL3D.1.EXP01.002.{des,lfi,nc} -rm -f REL3D.1.EXP01.002dg.{des,lfi,nc} -rm -f dirconv FICJD LISTING_DIA OUT_DIA pipe_name diff --git a/MY_RUN/KTEST/002_3Drelief/003_convdia/dir_conv2dia b/MY_RUN/KTEST/002_3Drelief/003_convdia/dir_conv2dia deleted file mode 100644 index 5ba8fe21114ec45e4d73c53c52274b23049da4f8..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/002_3Drelief/003_convdia/dir_conv2dia +++ /dev/null @@ -1,6 +0,0 @@ -1 -REL3D.1.EXP01.002 -REL3D.1.EXP01.002dg -n -n -0 diff --git a/MY_RUN/KTEST/002_3Drelief/003_python/clean_python b/MY_RUN/KTEST/002_3Drelief/003_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/002_3Drelief/003_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/002_3Drelief/003_python/plot_002_3DRelief.py b/MY_RUN/KTEST/002_3Drelief/003_python/plot_002_3DRelief.py new file mode 100644 index 0000000000000000000000000000000000000000..079e324052720e530282675cb68dbaad869336eb --- /dev/null +++ b/MY_RUN/KTEST/002_3Drelief/003_python/plot_002_3DRelief.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" +import matplotlib as mpl +mpl.use('Agg') +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +from misc_functions import comp_altitude2DVar +import cartopy.crs as ccrs +import os + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +path="" + +LnameFiles = ['REL3D.1.EXP01.002.nc'] + +Dvar_input = { +'f1':['ZS', 'UT', 'WT','ni_u','nj_u','level','ZTOP', 'ni','nj','level_w','time']} + +# Read the variables in the files +Dvar = {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=True) + +# Compute altitude variable in 3D with a 2D topography +Dvar['f1']['altitude'], Dvar['f1']['ni_u_3D'], Dvar['f1']['nj_u_3D'] = comp_altitude2DVar(Dvar['f1']['UT'], Dvar['f1']['ZS'],Dvar['f1']['ZTOP'], Dvar['f1']['level'], Dvar['f1']['ni_u'], Dvar['f1']['nj_u']) +Dvar['f1']['altitude_w'], Dvar['f1']['ni_3D'], Dvar['f1']['nj_3D'] = comp_altitude2DVar(Dvar['f1']['WT'], Dvar['f1']['ZS'],Dvar['f1']['ZTOP'], Dvar['f1']['level_w'],Dvar['f1']['ni'], Dvar['f1']['nj']) + +orog = Dvar['f1']['ZS'][15,:] + +################################################################ +######### PANEL 1 +############################################################### +Panel1 = PanelPlot(2,2, [20,20],'003_2DRelief vertical and horizontal sections') + +Lplot = [ Dvar['f1']['UT'][:,15,:], Dvar['f1']['WT'][:,15,:]] +LaxeX = [Dvar['f1']['ni_u_3D'][:,15,:], Dvar['f1']['ni_3D'][:,15,:]] +LaxeZ = [Dvar['f1']['altitude'][:,15,:], Dvar['f1']['altitude_w'][:,15,:]] +Ltitle = ['u-wind UT', 'Vertical velocity WT',] +Lcbarlabel = ['m/s']*len(Lplot) +Lxlab = ['x (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,10000.1)]*len(Lplot) +Lminval = [8, -1.2] +Lmaxval = [14, 0.9] +Lstep = [0.25, 0.1] +Lstepticks = Lstep +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Ltime = [Dvar['f1']['time']]*len(Lplot) +Lprojection = [ccrs.PlateCarree()]*len(Lplot) +fig1 = Panel1.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, + orog=orog, Lylim=Lylim, colorbar=True, Ltime=Ltime) + +# Horizontal cross-section +Lplot = [ Dvar['f1']['UT'], Dvar['f1']['WT']] +Ltitle = ['u-wind UT at K=2', 'Vertical velocity WT at K=2',] +LaxeX = [Dvar['f1']['ni_u'], Dvar['f1']['ni']] +LaxeY = [Dvar['f1']['nj_u'], Dvar['f1']['nj']] +Llvl = [0]*len(Lplot) + +fig2 = Panel1.psectionH(lon=LaxeX, lat=LaxeY, Lvar=Lplot, Llevel=Llvl, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, + colorbar=True, Ltime=Ltime, ax=fig1.axes) + +Panel1.save_graph(1,fig2) diff --git a/MY_RUN/KTEST/002_3Drelief/003_python/run_python b/MY_RUN/KTEST/002_3Drelief/003_python/run_python new file mode 100755 index 0000000000000000000000000000000000000000..7f4f816d956c462a75143af36c86fe34e1194970 --- /dev/null +++ b/MY_RUN/KTEST/002_3Drelief/003_python/run_python @@ -0,0 +1,14 @@ +#!/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 ${SRC_MESONH}/src/LIB/Python/* . +ln -sf ../002_mesonh/REL3D.1.EXP01.002.nc . + +python3 plot_002_3DRelief.py +${POSTRUN} display tempgraph1.png +#${POSTRUN} convert *.png 002_3DRelief.pdf +#${POSTRUN} evince 002_3DRelief.pdf diff --git a/MY_RUN/KTEST/002_3Drelief/004_diaprog/clean_diaprog b/MY_RUN/KTEST/002_3Drelief/004_diaprog/clean_diaprog deleted file mode 100755 index f1904b54b7017b3dbb9cb024ff32bc31a2672c0e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/002_3Drelief/004_diaprog/clean_diaprog +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f dir.* gmeta REL3D* OUT_DIA diff --git a/MY_RUN/KTEST/002_3Drelief/004_diaprog/dir_3Drelief b/MY_RUN/KTEST/002_3Drelief/004_diaprog/dir_3Drelief deleted file mode 100644 index 7181757a989b615e609ee3ca41021f23ab1b379b..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/002_3Drelief/004_diaprog/dir_3Drelief +++ /dev/null @@ -1,13 +0,0 @@ -visu -_file1_'REL3D.1.EXP01.002dg' -print groups -UT_k_2_file1_ -liso=f -lcolarea=t -UT_k_2_file1_ -quit -_file2_'REL3D_autre_run' -UT_k_2_file2_ -UT_k_2_file1__minus_UT_k_2_file2_ -quit - diff --git a/MY_RUN/KTEST/002_3Drelief/004_ncl/clean_ncl b/MY_RUN/KTEST/002_3Drelief/004_ncl/clean_ncl new file mode 100755 index 0000000000000000000000000000000000000000..8b82cdb8e78561ded4ce43712ce50580c6423c07 --- /dev/null +++ b/MY_RUN/KTEST/002_3Drelief/004_ncl/clean_ncl @@ -0,0 +1,2 @@ +#!/bin/bash +rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/002_3Drelief/005_ncl/plot_3Drelief.ncl b/MY_RUN/KTEST/002_3Drelief/004_ncl/plot_3Drelief.ncl similarity index 100% rename from MY_RUN/KTEST/002_3Drelief/005_ncl/plot_3Drelief.ncl rename to MY_RUN/KTEST/002_3Drelief/004_ncl/plot_3Drelief.ncl diff --git a/MY_RUN/KTEST/002_3Drelief/005_ncl/run_ncl b/MY_RUN/KTEST/002_3Drelief/004_ncl/run_ncl similarity index 100% rename from MY_RUN/KTEST/002_3Drelief/005_ncl/run_ncl rename to MY_RUN/KTEST/002_3Drelief/004_ncl/run_ncl diff --git a/MY_RUN/KTEST/002_3Drelief/005_ncl/clean_ncl b/MY_RUN/KTEST/002_3Drelief/005_ncl/clean_ncl deleted file mode 100755 index 233231e1eee2bac48853a70db7af884c517b70bd..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/002_3Drelief/005_ncl/clean_ncl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -rm -f *.nc *.ps diff --git a/MY_RUN/KTEST/002_3Drelief/Makefile b/MY_RUN/KTEST/002_3Drelief/Makefile index e50e3b333d17d9505c803b9ba51ca34fcdcaafea..fb8e06d4be5003590017ea87a10014e3bcabf0ac 100644 --- a/MY_RUN/KTEST/002_3Drelief/Makefile +++ b/MY_RUN/KTEST/002_3Drelief/Makefile @@ -1,13 +1,15 @@ all: cd 001_prep_ideal_case && run_prep_ideal_case_xyz cd 002_mesonh && run_mesonh_xyz - cd 003_convdia && run_conv2dia - cd 004_diaprog && run_diaprog - cd 005_ncl && run_ncl + 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 cd 002_mesonh && clean_mesonh_xyz - cd 003_convdia && clean_conv2dia - cd 004_diaprog && clean_diaprog - cd 005_ncl && clean_ncl + ifneq "$(MNH_PYTHON)" "NO" + cd 003_python && clean_python + endif + cd 004_ncl && clean_ncl diff --git a/MY_RUN/KTEST/003_KW78/003_convdia/clean_conv2dia b/MY_RUN/KTEST/003_KW78/003_convdia/clean_conv2dia deleted file mode 100755 index 9ba04f4e6b5d7baf4a3832abff01338eaff2dac4..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/003_convdia/clean_conv2dia +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -x -rm -f KWRAI.* -rm -f dirconv FICJD LISTING_DIA OUT_DIA pipe_name diff --git a/MY_RUN/KTEST/003_KW78/003_convdia/dir_conv2dia b/MY_RUN/KTEST/003_KW78/003_convdia/dir_conv2dia deleted file mode 100644 index b6310ba659e65bdc1ac6cfec31770957b9c07690..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/003_convdia/dir_conv2dia +++ /dev/null @@ -1,6 +0,0 @@ -1 -KWRAI.1.SEG01.004 -KWRAI.1.SEG01.004dg -n -n -0 diff --git a/MY_RUN/KTEST/003_KW78/003_diag/DIAG1.nam b/MY_RUN/KTEST/003_KW78/003_diag/DIAG1.nam new file mode 100644 index 0000000000000000000000000000000000000000..bde6301da864476969b9ded6ec83edc699b3ad1c --- /dev/null +++ b/MY_RUN/KTEST/003_KW78/003_diag/DIAG1.nam @@ -0,0 +1,14 @@ +&NAM_CONFIO LCDF4=T, LLFIOUT=F, LLFIREAD=F / +&NAM_CONFZ + ! NZ_VERB=5 , NZ_PROC=0 , NB_PROCIO_R=8 , NB_PROCIO_W=1 +/ +&NAM_DIAG + LCLSTR=T, + LBOTUP=T, + CFIELD='W', + XTHRES=10., + LISOAL=T, XISOAL(1)=3000, XISOAL(2)=5000 + / +&NAM_DIAG_FILE YINIFILE(1) = "KWRAI.1.SEG01.004" , + YSUFFIX='dia' / + diff --git a/MY_RUN/KTEST/003_KW78/003_diag/clean_diag_xyz b/MY_RUN/KTEST/003_KW78/003_diag/clean_diag_xyz new file mode 100755 index 0000000000000000000000000000000000000000..19b1bf34eb5ca4964c57e9b503ef15a7e940213f --- /dev/null +++ b/MY_RUN/KTEST/003_KW78/003_diag/clean_diag_xyz @@ -0,0 +1,5 @@ +#!/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/003_diag/diag.nam b/MY_RUN/KTEST/003_KW78/003_diag/diag.nam new file mode 100644 index 0000000000000000000000000000000000000000..a1252a72b1b6ef1bf8d6ad58ebe2ffd962e53fc6 --- /dev/null +++ b/MY_RUN/KTEST/003_KW78/003_diag/diag.nam @@ -0,0 +1,12 @@ + +exemple 1, identification des ascendances > 10 m/s + +&NAM_DIAG LCLSTR = T, LBOTUP = T, CFIELD = "W", XTHRES = 10. / + + + +exemple 2, identification des overshoots + +&NAM_DIAG LCLSTR = T, LBOTUP = F, CFIELD = "CLOUD", XTHRES = 0.00001 / + +NB: par défaut CLOUD prend en compte Rc+Ri+Rs+Rg i.e. cloud water and ice, graupel and snow diff --git a/MY_RUN/KTEST/002_3Drelief/003_convdia/run_conv2dia b/MY_RUN/KTEST/003_KW78/003_diag/run_diag_xyz similarity index 67% rename from MY_RUN/KTEST/002_3Drelief/003_convdia/run_conv2dia rename to MY_RUN/KTEST/003_KW78/003_diag/run_diag_xyz index db41113751bf7e7148be1a6100d95fc55c5aa443..b36518443ebec0529cd0d53901f3adffe95dc551 100755 --- a/MY_RUN/KTEST/002_3Drelief/003_convdia/run_conv2dia +++ b/MY_RUN/KTEST/003_KW78/003_diag/run_diag_xyz @@ -5,7 +5,11 @@ #MNH_LIC for details. version 1. set -x set -e -ln -sf ../002_mesonh/REL3D.1.EXP01.002.{des,lfi,nc} . -rm -f REL3D.1.EXP01.002dg.{des,lfi,nc} -${POSTRUN} conv2dia < dir_conv2dia +rm -f KWRAI* OUT* +# +# +ln -sf ../002_mesonh/KWRAI.1.SEG01.004.des . +ln -sf ../002_mesonh/KWRAI.1.SEG01.004.*nc . + +time ${MPIRUN} DIAG${XYZ} diff --git a/MY_RUN/KTEST/003_KW78/004_diaprog/clean_diaprog b/MY_RUN/KTEST/003_KW78/004_diaprog/clean_diaprog deleted file mode 100755 index f4e896519cb1fae63eb774815ca52c295b3e1c9a..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/004_diaprog/clean_diaprog +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f dir.* gmeta KWRAI.1.SEG01.00* OUT_DIA diff --git a/MY_RUN/KTEST/003_KW78/004_diaprog/dir_KW78 b/MY_RUN/KTEST/003_KW78/004_diaprog/dir_KW78 deleted file mode 100644 index f23437c1cdb46db72e54e3be4890ccbcbb5ae125..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/004_diaprog/dir_KW78 +++ /dev/null @@ -1,78 +0,0 @@ -visu -! directives de presentation -LINVWB=T NIGRNC=10 nhi=0 lminmax=t xsizel=0.015 -! plages de couleur, pas d isolignes -LCOLAREA=T LISO=F -! gestion des vecteurs (1 vecteur sur 4) -NISKIP=4 XVRL=0.15 -! 1er fichier a ouvrir -_file1_'KWRAI.1.SEG01.004dg' -! couleur de fond pour le 1er intervalle -LCOLZERO=T NCOLZERO=1 -! precipitations explicites instantanees -NIMNMX=1 -XISOMIN_INPRR=0 -XISOMAX_INPRR=6 -XDIAINT_INPRR=0.250 -INPRR -! precipitations explicites cumulees -XISOMIN_ACPRR=0 -XISOMAX_ACPRR=0.150 -XDIAINT_ACPRR=0.005 -ACPRR -! trace de tous les vecteurs -NISKIP=1 -! superposition de la pression et des vecteurs de vent au niveau K=2 -XISOMIN_PABST=98250 -XISOMAX_PABST=98350 -XDIAINT_PABST=5 -PABST_K_2_ON_UTVT_K_2 -! superposition du rapport d eau nuageuse et des vecteurs vent a 3000m -XISOMIN_RCT=0 -XISOMAX_RCT=0.003 -XDIAINT_RCT=0.00005 -RCT_Z_3000_ON_UTVT_Z_3000 -! superposition du rapport d eau nuageuse et des vecteurs vent a 5000m -RCT_Z_5000_ON_UTVT_Z_5000 -! definition d une coupe verticale -NIDEBCOU=5 NJDEBCOU=2 NLANGLE=47 NLMAX=21 -! trace de la coupe verticale dans le plan horizontal -LTRACECV=T -! rapport de vapeur et vecteurs vent dans la coupe verticale -XISOMIN_RVT=0 -XISOMAX_RVT=0.015 -XDIAINT_RVT=0.0005 -RVT_CV__ON_ULTWT_CV_ -! plus de trace de la coupe verticale -LTRACECV=F -! rapport de melange d eau nuageuse et rapport d eau de pluie -XISOMIN_RRT=0.00025 -XISOMAX_RRT=0.005 -XDIAINT_RRT=0.00025 -XISOMIN_RCT=0. -XISOMAX_RCT=0.001 -XDIAINT_RCT=0.00005 -RCT_CV__ON_RRT_CV_ -! difference pour la temperature potentielle avec le champ initial -XISOMIN=-4 -XISOMAX=4 -XDIAINT=0.2 -THT_CV__MINUS_LSTHM_CV_ -! vitesse verticale en coupe verticale -XISOMIN_WT=-4 -XISOMAX_WT=10 -XDIAINT_WT=0.5 -WT_CV_ -! definition d une autre coupe verticale -NIDEBCOU=15 NJDEBCOU=2 NLANGLE=90 NLMAX=23 -LTRACECV=T -RVT_CV__ON_ULTWT_CV_ -LTRACECV=F -RCT_CV__ON_RRT_CV_ -XISOMIN=-4 -XISOMAX=4 -XDIAINT=0.2 -THT_CV__MINUS_LSTHM_CV_ -WT_CV_ -quit - diff --git a/MY_RUN/KTEST/003_KW78/004_diaprog/run_diaprog b/MY_RUN/KTEST/003_KW78/004_diaprog/run_diaprog deleted file mode 100755 index 365ecc11eabe264469d38e41a4d1e10a743215ac..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/003_KW78/004_diaprog/run_diaprog +++ /dev/null @@ -1,11 +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 ../003_convdia/KWRAI.1.SEG01.004dg.{des,lfi} . -rm -f dir.* -${POSTRUN} diaprog < dir_KW78 -#idt gmeta diff --git a/MY_RUN/KTEST/003_KW78/004_python/clean_python b/MY_RUN/KTEST/003_KW78/004_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/003_KW78/004_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/003_KW78/004_python/plot_003_KW78.py b/MY_RUN/KTEST/003_KW78/004_python/plot_003_KW78.py new file mode 100644 index 0000000000000000000000000000000000000000..9ec2501f9495c586925e8dc649351a883f6db275 --- /dev/null +++ b/MY_RUN/KTEST/003_KW78/004_python/plot_003_KW78.py @@ -0,0 +1,229 @@ +#!/usr/bin/env python3 +""" + +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" + +import matplotlib as mpl +mpl.use('Agg') +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +from misc_functions import comp_altitude2DVar, oblique_proj, windvec_verti_proj, mean_operator +import math +import os + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +path="" + +LnameFiles = ['KWRAI.1.SEG01.004.nc','KWRAI.1.SEG01.004dia.nc' ] + +Dvar_input = { +'f1':['ZS', 'UT','VT', 'WT','THT', + 'ni_u','nj_u','level','ZTOP', 'ni','nj','level_w','time', + 'INPRR','ACPRR','PABST','RCT','RVT','RRT','LSTHM'], +'f2':['ALT_CLOUD', 'ALT_U', 'ALT_V', 'ni','nj']} + +# Read the variables in the files +Dvar = {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=True) + +################################################################ +######### PANEL 1 +############################################################### +Panel1 = PanelPlot(2,3, [25,14],'', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01) + +Lplot = [ Dvar['f1']['INPRR'], Dvar['f1']['ACPRR'], Dvar['f1']['PABST'],Dvar['f2']['ALT_CLOUD'],Dvar['f2']['ALT_CLOUD'] ] + +LaxeX = [Dvar['f1']['ni']]*len(Lplot) +LaxeY = [Dvar['f1']['nj']]*len(Lplot) +Ltitle = ['Instantaneous precipitation INPRR', 'Accumulated precipitation ACPRR','Absolute pressure','Mixing ratio of liquid droplets at z=3000m','Mixing ratio of liquid droplets at z=5000m' ] +Lcbarlabel = ['mm/h', 'mm','hPa','g/kg','g/kg'] +Lxlab = ['x (m)']*len(Lplot) +Lylab = ['y (m)']*len(Lplot) +Lminval = [0, 0, 982.25, 0, 0] +Lmaxval = [6.25, 0.15, 983.55, 3.0, 3.0] +Lstep = [0.25, 0.005, 0.05, 0.05, 0.05] +Lstepticks = [0.5, 0.02, 0.2, 0.5, 0.5] +Lfacconv = [1, 1, 1./100.0,1,1] +Lcolormap = ['gist_ncar_r']*len(Lplot) +Llvl = [0,0,0,0,1] +Ltime = [Dvar['f1']['time']]*len(Lplot) +LaddWhite = [True]*len(Lplot) +Lpltype = ['cf']*len(Lplot) + +fig1 = Panel1.psectionH(lon=LaxeX, lat=LaxeY, Lvar=Lplot, Llevel=Llvl, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + Ltime=Ltime, LaddWhite_cm=LaddWhite) +fig1.tight_layout() + +# Wind vectors +Lplot1 = [ Dvar['f1']['UT'], Dvar['f2']['ALT_U'], Dvar['f2']['ALT_U']] +Lplot2 = [ Dvar['f1']['VT'], Dvar['f2']['ALT_V'], Dvar['f2']['ALT_V']] +Ltitle = ['Wind at K=2', 'Wind at 3000m', 'Wind at 5000m'] +Lxlab = ['x (m)']*len(Lplot) +Lylab = ['y (m)']*len(Lplot) +Llegendval = [10,10,10] +Lcbarlabel = ['m/s']*len(Lplot) +Larrowstep = [1]*len(Lplot) +Lwidth = [0.002]*len(Lplot) +Lcolor = ['black']*len(Lplot) +Llvl = [0,0,1] +lon = [Dvar['f1']['ni_u'], Dvar['f2']['ni'], Dvar['f2']['ni'] ] +lat = [Dvar['f1']['nj_u'], Dvar['f2']['nj'], Dvar['f2']['nj'] ] +Lscale = [200]*len(Lplot) +fig2 = Panel1.pvector(Lxx=lon, Lyy=lat, Lvar1=Lplot1, Lvar2=Lplot2, Lcarte=[500,23500,500,23500], Llevel=Llvl, + Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, + Lcolor=Lcolor, Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lid_overlap=[4,6,8], ax=fig1.axes, Lscale=Lscale) +# Oblique projection +i_beg, j_beg = (3,0) +i_end, j_end = (22,21) +# Black line +Panel1.addLine(fig2.axes[6],[Dvar['f1']['ni'][i_beg],Dvar['f1']['nj'][j_beg]],[Dvar['f1']['ni'][i_end],Dvar['f1']['nj'][j_end]],'black',2) +Panel1.save_graph(1,fig2) + +################################################################ +######### PANEL 2 : Oblique projection +############################################################### +Panel2 = PanelPlot(2,2, [17,17],'Oblique section (angle = 47)', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01, lateralminmaxpad=0.97) + +Dvar['f1']['THT-LSTHM'] = Dvar['f1']['THT'] - Dvar['f1']['LSTHM'] + +tomass = mean_operator() +Dvar['f1']['UM'] = tomass.MXM(Dvar['f1']['UT']) +Dvar['f1']['VM'] = tomass.MYM(Dvar['f1']['VT']) +Dvar['f1']['WM'] = tomass.MZM(Dvar['f1']['WT']) + + +angle_sec1, RVT_sec1, axe_m1 = oblique_proj(Dvar['f1']['RVT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +WIND_proj = windvec_verti_proj(Dvar['f1']['UM'], Dvar['f1']['VM'], Dvar['f1']['level'], angle_sec1) +angle_sec1, WIND_sec1, axe_m1 = oblique_proj(WIND_proj, Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, WT_sec1, axe_m1 = oblique_proj(Dvar['f1']['WM'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, RCT_sec1, axe_m1 = oblique_proj(Dvar['f1']['RCT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, RRT_sec1, axe_m1 = oblique_proj(Dvar['f1']['RRT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, anoTHT_sec1, axe_m1 = oblique_proj(Dvar['f1']['THT-LSTHM'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) + +Lplot = [RVT_sec1, RCT_sec1, anoTHT_sec1, WT_sec1] +LaxeX = [axe_m1]*len(Lplot) +LaxeZ = [Dvar['f1']['level'], Dvar['f1']['level'], Dvar['f1']['level'],Dvar['f1']['level_w']] +Ltitle = ['Water vapor mixing ratio', 'Liquid cloud mxing ratio', 'Potential temperature anomaly', 'Vertical velocity'] +Lcbarlabel = ['g/kg','g/kg', 'K', 'm/s'] +Lxlab = ['distance (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lminval = [0., 0., -5, -18] +Lmaxval = [15, 3.0, 5, 18] +Lstep = [0.5, 0.05, 0.2, 0.5] +Lstepticks = [1, 0.2, 1, 2.5] +Lfacconv = [1000, 1000, 1, 1] +Lcolormap = ['gist_rainbow_r','gist_rainbow_r', 'seismic','seismic'] +Ltime = [Dvar['f1']['time']]*len(Lplot) +Lpltype = ['cf']*len(Lplot) +LaddWhite = [True, True, False, False] + +fig3 = Panel2.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + Ltime=Ltime, Lpltype=Lpltype, LaddWhite_cm=LaddWhite) + +Lplot1 = [ WIND_sec1] +Lplot2 = [ WT_sec1] +Ltitle = ['Wind'] +Llegendval = [25] +Lcbarlabel = ['m/s']*len(Lplot) +Larrowstep = [1]*len(Lplot) +Lwidth = [0.004]*len(Lplot) +Lscale = [200]*len(Lplot) + +fig4 = Panel2.pvector(Lxx=LaxeX, Lyy=LaxeZ, Lvar1=Lplot1, Lvar2=Lplot2, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, + Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lid_overlap=[0], ax=fig3.axes, Lscale=Lscale) + +Lplot = [RRT_sec1] +LaxeX = [axe_m1] +LaxeZ = [Dvar['f1']['level']] +Ltitle = ['precipitation'] +Lcbarlabel = ['g/kg']*len(Lplot) +Lxlab = ['distance (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,10000.1)]*len(Lplot) +Lminval = [0.] +Lmaxval = [3.5] +Lstep = [0.5] +Lstepticks = [0.5] +Lfacconv = [1000]*len(Lplot) +LcolorLine = ['black']*len(Lplot) +Llvl = [0]*len(Lplot) +Ltime = [Dvar['f1']['time']] +Lpltype = ['c']*len(Lplot) +LaddWhite = [True]*len(Lplot) + +fig5 = Panel2.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, LcolorLine=LcolorLine, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + Ltime=Ltime, Lpltype=Lpltype, LaddWhite_cm=LaddWhite, ax=fig4.axes,Lid_overlap=[2],colorbar=False) + +Panel2.save_graph(2,fig5) +################################################################ +######### PANEL 3 +############################################################### +Panel3 = PanelPlot(2,2, [17,17],'Vertical section along y at I=14', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01, lateralminmaxpad=0.97) + +Lplot = [Dvar['f1']['RVT'][:,:,13], Dvar['f1']['RCT'][:,:,13], Dvar['f1']['THT-LSTHM'][:,:,13], Dvar['f1']['WT'][:,:,13]] +LaxeX = [Dvar['f1']['nj']]*len(Lplot) +LaxeZ = [Dvar['f1']['level'], Dvar['f1']['level'], Dvar['f1']['level'],Dvar['f1']['level_w']] +Ltitle = ['Water vapor mixing ratio', 'Liquid cloud mxing ratio', 'Potential temperature anomaly', 'Vertical velocity'] +Lcbarlabel = ['g/kg','g/kg', 'K', 'm/s'] +Lxlab = ['distance (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lminval = [0., 0., -5, -18] +Lmaxval = [15, 3.0, 5, 18] +Lstep = [0.5, 0.05, 0.2, 0.5] +Lstepticks = [1, 0.2, 1, 2.5] +Lfacconv = [1000, 1000, 1, 1] +Lcolormap = ['gist_rainbow_r','gist_rainbow_r', 'seismic','seismic'] +Ltime = [Dvar['f1']['time']]*len(Lplot) +Lpltype = ['cf']*len(Lplot) +LaddWhite = [True, True, False, False] + +fig6 = Panel3.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + Ltime=Ltime, Lpltype=Lpltype, LaddWhite_cm=LaddWhite) + +Lplot1 = [ Dvar['f1']['VM'][:,:,13]] +Lplot2 = [ Dvar['f1']['WM'][:,:,13]] +Ltitle = ['Wind'] +Llegendval = [25] +Lcbarlabel = ['m/s']*len(Lplot) +Larrowstep = [1]*len(Lplot) +Lwidth = [0.004]*len(Lplot) +Lscale = [200]*len(Lplot) + +fig7 = Panel3.pvector(Lxx=LaxeX, Lyy=LaxeZ, Lvar1=Lplot1, Lvar2=Lplot2, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, + Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lid_overlap=[0], ax=fig6.axes, Lscale=Lscale) + + +Lplot = [Dvar['f1']['RRT'][:,:,13]] +Ltitle = ['precipitation'] +Lcbarlabel = ['g/kg']*len(Lplot) +Lxlab = ['distance (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,10000.1)]*len(Lplot) +Lminval = [0.] +Lmaxval = [3.5] +Lstep = [0.5] +Lstepticks = [0.5] +Lfacconv = [1000]*len(Lplot) +LcolorLine = ['black']*len(Lplot) +Llvl = [0]*len(Lplot) +Ltime = [Dvar['f1']['time']] +Lpltype = ['c']*len(Lplot) +LaddWhite = [True]*len(Lplot) + +fig8 = Panel3.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, LcolorLine=LcolorLine, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + Ltime=Ltime, Lpltype=Lpltype, LaddWhite_cm=LaddWhite, ax=fig7.axes,Lid_overlap=[2],colorbar=False) + + +Panel3.save_graph(3,fig8) diff --git a/MY_RUN/KTEST/003_KW78/004_python/run_python b/MY_RUN/KTEST/003_KW78/004_python/run_python new file mode 100755 index 0000000000000000000000000000000000000000..32cd8deb136fab81897afada37acf4c53ee7350d --- /dev/null +++ b/MY_RUN/KTEST/003_KW78/004_python/run_python @@ -0,0 +1,16 @@ +#!/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 ${SRC_MESONH}/src/LIB/Python/* . +ln -sf ../003_diag/KWRAI.1.SEG01.004*.nc . + +python3 plot_003_KW78.py +${POSTRUN} display tempgraph1.png +${POSTRUN} display tempgraph2.png +${POSTRUN} display tempgraph3.png +#${POSTRUN} convert *.png 003_KW78.pdf +#${POSTRUN} evince 003_KW78.pdf diff --git a/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl b/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl index 233231e1eee2bac48853a70db7af884c517b70bd..8b82cdb8e78561ded4ce43712ce50580c6423c07 100755 --- a/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl +++ b/MY_RUN/KTEST/003_KW78/005_ncl/clean_ncl @@ -1,2 +1,2 @@ #!/bin/bash -rm -f *.nc *.ps +rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/003_KW78/007_ncl_diag/run_ncl b/MY_RUN/KTEST/003_KW78/007_ncl_diag/run_ncl index ffd98523395dcc3395c9141c10cdaf375591f2b3..ab46be0a29beaa0b1a96ace425e1ace5867b9b3b 100755 --- a/MY_RUN/KTEST/003_KW78/007_ncl_diag/run_ncl +++ b/MY_RUN/KTEST/003_KW78/007_ncl_diag/run_ncl @@ -6,7 +6,7 @@ set -x ln -sf ../002_mesonh/KWRAI.1.SEG01.004.nc . -ln -sf ../006_diag/KWRAI.1.SEG01.004dia.nc . +ln -sf ../003_diag/KWRAI.1.SEG01.004dia.nc . rm -f visu_KW78_diag.png diff --git a/MY_RUN/KTEST/003_KW78/Makefile b/MY_RUN/KTEST/003_KW78/Makefile index 43f486a681a58240ba48a5fa53a950b27e684939..da2db720f94ac801bea9924a90e24fc36592bddb 100644 --- a/MY_RUN/KTEST/003_KW78/Makefile +++ b/MY_RUN/KTEST/003_KW78/Makefile @@ -1,17 +1,19 @@ all: cd 001_prep_ideal_case && run_prep_ideal_case_xyz cd 002_mesonh && run_mesonh_xyz - cd 003_convdia && run_conv2dia - cd 004_diaprog && run_diaprog + cd 003_diag && run_diag_xyz + ifneq "$(MNH_PYTHON)" "NO" + cd 004_python && run_python + endif cd 005_ncl && run_ncl - cd 006_diag && run_diag_xyz cd 007_ncl_diag && run_ncl clean: cd 001_prep_ideal_case && clean_prep_ideal_case_xyz cd 002_mesonh && clean_mesonh_xyz - cd 003_convdia && clean_conv2dia - cd 004_diaprog && clean_diaprog + cd 003_diag && clean_diag_xyz + ifneq "$(MNH_PYTHON)" "NO" + cd 004_python && clean_python + endif cd 005_ncl && clean_ncl - cd 006_diag && clean_diag_xyz cd 007_ncl_diag && clean_ncl diff --git a/MY_RUN/KTEST/004_Reunion/003_mesonh/EXSEG1.nam.src b/MY_RUN/KTEST/004_Reunion/003_mesonh/EXSEG1.nam.src index 3959e4bb897e5092e2b7355192f798f21cce9bb4..5e04536479e84dfceaf2bcaad061feb3937e8dd9 100644 --- a/MY_RUN/KTEST/004_Reunion/003_mesonh/EXSEG1.nam.src +++ b/MY_RUN/KTEST/004_Reunion/003_mesonh/EXSEG1.nam.src @@ -33,7 +33,7 @@ XBAK_TIME(1,1) = 80., XBAK_TIME(1,2) = 20., XBAK_TIME(1,3) = 40., XBAK_TIME(1,4) = 60. / &NAM_BUDGET CBUTYPE='CART', XBULEN=40., - NBUKL=2, NBUKH=51, NBUIL=15, NBUIH=64, NBUJL=15, NBUJH=68, + NBUKL=2, NBUKH=50, NBUIL=15, NBUIH=64, NBUJL=15, NBUJH=68, LBU_KCP=.TRUE., LBU_ICP=.FALSE., LBU_JCP=.FALSE. / &NAM_BU_RTH LBU_RTH=.FALSE. / &NAM_BU_RTKE LBU_RTKE=.FALSE., diff --git a/MY_RUN/KTEST/004_Reunion/003_mesonh/clean_mesonh_xyz b/MY_RUN/KTEST/004_Reunion/003_mesonh/clean_mesonh_xyz index 7530099e2719a131467ac11606935b609be440ce..ac8db97d41aeb9ddafe47a958cd69312f182b741 100755 --- a/MY_RUN/KTEST/004_Reunion/003_mesonh/clean_mesonh_xyz +++ b/MY_RUN/KTEST/004_Reunion/003_mesonh/clean_mesonh_xyz @@ -4,4 +4,4 @@ rm -f PRESSURE rm -f REUNION_IDEA.{des,lfi,nc} rm -f REUNION_PGD_1km5.{des,lfi,nc} rm -f REUNI.1.* OUT* pipe_name - +rm -f *.nc file_for* diff --git a/MY_RUN/KTEST/004_Reunion/004_convdia/clean_conv2dia b/MY_RUN/KTEST/004_Reunion/004_convdia/clean_conv2dia deleted file mode 100755 index d61f25f709fb56f668221fb1094f9ddfcd6b645e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/004_convdia/clean_conv2dia +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f REUNI.1* dirconv FICJD LISTING_DIA OUT_DIA pipe_name diff --git a/MY_RUN/KTEST/004_Reunion/004_convdia/dir_conv2dia b/MY_RUN/KTEST/004_Reunion/004_convdia/dir_conv2dia deleted file mode 100644 index ba3b4e5b27f6a6143d9c57f9322e7a4e41ce3c6d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/004_convdia/dir_conv2dia +++ /dev/null @@ -1,6 +0,0 @@ -1 -REUNI.1.00A20.004 -REUNI.1.00A20.004dg -n -n -0 diff --git a/MY_RUN/KTEST/004_Reunion/004_diag/DIAG1.nam b/MY_RUN/KTEST/004_Reunion/004_diag/DIAG1.nam new file mode 100644 index 0000000000000000000000000000000000000000..aa4b1ba37f6c5b02d36baadc9be22c391d96e61b --- /dev/null +++ b/MY_RUN/KTEST/004_Reunion/004_diag/DIAG1.nam @@ -0,0 +1,7 @@ +&NAM_CONFIO LCDF4=T, LLFIOUT=F, LLFIREAD=F / +&NAM_DIAG + LISOAL=T, XISOAL(1)=1500.0 / +&NAM_DIAG_FILE YINIFILE(1) = "REUNI.1.00A20.004" , + YINIFILEPGD(1) = "REUNION_PGD_1km5", + YSUFFIX='dia' / + diff --git a/MY_RUN/KTEST/004_Reunion/004_diag/clean_diag_xyz b/MY_RUN/KTEST/004_Reunion/004_diag/clean_diag_xyz new file mode 100755 index 0000000000000000000000000000000000000000..1d7efa01b7fe0c30d3316c8a456c0eba00b24dc0 --- /dev/null +++ b/MY_RUN/KTEST/004_Reunion/004_diag/clean_diag_xyz @@ -0,0 +1,5 @@ +#!/bin/bash +set -x +rm -f KWRAI* OUTPUT_LISTING* OUTPUT_TRANSFER pipe* *.tex +rm -f file_for_xtransfer +rm -f *.lfi *.des *.nc diff --git a/MY_RUN/KTEST/004_Reunion/004_convdia/run_conv2dia b/MY_RUN/KTEST/004_Reunion/004_diag/run_diag_xyz similarity index 67% rename from MY_RUN/KTEST/004_Reunion/004_convdia/run_conv2dia rename to MY_RUN/KTEST/004_Reunion/004_diag/run_diag_xyz index 2ce0351394da80ab713f896060faec8d52a9e013..4f3502cb1f6807a798046f0c61824606e20372f6 100755 --- a/MY_RUN/KTEST/004_Reunion/004_convdia/run_conv2dia +++ b/MY_RUN/KTEST/004_Reunion/004_diag/run_diag_xyz @@ -5,7 +5,11 @@ #MNH_LIC for details. version 1. set -x set -e -ln -sf ../003_mesonh/REUNI.1.00A20.004.{des,lfi,nc} . -rm -f REUNI.1.00A20.004dg.{des,lfi,nc} -${POSTRUN} conv2dia < dir_conv2dia +rm -f KWRAI* OUT* +# +# +ln -sf ../003_mesonh/REUNI.1.00A20.004.* . +ln -sf ../001_prep_pgd/REUNION_PGD_1km5.* . + +time ${MPIRUN} DIAG${XYZ} diff --git a/MY_RUN/KTEST/004_Reunion/005_diaprog/clean_diaprog b/MY_RUN/KTEST/004_Reunion/005_diaprog/clean_diaprog deleted file mode 100755 index ab7c07966f324073a71267c1c2fb8bf016eb03e3..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_diaprog/clean_diaprog +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f dir.* gmeta* REUNI.1.00A20.00* OUT_DIA diff --git a/MY_RUN/KTEST/004_Reunion/005_diaprog/dir_Reunion b/MY_RUN/KTEST/004_Reunion/005_diaprog/dir_Reunion deleted file mode 100644 index 7fafdea2284ea209c372c3efc69dd859416b6280..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_diaprog/dir_Reunion +++ /dev/null @@ -1,30 +0,0 @@ -visu -! directives de presentation -LINVWB=T NIGRNC=10 nhi=0 lminmax=t xsizel=0.015 LCOLAREA=T LISO=F -! gestion des vectuers -NISKIP=4 XVRL=0.15 -! nom du fichier a ouvrir -_file_'REUNI.1.00A20.004dg' -! module du vent et vecteurs du niveau K=2 -MUTVT_K_2_ON_UTVT_K_2 -! temperature potentielle a 1500m -THT_Z_1500 -pression et vent en vecteurs a 1500m -PABST_Z_1500_ON_UTVT_Z_1500 -! definition d une coupe verticale -NIDEBCOU=35 NJDEBCOU=2 NLANGLE=90 NLMAX=80 -! trace de la coupe verticale dans le plan horizontal -LTRACECV=T -! temperature potentielle -THT_CV_ -! plus de trace de la coupe verticale -LTRACECV=F -! difference pour la temperature potentielle avec le champ initial -THT_CV__MINUS_LSTHM_CV_ -! difference pour la composante du vent selon Y avec le champ initial -VT_CV__MINUS_LSVM_CV_ -! difference pour la vitesse verticale avec le champ initial -WT_CV__ON_ULTWT_CV_ -! -! a vous d indiquer vos directives -quit diff --git a/MY_RUN/KTEST/004_Reunion/005_diaprog/run_diaprog b/MY_RUN/KTEST/004_Reunion/005_diaprog/run_diaprog deleted file mode 100755 index dd66c99643e3bc11d5f5d094efc44e307328c06e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/004_Reunion/005_diaprog/run_diaprog +++ /dev/null @@ -1,11 +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_convdia/REUNI.1.00A20.004dg.{des,lfi} . -rm -f dir.0* -${POSTRUN} diaprog < dir_Reunion -mv gmeta gmeta_Reunion || echo pas de gmeta diff --git a/MY_RUN/KTEST/004_Reunion/006_ncl/clean_ncl b/MY_RUN/KTEST/004_Reunion/006_ncl/clean_ncl index 233231e1eee2bac48853a70db7af884c517b70bd..bbfe25caaa31a2e1aae687110d888e9805b34569 100755 --- a/MY_RUN/KTEST/004_Reunion/006_ncl/clean_ncl +++ b/MY_RUN/KTEST/004_Reunion/006_ncl/clean_ncl @@ -1,2 +1,2 @@ #!/bin/bash -rm -f *.nc *.ps +rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/004_Reunion/007_python/clean_python b/MY_RUN/KTEST/004_Reunion/007_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/004_Reunion/007_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/004_Reunion/007_python/plot_004_Reunion.py b/MY_RUN/KTEST/004_Reunion/007_python/plot_004_Reunion.py new file mode 100644 index 0000000000000000000000000000000000000000..2a607c828d7eff707b7bb5d75f8a68be83f5ff0a --- /dev/null +++ b/MY_RUN/KTEST/004_Reunion/007_python/plot_004_Reunion.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python3 +""" + +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" + +import matplotlib as mpl +mpl.use('Agg') +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +from misc_functions import comp_altitude2DVar, windvec_verti_proj, mean_operator +import cartopy.crs as ccrs +import numpy as np +import math +import copy +import os + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +path="" + +LnameFiles = ['REUNI.1.00A20.004dia.nc', 'REUNI.1.00A20.004.nc'] + +Dvar_input = { +'f1':['ZS', 'UT', 'VT', 'WT', 'THT', 'ALT_PRESSURE','ALT_U','ALT_V','ALT_THETA','level','ZTOP', 'longitude','latitude','level_w','time'], +'f2':['LSTHM', 'LSVM']} + +# Read the variables in the files +Dvar = {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=True) + +################################################################ +######### PANEL 1 # Horizontal cross-section +############################################################### +Panel1 = PanelPlot(2,2, [20,20],'004_Reunion horizontal sections') + +Dvar['f1']['WIND'] = np.sqrt(Dvar['f1']['UT']**2 + Dvar['f1']['VT']**2) +Lplot = [ Dvar['f1']['ZS'][:,:], Dvar['f1']['WIND'][0,:,:], Dvar['f1']['ALT_THETA'][0,:,:], Dvar['f1']['ALT_PRESSURE'][0,:,:]] + +LaxeX = [Dvar['f1']['longitude']]*len(Lplot) +LaxeY = [Dvar['f1']['latitude']]*len(Lplot) +Ltitle = ['Orography', 'Wind speed ','Potential temperature at z = 1500m', 'Pressure'] +Lcbarlabel = ['m', 'm/s','K','hPa'] +Lxlab = ['longitude']*len(Lplot) +Lylab = ['latitude']*len(Lplot) +Lminval = [0, 8, 301.8, 831] +Lmaxval = [3000, 26, 305, 838] +Lstep = [50,1, 0.1, 0.1, 0.1] +Lstepticks = [500, 2,1,0.5] +Lfacconv = [1, 1, 1, 1./100.] +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Ltime = [Dvar['f1']['time']]*len(Lplot) +Lpltype = ['cf']*len(Lplot) +LaddWhite_cm = [True, False, False, False] +Lprojection = [ccrs.PlateCarree()]*len(Lplot) + +fig1 = Panel1.psectionH(lon=LaxeX, lat=LaxeY, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + colorbar=True, Ltime=Ltime, LaddWhite_cm=LaddWhite_cm, Lproj=Lprojection) + +Lplot1 = [ Dvar['f1']['UT'], Dvar['f1']['ALT_U']] +Lplot2 = [ Dvar['f1']['VT'], Dvar['f1']['ALT_V']] +Ltitle = ['wind vectors at K=2', 'wind vectors at z = 1500m '] +Lxlab = ['longitude']*len(Lplot1) +Lylab = ['latitude']*len(Lplot1) +Llegendval = [25,25] +Lcbarlabel = ['(m/s)']*len(Lplot1) +Larrowstep = [4]*len(Lplot1) +Lwidth = [0.003]*len(Lplot1) +Lcolor = ['black']*len(Lplot1) +Lprojection = [ccrs.PlateCarree()]*len(Lplot1) +Llvl = [0]*len(Lplot1) +Lscale = [400]*len(Lplot1) +fig2 = Panel1.pvector(Lxx=LaxeX, Lyy=LaxeY, Llevel=Llvl, Lvar1=Lplot1, Lvar2=Lplot2, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, + Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lproj=Lprojection, Lid_overlap=[2,6], ax=fig1.axes, Lscale=Lscale) + + + +################################################################ +######### PANEL 2 # Vertical cross-section +############################################################### +# Compute wind into mass point +tomass = mean_operator() +Dvar['f1']['WM'] = tomass.MZM(Dvar['f1']['WT']) +Dvar['f1']['VM'] = tomass.MYM(Dvar['f1']['VT']) + +Panel2 = PanelPlot(2,2, [20,20],'004_Reunion vertical sections at i=35') +i_slice = 33 + +# Black line +Panel1.addLine(fig2.axes[0],[Dvar['f1']['longitude'][0,i_slice],Dvar['f1']['latitude'][0,i_slice]],[Dvar['f1']['longitude'][-1,i_slice],Dvar['f1']['latitude'][-1,i_slice]],'black',3) +Panel1.save_graph(1,fig2) + +# Compute altitude variable in 3D with a 2D topography +Dvar['f1']['altitude'] , Dvar['f1']['nx_3D'], Dvar['f1']['ny_3D'] = comp_altitude2DVar(Dvar['f2']['LSTHM'], Dvar['f1']['ZS'],Dvar['f1']['ZTOP'], Dvar['f1']['level'], Dvar['f1']['latitude'], Dvar['f1']['longitude']) +Dvar['f1']['altitude_w'], Dvar['f1']['nx_3D'], Dvar['f1']['ny_3D'] = comp_altitude2DVar(Dvar['f1']['WM'], Dvar['f1']['ZS'],Dvar['f1']['ZTOP'], Dvar['f1']['level_w'], Dvar['f1']['latitude'], Dvar['f1']['longitude']) +Dvar['f1']['THT-LSTHM'] = copy.deepcopy(Dvar['f1']['THT']) +Dvar['f1']['THT-LSTHM'] = Dvar['f1']['THT'] - Dvar['f2']['LSTHM'] +Dvar['f1']['VT-LSVM'] = copy.deepcopy(Dvar['f1']['VM']) +Dvar['f1']['VT-LSVM'] = Dvar['f1']['VM'] - Dvar['f2']['LSVM'] + +Lplot = [ Dvar['f1']['THT'][:,:,i_slice], Dvar['f1']['THT-LSTHM'][:,:,i_slice],Dvar['f1']['VT-LSVM'][:,:,i_slice],Dvar['f1']['WT'][:,:,i_slice]] +Ltitle = ['Potential Temperature', 'Anomalie de théta (THT-LSTHM)', 'Anomalie de V (VT-LSVM)', 'WT vertical velocity'] +LaxeZ = [Dvar['f1']['altitude'][:,:,i_slice], Dvar['f1']['altitude'][:,:,i_slice],Dvar['f1']['altitude'][:,:,i_slice],Dvar['f1']['altitude_w'][:,:,i_slice]] +LaxeX = [Dvar['f1']['ny_3D'][:,:,i_slice]]*len(Lplot) +Lcbarlabel = ['K', 'K','m/s', 'm/s'] +Lxlab = ['longitude']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,16000)]*len(Lplot) +Lminval = [300, -1.9, -10.5, -6.75] +Lmaxval = [355, 1.9, 10.5, 6.75] +Lstep = [2.5, 0.2, 1, 0.5] +Lstepticks = Lstep +Lcolormap=['gist_rainbow_r','seismic','seismic','seismic'] +orog = Dvar['f1']['ZS'][:,i_slice] + +fig3 = Panel2.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, Lylim=Lylim, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, + orog=orog, colorbar=True, Ltime=Ltime) + +# Wind vector on last panel +Lplot1 = [ Dvar['f1']['VM'][:,:,i_slice]] +Lplot2 = [ Dvar['f1']['WM'][:,:,i_slice]] +Ltitle = ['Wind'] +Llegendval = [15] +Lcbarlabel = ['m/s']*len(Lplot) +Lxlab = ['longitude']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Larrowstep = [1]*len(Lplot) +Lwidth = [0.002]*len(Lplot) +Lscale = [800]*len(Lplot) +Lylim=[(0,3000)] +Lxlim = [(-21.3,-20.9)]*len(Lplot) +Lcolor=['lightgray'] + +fig4 = Panel2.pvector(Lxx=LaxeX, Lyy=LaxeZ, Lvar1=Lplot1, Lvar2=Lplot2, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, + Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lid_overlap=[6], ax=fig3.axes, Lscale=Lscale, Lylim=Lylim, Lxlim=Lxlim, Lcolor=Lcolor) + +Panel2.save_graph(2,fig4) diff --git a/MY_RUN/KTEST/004_Reunion/007_python/run_python b/MY_RUN/KTEST/004_Reunion/007_python/run_python new file mode 100755 index 0000000000000000000000000000000000000000..c2e201cef13c20655654d2ef31d5860c71c95492 --- /dev/null +++ b/MY_RUN/KTEST/004_Reunion/007_python/run_python @@ -0,0 +1,15 @@ +#!/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 ${SRC_MESONH}/src/LIB/Python/* . +ln -sf ../004_diag/REUNI.1.00A20.004*.nc . + +python3 plot_004_Reunion.py +${POSTRUN} display tempgraph1.png +${POSTRUN} display tempgraph2.png +#${POSTRUN} convert *.png 004_Reunion.pdf +#${POSTRUN} evince 004_Reunion.pdf diff --git a/MY_RUN/KTEST/004_Reunion/Makefile b/MY_RUN/KTEST/004_Reunion/Makefile index a4e5c76038ee62d7a08a5090dc346dbedf84b738..abebbbabd9626b73e38b0ff5db0db5e1561bf350 100644 --- a/MY_RUN/KTEST/004_Reunion/Makefile +++ b/MY_RUN/KTEST/004_Reunion/Makefile @@ -3,16 +3,17 @@ all: 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 004_convdia && run_conv2dia - cd 005_diaprog && run_diaprog $ + cd 004_diag && run_diag_xyz cd 006_ncl && run_ncl + ifneq "$(MNH_PYTHON)" "NO" + cd 007_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 004_convdia && run_conv2dia cd 005_ncl_lfi2cdf && run_ncl all_ncl_extractdia: @@ -20,7 +21,6 @@ all_ncl_extractdia: 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 004_convdia && run_conv2dia cd 005_ncl_extractdia && run_ncl all_ncl_nc4: @@ -36,9 +36,11 @@ clean: 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_convdia && clean_conv2dia - cd 005_diaprog && clean_diaprog + 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 + cd 006_ncl && clean_ncl + ifneq "$(MNH_PYTHON)" "NO" + cd 007_python && clean_python + endif diff --git a/MY_RUN/KTEST/005_ARM/002_mesonh/clean_mesonh_xyz b/MY_RUN/KTEST/005_ARM/002_mesonh/clean_mesonh_xyz index 5bd665b8535e16da39e66854dbb55394bb027879..cb5a967a5b767fa7ffcf560ff20f2e84c6dda16a 100755 --- a/MY_RUN/KTEST/005_ARM/002_mesonh/clean_mesonh_xyz +++ b/MY_RUN/KTEST/005_ARM/002_mesonh/clean_mesonh_xyz @@ -1,3 +1,3 @@ #!/bin/bash rm -f ARM* pipe_name -rm -f eurocs* OUT* +rm -f eurocs* OUT* file_for* PRESSURE diff --git a/MY_RUN/KTEST/005_ARM/003_diaprog/clean_diaprog b/MY_RUN/KTEST/005_ARM/003_diaprog/clean_diaprog deleted file mode 100755 index 159c61110f80d5cc0e5800b4f3c94b6b5eeba74f..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/005_ARM/003_diaprog/clean_diaprog +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -rm -f ARM** -rm -f gmeta OUT* -rm -f rm dir.*:* diff --git a/MY_RUN/KTEST/005_ARM/003_diaprog/dir_arm b/MY_RUN/KTEST/005_ARM/003_diaprog/dir_arm deleted file mode 100644 index 56cfecac498a0ffd9e24eddcf8dfaf7c8c34dad6..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/005_ARM/003_diaprog/dir_arm +++ /dev/null @@ -1,77 +0,0 @@ -visu -_file1_'ARM__.1.CEN4T.000' -print groups -lcolarea=t -lminmax=t -liso=f -xhmax=3000 -LCOLZERO=t -NCOLZERO=1 -LMINMAX=t -LVPTUSER=T -XVPTVL=0.20 -XVPTR=0.80 -NIMNMX=1 -LTITDEF=F -LVPTUSER=T -XVPTVL=0.20 -XVPTR=0.80 -CTITB1='white' -CTITB2='white' -CTITB3='white' -CTITB4='white' -CTITT1='white' -CTITT2='white' -CTITVAR2='white' -LDATFILE=.FALSE. -XISOMIN_SBG_TKE=0 -XISOMAX_SBG_TKE=2.5 -XDIAINT_SBG_TKE=0.25 -XISOMIN_MEAN_TH=298 -XISOMAX_MEAN_TH=316 -XDIAINT_MEAN_TH=1 -XISOMIN_MEAN_U=3 -XISOMAX_MEAN_U=11. -XDIAINT_MEAN_U=0.5 -XISOMIN_MEAN_V=0 -XISOMAX_MEAN_V=3.2 -XDIAINT_MEAN_V=0.2 -XISOMIN_MEAN_RC=0 -XISOMAX_MEAN_RC=0.2E-03 -XDIAINT_MEAN_RC=0.1E-04 -XISOMIN_MEAN_RR=0 -XISOMAX_MEAN_RR=0.2E-04 -XDIAINT_MEAN_RR=0.1E-05 -XISOMIN_SBG_WTHL=-0.3 -XISOMAX_SBG_WTHL=0.12 -XDIAINT_SBG_WTHL=0.02 -XISOMIN_SBG_WRT=-0.1E-03 -XISOMAX_SBG_WRT=0.4E-03 -XDIAINT_SBG_WRT=0.05E-03 -SBG_TKE_pvt_ -MEAN_TH_pvt_ -MEAN_U_pvt_ -MEAN_V_pvt_ -MEAN_RC_pvt_ -MEAN_RR_pvt_ -SBG_WTHL_pvt_ -SBG_WRT_pvt_ -THLUP_MF_pvt_ -RTUP_MF_pvt_ -RVUP_MF_pvt_ -RCUP_MF_pvt_ -RIUP_MF_pvt_ -WUP_MF_pvt_ -MAFLX_MF_pvt_ -DETR_MF_pvt_ -ENTR_MF_pvt_ -FRCUP_MF_pvt_ -THVUP_MF_pvt_ -WTHL_MF_pvt_ -WRT_MF_pvt_ -WTHV_MF_pvt_ -WU_MF_pvt_ -WV_MF_pvt_ -quit - - diff --git a/MY_RUN/KTEST/005_ARM/003_diaprog/run_diaprog b/MY_RUN/KTEST/005_ARM/003_diaprog/run_diaprog deleted file mode 100755 index 15d55af0a576fae01a356cb2aea5ff3f42cc30b9..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/005_ARM/003_diaprog/run_diaprog +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -x -set -e -ln -sf ../002_mesonh/ARM__.1.CEN4T.000.* . -rm -f dir.0* -${POSTRUN} diaprog < dir_arm - - diff --git a/MY_RUN/KTEST/005_ARM/003_python/clean_python b/MY_RUN/KTEST/005_ARM/003_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/005_ARM/003_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/005_ARM/003_python/plot_005_ARM.py b/MY_RUN/KTEST/005_ARM/003_python/plot_005_ARM.py new file mode 100644 index 0000000000000000000000000000000000000000..7427083f029f7a175f234f47b3bed95fa23a28a2 --- /dev/null +++ b/MY_RUN/KTEST/005_ARM/003_python/plot_005_ARM.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +""" + +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" +import matplotlib as mpl +mpl.use('Agg') +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +import os + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +path="" + +LnameFiles = ['ARM__.1.CEN4T.000.nc' ] + +Dvar_input = { +'f1':['MEAN_TH','MEAN_U','MEAN_V','MEAN_RC','MEAN_RR', + 'SBG_TKE','SBG_WTHL','SBG_WRT', + 'THLUP_MF','RTUP_MF','RVUP_MF','RCUP_MF','RIUP_MF','WUP_MF', + 'MAFLX_MF','DETR_MF','ENTR_MF','FRCUP_MF','THVUP_MF','WTHL_MF', + 'WRT_MF','WTHV_MF','WU_MF','WV_MF', + 'level_les','time_les'] +} + +# Read the variables in the files +Dvar = {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=False) + +################################################################ +######### PANEL 1 +############################################################### +Panel1 = PanelPlot(2,3, [25,14],'', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.03, labelcolorbarpad = 13, colorbaraspect=40) + +Lplot = [Dvar['f1']['MEAN_TH'],Dvar['f1']['MEAN_U'], Dvar['f1']['MEAN_V'], Dvar['f1']['MEAN_RC'], Dvar['f1']['MEAN_RR'],Dvar['f1']['SBG_TKE'],] +LaxeX = [Dvar['f1']['time_les']/3600.]*len(Lplot) +LaxeZ = [Dvar['f1']['level_les']]*len(Lplot) +Ltitle = ['Mean potential temperature TH', 'Mean U', 'Mean V', 'Mean cloud mixing ratio RC', 'Mean precipitation RR', 'Subgrid TKE'] +Lcbarlabel = ['K','m/s','m/s','g/kg','g/kg','m2 s-2'] +Lxlab = ['time (h)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,3000)]*len(Lplot) +Lminval = [298, 3, 0, 0, 0, 0] +Lmaxval = [317, 12, 3.4,0.21, 0.021, 2.5] +Lstep = [1, 0.5, 0.2, 0.01,0.001, 0.25] +Lstepticks = Lstep +Lfacconv = [1, 1, 1, 1000, 1000, 1] +Lcolormap = ['gist_rainbow_r']*len(Lplot) +LaddWhite = [False, False, True, True,True, True] + +fig1 = Panel1.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + LaddWhite_cm=LaddWhite, Lylim=Lylim) + +Panel1.save_graph(1,fig1) + +################################################################ +######### PANEL 2 +############################################################### +Panel2 = PanelPlot(2,3, [25,14],'', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.03, labelcolorbarpad = 13, colorbaraspect=40) + +Lplot = [Dvar['f1']['SBG_WTHL'], Dvar['f1']['SBG_WRT'], Dvar['f1']['THLUP_MF'], Dvar['f1']['RTUP_MF'], Dvar['f1']['RVUP_MF'], Dvar['f1']['RCUP_MF']] +LaxeX = [Dvar['f1']['time_les']/3600.]*len(Lplot) +LaxeZ = [Dvar['f1']['level_les']]*len(Lplot) +Ltitle = ['Subgrid vertical liquid potential temp. flux', 'Subgrid vertical RT flux', + 'Updraft THL', 'Updraft total mixing ratio', 'Updraft water vapor mixing ratio', 'Updraft cloud mixing ratio'] +Lcbarlabel = ['m K s-1','m kg kg-1 s-1','K','kg/kg', 'kg/kg', 'kg/kg'] +Lxlab = ['time (h)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,3000)]*len(Lplot) +Lminval = [ -0.3, -0.1E-3, 301,0.35E-2, 0.1E-2, 0.25E-3] +Lmaxval = [0.14, 0.45E-3, 319 ,0.018, 0.018, 0.425E-2] +Lstep = [ 0.02, 0.05E-3, 1 ,0.001, 0.001, 0.25E-3] +Lstepticks = Lstep +Lfacconv = [1]*len(Lplot) +Lcolormap = ['gist_rainbow_r']*len(Lplot) +LaddWhite = [False, False, False, False, False, False] + +fig2 = Panel2.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + LaddWhite_cm=LaddWhite, Lylim=Lylim) + +Panel2.save_graph(2,fig2) + +################################################################ +######### PANEL 3 +############################################################### +Panel3 = PanelPlot(2,3, [25,14],'', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.03, labelcolorbarpad = 13, colorbaraspect=40) + +Lplot = [Dvar['f1']['RIUP_MF'], Dvar['f1']['WUP_MF'], Dvar['f1']['MAFLX_MF'], Dvar['f1']['DETR_MF'], Dvar['f1']['ENTR_MF'], Dvar['f1']['FRCUP_MF']] +LaxeX = [Dvar['f1']['time_les']/3600.]*len(Lplot) +LaxeZ = [Dvar['f1']['level_les']]*len(Lplot) +Ltitle = ['Updraft ice mixing ratio', 'Updraft vertical velocity', + 'Updraft mass-flux', 'Updraft detrainment', 'Updraft entrainement', 'Subgrid updraft fraction'] +Lcbarlabel = ['g/kg','m/s','kg m-2 s-1','kg m-3 s-1', 'kg m-3 s-1', '-'] +Lxlab = ['time (h)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,3000)]*len(Lplot) +Lminval = [ 0, 0., 0., 0., 0., 0.] +Lmaxval = [0.001, 5.75, 0.34, 0.55, 0.52E-2, 0.17] +Lstep = [ 0.0001, 0.25, 0.025, 0.025, 0.25E-3, 0.01] +Lstepticks = Lstep +Lfacconv = [1]*len(Lplot) +Lcolormap = ['gist_rainbow_r']*len(Lplot) +LaddWhite = [True]*len(Lplot) + +fig3 = Panel3.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + LaddWhite_cm=LaddWhite, Lylim=Lylim) + +Panel3.save_graph(3,fig3) + + +################################################################ +######### PANEL 4 +############################################################### +Panel4 = PanelPlot(2,3, [25,14],'', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.03, labelcolorbarpad = 13, colorbaraspect=40) + +Lplot = [Dvar['f1']['THVUP_MF'], Dvar['f1']['WTHL_MF'], Dvar['f1']['WRT_MF'], Dvar['f1']['WTHV_MF'], Dvar['f1']['WU_MF'], Dvar['f1']['WV_MF']] +LaxeX = [Dvar['f1']['time_les']/3600.]*len(Lplot) +LaxeZ = [Dvar['f1']['level_les']]*len(Lplot) +Ltitle = ['Updraft virtual potential temperature', 'Subgrid WTHL flux from Mass-Flux scheme', + 'Subgrid WRT flux from Mass-Flux scheme', 'Subgrid WTHV flux from Mass-Flux scheme', 'Subgrid WU from Mass-Flux scheme', 'Subgrid WV from Mass-Flux scheme'] +Lcbarlabel = ['K','m K s-1','m kg/kg s-1','m K s-1', 'm2 s-2', 'm2 s-2'] +Lxlab = ['time (h)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,3000)]*len(Lplot) +Lminval = [303, -0.07, 0., -0.015, -0.12, -0.024 ] +Lmaxval = [320, 0.06, 0.19E-3, 0.08, 0., 0.052 ] +Lstep = [1, 0.005,0.1E-4, 0.5E-2,0.005,0.4E-2 ] +Lstepticks = Lstep +Lfacconv = [1]*len(Lplot) +Lcolormap = ['gist_rainbow_r']*len(Lplot) +LaddWhite = [False, False, True, False, False, False] + +fig4 = Panel4.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + LaddWhite_cm=LaddWhite, Lylim=Lylim) + +Panel4.save_graph(4,fig4) diff --git a/MY_RUN/KTEST/005_ARM/003_python/run_python b/MY_RUN/KTEST/005_ARM/003_python/run_python new file mode 100755 index 0000000000000000000000000000000000000000..f15dc37f2cd2c43300e9c7b225a4e7378bbc519a --- /dev/null +++ b/MY_RUN/KTEST/005_ARM/003_python/run_python @@ -0,0 +1,17 @@ +#!/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 ${SRC_MESONH}/src/LIB/Python/* . +ln -sf ../002_mesonh/ARM__.1.CEN4T.000.nc . + +python3 plot_005_ARM.py +${POSTRUN} display tempgraph1.png +${POSTRUN} display tempgraph2.png +${POSTRUN} display tempgraph3.png +${POSTRUN} display tempgraph4.png +#${POSTRUN} convert *.png 005_ARM.pdf +#${POSTRUN} evince 005_ARM.pdf 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 5d315db0f450055db1dd39d5ee46455146bec67f..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 - - - -vname="SBG_TKE___PROC1" -SBGTKE = fichier1->$vname$(0,:,:,0,0) -SBGTKE@long_name="SBG_TKE" -SBGTKE!1="nzh" -SBGTKE!0="TIME" -SBG_TKE=transpose(SBGTKE) - -vname="MEAN_TH___PROC1" -MEANTH = fichier1->$vname$(0,:,:,0,0) ; MEAN_TH -MEANTH@long_name="MEAN_TH" -MEANTH@units="K" -MEANTH!1="nzh" -MEANTH!0="TIME" -MEAN_TH=transpose(MEANTH) - - -vname="MEAN_U___PROC1" -MEANU = fichier1->$vname$(0,:,:,0,0) -MEANU!1="nzh" -MEANU!0="TIME" -MEAN_U=transpose(MEANU) -MEAN_U@long_name="MEAN_U" - -vname="MEAN_V___PROC1" -MEANV = fichier1->$vname$(0,:,:,0,0) -MEANV!1="nzh" -MEANV!0="TIME" -MEAN_V=transpose(MEANV) -MEAN_V@long_name="MEAN_V" - -vname="MEAN_RC___PROC1" -MEANRC = fichier1->$vname$(0,:,:,0,0) -MEANRC!1="nzh" -MEANRC!0="TIME" -MEAN_RC=transpose(MEANRC) -MEAN_RC@long_name="MEAN_RC" - -vname="MEAN_RR___PROC1" -MEANRR = fichier1->$vname$(0,:,:,0,0) -MEANRR!1="nzh" -MEANRR!0="TIME" -MEAN_RR=transpose(MEANRR) -MEAN_RR@long_name="MEAN_RR" - -vname="SBG_WTHL___PROC1" -SBGWTHL = fichier1->$vname$(0,:,:,0,0) -SBGWTHL!1="nzh" -SBGWTHL!0="TIME" -SBG_WTHL=transpose(SBGWTHL) -SBG_WTHL@long_name="SBG_WTHL" - -vname="SBG_WRT___PROC1" -SBGWRT = fichier1->$vname$(0,:,:,0,0) -SBGWRT!1="nzh" -SBGWRT!0="TIME" -SBG_WRT=transpose(SBGWRT) -SBG_WRT@long_name="SBG_WRT" - - -vname="THLUP_MF___PROC1" - THLUPMF= fichier1->$vname$(0,:,:,0,0) -THLUPMF!1="nzh" -THLUPMF!0="TIME" -THLUP_MF=transpose(THLUPMF) -THLUP_MF@long_name="THLUP_MF" - -vname="RTUP_MF___PROC1" -RTUPMF = fichier1->$vname$(0,:,:,0,0) -RTUPMF!1="nzh" -RTUPMF!0="TIME" -RTUP_MF=transpose(RTUPMF) -RTUP_MF@long_name="RTUP_MF" - -vname="RVUP_MF___PROC1" -RVUPMF = fichier1->$vname$(0,:,:,0,0) -RVUPMF!1="nzh" -RVUPMF!0="TIME" -RVUP_MF=transpose(RVUPMF) -RVUP_MF@long_name="RVUP_MF" - -vname="RCUP_MF___PROC1" -RCUPMF = fichier1->$vname$(0,:,:,0,0) -RCUPMF!1="nzh" -RCUPMF!0="TIME" -RCUP_MF=transpose(RCUPMF) -RCUP_MF@long_name="RCUP_MF" - -vname="RIUP_MF___PROC1" -RIUPMF = fichier1->$vname$(0,:,:,0,0) -RIUPMF!1="nzh" -RIUPMF!0="TIME" -RIUP_MF=transpose(RIUPMF) -RIUP_MF@long_name="RIUP_MF" - -vname="WUP_MF___PROC1" -WUPMF = fichier1->$vname$(0,:,:,0,0) -WUPMF!1="nzh" -WUPMF!0="TIME" -WUP_MF=transpose(WUPMF) -WUP_MF@long_name="WUP_MF" - -vname="MAFLX_MF___PROC1" -MAFLXMF = fichier1->$vname$(0,:,:,0,0) -MAFLXMF!1="nzh" -MAFLXMF!0="TIME" -MAFLX_MF=transpose(MAFLXMF) -MAFLX_MF@long_name="MAFLX_MF" - -vname="DETR_MF___PROC1" -DETRMF = fichier1->$vname$(0,:,:,0,0) -DETRMF!1="nzh" -DETRMF!0="TIME" -DETR_MF=transpose(DETRMF) -DETR_MF@long_name="DETR_MF" - -vname="ENTR_MF___PROC1" -ENTRMF = fichier1->$vname$(0,:,:,0,0) -ENTRMF!1="nzh" -ENTRMF!0="TIME" -ENTR_MF=transpose(ENTRMF) -ENTR_MF@long_name="ENTR_MF" - -vname="FRCUP_MF___PROC1" -FRCUPMF = fichier1->$vname$(0,:,:,0,0) -FRCUPMF!1="nzh" -FRCUPMF!0="TIME" -FRCUP_MF=transpose(FRCUPMF) -FRCUP_MF@long_name="FRCUP_MF" - -vname="THVUP_MF___PROC1" -THVUPMF = fichier1->$vname$(0,:,:,0,0) -THVUPMF!1="nzh" -THVUPMF!0="TIME" -THVUP_MF=transpose(THVUPMF) -THVUP_MF@long_name="THVUP_MF" - -vname="WTHL_MF___PROC1" -WTHLMF = fichier1->$vname$(0,:,:,0,0) -WTHLMF!1="nzh" -WTHLMF!0="TIME" -WTHL_MF=transpose(WTHLMF) -WTHL_MF@long_name="WTHL_MF" - -vname="WRT_MF___PROC1" -WRTMF = fichier1->$vname$(0,:,:,0,0) -WRTMF!1="nzh" -WRTMF!0="TIME" -WRT_MF=transpose(WRTMF) -WRT_MF@long_name="WRT_MF" - - -vname="WTHV_MF___PROC1" -WTHVMF = fichier1->$vname$(0,:,:,0,0) -WTHVMF!1="nzh" -WTHVMF!0="TIME" -WTHV_MF=transpose(WTHVMF) -WTHV_MF@long_name="WTHV_MF" - - -vname="WU_MF___PROC1" -WUMF = fichier1->$vname$(0,:,:,0,0) -WUMF!1="nzh" -WUMF!0="TIME" -WU_MF=transpose(WUMF) -WU_MF@long_name="WU_MF" - - -vname="WV_MF___PROC1" -WVMF = fichier1->$vname$(0,:,:,0,0) -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 15aadf169c336aed121259ec56aff30a717057e7..ea3b47d02c482ebfd287cf86e058ea1f156a6b8c 100644 --- a/MY_RUN/KTEST/005_ARM/Makefile +++ b/MY_RUN/KTEST/005_ARM/Makefile @@ -1,11 +1,9 @@ all: cd 001_prep_ideal && run_prep_ideal_case_xyz cd 002_mesonh && run_mesonh_xyz - cd 003_diaprog && run_diaprog - cd 004_ncl && run_ncl + cd 003_python && run_python clean: cd 001_prep_ideal && clean_prep_ideal_case_xyz cd 002_mesonh && clean_mesonh_xyz - cd 003_diaprog && clean_diaprog - cd 004_ncl && clean_ncl + cd 003_python && clean_python diff --git a/MY_RUN/KTEST/007_16janvier/008_run2/clean_mesonh_xyz b/MY_RUN/KTEST/007_16janvier/008_run2/clean_mesonh_xyz index 5311f8a7dab9f2c6bdc2565bfa4cae145226e94c..c3956ffacac2ae0c695b0fdbe93cc68127728407 100755 --- a/MY_RUN/KTEST/007_16janvier/008_run2/clean_mesonh_xyz +++ b/MY_RUN/KTEST/007_16janvier/008_run2/clean_mesonh_xyz @@ -1,5 +1,5 @@ #!/bin/bash set -x -rm -f 16JAN* OUTPUT_LISTING* OUTPUT_TRANSFER pipe* *.tex +rm -f 16JAN* OUTPUT_LISTING* OUTPUT_TRANSFER pipe* *.tex REMAP* rm -f EXSEG?.nam PRESSURE file_for_xtransfer diff --git a/MY_RUN/KTEST/007_16janvier/009_diag/DIAG1.nam1 b/MY_RUN/KTEST/007_16janvier/009_diag/DIAG1.nam1 index 910e3354493cb77d56ba6ce24158766906ab936a..599bd73b5017c831a10b77fa0e87289a1b4fe684 100644 --- a/MY_RUN/KTEST/007_16janvier/009_diag/DIAG1.nam1 +++ b/MY_RUN/KTEST/007_16janvier/009_diag/DIAG1.nam1 @@ -19,7 +19,9 @@ LHU_FLX=T,LTRAJ=T, LCLD_COV=T, NCAPE=1, LRADAR=T, - LDIAG(:)=.FALSE. / + LDIAG(:)=.FALSE., + LISOAL=T, XISOAL(1)=9000, + LISOPR=T, XISOPR(1)=850, XISOPR(2)=700 / &NAM_DIAG_FILE YINIFILE(1) = "16JAN.1.12B18.001" , YINIFILEPGD(1) = "16JAN98_36km.neste1", YSUFFIX='dg' / diff --git a/MY_RUN/KTEST/007_16janvier/009_diag/DIAG1.nam2 b/MY_RUN/KTEST/007_16janvier/009_diag/DIAG1.nam2 index a621eff49d2c59ce2aab1fc0a4cd673b42b9e351..71020a0a80cbaa499561b633d9532f20ace65061 100644 --- a/MY_RUN/KTEST/007_16janvier/009_diag/DIAG1.nam2 +++ b/MY_RUN/KTEST/007_16janvier/009_diag/DIAG1.nam2 @@ -19,7 +19,9 @@ LHU_FLX=T,LTRAJ=T, LCLD_COV=T, NCAPE=1, LRADAR=T, - LDIAG(:)=.FALSE. / + LDIAG(:)=.FALSE., + LISOAL=T, XISOAL(1)=9000, + LISOPR=T, XISOPR(1)=850, XISOPR(2)=700 / &NAM_DIAG_FILE YINIFILE(1) = "16JAN.2.12B18.001" , YINIFILEPGD(1) ="16JAN98_9km.neste1", YSUFFIX='dg' / diff --git a/MY_RUN/KTEST/007_16janvier/010_conv2dia/clean_conv2dia b/MY_RUN/KTEST/007_16janvier/010_conv2dia/clean_conv2dia deleted file mode 100755 index ef0cd032d0730ad98b606f17f6e976c12a32a6e4..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/010_conv2dia/clean_conv2dia +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -x -rm -f 16JAN* -rm -f dirconv FICJD LISTING_DIA OUT_DIA pipe_name diff --git a/MY_RUN/KTEST/007_16janvier/010_conv2dia/dir_conv2dia1 b/MY_RUN/KTEST/007_16janvier/010_conv2dia/dir_conv2dia1 deleted file mode 100644 index a0e51e0a6694487186cc1cda7f09bf2b7c5aaae8..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/010_conv2dia/dir_conv2dia1 +++ /dev/null @@ -1,6 +0,0 @@ -1 -16JAN.1.12B18.001dg -16JAN.1.12B18.001cv -n -n -0 diff --git a/MY_RUN/KTEST/007_16janvier/010_conv2dia/dir_conv2dia2 b/MY_RUN/KTEST/007_16janvier/010_conv2dia/dir_conv2dia2 deleted file mode 100644 index 4787f9a32466742f8c4d5af09cd28e71dc7fb28d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/010_conv2dia/dir_conv2dia2 +++ /dev/null @@ -1,6 +0,0 @@ -1 -16JAN.2.12B18.001dg -16JAN.2.12B18.001cv -n -n -0 diff --git a/MY_RUN/KTEST/007_16janvier/010_conv2dia/run_conv2dia b/MY_RUN/KTEST/007_16janvier/010_conv2dia/run_conv2dia deleted file mode 100755 index d6fd020632a5efe7e639b9019c633d7b0c51547c..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/010_conv2dia/run_conv2dia +++ /dev/null @@ -1,12 +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 ../009_diag/16JAN.?.12B18.001dg.{des,lfi,nc} . -rm -f 16JAN.?.12B18.001cv.{des,lfi,nc} -${POSTRUN} conv2dia < dir_conv2dia1 -${POSTRUN} conv2dia < dir_conv2dia2 - diff --git a/MY_RUN/KTEST/007_16janvier/010_python/clean_python b/MY_RUN/KTEST/007_16janvier/010_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/007_16janvier/010_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/007_16janvier/010_python/plot_007_16janvier.py b/MY_RUN/KTEST/007_16janvier/010_python/plot_007_16janvier.py new file mode 100644 index 0000000000000000000000000000000000000000..7e32b6b951b437dcba03357de097726a2bd5d985 --- /dev/null +++ b/MY_RUN/KTEST/007_16janvier/010_python/plot_007_16janvier.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +""" +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" +import matplotlib as mpl +mpl.use('Agg') +import cartopy.crs as ccrs +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +import os + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +# +path="" +LnameFiles = ['16JAN.1.12B18.001dg.nc', '16JAN.2.12B18.001dg.nc'] + +Dvar_input = { +'f1':['MRV700HPA','THT850HPA','UT850HPA','VT850HPA','UT700HPA','VT700HPA', 'ALT_PRESSURE','ALT_U','ALT_V', 'ZS', 'latitude', 'longitude'], +'f2':['MRV700HPA','THT850HPA','UT850HPA','VT850HPA','UT700HPA','VT700HPA', 'ALT_PRESSURE', 'ZS', 'ALT_U','ALT_V','latitude', 'longitude'] +} + +# Read the variables in the files +Dvar = {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=True) + +################################################################ +######### PANEL 1 +############################################################### +Panel1 = PanelPlot(2,2, [20,20],'007_janvier domaine 1 16JAN.1.12B18.001dg.nc') + +Lplot = [ Dvar['f1']['ZS'],Dvar['f1']['THT850HPA'], Dvar['f1']['MRV700HPA'],Dvar['f1']['ALT_PRESSURE']] +lon = [Dvar['f1']['longitude']]*len(Lplot) +lat = [Dvar['f1']['latitude']]*len(Lplot) +Ltitle = ['Orography', 'Potential Temperature at 850hPa', 'Water vapor mixing at 700hPa','Pressure at z = 9000m'] +Lcbarlabel = ['(m)','(K)', 'g/kg', 'hPa'] +Lxlab = ['longitude']*len(Lplot) +Lylab = ['latitude']*len(Lplot) +Lminval = [0, 285, 0.9, 286] +Lmaxval = [300, 289, 2.6, 294] +Lstep = [10, 0.25, 0.1, 0.4] +Lstepticks = [50, 1, 0.2, 0.4] +Lfacconv = [1.0, 1.0, 1.0, 1./100.0] +Lcolormap = ['terrain', 'gist_rainbow_r', 'gist_rainbow_r', 'gist_rainbow_r'] +Lprojection = [ccrs.PlateCarree()]*len(Lplot) +Llvl = [0, 0, 0, 0] +fig1 = Panel1.psectionH(lon=lon, lat=lat, Lvar=Lplot, Lcarte=[], Llevel=Llvl, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lproj=Lprojection, Lfacconv=Lfacconv) + +Lplot1 = [ Dvar['f1']['UT850HPA'], Dvar['f1']['UT700HPA'], Dvar['f1']['ALT_U']] +Lplot2 = [ Dvar['f1']['VT850HPA'], Dvar['f1']['VT700HPA'], Dvar['f1']['ALT_V']] +Ltitle = ['Wind at 850hPa', 'Wind at 700hPa', 'Wind at 9000m'] +Lxlab = ['longitude']*len(Lplot) +Lylab = ['latitude']*len(Lplot) +Llegendval = [20,20,40] +Lcbarlabel = ['(m/s)']*len(Lplot) +Larrowstep = [2]*len(Lplot) +Lwidth = [0.002]*len(Lplot) +Lcolor = ['black']*len(Lplot) +Lprojection = [ccrs.PlateCarree()]*len(Lplot) +Llvl = [0]*len(Lplot) +fig2 = Panel1.pvector(Lxx=lon, Lyy=lat, Lvar1=Lplot1, Lvar2=Lplot2, Lcarte=[], Llevel=Llvl, Lxlab=Lxlab, Lylab=Lylab, + Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, Lproj=Lprojection, + Lcolor=Lcolor, Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lid_overlap=[2,4,6], ax=fig1.axes) + +Panel1.save_graph(1,fig2) + +################################################################ +######### PANEL 2 +############################################################### +Panel2 = PanelPlot(2,2, [20,20],'007_janvier domaine 2 16JAN.1.12B18.001dg.nc') + +Lplot = [ Dvar['f2']['ZS'],Dvar['f2']['THT850HPA'], Dvar['f2']['MRV700HPA'],Dvar['f2']['ALT_PRESSURE']] +lon = [Dvar['f2']['longitude']]*len(Lplot) +lat = [Dvar['f2']['latitude']]*len(Lplot) +Ltitle = ['Orography', 'Potential Temperature at 850hPa', 'Water vapor mixing at 700hPa','Pressure at z = 9000m'] +Lbarlabel = ['(m)','(K)', 'g/kg', 'hPa'] +Lxlab = ['longitude']*len(Lplot) +Lylab = ['latitude']*len(Lplot) +Lminval = [0, 285, 0.9, 286] +Lmaxval = [300, 289, 2.6, 294] +Lstep = [10, 0.25, 0.1, 0.4] +Lstepticks = [50, 1, 0.2, 0.4] +Lfacconv = [1.0, 1.0, 1.0, 1./100.0] +Lcolormap = ['terrain', 'gist_rainbow_r', 'gist_rainbow_r', 'gist_rainbow_r'] +Lprojection = [ccrs.PlateCarree()]*len(Lplot) +Llvl = [0]*len(Lplot) +fig1 = Panel2.psectionH(lon=lon, lat=lat, Lvar=Lplot, Lcarte=[], Llevel=Llvl, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lproj=Lprojection, Lfacconv=Lfacconv) + +Lplot1 = [ Dvar['f2']['UT850HPA'], Dvar['f2']['UT700HPA'], Dvar['f2']['ALT_U']] +Lplot2 = [ Dvar['f2']['VT850HPA'], Dvar['f2']['VT700HPA'], Dvar['f2']['ALT_V']] +Ltitle = ['Wind at 850hPa', 'Wind at 700hPa', 'Wind at 9000m'] +Llegendval = [20,20,40] +Lxlab = ['longitude']*len(Lplot) +Lylab = ['latitude']*len(Lplot) +Lbarlabel = ['(m/s)']*len(Lplot) +Larrowstep = [2]*len(Lplot) +Lwidth = [0.002]*len(Lplot) +Lcolor = ['black']*len(Lplot) +Lprojection = [ccrs.PlateCarree()]*len(Lplot) +Llvl = [0]*len(Lplot) +fig2 = Panel2.pvector(Lxx=lon, Lyy=lat, Lvar1=Lplot1, Lvar2=Lplot2, Lcarte=[], Llevel=Llvl, Lxlab=Lxlab, Lylab=Lylab, + Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, Lproj=Lprojection, + Lcolor=Lcolor, Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lid_overlap=[2,4,6], ax=fig1.axes) + +Panel2.save_graph(2,fig2) diff --git a/MY_RUN/KTEST/007_16janvier/010_python/run_python b/MY_RUN/KTEST/007_16janvier/010_python/run_python new file mode 100755 index 0000000000000000000000000000000000000000..f832cec2c06ab7bf3bdd700e972be416dafa3711 --- /dev/null +++ b/MY_RUN/KTEST/007_16janvier/010_python/run_python @@ -0,0 +1,15 @@ +#!/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 ${SRC_MESONH}/src/LIB/Python/* . +ln -sf ../009_diag/16JAN.*.12B18.001dg.nc . + +python3 plot_007_16janvier.py +${POSTRUN} display tempgraph1.png +${POSTRUN} display tempgraph2.png +#${POSTRUN} convert *.png 007_16janvier.pdf +#${POSTRUN} evince 007_16janvier.pdf diff --git a/MY_RUN/KTEST/007_16janvier/011_diaprog/clean_diaprog b/MY_RUN/KTEST/007_16janvier/011_diaprog/clean_diaprog deleted file mode 100755 index c0d45814101d68a224c6868790970b0e139068be..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_diaprog/clean_diaprog +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f dir.* gmeta 16JAN* OUT_DIA diff --git a/MY_RUN/KTEST/007_16janvier/011_diaprog/dir_16janv b/MY_RUN/KTEST/007_16janvier/011_diaprog/dir_16janv deleted file mode 100644 index 8c12e7a0cae260b94630229a4c48b11f6b910ba3..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_diaprog/dir_16janv +++ /dev/null @@ -1,24 +0,0 @@ -LINVWB=T NIGRNC=5 nhi=0 lminmax=t xsizel=0.015 -NISKIP=4 XVRL=0.1 -_file1_'16JAN.1.12B18.001cv' -_file2_'16JAN.2.12B18.001cv' -visu -print groups -LCOLINE=T -_file1_ -ZS -LCOLAREA=T LISO=F -LCOLZERO=T NCOLZERO=1 -LCOLZERO=F -NIMNMX=0 XDIAINT_THT=1. -THT_PR_850_ON_UTVT_PR_850 -NIMNMX=-1 -RVT(*1000)_PR_700 -PABST_Z_9000_ON_UTVT_Z_9000 -_file2_ -NIMNMX=0 XDIAINT_THT=1. -THT_PR_850_ON_UTVT_PR_850 -NIMNMX=-1 -RVT(*1000)_PR_700 -PABST_Z_9000_ON_UTVT_Z_9000 -quit diff --git a/MY_RUN/KTEST/007_16janvier/011_diaprog/run_diaprog b/MY_RUN/KTEST/007_16janvier/011_diaprog/run_diaprog deleted file mode 100755 index 4fec27faf46c42c0b6e5203a548e8575110dd47b..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/007_16janvier/011_diaprog/run_diaprog +++ /dev/null @@ -1,11 +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 ../010_conv2dia/16JAN.?.12B18.001cv.{des,lfi} . -rm -f dir.0* -${POSTRUN} diaprog < dir_16janv - diff --git a/MY_RUN/KTEST/007_16janvier/Makefile b/MY_RUN/KTEST/007_16janvier/Makefile index aecb1327b1abb58c03dc7db215897ebf77429fcd..d5256aaa9f8c5f95982537b5245058d26236ded7 100644 --- a/MY_RUN/KTEST/007_16janvier/Makefile +++ b/MY_RUN/KTEST/007_16janvier/Makefile @@ -1,10 +1,14 @@ -all: E001_pgd1 E002_pgd2 E003_nest E004_arp2lfi E005_spa_mod1_mod2 E006_preal E008_run2 E009_diag E010_conv2dia E011_diaprog E011_ncl E012_spectre +all: E001_pgd1 E002_pgd2 E003_nest E004_arp2lfi E005_spa_mod1_mod2 E006_preal E008_run2 E009_diag +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_conv2dia E011_ncl_lfi2cdf +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_conv2dia E011_ncl_extractdia +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 E001_pgd1 : cd 001_pgd1 && get_pgd_files @@ -23,10 +27,8 @@ E008_run2: cd 008_run2 && run_mesonh_xyz E009_diag: cd 009_diag && run_diag_xyz -E010_conv2dia: - cd 010_conv2dia && run_conv2dia -E011_diaprog: - cd 011_diaprog && run_diaprog +E010_python: + cd 010_python && run_python E011_ncl: cd 011_ncl && run_ncl E011_ncl_nc4: @@ -47,8 +49,9 @@ clean: cd 006_preal && clean_preal_xyz cd 008_run2 && clean_mesonh_xyz cd 009_diag && clean_diag_xyz - cd 010_conv2dia && clean_conv2dia - cd 011_diaprog && clean_diaprog + 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 diff --git a/MY_RUN/KTEST/009_ICARTT/003_mesonh/clean_mesonh_xyz b/MY_RUN/KTEST/009_ICARTT/003_mesonh/clean_mesonh_xyz index 9db6cfa78a5a375dc8d1d257473e6f2dfd124cab..d8301acbd9c0935fa4ec90802731afe5f7da1036 100755 --- a/MY_RUN/KTEST/009_ICARTT/003_mesonh/clean_mesonh_xyz +++ b/MY_RUN/KTEST/009_ICARTT/003_mesonh/clean_mesonh_xyz @@ -1,6 +1,6 @@ #!/bin/bash set -x -rm -f ICART* CPLCH* OUTPUT_LISTING* pipe* +rm -f ICART* CPLCH* OUTPUT_LISTING* pipe* REMAP* rm -f EXSEG?.nam PRESSURE file_for_xtransfer rm -f DATAE1 DATAJ1 DATAS1 diff --git a/MY_RUN/KTEST/009_ICARTT/005_python/clean_python b/MY_RUN/KTEST/009_ICARTT/005_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/009_ICARTT/005_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/009_ICARTT/005_python/plot_009_ICARTT.py b/MY_RUN/KTEST/009_ICARTT/005_python/plot_009_ICARTT.py new file mode 100644 index 0000000000000000000000000000000000000000..9ca893ad07f9aa4a9ef2745a2cb31323a52117f0 --- /dev/null +++ b/MY_RUN/KTEST/009_ICARTT/005_python/plot_009_ICARTT.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 +""" +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" +import matplotlib as mpl +mpl.use('Agg') +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +import cartopy.crs as ccrs +import os +import numpy as np + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +path="" + +LnameFiles = ['ICART.1.SEG01.001dg.nc', 'ICART.1.SEG01.002dg.nc'] + +Dvar_input = { +'f1':['MRC','COT','O3T','O3_PROD','O3_LOSS','CO_PROD','CO_LOSS','level','ZTOP', 'longitude','latitude','level_w','time', + 'CO_BUDGET','O3_BUDGET','O3_CHREACLIST','CO_CHREACLIST'], +'f2':['MRC','COT','O3T','O3_PROD','O3_LOSS','CO_PROD','CO_LOSS','level','ZTOP', 'longitude','latitude','level_w','time', + 'CO_BUDGET','O3_BUDGET','O3_CHREACLIST','CO_CHREACLIST'] +} +# Read the variables in the files +Dvar = {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=True) + +################################################################ +######### PANEL 1 # Horizontal cross-section +############################################################### +Panel1 = PanelPlot(3,3, [25,17],'Horizontal section at 1150m, 19h', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01, colorbaraspect=40, labelcolorbarpad = 13) + +Lplot = [ Dvar['f1']['MRC'][:,:,:], Dvar['f1']['COT'][:,:,:], Dvar['f1']['O3T'][:,:,:], Dvar['f1']['O3_PROD'][:,:,:], + Dvar['f1']['O3_LOSS'][:,:,:], Dvar['f1']['CO_PROD'][:,:,:], Dvar['f1']['CO_LOSS'][:,:,:]] + +LaxeX = [Dvar['f1']['longitude']]*len(Lplot) +LaxeY = [Dvar['f1']['latitude']]*len(Lplot) +Ltitle = ['Cloud mixing ratio', 'Carbon monoxyde CO ','Ozone O3', 'Ozone production', 'Ozone destruction','Carbon monoxyde production','Carbon monoxyde destruction'] +Lcbarlabel = ['g/kg', 'ppbv','ppbv','ppbv/h','ppbv/h','ppbv/h','ppbv/h'] +Lylab = ['latitude']*len(Lplot) +Lminval = [ 0, 107.5, 0, 70, 70, 0.5, 0.5 ] +Lmaxval = [ 0.2, 137.5, 70, 130, 130, 1.7, 1.7 ] +Lstep = [ 0.01, 2.5, 5, 5, 5, 0.1, 0.1] +Lstepticks = Lstep +Lfacconv = [ 1, 1, 1, 1e9*3600, 1e9*3600,1e9*3600, 1e9*3600] +Lcolormap = ['gist_ncar']*len(Lplot) +Llvl = [14]*len(Lplot) +LaddWhite_cm = [True, False, False, False, False, False, False] +Lprojection = [ccrs.PlateCarree()]*len(Lplot) + +fig1 = Panel1.psectionH(lon=LaxeX, lat=LaxeY, Lvar=Lplot, Llevel=Llvl,Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + colorbar=True, LaddWhite_cm=LaddWhite_cm, Lproj=Lprojection) + +Panel1.save_graph(1,fig1) + +################################################################ +######### PANEL 2 # Horizontal cross-section +############################################################### +Panel2 = PanelPlot(3,3, [25,17],'Horizontal section at 1150m, 20h', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01, colorbaraspect=40, labelcolorbarpad = 13) + +Lplot = [ Dvar['f2']['MRC'][:,:,:], Dvar['f2']['COT'][:,:,:], Dvar['f2']['O3T'][:,:,:], Dvar['f2']['O3_PROD'][:,:,:], + Dvar['f2']['O3_LOSS'][:,:,:], Dvar['f2']['CO_PROD'][:,:,:], Dvar['f2']['CO_LOSS'][:,:,:]] + +fig2 = Panel2.psectionH(lon=LaxeX, lat=LaxeY, Lvar=Lplot, Llevel=Llvl,Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + colorbar=True, LaddWhite_cm=LaddWhite_cm, Lproj=Lprojection) + +Panel2.save_graph(2,fig2) + +################################################################ +######### PANEL 3 # Bar plots Budget chemical reactions +############################################################### +Dvar['f1']['CO_BUDGET_mean'] = np.mean(Dvar['f1']['CO_BUDGET'][:,13,:,:],axis=(1,2)) # {x,y} Average on height = 1150m +Dvar['f1']['O3_BUDGET_mean'] = np.mean(Dvar['f1']['O3_BUDGET'][:,13,:,:],axis=(1,2)) # {x,y} Average on height = 1150m +Dvar['f2']['CO_BUDGET_mean'] = np.mean(Dvar['f2']['CO_BUDGET'][:,13,:,:],axis=(1,2)) # {x,y} Average on height = 1150m +Dvar['f2']['O3_BUDGET_mean'] = np.mean(Dvar['f2']['O3_BUDGET'][:,13,:,:],axis=(1,2)) # {x,y} Average on height = 1150m + +Panel3 = PanelPlot(2,2, [20,20],'Chemical budgets', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01, colorbaraspect=40, labelcolorbarpad = 13) + +Lplot = [Dvar['f1']['CO_BUDGET_mean'], Dvar['f1']['O3_BUDGET_mean'], Dvar['f2']['CO_BUDGET_mean'], Dvar['f2']['O3_BUDGET_mean'] ] +Lbins=[Dvar['f1']['CO_CHREACLIST'], Dvar['f1']['O3_CHREACLIST'],Dvar['f2']['CO_CHREACLIST'], Dvar['f2']['O3_CHREACLIST']] +Ltitle = ['Carbon monoxyde CO chemical reactions', 'Ozone O3 chemical reactions']*2 +Lylab = ['Budget (ppbv/h)']*len(Lplot) +Ltime = [Dvar['f1']['time'], Dvar['f1']['time'], Dvar['f2']['time'], Dvar['f2']['time']] +Lylim=[(-1,1), (-100, 100)]*2 +Lfacconv = [1E9*3600]*len(Lplot) +Lwidth=[0.95]*len(Lplot) +Lcolors=[] +for var in Lplot: + cc=['']*len(var) + for n,val in enumerate(var): + if val<0: + cc[n]='blue' + elif val>=0: + cc[n]='red' + Lcolors.append(cc) + +fig3 = Panel3.pXY_bar(Lbins=Lbins, Lvar=Lplot, Lylim=Lylim, Lfacconv=Lfacconv, Ltitle=Ltitle, Lylab=Lylab, Lcolor=Lcolors, Lwidth=Lwidth, Ltime=Ltime) + +# Handle a new axis at y=0 for each graphs +for i,var in enumerate(Lplot): + ax2 = fig3.axes[i].twinx() # Clone the existing axis + ax2_x = ax2.get_xaxis() + ax2_x.set_label('Chemical reactions') + ax2_y = ax2.get_yaxis() # Get the new Y axe and hide it + ax2_y.set_visible(False) + fig3.axes[i].spines['bottom'].set_position('center') # Move the original axis to the center + +Panel3.save_graph(3,fig3) diff --git a/MY_RUN/KTEST/009_ICARTT/005_python/run_python b/MY_RUN/KTEST/009_ICARTT/005_python/run_python new file mode 100755 index 0000000000000000000000000000000000000000..b478acd33200e7c354ed683d70259239bbcd4d45 --- /dev/null +++ b/MY_RUN/KTEST/009_ICARTT/005_python/run_python @@ -0,0 +1,16 @@ +#!/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 ${SRC_MESONH}/src/LIB/Python/* . +ln -sf ../004_diag/ICART.1.SEG01.00*dg.nc . + +python3 plot_009_ICARTT.py +${POSTRUN} display tempgraph1.png +${POSTRUN} display tempgraph2.png +${POSTRUN} display tempgraph3.png +#${POSTRUN} convert *.png 009_ICARTT.pdf +#${POSTRUN} evince 009_ICARTT.pdf diff --git a/MY_RUN/KTEST/009_ICARTT/Makefile b/MY_RUN/KTEST/009_ICARTT/Makefile index 047047e15b5c8a08f017c58136424b3481ce3b00..9fb249ec3c2e804e7f866446b524409a1305ec76 100644 --- a/MY_RUN/KTEST/009_ICARTT/Makefile +++ b/MY_RUN/KTEST/009_ICARTT/Makefile @@ -1,4 +1,8 @@ -all: E001_pgd1 E002_arp2lfi E003_mesonh E004_diag E006_ncl +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 @@ -9,6 +13,9 @@ E003_mesonh: cd 003_mesonh && run_mesonh_xyz E004_diag: cd 004_diag && run_diag_xyz +E005_python: + cd 005_python && run_python + E006_ncl: cd 006_ncl && run_ncl @@ -17,5 +24,8 @@ clean: cd 002_arp2lfi && clean_arp2lfi_xyz cd 003_mesonh && clean_mesonh_xyz cd 004_diag && clean_diag_xyz + ifneq "$(MNH_PYTHON)" "NO" + cd 005_python && clean_python + endif cd 006_ncl && clean_ncl diff --git a/MY_RUN/KTEST/011_KW78CHEM/003_convdia/clean_conv2dia b/MY_RUN/KTEST/011_KW78CHEM/003_convdia/clean_conv2dia deleted file mode 100755 index 3e4536e706188a81078315a0f0efc8882bc454f9..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/011_KW78CHEM/003_convdia/clean_conv2dia +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -x -rm -f KWRAI.1.SEGCH.004.* -rm -f KWRAI.1.SEGCH.004dg.* -rm -f dirconv FICJD LISTING_DIA OUT_DIA pipe_name diff --git a/MY_RUN/KTEST/011_KW78CHEM/003_convdia/dir_conv2dia b/MY_RUN/KTEST/011_KW78CHEM/003_convdia/dir_conv2dia deleted file mode 100644 index e427dacf03ac44d5078e10b15d7fe4c4f6e383c3..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/011_KW78CHEM/003_convdia/dir_conv2dia +++ /dev/null @@ -1,6 +0,0 @@ -1 -KWRAI.1.SEGCH.004 -KWRAI.1.SEGCH.004dg -n -n -0 diff --git a/MY_RUN/KTEST/011_KW78CHEM/003_convdia/run_conv2dia b/MY_RUN/KTEST/011_KW78CHEM/003_convdia/run_conv2dia deleted file mode 100755 index 15dbc6fa0d9008ce67bf343024a9bffeb869442d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/011_KW78CHEM/003_convdia/run_conv2dia +++ /dev/null @@ -1,11 +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.{des,lfi,nc} . -rm -f KWRAI.1.SEGCH.004dg.{des,lfi,nc} -${POSTRUN} conv2dia < dir_conv2dia - diff --git a/MY_RUN/KTEST/011_KW78CHEM/003_diag/DIAG1.nam b/MY_RUN/KTEST/011_KW78CHEM/003_diag/DIAG1.nam new file mode 100644 index 0000000000000000000000000000000000000000..4ddee99a9be291870a1b2a752128d1d4f95f5465 --- /dev/null +++ b/MY_RUN/KTEST/011_KW78CHEM/003_diag/DIAG1.nam @@ -0,0 +1,14 @@ +&NAM_CONFIO LCDF4=T, LLFIOUT=F, LLFIREAD=F / +&NAM_CONFZ + ! NZ_VERB=5 , NZ_PROC=0 , NB_PROCIO_R=8 , NB_PROCIO_W=1 +/ +&NAM_DIAG + LCLSTR=T, + LBOTUP=T, + CFIELD='W', + XTHRES=10., + LISOAL=T, XISOAL(1)=3000, XISOAL(2)=5000 + / +&NAM_DIAG_FILE YINIFILE(1) = "KWRAI.1.SEGCH.004" , + YSUFFIX='dg' / + diff --git a/MY_RUN/KTEST/011_KW78CHEM/003_diag/clean_diag_xyz b/MY_RUN/KTEST/011_KW78CHEM/003_diag/clean_diag_xyz new file mode 100755 index 0000000000000000000000000000000000000000..19b1bf34eb5ca4964c57e9b503ef15a7e940213f --- /dev/null +++ b/MY_RUN/KTEST/011_KW78CHEM/003_diag/clean_diag_xyz @@ -0,0 +1,5 @@ +#!/bin/bash +set -x +rm -f KWRAI* OUTPUT_LISTING* OUTPUT_TRANSFER pipe* *.tex +rm -f file_for_xtransfer + diff --git a/MY_RUN/KTEST/011_KW78CHEM/003_diag/diag.nam b/MY_RUN/KTEST/011_KW78CHEM/003_diag/diag.nam new file mode 100644 index 0000000000000000000000000000000000000000..a1252a72b1b6ef1bf8d6ad58ebe2ffd962e53fc6 --- /dev/null +++ b/MY_RUN/KTEST/011_KW78CHEM/003_diag/diag.nam @@ -0,0 +1,12 @@ + +exemple 1, identification des ascendances > 10 m/s + +&NAM_DIAG LCLSTR = T, LBOTUP = T, CFIELD = "W", XTHRES = 10. / + + + +exemple 2, identification des overshoots + +&NAM_DIAG LCLSTR = T, LBOTUP = F, CFIELD = "CLOUD", XTHRES = 0.00001 / + +NB: par défaut CLOUD prend en compte Rc+Ri+Rs+Rg i.e. cloud water and ice, graupel and snow diff --git a/MY_RUN/KTEST/003_KW78/003_convdia/run_conv2dia b/MY_RUN/KTEST/011_KW78CHEM/003_diag/run_diag_xyz similarity index 67% rename from MY_RUN/KTEST/003_KW78/003_convdia/run_conv2dia rename to MY_RUN/KTEST/011_KW78CHEM/003_diag/run_diag_xyz index 60db55d108f1af83689bf6ce9a86a3147c97af83..2d50f858e38348e1f5e8afcbdcf61555014043e6 100755 --- a/MY_RUN/KTEST/003_KW78/003_convdia/run_conv2dia +++ b/MY_RUN/KTEST/011_KW78CHEM/003_diag/run_diag_xyz @@ -5,7 +5,11 @@ #MNH_LIC for details. version 1. set -x set -e -ln -sf ../002_mesonh/KWRAI.1.SEG01.004.{des,lfi,nc} . -rm -f KWRAI.1.SEG01.004dg.{des,lfi,nc} -${POSTRUN} conv2dia < dir_conv2dia +rm -f KWRAI* OUT* +# +# +ln -sf ../002_mesonh/KWRAI.1.SEGCH.004.*des . +ln -sf ../002_mesonh/KWRAI.1.SEGCH.004.*nc . + +time ${MPIRUN} DIAG${XYZ} diff --git a/MY_RUN/KTEST/011_KW78CHEM/004_diaprog/clean_diaprog b/MY_RUN/KTEST/011_KW78CHEM/004_diaprog/clean_diaprog deleted file mode 100755 index 9a215110f909a7c8883a8e3d44abb5b8dbe50acb..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/011_KW78CHEM/004_diaprog/clean_diaprog +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f dir.* gmeta KWRAI.1.SEGCH.00* OUT_DIA diff --git a/MY_RUN/KTEST/011_KW78CHEM/004_diaprog/dir_KW78_chem b/MY_RUN/KTEST/011_KW78CHEM/004_diaprog/dir_KW78_chem deleted file mode 100644 index 834ade876fb27691c47f1d02cbaaae22a7429f0e..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/011_KW78CHEM/004_diaprog/dir_KW78_chem +++ /dev/null @@ -1,65 +0,0 @@ -visu -! directives de presentation -LINVWB=T NIGRNC=10 nhi=0 lminmax=t xsizel=0.015 -! plages de couleur, pas d isolignes -LCOLAREA=T LISO=F -! gestion des vecteurs (1 vecteur sur 4) -NISKIP=4 XVRL=0.15 -! 1er fichier a ouvrir -_file1_'KWRAI.1.SEGCH.004dg' -! couleur de fond pour le 1er intervalle -LCOLZERO=T NCOLZERO=1 -! precipitations explicites instantanees -INPRR -! precipitations explicites cumulees -ACPRR -! trace de tous les vecteurs -NISKIP=1 -! superposition de la pression et des vecteurs de vent au niveau K=2 -PABST_K_2_ON_UTVT_K_2 -! superposition du rapport d eau nuageuse et des vecteurs vent a 3000m -RCT_Z_3000_ON_UTVT_Z_3000 -! superposition du rapport d eau nuageuse et des vecteurs vent a 5000m -RCT_Z_5000_ON_UTVT_Z_5000 -! concentration CO et ozone à 3000m -COT_Z_3000 -O3T_Z_3000 -! concentration CO et ozone à 5000m -COT_Z_5000 -O3T_Z_5000 -! definition d une coupe verticale -NIDEBCOU=5 NJDEBCOU=2 NLANGLE=47 NLMAX=21 -! trace de la coupe verticale dans le plan horizontal -LTRACECV=T -! rapport de vapeur et vecteurs vent dans la coupe verticale -RVT_CV__ON_ULTWT_CV_ -! plus de trace de la coupe verticale -LTRACECV=F -! rapport de melange d eau nuageuse et rapport d eau de pluie -RCT_CV__ON_RRT_CV_ -! difference pour la temperature potentielle avec le champ initial -THT_CV__MINUS_LSTHM_CV_ -! vitesse verticale en coupe verticale -WT_CV_ -! concentration CO en coupe verticale -COT_CV_ -! concentration HCHO en coupe verticale -HCHOT_CV_ -WC_HCHOT_CV__ON_RCT_CV_ -WR_HCHOT_CV__ON_RRT_CV_ -IC_HCHOT_CV__ON_RST_PLUS_RGT_CV_ -! concentration SO2 en coupe verticale -SO2T_CV_ -WC_SO2T_CV__ON_RCT_CV_ -WR_SO2T_CV__ON_RRT_CV_ -IC_SO2T_CV__ON_RST_PLUS_RGT_CV_ -! concentration HNO3 en coupe verticale -HNO3T_CV_ -WC_HNO3T_CV__ON_RCT_CV_ -WR_HNO3T_CV__ON_RRT_CV_ -IC_HNO3T_CV__ON_RST_PLUS_RGT_CV_ -! PH nuage et pluie en coupe verticale -PHC_CV_ -PHR_CV_ -quit - diff --git a/MY_RUN/KTEST/011_KW78CHEM/004_diaprog/run_diaprog b/MY_RUN/KTEST/011_KW78CHEM/004_diaprog/run_diaprog deleted file mode 100755 index 307811a8f4af3792ad742348c6e0793551566777..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/011_KW78CHEM/004_diaprog/run_diaprog +++ /dev/null @@ -1,11 +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 ../003_convdia/KWRAI.1.SEGCH.004dg.{des,lfi} . -rm -f dir.* -${POSTRUN} diaprog < dir_KW78_chem -#idt gmeta diff --git a/MY_RUN/KTEST/011_KW78CHEM/004_python/clean_python b/MY_RUN/KTEST/011_KW78CHEM/004_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/011_KW78CHEM/004_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/011_KW78CHEM/004_python/plot_011_KW78CHEM.py b/MY_RUN/KTEST/011_KW78CHEM/004_python/plot_011_KW78CHEM.py new file mode 100644 index 0000000000000000000000000000000000000000..d271fe993d8733a11387ff34e6ebd728f36d6e3c --- /dev/null +++ b/MY_RUN/KTEST/011_KW78CHEM/004_python/plot_011_KW78CHEM.py @@ -0,0 +1,295 @@ +#!/usr/bin/env python3 +""" + +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" +import matplotlib as mpl +mpl.use('Agg') +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +from misc_functions import oblique_proj, windvec_verti_proj, mean_operator +import os + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +path="" +LnameFiles = ['KWRAI.1.SEGCH.004.nc','KWRAI.1.SEGCH.004dg.nc' ] + +Dvar_input = { +'f1':['ZS', 'UT','VT', 'WT','THT', + 'ni_u','nj_u','level','ZTOP', 'ni','nj','level_w','time', + 'INPRR','ACPRR','PABST','RCT','RVT','RRT','RGT', 'LSTHM', + 'COT','O3T','HCHOT','WC_HCHOT','IC_HCHOT', 'WR_HCHOT','SO2T','WC_SO2T','WR_SO2T', + 'IC_SO2T','HNO3T','WC_HNO3T','WR_HNO3T','IC_HNO3T','PHC','PHR',], +'f2':['ALT_CLOUD', 'ALT_U', 'ALT_V', 'ni','nj'] +} + +# Read the variables in the files +Dvar = {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=True) + +################################################################ +######### PANEL 1 +############################################################### +Panel1 = PanelPlot(2,3, [25,14],'', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01) + +Lplot = [ Dvar['f1']['INPRR'], Dvar['f1']['ACPRR'], Dvar['f1']['PABST'],Dvar['f2']['ALT_CLOUD'],Dvar['f2']['ALT_CLOUD'] ] + +LaxeX = [Dvar['f1']['ni']]*len(Lplot) +LaxeY = [Dvar['f1']['nj']]*len(Lplot) +Ltitle = ['Instantaneous precipitation INPRR', 'Accumulated precipitation ACPRR','Absolute pressure','Mixing ratio of liquid droplets at z=3000m','Mixing ratio of liquid droplets at z=5000m' ] +Lcbarlabel = ['mm/h', 'mm','hPa','g/kg','g/kg'] +Lxlab = ['x (m)']*len(Lplot) +Lylab = ['y (m)']*len(Lplot) +Lminval = [0, 0, 982.25, 0, 0] +Lmaxval = [13.5, 0.36, 983.45, 2.5, 1.8] +Lstep = [0.5, 0.005, 0.05, 0.05, 0.05] +Lstepticks = [0.5, 0.02, 0.2, 0.5, 0.5] +Lfacconv = [1, 1, 1./100.0,1,1] +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Llvl = [0,0,0,0,1] +Ltime = [Dvar['f1']['time']]*len(Lplot) +LaddWhite = [True]*len(Lplot) +Lpltype = ['cf']*len(Lplot) + +fig1 = Panel1.psectionH(lon=LaxeX, lat=LaxeY, Lvar=Lplot, Llevel=Llvl, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + Ltime=Ltime, LaddWhite_cm=LaddWhite) +fig1.tight_layout() + +# Wind vectors +Lplot1 = [ Dvar['f1']['UT'], Dvar['f2']['ALT_U'], Dvar['f2']['ALT_U']] +Lplot2 = [ Dvar['f1']['VT'], Dvar['f2']['ALT_V'], Dvar['f2']['ALT_V']] +Ltitle = ['Wind at K=2', 'Wind at 3000m', 'Wind at 5000m'] +Lxlab = ['x (m)']*len(Lplot) +Lylab = ['y (m)']*len(Lplot) +Llegendval = [10,10,10] +Lcbarlabel = ['m/s']*len(Lplot) +Larrowstep = [1]*len(Lplot) +Lwidth = [0.002]*len(Lplot) +Lcolor = ['black']*len(Lplot) +Llvl = [0,0,1] +lon = [Dvar['f1']['ni_u'], Dvar['f2']['ni'], Dvar['f2']['ni'] ] +lat = [Dvar['f1']['nj_u'], Dvar['f2']['nj'], Dvar['f2']['nj'] ] +Lscale = [200]*len(Lplot) +fig2 = Panel1.pvector(Lxx=lon, Lyy=lat, Lvar1=Lplot1, Lvar2=Lplot2, Lcarte=[500,23500,500,23500], Llevel=Llvl, + Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, + Lcolor=Lcolor, Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lid_overlap=[4,6,8], ax=fig1.axes, Lscale=Lscale) +# Oblique projection +i_beg, j_beg = (2,0) +i_end, j_end = (21,22) +# Black line +Panel1.addLine(fig2.axes[6],[Dvar['f1']['ni'][i_beg],Dvar['f1']['nj'][j_beg]],[Dvar['f1']['ni'][i_end],Dvar['f1']['nj'][j_end]],'black',2) +Panel1.save_graph(1,fig2) + +################################################################ +######### PANEL 2 +############################################################### +Panel2 = PanelPlot(2,2, [20,20],'', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01, colorbaraspect=40, labelcolorbarpad = 13) + +# Interpoler COT','O3T à 3000 et 5000m avec une moyenne sur2 niveaux +Dvar['f1']['COT3000m'] = (Dvar['f1']['COT'][6,:,:] + Dvar['f1']['COT'][5,:,:])/2.0 +Dvar['f1']['O3T3000m'] = (Dvar['f1']['O3T'][6,:,:] + Dvar['f1']['O3T'][5,:,:])/2.0 +Dvar['f1']['COT5000m'] = (Dvar['f1']['COT'][10,:,:] + Dvar['f1']['COT'][9,:,:])/2.0 +Dvar['f1']['O3T5000m'] = (Dvar['f1']['O3T'][10,:,:] + Dvar['f1']['O3T'][9,:,:])/2.0 +Lplot = [Dvar['f1']['COT3000m'], Dvar['f1']['O3T3000m'],Dvar['f1']['COT5000m'], Dvar['f1']['O3T5000m'] ] + +LaxeX = [Dvar['f1']['ni']]*len(Lplot) +LaxeY = [Dvar['f1']['nj']]*len(Lplot) +Ltitle = ['CO at z = 3000m', 'Ozone O3 at z = 3000m ', 'CO at z = 5000m', 'Ozone O3 at z = 5000m '] +Lcbarlabel = ['kg/kg']*len(Lplot) +Lxlab = ['x (m)']*len(Lplot) +Lylab = ['y (m)']*len(Lplot) +Lminval = [0, 0, 0, 0] +Lmaxval = [1E-7, 0.4E-7, 0.95E-7, 0.4E-7] +Lstep = [0.05E-7, 0.02E-7, 0.05E-7, 0.02E-7] +Lstepticks = Lstep +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Ltime = [Dvar['f1']['time']]*len(Lplot) +LaddWhite = [True]*len(Lplot) + +fig2 = Panel2.psectionH(lon=LaxeX, lat=LaxeY, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, + Ltime=Ltime, LaddWhite_cm=LaddWhite) + +Panel2.save_graph(2,fig2) + +################################################################ +######### PANEL 3 : Oblique projection +############################################################### +Panel3 = PanelPlot(2,2, [17,17],'Oblique section (angle = 47)', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01, lateralminmaxpad=0.9) + +Dvar['f1']['THT-LSTHM'] = Dvar['f1']['THT'] - Dvar['f1']['LSTHM'] + +tomass = mean_operator() +Dvar['f1']['UM'] = tomass.MXM(Dvar['f1']['UT']) +Dvar['f1']['VM'] = tomass.MYM(Dvar['f1']['VT']) +Dvar['f1']['WM'] = tomass.MZM(Dvar['f1']['WT']) + + +angle_sec1, RVT_sec1, axe_m1 = oblique_proj(Dvar['f1']['RVT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +WIND_proj = windvec_verti_proj(Dvar['f1']['UM'], Dvar['f1']['VM'], Dvar['f1']['level'], angle_sec1) +angle_sec1, WIND_sec1, axe_m1 = oblique_proj(WIND_proj, Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, WT_sec1, axe_m1 = oblique_proj(Dvar['f1']['WM'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, RCT_sec1, axe_m1 = oblique_proj(Dvar['f1']['RCT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, RRT_sec1, axe_m1 = oblique_proj(Dvar['f1']['RRT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, anoTHT_sec1, axe_m1 = oblique_proj(Dvar['f1']['THT-LSTHM'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) + +Lplot = [RVT_sec1, RCT_sec1, anoTHT_sec1, WT_sec1] +LaxeX = [axe_m1]*len(Lplot) +LaxeZ = [Dvar['f1']['level'], Dvar['f1']['level'], Dvar['f1']['level'],Dvar['f1']['level_w']] +Ltitle = ['Water vapor mixing ratio', 'Liquid cloud mixing ratio', 'Potential temperature anomaly', 'Vertical velocity'] +Lcbarlabel = ['g/kg','g/kg', 'K', 'm/s'] +Lxlab = ['distance (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lminval = [0., 0., -5, -18] +Lmaxval = [15, 3.0, 5, 18] +Lstep = [0.5, 0.05, 0.2, 0.5] +Lstepticks = [1, 0.2, 1, 2.5] +Lfacconv = [1000, 1000, 1, 1] +Lcolormap = ['gist_rainbow_r','gist_rainbow_r', 'seismic','seismic'] +Ltime = [Dvar['f1']['time']]*len(Lplot) +Lpltype = ['cf']*len(Lplot) +LaddWhite = [True, True, False, False] + +fig3 = Panel3.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + Ltime=Ltime, Lpltype=Lpltype, LaddWhite_cm=LaddWhite) + + +Lplot1 = [ WIND_sec1] +Lplot2 = [ WT_sec1] +Ltitle = ['Wind'] +Llegendval = [25] +Lcbarlabel = ['m/s']*len(Lplot) +Larrowstep = [1]*len(Lplot) +Lwidth = [0.004]*len(Lplot) +Lscale = [200]*len(Lplot) + +fig4 = Panel3.pvector(Lxx=LaxeX, Lyy=LaxeZ, Lvar1=Lplot1, Lvar2=Lplot2, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, + Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lid_overlap=[0], ax=fig3.axes, Lscale=Lscale) + + +Lplot = [RRT_sec1] +LaxeX = [axe_m1] +LaxeZ = [Dvar['f1']['level']] +Ltitle = ['precipitation'] +Lcbarlabel = ['g/kg']*len(Lplot) +Lxlab = ['distance (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,10000.1)]*len(Lplot) +Lminval = [0.] +Lmaxval = [3.5] +Lstep = [0.5] +Lstepticks = [0.5] +Lfacconv = [1000]*len(Lplot) +LcolorLine = ['black']*len(Lplot) +Ltime = [Dvar['f1']['time']] +Lpltype = ['c']*len(Lplot) +LaddWhite = [True]*len(Lplot) + +fig5 = Panel3.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, LcolorLine=LcolorLine, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + Ltime=Ltime, Lpltype=Lpltype, LaddWhite_cm=LaddWhite, ax=fig4.axes,Lid_overlap=[2],colorbar=False) + +Panel3.save_graph(3,fig5) + +################################################################ +######### PANEL 4 : Oblique projection of chemical variables +############################################################### +Panel4 = PanelPlot(2,3, [25,14],'Oblique projection of chemical variables', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01, colorbaraspect=40, labelcolorbarpad = 13) + +angle_sec1, RGT_sec1, axe_m1 = oblique_proj(Dvar['f1']['RGT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, COT_sec1, axe_m1 = oblique_proj(Dvar['f1']['COT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, O3T_sec1, axe_m1 = oblique_proj(Dvar['f1']['O3T'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, HCHOT_sec1, axe_m1 = oblique_proj(Dvar['f1']['HCHOT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, WC_HCHOT_sec1, axe_m1 = oblique_proj(Dvar['f1']['WC_HCHOT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, WR_HCHOT_sec1, axe_m1 = oblique_proj(Dvar['f1']['WR_HCHOT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, SO2T_sec1, axe_m1 = oblique_proj(Dvar['f1']['SO2T'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, WC_SO2T_sec1, axe_m1 = oblique_proj(Dvar['f1']['WC_SO2T'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, WR_SO2T_sec1, axe_m1 = oblique_proj(Dvar['f1']['WR_SO2T'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, IC_SO2T_sec1, axe_m1 = oblique_proj(Dvar['f1']['IC_SO2T'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, IC_HCHOT_sec1, axe_m1 = oblique_proj(Dvar['f1']['IC_HCHOT'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, HNO3T_sec1, axe_m1 = oblique_proj(Dvar['f1']['HNO3T'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, WC_HNO3T_sec1, axe_m1 = oblique_proj(Dvar['f1']['WC_HNO3T'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, WR_HNO3T_sec1, axe_m1 = oblique_proj(Dvar['f1']['WR_HNO3T'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, IC_HNO3T_sec1, axe_m1 = oblique_proj(Dvar['f1']['IC_HNO3T'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, PHC_sec1, axe_m1 = oblique_proj(Dvar['f1']['PHC'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) +angle_sec1, PHR_sec1, axe_m1 = oblique_proj(Dvar['f1']['PHR'], Dvar['f1']['ni'], Dvar['f1']['nj'], Dvar['f1']['level'], i_beg, j_beg, i_end, j_end) + +Lplot = [COT_sec1, HCHOT_sec1, SO2T_sec1, HNO3T_sec1, PHC_sec1, PHR_sec1 ] + +LaxeX = [axe_m1]*len(Lplot) +LaxeZ = [Dvar['f1']['level']]*len(Lplot) +Ltitle = ['CO', 'HCHO', 'SO2', 'HNO3', 'pH in cloud','pH in rain'] +Lcbarlabel = ['ppp', 'ppp', 'ppp','ppp', '', '' ] +Lxlab = ['distance (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lminval = [0., 0., 0., 0., 0., 0.] +Lmaxval = [1E-7, 0.23E-9, 0.51E-10, 0.13E-9, 6, 6] +Lstep = [0.05E-7, 0.1E-10, 0.25E-11, 0.01E-9, 0.25, 0.25] +Lstepticks = Lstep +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Ltime = [Dvar['f1']['time']]*len(Lplot) +Lpltype = ['cf']*len(Lplot) +LaddWhite = [True]*len(Lplot) + +fig6 = Panel4.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, + Ltime=Ltime, Lpltype=Lpltype, LaddWhite_cm=LaddWhite) +fig1.tight_layout() +Panel4.save_graph(4,fig6) + +################################################################ +######### PANEL 5 : Oblique projection of chemical variables +############################################################### +Panel5 = PanelPlot(3,3, [25,14],'', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.01, colorbaraspect=40, labelcolorbarpad = 13) + +Lplot = [WC_HCHOT_sec1, WR_HCHOT_sec1, IC_HCHOT_sec1, WC_SO2T_sec1, WR_SO2T_sec1, IC_SO2T_sec1, WC_HNO3T_sec1, WR_HNO3T_sec1, IC_HNO3T_sec1] + +LaxeX = [axe_m1]*len(Lplot) +LaxeZ = [Dvar['f1']['level']]*len(Lplot) +Ltitle = ['WC_HCHO', 'WR_HCHO', 'IC_HCHO','WC_SO2', 'WR_SO2', 'IC_SO2','WC_HNO3', 'WR_HNO3', 'IC_HNO3'] +Lcbarlabel = ['ppp']*len(Lplot) +Lxlab = ['distance (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lminval = [0., 0., 0., 0., 0., 0., 0., 0., 0.] +Lmaxval = [0.6E-10, 1E-10, 0.17E-9, 0.9E-11, 0.68E-11, 0.62E-12, 0.85E-10, 0.12E-9, 0.18E-9] +Lstep = [0.3E-11, 0.05E-10, 0.1E-10, 0.5E-12, 0.04E-11, 0.25E-13, 0.05E-10, 0.05E-10, 0.1E-10] +Lstepticks = Lstep +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Ltime = [Dvar['f1']['time']]*len(Lplot) +Lpltype = ['cf']*len(Lplot) +LaddWhite = [True]*len(Lplot) + +fig7 = Panel5.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, + Ltime=Ltime, Lpltype=Lpltype, LaddWhite_cm=LaddWhite) +fig7.tight_layout() + +Lplot = [RCT_sec1, RRT_sec1, RGT_sec1, RCT_sec1, RRT_sec1, RGT_sec1, RCT_sec1, RRT_sec1, RGT_sec1 ] +LaxeX = [axe_m1]*len(Lplot) +LaxeZ = [Dvar['f1']['level']]*len(Lplot) +Ltitle = ['cloud mixing ratio (g/kg)', 'precipitation mixing ratio (g/kg)', 'graupel mixing ratio (g/kg)']*3 +Lcbarlabel = ['g/kg']*len(Lplot) +Lxlab = ['distance (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,10000.1)]*len(Lplot) +Lminval = [0.]*len(Lplot) +Lmaxval = [6]*len(Lplot) +Lstep = [0.5]*len(Lplot) +Lstepticks = [0.5]*len(Lplot) +Lfacconv = [1000]*len(Lplot) +LcolorLine = ['black']*len(Lplot) +Lpltype = ['c']*len(Lplot) + +fig8 = Panel5.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, LcolorLine=LcolorLine, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv, + Lpltype=Lpltype, ax=fig7.axes,Lid_overlap=[0, 2, 4, 6, 8, 10, 12, 14, 16],colorbar=False) + +Panel5.save_graph(5,fig8) diff --git a/MY_RUN/KTEST/011_KW78CHEM/004_python/run_python b/MY_RUN/KTEST/011_KW78CHEM/004_python/run_python new file mode 100755 index 0000000000000000000000000000000000000000..829cd2a4f7de8c957f8e241fed3825647e9bf451 --- /dev/null +++ b/MY_RUN/KTEST/011_KW78CHEM/004_python/run_python @@ -0,0 +1,18 @@ +#!/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 ${SRC_MESONH}/src/LIB/Python/* . +ln -sf ../003_diag/KWRAI.1.SEGCH.004*.nc . + +python3 plot_011_KW78CHEM.py +${POSTRUN} display tempgraph1.png +${POSTRUN} display tempgraph2.png +${POSTRUN} display tempgraph3.png +${POSTRUN} display tempgraph4.png +${POSTRUN} display tempgraph5.png +#${POSTRUN} convert *.png 011_KW78CHEM.pdf +#${POSTRUN} evince 011_KW78CHEM.pdf diff --git a/MY_RUN/KTEST/011_KW78CHEM/005_ncl/clean_ncl b/MY_RUN/KTEST/011_KW78CHEM/005_ncl/clean_ncl index 3f7a799f163d1faebcae30394e9e40a6de80898a..6d1fcfec203cbd90b4693d08c68964108cd43968 100755 --- a/MY_RUN/KTEST/011_KW78CHEM/005_ncl/clean_ncl +++ b/MY_RUN/KTEST/011_KW78CHEM/005_ncl/clean_ncl @@ -3,4 +3,4 @@ #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 +rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/011_KW78CHEM/Makefile b/MY_RUN/KTEST/011_KW78CHEM/Makefile index e50e3b333d17d9505c803b9ba51ca34fcdcaafea..3d72ae88418cecbac68e63d840b33bf10fb3816f 100644 --- a/MY_RUN/KTEST/011_KW78CHEM/Makefile +++ b/MY_RUN/KTEST/011_KW78CHEM/Makefile @@ -1,13 +1,17 @@ all: cd 001_prep_ideal_case && run_prep_ideal_case_xyz cd 002_mesonh && run_mesonh_xyz - cd 003_convdia && run_conv2dia - cd 004_diaprog && run_diaprog + cd 003_diag && run_diag_xyz + 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 cd 002_mesonh && clean_mesonh_xyz - cd 003_convdia && clean_conv2dia - cd 004_diaprog && clean_diaprog + cd 003_diag && clean_diag_xyz + ifneq "$(MNH_PYTHON)" "NO" + cd 004_python && clean_python + endif cd 005_ncl && clean_ncl diff --git a/MY_RUN/KTEST/012_dust/002_ecmwf2lfi/run_ecmwf2lfi_xyz b/MY_RUN/KTEST/012_dust/002_ecmwf2lfi/run_ecmwf2lfi_xyz index 9d85d71fbafd43690be45d1b7eac753d2ae3ba8c..c244dca4b64919ece5c9180cf14e186c2c06a4f7 100755 --- a/MY_RUN/KTEST/012_dust/002_ecmwf2lfi/run_ecmwf2lfi_xyz +++ b/MY_RUN/KTEST/012_dust/002_ecmwf2lfi/run_ecmwf2lfi_xyz @@ -22,16 +22,18 @@ rm -f S702000092* OUTPUT_LISTING* pipe* *.tex cp PRE_REAL1.nam.20000924.00 PRE_REAL1.nam time ${MONORUN} PREP_REAL_CASE${XYZ} -mv OUTPUT_LISTING0 OUTPUT_LISTING0_2400 +cp OUTPUT_LISTING0 OUTPUT_LISTING0_2400 -#exit +#exit +rm -f OUTPUT_LISTING0 cp PRE_REAL1.nam.20000924.12 PRE_REAL1.nam time ${MONORUN} PREP_REAL_CASE${XYZ} -mv OUTPUT_LISTING0 OUTPUT_LISTING0_2412 +cp OUTPUT_LISTING0 OUTPUT_LISTING0_2412 +rm -f OUTPUT_LISTING0 cp PRE_REAL1.nam.20000925.00 PRE_REAL1.nam time ${MONORUN} PREP_REAL_CASE${XYZ} -mv OUTPUT_LISTING0 OUTPUT_LISTING0_2500 +cp OUTPUT_LISTING0 OUTPUT_LISTING0_2500 diff --git a/MY_RUN/KTEST/012_dust/005_conv2dia/clean_conv2dia b/MY_RUN/KTEST/012_dust/005_conv2dia/clean_conv2dia deleted file mode 100755 index 9b1176bdf2cc5e00f1cc8d88dafbb5e00c1080eb..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/005_conv2dia/clean_conv2dia +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -x -rm -f DUST7* -rm -f dirconv FICJD LISTING_DIA OUT_DIA pipe_name diff --git a/MY_RUN/KTEST/012_dust/005_conv2dia/dir_conv2dia1 b/MY_RUN/KTEST/012_dust/005_conv2dia/dir_conv2dia1 deleted file mode 100644 index 858d45891459c812d0a8bf1369854aed026ce041..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/005_conv2dia/dir_conv2dia1 +++ /dev/null @@ -1,6 +0,0 @@ -1 -DUST7.1.SEG02.004 -DUST7.1.SEG02.004_dia -n -n -0 diff --git a/MY_RUN/KTEST/012_dust/005_conv2dia/run_conv2dia b/MY_RUN/KTEST/012_dust/005_conv2dia/run_conv2dia deleted file mode 100755 index 730b717dfaa9102e903c349f97b537be2fabc291..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/005_conv2dia/run_conv2dia +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -x -set -e -ln -sf ../004_restart/DUST7.1.SEG02.004.lfi . -rm -f DUST7.1.SEG02.004_dia* -${POSTRUN} conv2dia < dir_conv2dia1 - diff --git a/MY_RUN/KTEST/012_dust/005_python/clean_python b/MY_RUN/KTEST/012_dust/005_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/012_dust/005_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/012_dust/005_python/plot_012_dust.py b/MY_RUN/KTEST/012_dust/005_python/plot_012_dust.py new file mode 100644 index 0000000000000000000000000000000000000000..be5585a8942d90a752b1241023742d6f9da5f74f --- /dev/null +++ b/MY_RUN/KTEST/012_dust/005_python/plot_012_dust.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 +""" +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" +import matplotlib as mpl +mpl.use('Agg') +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +from misc_functions import mean_operator, convert_date +import cartopy.crs as ccrs +import numpy as np +import os + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +path="" +LnameFiles = ['DUST7.1.SEG02.004.nc'] + +Dvar_input = { +'f1':['ZS', 'UT','VT', 'WT','THT', + 'DSTM03T','DSTM33T','DSTM02T','DSTM32T','DSTM01T','DSTM31T','F_DST001P1','F_DST002P1','F_DST003P1', + 'latitude','longitude','level', + 'INPRR','ACPRR','PABST','RCT','RVT','RRT','LSTHM']} + +# Read the variables in the files +Dvar = {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=True) +Dvar['f1']['date'] = convert_date(Dvar['f1']['date'], Dvar['f1']['time']) +################################################################ +######### PANEL 1 +############################################################### +Panel1 = PanelPlot(1,2, [20,10],'012_dust', titlepad=25, minmaxpad=1.04, timepad=-0.10, colorbarpad=0.01, colorbaraspect=30) +tomass = mean_operator() +Dvar['f1']['UM'] = tomass.MXM(Dvar['f1']['UT']) +Dvar['f1']['VM'] = tomass.MYM(Dvar['f1']['VT']) +Dvar['f1']['WIND'] = np.sqrt(Dvar['f1']['VM']**2 + Dvar['f1']['UM']**2) + +Lplot = [ Dvar['f1']['WIND'],Dvar['f1']['THT']] +lon = [Dvar['f1']['longitude']]*len(Lplot) +lat = [Dvar['f1']['latitude']]*len(Lplot) +Ltitle = ['Wind speed', 'Potential Temperature at 1st level'] +Lcbarlabel = ['m/s','K'] +Lxlab = ['longitude']*len(Lplot) +Lylab = ['latitude']*len(Lplot) +Lminval = [0, 296.5] +Lmaxval = [10.5, 307.5] +Lstep = [0.5, 0.5] +Lstepticks = Lstep +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Lprojection = [ccrs.PlateCarree()]*len(Lplot) +Llvl = [0, 0] +LaddWhite = [True, False] +Ltime = [Dvar['f1']['date']]*len(Lplot) + +fig1 = Panel1.psectionH(lon=lon, lat=lat, Lvar=Lplot, Llevel=Llvl, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, + Ltime=Ltime, LaddWhite_cm=LaddWhite, Lproj=Lprojection) + +Lplot1 = [ Dvar['f1']['UM']] +Lplot2 = [ Dvar['f1']['VM']] +Ltitle = [' vectors at 1st level'] +Llegendval = [20] +Lcbarlabel = ['m/s']*len(Lplot) +Larrowstep = [1]*len(Lplot) +Lwidth = [0.002]*len(Lplot) +Lcolor = ['black']*len(Lplot) +Lscale = [200]*len(Lplot) + +fig2 = Panel1.pvector(Lxx=lon, Lyy=lat, Lvar1=Lplot1, Llevel=Llvl, Lvar2=Lplot2, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lwidth=Lwidth, Larrowstep=Larrowstep, + Llegendval=Llegendval, Lcbarlabel=Lcbarlabel, Lid_overlap=[0], ax=fig1.axes, Lscale=Lscale) + +Panel1.save_graph(1,fig2) +################################################################ +######### PANEL 2 +############################################################### +Panel2 = PanelPlot(2,3, [25,14],'', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.03, labelcolorbarpad = 13, colorbaraspect=40) +Lplot = [ Dvar['f1']['DSTM03T'],Dvar['f1']['DSTM33T'],Dvar['f1']['DSTM02T'],Dvar['f1']['DSTM32T'],Dvar['f1']['DSTM01T'],Dvar['f1']['DSTM31T']] +lon = [Dvar['f1']['longitude']]*len(Lplot) +lat = [Dvar['f1']['latitude']]*len(Lplot) +Ltitle = ['DSTM03T','DSTM33T','DSTM02T','DSTM32T','DSTM01T','DSTM31T'] +Lcbarlabel = ['kg/kg']*len(Lplot) +Lxlab = ['longitude']*len(Lplot) +Lylab = ['latitude']*len(Lplot) +Lminval = [0,0,0,0,0,0] +Lmaxval = [0.11E-21, 0.62E-9, 0.33E-17, 0.44E-6, 0.45E-16, 0.17E-7] +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Lprojection = [ccrs.PlateCarree()]*len(Lplot) +LaddWhite = [True]*len(Lplot) +Ltime = [Dvar['f1']['time']]*len(Lplot) +Llvl = [0]*len(Lplot) +fig3 = Panel2.psectionH(lon=lon, lat=lat, Lvar=Lplot, Llevel=Llvl, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=[], Lstepticks=[], Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, + Ltime=Ltime, LaddWhite_cm=LaddWhite, Lproj=Lprojection, ax=[]) + +Panel2.save_graph(2,fig3) +################################################################ +######### PANEL 3 +############################################################### +Panel3 = PanelPlot(2,3, [25,14],'', titlepad=25, minmaxpad=1.04, timepad=-0.10, colorbarpad=0.03, labelcolorbarpad = 13, colorbaraspect=50) +Lplot = [ Dvar['f1']['F_DST001P1'],Dvar['f1']['F_DST002P1'],Dvar['f1']['F_DST003P1']] +lon = [Dvar['f1']['longitude']]*len(Lplot) +lat = [Dvar['f1']['latitude']]*len(Lplot) +Ltitle = ['F_DST001P1','F_DST002P1','F_DST003P1'] +Lcbarlabel = ['kg/m2/s']*len(Lplot) +Lxlab = ['longitude']*len(Lplot) +Lylab = ['latitude']*len(Lplot) +Lminval = [0,0,0] +Lmaxval = [0.54E-9,0.76E-7, 0.28E-8] +Lcolormap = ['gist_rainbow_r']*len(Lplot) +Lprojection = [ccrs.PlateCarree()]*len(Lplot) +LaddWhite = [True]*len(Lplot) +Ltime = [Dvar['f1']['date']]*len(Lplot) +Lcarte = [Dvar['f1']['longitude'].min(),Dvar['f1']['longitude'].max(), Dvar['f1']['latitude'].min(), Dvar['f1']['latitude'].max()] +fig4 = Panel3.psectionH(lon=lon, lat=lat, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=[], Lstepticks=[], Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel,Lcarte=Lcarte, + Ltime=Ltime, LaddWhite_cm=LaddWhite, Lproj=Lprojection, ax=[]) + +Panel3.save_graph(3,fig4) diff --git a/MY_RUN/KTEST/012_dust/005_python/run_python b/MY_RUN/KTEST/012_dust/005_python/run_python new file mode 100755 index 0000000000000000000000000000000000000000..27e2f28c1558a45b015baf7bcfc3e1f46dc02714 --- /dev/null +++ b/MY_RUN/KTEST/012_dust/005_python/run_python @@ -0,0 +1,16 @@ +#!/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 ${SRC_MESONH}/src/LIB/Python/* . +ln -sf ../004_restart/DUST7.1.SEG02.004.nc . + +python3 plot_012_dust.py +${POSTRUN} display tempgraph1.png +${POSTRUN} display tempgraph2.png +${POSTRUN} display tempgraph3.png +#${POSTRUN} convert *.png 012_dust.pdf +#${POSTRUN} evince 012_dust.pdf diff --git a/MY_RUN/KTEST/012_dust/006_diaprog/clean_diaprog b/MY_RUN/KTEST/012_dust/006_diaprog/clean_diaprog deleted file mode 100755 index b43ef143fa29d857798b07b0725c14c26f9b1d1c..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/006_diaprog/clean_diaprog +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -x -rm -f dir.* gmeta DUST* OUT_DIA diff --git a/MY_RUN/KTEST/012_dust/006_diaprog/dirdust b/MY_RUN/KTEST/012_dust/006_diaprog/dirdust deleted file mode 100644 index 355cf5afcceb252104c582b52c0706d9f3fbb770..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/006_diaprog/dirdust +++ /dev/null @@ -1,34 +0,0 @@ -_file_'DUST7.1.SEG02.004_dia' -LCOLAREA=T -LISO=F -print groups -nigrnc=1 -lcolzero=f -ncolzero=1 -LVPTUSER=.T. -XVPTVL=0.1 -XVPTVR=0.8 -XVPTVB=0.1 -XVPTVT=0.9 -LFACTIMP=T -LMINMAX=T -LCOLAREA=.T. -LCOLZERO=.T. -NCOLZERO=1 -LCOLINE=F -LISO=.F. - -niskip=1 -xvrl=0.1 -MUTVT_k_2_t_time1_on_UTVT_k_2_t_time1 -THT_K_2 -DSTM03T_K_2 -DSTM33T_K_2 -DSTM02T_K_2 -DSTM32T_K_2 -DSTM01T_K_2 -DSTM31T_K_2 -F_DST001P1 -F_DST002P1 -F_DST003P1 -quit diff --git a/MY_RUN/KTEST/012_dust/006_diaprog/run_diaprog b/MY_RUN/KTEST/012_dust/006_diaprog/run_diaprog deleted file mode 100755 index ab5bc445e57ea094c2b5079252a5c3939c5603ab..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/006_diaprog/run_diaprog +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -x -set -e -ln -sf ../005_conv2dia/DUST7.1.SEG02.004_dia.lfi . -rm -f dir.0* -${POSTRUN} diaprog < dirdust - diff --git a/MY_RUN/KTEST/012_dust/006_ncl/clean_ncl b/MY_RUN/KTEST/012_dust/006_ncl/clean_ncl new file mode 100755 index 0000000000000000000000000000000000000000..2bb66b885adab3b3c4eef7b62c3fc348e2b5b54d --- /dev/null +++ b/MY_RUN/KTEST/012_dust/006_ncl/clean_ncl @@ -0,0 +1,3 @@ +#!/bin/bash +set -x +rm -f *.nc *.ps *.png diff --git a/MY_RUN/KTEST/012_dust/007_ncl/plot_dust.ncl b/MY_RUN/KTEST/012_dust/006_ncl/plot_dust.ncl similarity index 100% rename from MY_RUN/KTEST/012_dust/007_ncl/plot_dust.ncl rename to MY_RUN/KTEST/012_dust/006_ncl/plot_dust.ncl diff --git a/MY_RUN/KTEST/012_dust/007_ncl/run_ncl b/MY_RUN/KTEST/012_dust/006_ncl/run_ncl similarity index 100% rename from MY_RUN/KTEST/012_dust/007_ncl/run_ncl rename to MY_RUN/KTEST/012_dust/006_ncl/run_ncl diff --git a/MY_RUN/KTEST/012_dust/007_ncl/clean_ncl b/MY_RUN/KTEST/012_dust/007_ncl/clean_ncl deleted file mode 100755 index aa9f928147719870e032433d1a3ac85b8ed720d9..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/012_dust/007_ncl/clean_ncl +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -x -rm -f *.nc -rm -f *.ps diff --git a/MY_RUN/KTEST/012_dust/Makefile b/MY_RUN/KTEST/012_dust/Makefile index ee078671aee07513f52f91018bf64d747f250039..d27b829b472bc3ed05336257fe328e888ee6e3d1 100644 --- a/MY_RUN/KTEST/012_dust/Makefile +++ b/MY_RUN/KTEST/012_dust/Makefile @@ -1,4 +1,8 @@ -all: E001_pgd1 E002_ecmwf2lfi E003_run E004_restart E005_conv2dia E006_diaprog E007_ncl +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 @@ -8,17 +12,16 @@ E003_run: cd 003_run && run_mesonh_xyz E004_restart: cd 004_restart && run_mesonh_xyz -E005_conv2dia: - cd 005_conv2dia && run_conv2dia -E006_diaprog: - cd 006_diaprog && run_diaprog -E007_ncl: - cd 007_ncl && run_ncl +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 cd 003_run && clean_mesonh_xyz - cd 004_restart && clean_mesonh_xyz - cd 005_conv2dia && clean_conv2dia - cd 006_diaprog && clean_diaprog - cd 007_ncl && clean_ncl + cd 004_restart && clean_mesonh_xyz + ifneq "$(MNH_PYTHON)" "NO" + cd 005_python && clean_python + endif + cd 006_ncl && clean_ncl diff --git a/MY_RUN/KTEST/014_LIMA/002_mesonh/EXSEG1.nam b/MY_RUN/KTEST/014_LIMA/002_mesonh/EXSEG1.nam index ee3b307108e483a9ae08780bebecf2de7b9d1cbc..0d8a9c3402e73d2443109d3ce917aed225aa493b 100644 --- a/MY_RUN/KTEST/014_LIMA/002_mesonh/EXSEG1.nam +++ b/MY_RUN/KTEST/014_LIMA/002_mesonh/EXSEG1.nam @@ -68,13 +68,13 @@ NBUMOD = 1, XBULEN=3600., XBUWRI=3600., - NBUKL = 2, - NBUKH = 51, + NBUKL = 1, + NBUKH = 50, LBU_KCP = .FALSE., - NBUIL = 2, - NBUIH = 181, - NBUJL = 2, - NBUJH = 2, + NBUIL = 1, + NBUIH = 180, + NBUJL = 1, + NBUJH = 1, LBU_ICP = .FALSE., LBU_JCP = .FALSE. / 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 a7daead6570cdc6b4f249031185830640f62fc0d..0000000000000000000000000000000000000000 --- a/MY_RUN/KTEST/014_LIMA/003_ncl/plot_LIMA.ncl +++ /dev/null @@ -1,121 +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 -;=================================================; -vname = "RI___0001___PROC3" -RI___0001_P3= fichier1->$vname$(0,0,:,0,:) -RI___0001_P3@long_name="ice water content" -RI___0001_P3@units="g/kg" - -vname2 = "SV0050001___PROC3" -NI___0001_P3= fichier1->$vname2$(0,0,:,0,:) -NI___0001_P3@long_name="ice concentration" -NI___0001_P3@units="/kg" - -vname3 = "RS___0001___PROC3" -RS___0001_P3= fichier1->$vname3$(0,0,:,0,:) -RS___0001_P3@long_name="snow water content" -RS___0001_P3@units="g/kg" - -vname4 = "RG___0001___PROC3" -RG___0001_P3= fichier1->$vname4$(0,0,:,0,:) -RG___0001_P3@long_name="graupel water content" -RG___0001_P3@units="g/kg" - -vname5 = "SV0060001___PROC3" -N_IFN_FREE_P3= fichier1->$vname5$(0,0,:,0,:) -N_IFN_FREE_P3@long_name="concentration of free IFN" -N_IFN_FREE_P3@units="/kg" - -vname6 = "SV0070001___PROC3" -N_IFN_NUCL_P3= fichier1->$vname6$(0,0,:,0,:) -N_IFN_NUCL_P3@long_name="concentration of nucleated IFN" -N_IFN_NUCL_P3@units="/kg" - - -zhat = fichier1->ZHAT(1:50) -xhat = fichier1->XHAT(1:180) -zs = fichier1->ZS(0,1:180) ; ZS - -xconf=conform(RI___0001_P3,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___0001_P3(:,:),res) - draw(plot) - frame(wks) - - plot2 = gsn_csm_contour(wks,NI___0001_P3(:,:),res) - draw(plot2) - frame(wks) - - plot3 = gsn_csm_contour(wks,RS___0001_P3(:,:),res) - draw(plot3) - frame(wks) - - plot4 = gsn_csm_contour(wks,RG___0001_P3(:,:),res) - draw(plot4) - frame(wks) - plot5 = gsn_csm_contour(wks,N_IFN_FREE_P3(:,:),res) - draw(plot5) - frame(wks) - plot6 = gsn_csm_contour(wks,N_IFN_NUCL_P3(:,:),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/004_python/clean_python new file mode 100755 index 0000000000000000000000000000000000000000..d75604a6ad8743f9782400155bb3def9cfd69410 --- /dev/null +++ b/MY_RUN/KTEST/014_LIMA/004_python/clean_python @@ -0,0 +1,4 @@ +#!/bin/bash +rm -f *.png *.pdf *.nc +rm -Rf __pycache__ +find . -type l -delete diff --git a/MY_RUN/KTEST/014_LIMA/004_python/plot_014_LIMA.py b/MY_RUN/KTEST/014_LIMA/004_python/plot_014_LIMA.py new file mode 100644 index 0000000000000000000000000000000000000000..12ff241726cb4b00c005051e28ee8e69516e2b35 --- /dev/null +++ b/MY_RUN/KTEST/014_LIMA/004_python/plot_014_LIMA.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +""" + +@author: Quentin Rodier +Creation : 07/01/2021 + +Last modifications +""" +import matplotlib as mpl +mpl.use('Agg') +from read_MNHfile import read_netcdf +from Panel_Plot import PanelPlot +from misc_functions import comp_altitude1DVar +import os + +os.system('rm -f tempgraph*') +# +# User's parameter / Namelist +# +path="" +LnameFiles = ['XPREF.1.SEG01.000.nc' ] + +Dvar_input = {'f1':['RI', 'CICE', 'RS','RG', 'CIFNFREE01','CIFNNUCL01' ]} +Dvar_input_coord_budget = {'f1':['cart_level', 'cart_ni']} +Dvar_input_coord = {'f1':['ZS','ZTOP']} + +# Add ___AVED to all variables +for i,var in enumerate(Dvar_input['f1']): + Dvar_input['f1'][i] = var + '___AVEF' +# +# Read the variables in the files +Dvar, Dvar_coord_budget, Dvar_coord = {}, {}, {} +Dvar = read_netcdf(LnameFiles, Dvar_input, path=path, removeHALO=False) +Dvar_coord_budget = read_netcdf(LnameFiles, Dvar_input_coord_budget, path=path, removeHALO=False) +Dvar_coord = read_netcdf(LnameFiles, Dvar_input_coord, path=path, removeHALO=True) + +Dvar['f1']['altitude'], Dvar['f1']['ni_2D'] = comp_altitude1DVar(Dvar['f1']['CIFNFREE01'], Dvar_coord['f1']['ZS'],Dvar_coord['f1']['ZTOP'], Dvar_coord_budget['f1']['cart_level'],Dvar_coord_budget['f1']['cart_ni']) + +################################################################ +######### PANEL 1 +############################################################### +Panel1 = PanelPlot(2,3, [25,14],'014_LIMA', titlepad=25, minmaxpad=1.04, timepad=-0.07, colorbarpad=0.03, labelcolorbarpad = 13, colorbaraspect=40) + +Lplot = [Dvar['f1']['RI'],Dvar['f1']['CICE'], Dvar['f1']['RS'], + Dvar['f1']['RG'],Dvar['f1']['CIFNFREE01'], Dvar['f1']['CIFNNUCL01']] +LaxeX = [Dvar['f1']['ni_2D']]*len(Lplot) +LaxeZ = [Dvar['f1']['altitude']]*len(Lplot) +Ltitle = ['Ice water content', 'Ice concentration', 'Snow water content', + 'Graupel water content', 'Concentration of free IFN', 'Concentration of nucleated IFN'] +Lcbarlabel = ['g/kg', '/kg', 'g/kg','g/kg',r'x $10^6$/kg','/kg'] +Lxlab = ['x (m)']*len(Lplot) +Lylab = ['altitude (m)']*len(Lplot) +Lylim = [(0,16000)]*len(Lplot) +Lminval = [0, 0, 0, 0, 0.8 ,0] +Lmaxval = [3.75E-2, 5400, 3E-1, 3E-1, 7, 1800] +Lstep = [0.25E-2,400,0.01,0.01,0.25, 100] +Lstepticks = Lstep +Lfacconv = [1000, 1, 1000, 1000, 1E-6, 1] +orog = Dvar_coord['f1']['ZS'] +Lcolormap = ['gist_rainbow_r']*len(Lplot) +LaddWhite = [True, True, True, True, False, True] + +fig1 = Panel1.psectionV(Lxx=LaxeX, Lzz=LaxeZ, Lvar=Lplot, Lxlab=Lxlab, Lylab=Lylab, Ltitle=Ltitle, Lminval=Lminval, Lmaxval=Lmaxval, + Lstep=Lstep, Lstepticks=Lstepticks, Lcolormap=Lcolormap, Lcbarlabel=Lcbarlabel, Lfacconv=Lfacconv,Lylim=Lylim, + orog=orog, LaddWhite_cm=LaddWhite) + +Panel1.save_graph(1,fig1) diff --git a/MY_RUN/KTEST/002_3Drelief/004_diaprog/run_diaprog b/MY_RUN/KTEST/014_LIMA/004_python/run_python similarity index 57% rename from MY_RUN/KTEST/002_3Drelief/004_diaprog/run_diaprog rename to MY_RUN/KTEST/014_LIMA/004_python/run_python index 6fb30e42f4fd801ec4fff45781196b0530e9af1c..96e73e8209bbefc840d543ad91254d261e707ec3 100755 --- a/MY_RUN/KTEST/002_3Drelief/004_diaprog/run_diaprog +++ b/MY_RUN/KTEST/014_LIMA/004_python/run_python @@ -5,8 +5,10 @@ #MNH_LIC for details. version 1. set -x set -e -ln -sf ../003_convdia/REL3D.1.EXP01.002dg.{des,lfi} . -#ln -sf ../003_convdia/REL3D_autre_run.{des,lfi} . -rm -f dir.0* -${POSTRUN} diaprog < dir_3Drelief +ln -sf ${SRC_MESONH}/src/LIB/Python/* . +ln -sf ../002_mesonh/XPREF.1.SEG01.000.nc . +python3 plot_014_LIMA.py +${POSTRUN} display tempgraph1.png +#${POSTRUN} convert *.png 014_LIMA.pdf +#${POSTRUN} evince 014_LIMA.pdf diff --git a/MY_RUN/KTEST/014_LIMA/Makefile b/MY_RUN/KTEST/014_LIMA/Makefile index 5ef01ca8d4fcc8a5c6caa9a142b53d18c3d74462..c03971716585263f5a1107ad18335ea48c7fc060 100644 --- a/MY_RUN/KTEST/014_LIMA/Makefile +++ b/MY_RUN/KTEST/014_LIMA/Makefile @@ -1,9 +1,13 @@ 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 + 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 + endif diff --git a/src/LIB/Python/Panel_Plot.py b/src/LIB/Python/Panel_Plot.py new file mode 100644 index 0000000000000000000000000000000000000000..dc5cfb6ffbc10fef09b834386192603de5850466 --- /dev/null +++ b/src/LIB/Python/Panel_Plot.py @@ -0,0 +1,792 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Wed Feb 24 10:49:45 2021 + +@author: rodierq +""" +import matplotlib as mpl +mpl.use('Agg') +import matplotlib.pyplot as plt +from matplotlib import cm +from matplotlib.colors import ListedColormap +import numpy as np +import cartopy.feature as cfeature + +class PanelPlot(): + + def __init__(self, nb_l, nb_c, Lfigsize, bigtitle, titlepad=40, minmaxpad=1.03, timepad=-0.06, lateralminmaxpad=0.86, + labelcolorbarpad=6.0, colorbaraspect=20, colorbarpad=0.04 ): + self.bigtitle = bigtitle + self.Lfigsize = Lfigsize + self.nb_l = nb_l + self.nb_c = nb_c + self.nb_graph = 0 # New independent graph within the subplot + self.titlepad = titlepad # Title pad (vertical shift) from graph + self.minmaxpad = minmaxpad # Min/Max print pad (vertical shift) + self.timepad = timepad # Time print pad (vertical shift) + self.colorbarpad = colorbarpad # Colorbar pad (horizontal shift from graph) + self.lateralminmaxpad = lateralminmaxpad + self.labelcolorbarpad = labelcolorbarpad # Vertical colorbal label pad + self.colorbaraspect = colorbaraspect # Ratio of long to short dimensions of colorbar w.r.t. the figure + + # Initialization of the panel plots + self.fig = plt.figure(figsize=(self.Lfigsize[0],self.Lfigsize[1])) + self.fig.set_dpi(125) + self.fig.suptitle(self.bigtitle,fontsize=16) + + def save_graph(self, iplt, fig): + """ + Create a temporary png file of (sub)-plot(s) which can be converted to PDF + """ + self.iplt = iplt + self.fig = fig + + self.fig.savefig('tempgraph'+str(self.iplt)) #TODO possibility to change the default value of .png file name + self.iplt+=1 + return self.iplt + + def draw_Backmap(self,drawCoastLines, ax, projo): + """ + Handle drawing of the background plot (coastlines, departements, grid lines and labels) + """ + self.drawCoastLines = drawCoastLines + self.projo = projo + + # Grid lines and labels + if 'PlateCarree' in str(projo): + gl = ax.gridlines(crs=self.projo, draw_labels=True, linewidth=1, color='gray') + gl.xlabels_top = False + gl.ylabels_right = False + + # Coastlines + if self.drawCoastLines and 'GeoAxes' in str(type(ax)): + ax.coastlines(resolution='10m') + + # Countries border + ax.add_feature(cfeature.BORDERS) + ax.add_feature(cfeature.LAKES, alpha=0.7) + + def addWhitecm(self, Laddwhite, colormap_in, nb_level): + if Laddwhite: + color_map = cm.get_cmap(colormap_in, 256) + newcolor_map = color_map(np.linspace(0, 1, 256)) + whites = np.array([1, 1, 1, 1]) #RBG code + opacity + for i in range(int(256/nb_level)): newcolor_map[:i, :] = whites + newcmp = ListedColormap(newcolor_map) + return newcmp + + + def set_Title(self, ax, i, title, Lid_overlap, xlab, ylab): + """ + Handle top title of each graph + Parameters : + - titlepad : global attribute for vertical shift placement w.r.t the graph + """ + self.ax = ax + self.title = title + self.Lid_overlap = Lid_overlap + self.i = i + #self.ax[self.i].set_xlabel("test", fontweight='bold') + if not Lid_overlap: + self.ax[self.i].set_title(title, pad=self.titlepad) + else: # If graph overlap, title is concatenated + new_title = self.ax[self.i].get_title() + ' and ' + title + self.ax[self.i].set_title(new_title, pad=self.titlepad) + + def set_xlim(self, ax, i, xlim): + """ + Handle x limits plotted if necessary + """ + self.ax = ax + self.xlim = xlim + self.i = i + + self.ax[self.i].set_xlim(xlim[0],xlim[1]) + + def set_ylim(self, ax, i, ylim): + """ + Handle x limits plotted if necessary + """ + self.ax = ax + self.ylim = ylim + self.i = i + + self.ax[self.i].set_ylim(ylim[0],ylim[1]) + + def set_XYaxislab(self, ax, i, xlab, ylab): + """ + Handle x and y axis labels + """ + self.ax = ax + self.xlab = xlab + self.ylab = ylab + self.i = i + + # This handing label is a known issue with GeoAxes of cartopy + # https://stackoverflow.com/questions/35479508/cartopy-set-xlabel-set-ylabel-not-ticklabels + # https://github.com/SciTools/cartopy/issues/1332 + if 'GeoAxes' in str(type(self.ax[self.i])): + self.ax[self.i].text(-0.11, 0.45, ylab, verticalalignment='top', horizontalalignment='left', + rotation='vertical', rotation_mode='anchor', transform=self.ax[self.i].transAxes, color='black', fontsize=11) + self.ax[self.i].text(0.45, -0.06, xlab, verticalalignment='top', horizontalalignment='left', + rotation='horizontal', rotation_mode='anchor', transform=self.ax[self.i].transAxes, color='black', fontsize=11) + else: + self.ax[self.i].set_xlabel(xlab) + self.ax[self.i].set_ylabel(ylab) + + def addLine(self, ax, beg_coord, end_coord, color='black', linewidth=1): + self.ax = ax + self.beg_coord = beg_coord + self.end_coord = end_coord + self.color = color + self.linewidth = linewidth + + x1, y1 = [self.beg_coord[0],self.end_coord[0]], [self.beg_coord[1], self.end_coord[1]] + ax.plot(x1, y1,color=self.color,linewidth=self.linewidth) + + def print_minmax(self, var, title): + print(str(title) + " min = " + str(np.nanmin(var)) + " max = " + str(np.nanmax(var))) + + def set_minmaxText(self, ax, i, var, title, Lid_overlap, facconv): + """ + Show min and max value Text in the plot + If overlap variable, text is align to the right + TODO : handle more than 2 overlap variables + """ + self.ax = ax + self.var = var + self.i = i + self.title = title + self.facconv = facconv + + strtext = " min = " + "{:.3e}".format(np.nanmin(var*facconv)) + " max = " + "{:.3e}".format(np.nanmax(var*facconv)) + if not Lid_overlap: + self.ax[self.i].text(0.01, self.minmaxpad, strtext, verticalalignment='top', horizontalalignment='left', + transform=self.ax[self.i].transAxes, color='black', fontsize=10) + else: + self.ax[self.i].text(self.lateralminmaxpad, self.minmaxpad, strtext, verticalalignment='top', horizontalalignment='right', + transform=self.ax[self.i].transAxes, color='black', fontsize=10) + # Print to help choose min/max value for ticks + self.print_minmax(var*facconv, title) + + def showTimeText(self, ax, i, timetxt): + """ + Show time validity + """ + self.ax = ax + self.i = i + self.timetxt = timetxt + + strtext = "Time = " + timetxt + self.ax[self.i].text(0.0, self.timepad, strtext, verticalalignment='top', horizontalalignment='left', + transform=self.ax[self.i].transAxes, color='black', fontsize=10) + + + def psectionV(self, Lxx=[], Lzz=[], Lvar=[], Lxlab=[], Lylab=[], Ltitle=[], Lminval=[], Lmaxval=[], + Lstep=[], Lstepticks=[], Lcolormap=[], Lcbarlabel=[], LcolorLine=[], + Lfacconv=[], ax=[], Lid_overlap=[], colorbar=True, orog=[], Lxlim=[], Lylim=[], Ltime=[], Lpltype=[], LaddWhite_cm=[]): + """ + Horizontal cross section plot + Arguments : + - Lxx : List of x or y coordinate variable or time axis + - Lzz : List of z coordinates variable + - Lvar : List of variables to plot + - Lxlab : List of x-axis label + - Lylab : List of y-axis label + - Lxlim : List of x (min, max) value plotted + - Lylim : List of y (min, max) value plotted + - Ltime : List of time (validity) + - Ltitle : List of sub-title + - Lminval: List of minimum value for each colorbar + - Lmaxval: List of maximum value for each colorbar + - Lstep : List of color-steps for each colorbar + - Lstepticks : List of value of labels for each colorbar + - Lcolormap : List of colormap + - LcolorLine : List of colors for colors arg of contour (color line only) + - Lcbarlabel : List of colorbar label legend (units) + - Lfacconv : List of factors for unit conversion of each variables + - ax : List of fig.axes for ploting multiple different types of plots in a subplot panel + - Lid_overlap: List of number index of plot to overlap current variables + - Lpltype : List of types of plot 'cf' or 'c'. cf=contourf, c=contour (lines only) + - colorbar : show colorbar or not + - LaddWhite_cm : List of boolean to add white color to a colormap at the first (low value) tick colorbar + """ + self.ax = ax + firstCall = (len(self.ax) == 0) + + # Initialize default value w.r.t to the number of plots +# D={'Lxlab':Lxlab, 'Lylab':Lylab, 'Ltitle':Ltitle,'Lminval':Lminval, 'Lmaxval':Lmaxval, +# 'Lstep':Lstep, 'Lstepticks':Lstepticks, 'Lcolormap':Lcolormap, 'Lcbarlabel':Lcbarlabel, 'Lfacconv':Lfacconv, 'Ltime':Ltime, +# 'LaddWhite_cm':LaddWhite_cm, 'Lpltype':Lpltype} +# D = initialize_default_val(Lvar, D) + + # Default values + if not Lfacconv: Lfacconv = [1.0]*len(Lvar) + if not Lcolormap and not LcolorLine: Lcolormap=['gist_rainbow_r']*len(Lvar) # If no color given, a cmap is given + if not Lcolormap: LcolorLine=['black']*len(Lvar) + if not Lpltype: Lpltype=['cf']*len(Lvar) + if not LaddWhite_cm: LaddWhite_cm=[False]*len(Lvar) + if not Lylab: Lylab = ['']*len(Lvar) + if not Lxlab: Lxlab = ['']*len(Lvar) + # Add an extra percentage of the top max value for forcing the colorbar show the true user maximum value (correct a bug) + Lmaxval = list(map(lambda x, y: x + 1E-6*y, Lmaxval, Lstep) ) #The extra value is 1E-6 times the step ticks of the colorbar + + # On all variables to plot + for i,var in enumerate(Lvar): + if firstCall: #1st call + iax = i + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,i+1)) + self.nb_graph+=1 + elif Lid_overlap != []: #overlapping plot + iax = Lid_overlap[i] + else: #existing ax with no overlapping (graphd appended to existing panel) + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,self.nb_graph+1)) + self.nb_graph+=1 + iax = len(self.ax)-1 # The ax index of the new coming plot is the length of the existant ax -1 for indices matter + + # Colors normalization + norm = mpl.colors.Normalize(vmax=Lmaxval[i], vmin=Lminval[i]) + + # Print min/max (stout and on plot) + self.set_minmaxText(self.ax, iax, var, Ltitle[i], Lid_overlap, Lfacconv[i]) + + # Print time validity + if Ltime: self.showTimeText(self.ax, iax, str(Ltime[i])) + + # Number of contours level + if not Lstep[i]: # Default value of number of steps is 20 + Lstep[i] = (Lmaxval[i] - Lminval[i])/20 + Lstepticks[i] = Lstep[i] + + levels_contour = np.arange(Lminval[i],Lmaxval[i],step=Lstep[i]) + + # Add White to colormap + if LaddWhite_cm[i] and Lcolormap: Lcolormap[i]=self.addWhitecm(LaddWhite_cm[i], Lcolormap[i], len(levels_contour)) + + # Plot + if Lpltype[i]=='c': # Contour + if LcolorLine: + cf = self.ax[iax].contour(Lxx[i], Lzz[i], var*Lfacconv[i], levels=levels_contour, + norm=norm, vmin=Lminval[i], vmax=Lmaxval[i], colors=LcolorLine[i]) + else: + cf = self.ax[iax].contour(Lxx[i], Lzz[i], var*Lfacconv[i], levels=levels_contour, + norm=norm, vmin=Lminval[i], vmax=Lmaxval[i], cmap=Lcolormap[i]) + else: # Contourf + cf = self.ax[iax].contourf(Lxx[i], Lzz[i], var*Lfacconv[i], levels=levels_contour, + norm=norm, vmin=Lminval[i], vmax=Lmaxval[i], cmap=Lcolormap[i]) + + # Title + self.set_Title(self.ax, iax, Ltitle[i], Lid_overlap,Lxlab[i], Lylab[i]) + + # X/Y Axis label + self.set_XYaxislab(self.ax, iax, Lxlab[i], Lylab[i]) + + # X/Y Axis limits value + if Lxlim: + try: + self.set_xlim(self.ax, iax, Lxlim[i]) + except: + pass + if Lylim: + try: + self.set_ylim(self.ax, iax, Lylim[i]) + except: + pass + + # Color label on contour-ligne + if Lpltype[i]=='c': # Contour + self.ax[iax].clabel(cf, levels=np.arange(Lminval[i],Lmaxval[i],step=Lstep[i])) + + #Filling area under topography + if not orog==[]: + self.ax[iax].fill_between(Lxx[i][0,:], orog, color='black') + + # Colorbar + if colorbar: + cb=plt.colorbar(cf, ax=self.ax[iax], fraction=0.031, pad=self.colorbarpad, ticks=np.arange(Lminval[i],Lmaxval[i],Lstepticks[i]), aspect=self.colorbaraspect) + cb.ax.set_title(Lcbarlabel[i], pad = self.labelcolorbarpad, loc='left') #This creates a new AxesSubplot only for the colorbar y=0 ==> location at the bottom + + return self.fig + + def pXY_lines(self, Lxx=[], Lyy=[], Lxlab=[], Lylab=[], Ltitle=[], Llinetype=[], Llinewidth=[], + Llinecolor=[], Llinelabel=[], LfacconvX=[], LfacconvY=[], ax=[], id_overlap=None, Lxlim=[], + Lylim=[], Ltime=[], LaxisColor=[]): + """ + XY (multiple)-lines plot + Arguments : + - Lxx : List of variables to plot or coordinates along the X axis #TODO : ajouter Lfacconv pour les deux axes. Impact tous les cas test avec lignes X/Y + - Lyy : List of variables to plot or coordinates along the Y axis + - Lxlab : List of x-axis label + - Lylab : List of y-axis label + - Lxlim : List of x (min, max) value plotted + - Lylim : List of y (min, max) value plotted + - Ltime : List of time (validity) + - Ltitle : List of sub-title + - Llinewidth : List of lines thickness + - Llinetype : List of line types + - Lcolorlines: List of color lines + - Llinelabel : List of legend label lines + - LfacconvX/Y: List of factors for unit conversion of the variables/coordinates to plot on X and Y axis + - ax : List of fig.axes for ploting multiple different types of plots in a subplot panel + - Lid_overlap: List of number index of plot to overlap current variables + - LaxisColor : List of colors for multiple x-axis overlap + """ + self.ax = ax + firstCall = (len(self.ax) == 0) + # Defaults value convert to x number of variables list + if not LfacconvX: LfacconvX = [1.0]*len(Lxx) + if not LfacconvY: LfacconvY = [1.0]*len(Lxx) + if not Llinewidth: Llinewidth = [1.0]*len(Lxx) + if not Llinecolor: Llinecolor = ['blue']*len(Lxx) + if not Llinetype: Llinetype = ['-']*len(Lxx) + if not Llinelabel: Llinelabel = ['']*len(Lxx) + if not LaxisColor: LaxisColor = ['black']*len(Lxx) + if not Lylab: Lylab = ['']*len(Lxx) + if not Lxlab: Lxlab = ['']*len(Lxx) + + if firstCall: # 1st call + iax = 0 + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,1, label='graph axe x down')) + self.nb_graph+=1 + elif id_overlap: # overlapping plot with a different x-axis + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,self.nb_graph, label='graph axe x top',frame_on=False)) + iax = len(self.ax)-1 + else: # existing ax with no overlapping (graph appended to existing panel) + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,self.nb_graph+1)) + self.nb_graph+=1 + iax = len(self.ax)-1 # The ax index of the new coming plot is the length of the existant ax -1 for indices matter + + # On all variables to plot + for i,var in enumerate(Lxx): + # Print time validity + if Ltime: self.showTimeText(self.ax, iax, str(Ltime[i])) + + # Plot + cf = self.ax[iax].plot(Lxx[i]*LfacconvX[i], Lyy[i]*LfacconvY[i], color=Llinecolor[i], ls=Llinetype[i], + label=Llinelabel[i], linewidth=Llinewidth[i]) + # Legend + #TODO : Handling legend with overlap two axis lines in the same box. For now, placement is by hand + if not id_overlap: + self.ax[iax].legend(loc='upper right', bbox_to_anchor=(1, 0.95)) + else: + self.ax[iax].legend(loc='upper right', bbox_to_anchor=(1, 0.90)) + + # Title + if Ltitle: self.set_Title(self.ax, iax, Ltitle[i], id_overlap,Lxlab[i], Lylab[i]) + + # X/Y Axis label + if id_overlap: + self.ax[iax].xaxis.tick_top() + self.ax[iax].xaxis.set_label_position('top') + self.ax[iax].set_xlabel(Lxlab[i]) + self.ax[iax].set_ylabel(Lylab[i]) + else: + self.set_XYaxislab(self.ax, iax, Lxlab[i], Lylab[i]) + + self.ax[iax].tick_params(axis='x', colors=LaxisColor[i]) + + # X/Y Axis limits value + if Lxlim: + try: + self.set_xlim(self.ax, iax, Lxlim[i]) + except: + pass + if Lylim: + try: + self.set_ylim(self.ax, iax, Lylim[i]) + except: + pass + return self.fig + + def psectionH(self, lon=[],lat=[], Lvar=[], Lcarte=[], Llevel=[], Lxlab=[], Lylab=[], Ltitle=[], Lminval=[], Lmaxval=[], + Lstep=[], Lstepticks=[], Lcolormap=[], LcolorLine=[], Lcbarlabel=[], Lproj=[], Lfacconv=[], coastLines=True, ax=[], + Lid_overlap=[], colorbar=True, Ltime=[], LaddWhite_cm=[], Lpltype=[]): + """ + Horizontal cross section plot + Arguments : + - lon : longitude 2D array + - lat : latitude 2D array + - Lvar : List of variables to plot + - Lcarte : Zooming [lonmin, lonmax, latmin, latmax] + - Llevel : List of k-level value for the section plot (ignored if variable is already 2D) + - Lxlab : List of x-axis label + - Lylab : List of y-axis label + - Ltitle : List of sub-title + - Ltime : List of time (validity) + - Lminval: List of minimum value for each colorbar + - Lmaxval: List of maximum value for each colorbar + - Lstep : List of color-steps for each colorbar + - Lstepticks : List of value of labels for each colorbar + - Lcolormap : List of colormap + - LcolorLine : List of colors for colors arg of contour (color line only) + - Lcbarlabel : List of colorbar label legend (units) + - Lproj : List of ccrs cartopy projection ([] for cartesian coordinates) + - Lfacconv : List of factors for unit conversion of each variables + - coastLines : Boolean to plot coast lines and grid lines + - ax : List of fig.axes for ploting multiple different types of plots in a subplot panel + - Lid_overlap : List of number index of plot to overlap current variables + - colorbar : show colorbar or not + - Lpltype : List of types of plot 'cf' or 'c'. cf=contourf, c=contour (lines only) + - LaddWhite_cm : List of boolean to add white color to a colormap at the first (low value) tick colorbar + """ + self.ax = ax + firstCall = (len(self.ax) == 0) + + # Initialize default value w.r.t to the number of plots +# D={'lon':lon, 'lat':lat, 'Lcarte':Lcarte, 'Llevel':Llevel, 'Lxlab':Lxlab, 'Lylab':Lylab, 'Ltitle':Ltitle,'Lminval':Lminval, 'Lmaxval':Lmaxval, +# 'Lstep':Lstep, 'Lstepticks':Lstepticks, 'Lcolormap':Lcolormap, 'Lcbarlabel':Lcbarlabel, 'Lproj':Lproj, 'Lfacconv':Lfacconv, 'Ltime':Ltime, +# 'LaddWhite_cm':LaddWhite_cm, 'Lpltype':Lpltype} +# D = initialize_default_val(Lvar, D) + + # If all plots are not using conversion factor, convert it to List + if not Lfacconv: Lfacconv = [1.0]*len(Lvar) + if not Lylab: Lylab = ['']*len(Lvar) + if not Lxlab: Lxlab = ['']*len(Lvar) + if not Lcolormap and not LcolorLine: Lcolormap=['gist_rainbow_r']*len(Lvar) # If no color given, a cmap is given + if not Lcolormap: LcolorLine=['black']*len(Lvar) + if not Lpltype: Lpltype=['cf']*len(Lvar) + if not LaddWhite_cm: LaddWhite_cm=[False]*len(Lvar) + # Add an extra percentage of the top max value for forcing the colorbar show the true user maximum value (correct a bug) + if Lstep: Lmaxval = list(map(lambda x, y: x + 1E-6*y, Lmaxval, Lstep) ) #The extra value is 1E-6 times the step ticks of the colorbar + + # This following must be after the extra percentage top value addition + if not Lstep: Lstep=[None]*len(Lvar) + if not Lstepticks: Lstepticks=[None]*len(Lvar) + + # On all variables to plot + for i,var in enumerate(Lvar): + if firstCall: #1st call + iax = i + if Lproj: + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,i+1, projection = Lproj[i])) + else: # Cartesian coordinates + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,i+1)) + self.nb_graph+=1 + elif Lid_overlap != []: #overlapping plot + iax = Lid_overlap[i] + else: #existing ax with no overlapping (graphd appended to existing panel) + if Lproj: + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,self.nb_graph+1, projection = Lproj[i])) + else: # Cartesian coordinates + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,self.nb_graph+1)) + self.nb_graph+=1 + iax = len(self.ax)-1 # The ax index of the new coming plot is the length of the existant ax -1 for indices matter + + #Colors normalization + norm = mpl.colors.Normalize(vmax=Lmaxval[i], vmin=Lminval[i]) + + # Zooming + if len(Lcarte) == 4: #zoom + self.ax[iax].set_xlim(Lcarte[0], Lcarte[1]) + self.ax[iax].set_ylim(Lcarte[2], Lcarte[3]) + # Variable to plot w.r.t dimensions + if var.ndim==2: + vartoPlot = var[:,:] + else: + vartoPlot = var[Llevel[i],:,:] + + # Print min/max (stout and on plot) + self.set_minmaxText(self.ax, iax, vartoPlot, Ltitle[i], Lid_overlap, Lfacconv[i]) + + # Print time validity + if Ltime: self.showTimeText(self.ax, iax, str(Ltime[i])) + + # Number of contours level + if not Lstep[i]: # Default value of number of steps is 20 + Lstep[i] = (Lmaxval[i] - Lminval[i])/20 + Lstepticks[i] = Lstep[i] + + levels_contour = np.arange(Lminval[i],Lmaxval[i],step=Lstep[i]) + + # Add White to colormap + if LaddWhite_cm[i] and Lcolormap: Lcolormap[i]=self.addWhitecm(LaddWhite_cm[i], Lcolormap[i], len(levels_contour)) + + # Plot + if Lproj: + if Lpltype[i]=='c': # Contour + if LcolorLine: + cf = self.ax[iax].contourf(lon[i], lat[i], vartoPlot*Lfacconv[i], levels=levels_contour,transform=Lproj[i], + norm=norm, vmin=Lminval[i], vmax=Lmaxval[i], colors=LcolorLine[i]) + else: + cf = self.ax[iax].contourf(lon[i], lat[i], vartoPlot*Lfacconv[i], levels=levels_contour,transform=Lproj[i], + norm=norm, vmin=Lminval[i], vmax=Lmaxval[i], cmap=Lcolormap[i]) + else: + cf = self.ax[iax].contourf(lon[i], lat[i], vartoPlot*Lfacconv[i], levels=levels_contour,transform=Lproj[i], + norm=norm, vmin=Lminval[i], vmax=Lmaxval[i], cmap=Lcolormap[i]) + else: # Cartesian coordinates + if Lpltype[i]=='c': # Contour + cf = self.ax[iax].contourf(lon[i], lat[i], vartoPlot*Lfacconv[i], levels=levels_contour, + norm=norm, vmin=Lminval[i], vmax=Lmaxval[i], colors=LcolorLine[i]) + else: + cf = self.ax[iax].contourf(lon[i], lat[i], vartoPlot*Lfacconv[i], levels=levels_contour, + norm=norm, vmin=Lminval[i], vmax=Lmaxval[i], cmap=Lcolormap[i]) + # Title + self.set_Title(self.ax, iax, Ltitle[i], Lid_overlap,Lxlab[i], Lylab[i]) + + # Coastlines / Grid lines and labels + if Lproj: self.draw_Backmap(coastLines, self.ax[iax], Lproj[i]) + + # X/Y Axis + self.set_XYaxislab(self.ax, iax, Lxlab[i], Lylab[i]) + + # Color label on contour-ligne + if Lpltype[i]=='c': # Contour + self.ax[iax].clabel(cf, levels=np.arange(Lminval[i],Lmaxval[i],step=Lstep[i])) + + # Colorbar + if colorbar: + cb=plt.colorbar(cf, ax=self.ax[iax], fraction=0.031, pad=self.colorbarpad, ticks=np.arange(Lminval[i],Lmaxval[i],Lstepticks[i]), aspect=self.colorbaraspect) + cb.ax.set_title(Lcbarlabel[i], pad = self.labelcolorbarpad, loc='left') #This creates a new AxesSubplot only for the colorbar y=0 ==> location at the bottom + + return self.fig + + + def pvector(self, Lxx=[], Lyy=[], Lvar1=[], Lvar2=[], Lcarte=[], Llevel=[], Lxlab=[], Lylab=[], + Ltitle=[], Lwidth=[], Larrowstep=[], Lcolor=[], Llegendval=[], Lcbarlabel=[], + Lproj=[], Lfacconv=[], ax=[], coastLines=True, Lid_overlap=[], Ltime=[], Lscale=[], + Lylim=[], Lxlim=[]): + """ + Horizontal vectors lines + Arguments : + - Lxx : List of x or y coordinate variable (lat or ni or nm) + - Lyy : List of y coordinates variable (lon or level) + - Lvar1 : List of wind-component along x/y or oblic axis (3D for hor. section, 2D for vertical section) + - Lvar2 : List of wind-component along y-axis : v-component for horizontal section / w-component for vertical section + - Lcarte : Zooming [lonmin, lonmax, latmin, latmax] + - Llevel : List of k-level value for the horizontal section plot (ignored if variable is already 2D) + - Lxlab : List of x-axis label + - Lylab : List of y-axis label + - Lxlim : List of x (min, max) value plotted + - Lylim : List of y (min, max) value plotted + - Ltitle : List of sub-titles + - Ltime : List of time (validity) + - Lwidth : List of thickness of the arrows + - Lscale : List of scale for the length of the arrows (high value <=> small length) + - Larrowstep : List of sub-sample (frequency) if too much arrows + - Lcolor : List of colors for the arrows (default: black) + - Llegendval : List of value for the legend of the default arrow + - Lcbarlabel : List of labels for the legend of the default arrow + - Lproj : List of ccrs cartopy projection + - Lfacconv : List of factors for unit conversion of each variables + - coastLines : Boolean to plot coast lines and grid lines + - ax : List of fig.axes for ploting multiple different types of plots in a subplot panel + - Lid_overlap : List of number index of plot to overlap current variables + """ + self.ax = ax + firstCall = (len(self.ax) == 0) + # If all plots are not using conversion factor, convert it to List + if not Lfacconv: Lfacconv = [1.0]*len(Lvar1) + if not Lcolor: Lcolor = ['black']*len(Lvar1) + if not Lscale : Lscale = [None]*len(Lvar1) + if not Lylab: Lylab = ['']*len(Lvar1) + if not Lxlab: Lxlab = ['']*len(Lvar1) + # On all variables to plot + for i,var1 in enumerate(Lvar1): + if firstCall: #1st call + iax = i + if Lproj: + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,i+1, projection = Lproj[i])) + else: + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,i+1)) + self.nb_graph+=1 + elif Lid_overlap != []: #overlapping plot + iax = Lid_overlap[i] + else: #existing ax with no overlapping (graphd appended to existing panel) + if Lproj: + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,self.nb_graph+1, projection = Lproj[i])) + else: + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,self.nb_graph+1)) + self.nb_graph+=1 + iax = len(self.ax)-1 # The ax index of the new coming plot is the length of the existant ax -1 for indices matter + + # Zooming + if len(Lcarte) == 4: #zoom + self.ax[iax].set_xlim(Lcarte[0], Lcarte[1]) + self.ax[iax].set_ylim(Lcarte[2], Lcarte[3]) + + # Variable to plot w.r.t dimensions + if var1.ndim==2: + vartoPlot1 = var1[:,:] + vartoPlot2 = Lvar2[i][:,:] + else: # Variable is 3D : only for horizontal section + vartoPlot1 = var1[Llevel[i],:,:] + vartoPlot2 = Lvar2[i][Llevel[i],:,:] + + # Print min/max val to help choose colorbar steps + self.set_minmaxText(self.ax, iax, np.sqrt(vartoPlot1**2 + vartoPlot2**2), Ltitle[i], Lid_overlap, Lfacconv[i]) + + # Print time validity + if Ltime: self.showTimeText(self.ax, iax, str(Ltime[i])) + + # Plot + axeX = Lxx[i] + axeY = Lyy[i] + if Lxx[i].ndim == 2: + cf = self.ax[iax].quiver(axeX[::Larrowstep[i],::Larrowstep[i]], axeY[::Larrowstep[i],::Larrowstep[i]], + vartoPlot1[::Larrowstep[i],::Larrowstep[i]], vartoPlot2[::Larrowstep[i],::Larrowstep[i]], + width=Lwidth[i] ,angles='uv', color=Lcolor[i],scale=Lscale[i]) + else: + cf = self.ax[iax].quiver(axeX[::Larrowstep[i]], axeY[::Larrowstep[i]], + vartoPlot1[::Larrowstep[i],::Larrowstep[i]], vartoPlot2[::Larrowstep[i],::Larrowstep[i]], + width=Lwidth[i] ,angles='uv', color=Lcolor[i], scale=Lscale[i]) + # Title + self.set_Title(self.ax, iax, Ltitle[i], Lid_overlap,Lxlab[i], Lylab[i]) + + # X/Y Axis Label + self.set_XYaxislab(self.ax, iax, Lxlab[i], Lylab[i]) + + # X/Y Axis limits value + if Lxlim: + try: + self.set_xlim(self.ax, iax, Lxlim[i]) + except: + pass + if Lylim: + try: + self.set_ylim(self.ax, iax, Lylim[i]) + except: + pass + + # Coastlines: + if Lproj: self.draw_Backmap(coastLines, self.ax[iax], Lproj[i]) + + # Arrow legend key + qk = self.ax[iax].quiverkey(cf, 1.0, -0.05, Llegendval[i], str(Llegendval[i]) + Lcbarlabel[i], labelpos='E', color='black') + + return self.fig + + def pXY_bar(self, Lbins=[], Lvar=[], Lxlab=[], Lylab=[], Ltitle=[], Lcolor=[], Lwidth=[], + Llinecolor=[], Llinewidth=[], Lfacconv=[], ax=[], id_overlap=None, Lxlim=[], + Lylim=[], Ltime=[], LaxisColor=[]): + """ + XY Histogram + Arguments : + - Lbins : List of bins + - Lvar : List of the value for each bin + - Lxlab : List of x-axis label + - Lylab : List of y-axis label + - Ltitle : List of sub-title + - Lcolor : List of color (or sequence of colors for each value) of the bars + - Lwidth : List of width of the bars + - Llinecolor : List of line color of the bar edges + - Llinewidth : List of lines thickness of the bar edges + - Lfacconv : List of factors for unit conversion of each variables + - Lxlim : List of x (min, max) value plotted + - Lylim : List of y (min, max) value plotted + - Ltime : List of time (validity) + - ax : List of fig.axes for ploting multiple different types of plots in a subplot panel + - Lid_overlap: List of number index of plot to overlap current variables + - LaxisColor : List of colors for multiple x-axis overlap + """ + self.ax = ax + firstCall = (len(self.ax) == 0) + # Defaults value convert to x number of variables list + if not Lfacconv: Lfacconv = [1.0]*len(Lvar) + if not LaxisColor: LaxisColor = ['black']*len(Lvar) + if not Lylab: Lylab = ['']*len(Lvar) + if not Lxlab: Lxlab = ['']*len(Lvar) + if not Lcolor: Lcolor = ['black']*len(Lvar) + if not Lwidth: Lwidth = [1]*len(Lvar) + if not Llinecolor: Llinecolor = ['black']*len(Lvar) + if not Llinewidth: Llinewidth = [0]*len(Lvar) + + # On all variables to plot + for i,var in enumerate(Lvar): + if firstCall: # 1st call + iax = i + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,i+1, label='graph axe x down')) + self.nb_graph+=1 + elif id_overlap: # overlapping plot with a different x-axis + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,self.nb_graph, label='graph axe x top',frame_on=False)) + iax = len(self.ax)-1 + else: # existing ax with no overlapping (graph appended to existing panel) + self.ax.append(self.fig.add_subplot(self.nb_l,self.nb_c,self.nb_graph+1)) + self.nb_graph+=1 + print(len(self.ax)) + iax = len(self.ax)-1 # The ax index of the new coming plot is the length of the existant ax -1 for indices matter + + # Print time validity + if Ltime: self.showTimeText(self.ax, iax, str(Ltime[i])) + + # Bins by labels + labels = np.array([str(L) for L in Lbins[i]]) + + # Plot + cf = self.ax[iax].bar(labels, var*Lfacconv[i], width=Lwidth[i], color=Lcolor[i], linewidth=Llinewidth[i], edgecolor=Llinecolor[i]) + + # Legend + #TODO : Handling legend with overlap two axis lines in the same box. For now, placement is by hand + if not id_overlap: + self.ax[iax].legend(loc='upper right', bbox_to_anchor=(1, 0.95)) + else: + self.ax[iax].legend(loc='upper right', bbox_to_anchor=(1, 0.90)) + + # Title + if Ltitle: self.set_Title(self.ax, iax, Ltitle[i], id_overlap,Lxlab[i], Lylab[i]) + + # X/Y Axis label + if id_overlap: + self.ax[iax].xaxis.tick_top() + self.ax[iax].xaxis.set_label_position('top') + self.ax[iax].set_xlabel(Lxlab[i]) + self.ax[iax].set_ylabel(Lylab[i]) + else: + self.set_XYaxislab(self.ax, iax, Lxlab[i], Lylab[i]) + + self.ax[iax].tick_params(axis='x', colors=LaxisColor[i]) + + # X/Y Axis limits value + if Lxlim: + try: + self.set_xlim(self.ax, iax, Lxlim[i]) + except: + pass + if Lylim: + try: + self.set_ylim(self.ax, iax, Lylim[i]) + except: + pass + + return self.fig +#def initialize_default_val(Lvar, Dparam): +# #TODO : initialize default value for all parameter of all type of graphs +# #Returns All the parameters given in Dparam where : +# "- If no value is found (empty list []) : return the default value (if exist) * number of graph +# #- If ONE value only is found : return the value copied x times the number of graph +# #- If the list is complete, nothing is done +# #CURRENT PROBLEM +# #The returned value do not change the true referenced variable given as argument +# # Number of graphs +# l = len(Lvar) +# +# # Add an extra percentage of the top max value for forcing the colorbar show the true user maximum value (correct a bug) +# #if Dparam['Lstep'] and Dparam['Lmaxval']: Dparam['Lmaxval'] = list(map(lambda x, y: x + 1E-6*y, Dparam['Lmaxval'], Dparam['Lstep']) ) #The extra value is 1E-6 times the step ticks of the colorbar +# print(Dparam.items()) +# +# # Read on which parameters initialize the default values +# for args_t in list(Dparam.items()): # Test on all arguments present, if they are empty list, default values apply for each graph +# args = list(args_t) +# print(args) +# if args[0] == 'Lfacconv' and not args[1]: args[1] = [1.0]*l +# elif args[0] == 'Lcolormap' and not args[1]: args[1] = ['gist_rainbow_r']*l +# elif args[0] == 'LcolorLine' and not args[1]: args[1] = ['black']*l +# elif args[0] == 'Lpltype' and not args[1]: args[1]= ['cf']*l +# elif args[0] == 'LaddWhite_cm' and not args[1]: args[1] = ['False']*l +# elif args[0] == 'Lstep' and not args[1]: args[1] = [None]*l # default value filled later +# elif args[0] == 'Lstepticks' and not args[1]: args[1] = [None]*l +# Dparam[args[0]] = args[1] +# print(args) +# +# # Check if there is no value for a parameter +## for args_t in list(Dparam.items()): +## args = list(args_t) +## if args[1] +# # Number of contours level +## for i in range(l): +## if 'Lstepticks' in arguments.args and 'Lmaxval' in arguments.args and 'Lminval' in arguments.args: +## Lstep[i] = (Lmaxval[i] - Lminval[i])/20 # Default value of number of steps is 20 +## Lstepticks[i] = Lstep[i] # Default value is stepticks are the same as steps values +# +# +# return Dparam diff --git a/src/LIB/Python/misc_functions.py b/src/LIB/Python/misc_functions.py new file mode 100644 index 0000000000000000000000000000000000000000..e1e467a767691b327d4030445820299d6f77a3ca --- /dev/null +++ b/src/LIB/Python/misc_functions.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Thu Feb 25 11:25:31 2021 + +@author: rodierq +""" +import copy +from scipy.interpolate import RectBivariateSpline +import numpy as np +import math + +def convert_date(datesince, time_in_sec): + print(type(datesince)) + print(type(time_in_sec)) + return str(time_in_sec) + datesince[:33] + +class mean_operator(): + def MYM(self,var): + ny = var.shape[1] + out = copy.deepcopy(var) + for j in range(ny-1): + out[:,j,:] = (var[:,j,:] + var[:,j+1,:])*0.5 + return out + + def MXM(self,var): + nx = var.shape[2] + out = copy.deepcopy(var) + for i in range(nx-1): + out[:,:,i] = (var[:,:,i] + var[:,:,i+1])*0.5 + return out + + def MZM(self,var): + nz = var.shape[0] + out = copy.deepcopy(var) + for k in range(nz-1): + out[k,:,:] = (var[k,:,:] + var[k+1,:,:])*0.5 + return out + +def windvec_verti_proj(u, v, lvl, angle): + """ + Compute the projected horizontal wind vector on an axis with a given angle w.r.t. the x/ni axes (West-East) + Arguments : + - u : U-wind component + - v : V-wind component + - angle (radian) of the new axe w.r.t the x/ni axes (West-East). angle = 0 for (z,x) sections, angle=pi/2 for (z,y) sections + Returns : + - a 3D wind component projected on the axe to be used with Panel_Plot.vector as Lvar1 + """ + out = copy.deepcopy(u) + for k in range(len(lvl)): + out[k,:,:] = u[k,:,:]*math.cos(angle) + v[k,:,:]*math.sin(angle) + return out + +def oblique_proj(var, ni, nj, lvl, i_beg, j_beg, i_end, j_end): + """ + Compute an oblique projection of a 3D variable w.r.t. its axes + Arguments : + - var : 3D var to project (example THT) + - ni : 1D x-axe of the 3D dimension + - nj : 1D y-axe of the 3D dimension + - level : 1D level variable (level or level_w) + - i_beg, j_beg : coordinate of the begin point of the new axe + - i_end, j_end : coordinate of the end point of the new axe + Returns : + - a 2D (z,m) variable projected on the oblique axe + - a 1D m new axe (distance from the beggining point) + - the angle (radian) of the new axe w.r.t the x/ni axes (West-East) + """ + dist_seg=np.sqrt((i_end-i_beg)**2.0 + (j_end-j_beg)**2.0) # Distance de la section oblique m + out_var = np.zeros((len(lvl),int(dist_seg)+1)) # Initialisation du nouveau champs projeté dans la coupe (z,m) + axe_m = np.zeros(int(dist_seg)+1) #Axe des abscisses qui sera tracé selon la coupe + axe_m_coord = [] #Coordonnées x,y des points qui composent l'axe + axe_m_coord.append( (ni[i_beg],nj[j_beg]) ) #Le premier point est celui donné par l'utilisateur + for m in range(int(dist_seg)): #Discrétisation selon distance de la coupe / int(distance_de_la_coupe) + axe_m_coord.append( (axe_m_coord[0][0] + (ni[i_end]-ni[i_beg])/(int(dist_seg))*(m+1), + axe_m_coord[0][1] + (nj[j_end]-nj[j_beg])/(int(dist_seg))*(m+1) )) + axe_m[m+1] = np.sqrt((ni[i_beg]-axe_m_coord[m+1][0])**2 + (nj[j_beg]-axe_m_coord[m+1][1])**2) + + for k in range(len(lvl)): + a=RectBivariateSpline(ni, nj,var[k,:,:],kx=1,ky=1) #Interpolation par niveau à l'ordre 1 pour éviter des valeurs négatives de champs strictement > 0 + for m in range(int(dist_seg)+1): + out_var[k,m] = a.ev(axe_m_coord[m][0],axe_m_coord[m][1]) # La fonction ev de RectBivariate retourne la valeur la plus proche du point considéré + + angle_proj = math.acos((ni[i_end]-ni[i_beg])/axe_m[-1]) + return angle_proj, out_var, axe_m + +def comp_altitude1DVar(oneVar2D, orography, ztop, level, n_xory): + """ + Compute and returns an altitude and x or y grid mesh variable in 2D following the topography in 1D + To be used with 2D simulations + Arguments : + - oneVar2D : a random netCDF 2D var (example UT, THT) + - orography : 1D orography (ZS) + - ztop : scalar of the top height of the model (ZTOP) + - level : 1D level variable (level or level_w) + - n_xory: : 1D directionnal grid variable (ni_u, nj_u, ni_v or nj_v) + Returns : + - a 2D altitude variable with topography taken into account + - a 2D directionnal variable + """ + n_xory_2D = copy.deepcopy(oneVar2D) + altitude = copy.deepcopy(oneVar2D) + for i in range(len(level)): + n_xory_2D[i,:] = n_xory + for j in range(len(n_xory)): + for k in range(len(level)): + altitude[k,j] = orography[j] + level[k]*((ztop-orography[j])/ztop) + return altitude, n_xory_2D + +def comp_altitude2DVar(oneVar3D, orography, ztop, level, n_y, n_x): + """ + Compute and returns an altitude and x or y grid mesh variable in 3D following the topography in 2D + To be used with 3D simulations in cartesian coordinates + Arguments : + - oneVar3D : a random netCDF 3D var (example UT, THT) + - orography : 2D orography (ZS) + - ztop : scalar of the top height of the model (ZTOP) + - level : 1D level variable (level or level_w) + - n_xory: : 1D directionnal grid variable (ni_u, nj_u, ni_v or nj_v) + Returns : + - a 3D altitude variable with topography taken into account + - a 3D directionnal variable + """ + n_x3D = copy.deepcopy(oneVar3D) + n_y3D = copy.deepcopy(oneVar3D) + altitude = copy.deepcopy(oneVar3D) + for i in range(len(level)): + n_y3D[i,:] = n_y + n_x3D[i,:] = n_x + for i in range(oneVar3D.shape[2]): + for j in range(oneVar3D.shape[1]): + for k in range(len(level)): + altitude[k,j,i] = orography[j,i] + level[k]*((ztop-orography[j,i])/ztop) + return altitude, n_x3D, n_y3D diff --git a/src/LIB/Python/read_MNHfile.py b/src/LIB/Python/read_MNHfile.py new file mode 100644 index 0000000000000000000000000000000000000000..5158f4b67218b64a16fb1e4335f993aed85ed249 --- /dev/null +++ b/src/LIB/Python/read_MNHfile.py @@ -0,0 +1,257 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Mon Feb 22 10:29:13 2021 + +@author: rodierq +""" + +import netCDF4 as nc +import numpy as np + +def read_netcdf(LnameFiles, Dvar_input, path='.', removeHALO=True): + Dvar = {} + for i,nameFiles in enumerate(LnameFiles): + f_nb = 'f' + str(i+1) + print('Reading file ' + f_nb) + print(path + nameFiles) + if '000' in nameFiles[-6:-3]: #time series file (diachronic) + theFile = nc.Dataset(path + nameFiles,'r') + if theFile['MASDEV'][0] <= 54: + read_TIMESfiles_54(theFile, f_nb, Dvar_input, Dvar) + else : # 55 groups variables + read_TIMESfiles_55(theFile, f_nb, Dvar_input, Dvar, removeHALO) + theFile.close() + else: + read_BACKUPfile(nameFiles, f_nb, Dvar_input, Dvar, path=path, removeHALO=removeHALO) + return Dvar #Return the dic of [files][variables] + +def read_BACKUPfile(nameF, ifile, Dvar_input, Dvar_output, path='.', removeHALO=True): + theFile = nc.Dataset(path + nameF,'r') + Dvar_output[ifile] = {} #initialize dic for each files + + # Reading date since beginning of the model run + Dvar_output[ifile]['date'] = theFile.variables['time'].units + Dvar_output[ifile]['time'] = theFile.variables['time'][0] + + for var in Dvar_input[ifile]: #For each files + # Read variables + n_dim = theFile.variables[var].ndim + name_dim = theFile.variables[var].dimensions + # print(var + " n_dim = " + str(n_dim)) + + if (n_dim ==0) or (n_dim == 1 and 'time' in name_dim): #Scalaires or Variable time + Dvar_output[ifile][var] = theFile.variables[var][0].data + else: + if removeHALO: + if n_dim == 1: + Dvar_output[ifile][var] = theFile.variables[var][1:-1] #Variables 1D + elif n_dim == 2: + if theFile.variables[var].shape[0] == 1 and 'size' in name_dim[1]: #Variables 2D with the second dimension not a coordinate (--> list of strings : chemicals) + Dvar_output[ifile][var] = theFile.variables[var][0,:] #Variables 2D + elif theFile.variables[var].shape[0] == 1: #Variables 2D with first dim = 0 + Dvar_output[ifile][var] = theFile.variables[var][0,1:-1] #Variables 2D + else: + Dvar_output[ifile][var] = theFile.variables[var][1:-1,1:-1] #Variables 2D + elif n_dim == 5: #Variables time, sizeXX, level, nj, ni (ex: chemical budgets in 3D) + Dvar_output[ifile][var] = theFile.variables[var][0, :, 1:-1,:1:-1,1:-1] + elif n_dim == 4 and 'time' in name_dim and ('level' in name_dim or 'level_w' in name_dim): # time,z,y,x + if theFile.variables[var].shape[1] == 1: #Variables 4D time,z,y,x with time=0 z=0 + Dvar_output[ifile][var] = theFile.variables[var][0,0,1:-1,1:-1] #Variables 2D y/x + elif theFile.variables[var].shape[2] == 1: #Variable 2D (0,zz,0,xx) + Dvar_output[ifile][var] = theFile.variables[var][0,1:-1,0,1:-1] #Variables 2D z/y + elif theFile.variables[var].shape[3] == 1: #Variable 2D (0,zz,yy,0) + Dvar_output[ifile][var] = theFile.variables[var][0,1:-1,1:-1,0] #Variables 2D z/x + ## ATTENTION VARIABLE 1D codé en 4D non faite + else: #Variable 3D simple + Dvar_output[ifile][var] = theFile.variables[var][0,1:-1,1:-1,1:-1] #Variables time + 3D + elif n_dim == 4 and 'time' in name_dim and 'level' not in name_dim and 'level_w' not in name_dim: # time,nb_something,y,x + Dvar_output[ifile][var] = theFile.variables[var][0,:,1:-1,1:-1] #Variables 2D y/x + elif n_dim == 3 and 'time' in name_dim: # time, y, x + Dvar_output[ifile][var] = theFile.variables[var][0,1:-1,1:-1] + else : + Dvar_output[ifile][var] = theFile.variables[var][1:-1,1:-1,1:-1] #Variables 3D + else: + if n_dim == 1: + Dvar_output[ifile][var] = theFile.variables[var][:] #Variables 1D + elif n_dim == 2: + if theFile.variables[var].shape[0] == 1 and 'size' in name_dim[1]: #Variables 2D with the second dimension not a coordinate (--> list of strings : chemicals) + Dvar_output[ifile][var] = theFile.variables[var][0,:] #Variables 2D + elif theFile.variables[var].shape[0] == 1: #Variables 2D with first dim = 0 + Dvar_output[ifile][var] = theFile.variables[var][0,:] #Variables 2D + else: + Dvar_output[ifile][var] = theFile.variables[var][:,:] #Variables 2D + elif n_dim == 5: #Variables time, sizeXX, level, nj, ni (ex: chemical budgets in 3D) + Dvar_output[ifile][var] = theFile.variables[var][0,:,:,:,:] + elif n_dim == 4: # time,z,y,x + if theFile.variables[var].shape[1] == 1: #Variables 4D time,z,y,x with time=0 z=0 + Dvar_output[ifile][var] = theFile.variables[var][0,0,:,:] #Variables 2D y/x + elif theFile.variables[var].shape[2] == 1: #Variable 2D (0,zz,0,xx) + Dvar_output[ifile][var] = theFile.variables[var][0,:,0,:] #Variables 2D z/y + elif theFile.variables[var].shape[3] == 1: #Variable 2D (0,zz,yy,0) + Dvar_output[ifile][var] = theFile.variables[var][0,:,:,0] #Variables 2D z/x + ## ATTENTION VARIABLE 1D codé en 4D non faite + else: #Variable 3D simple + Dvar_output[ifile][var] = theFile.variables[var][0,:,:,:] #Variables time + 3D + elif n_dim ==3 and name_dim in var.dimensions: # time, y, x + Dvar_output[ifile][var] = theFile.variables[var][0,:,:] + else: + Dvar_output[ifile][var] = theFile.variables[var][:,:,:] #Variables 3D + # For all variables except scalars, change Fill_Value to NaN + Dvar_output[ifile][var]= np.where(Dvar_output[ifile][var] != -99999.0, Dvar_output[ifile][var], np.nan) + Dvar_output[ifile][var]= np.where(Dvar_output[ifile][var] != 999.0, Dvar_output[ifile][var], np.nan) + + theFile.close() + return Dvar_output #Return the dic of [files][variables] + +def read_TIMESfiles_54(theFile, ifile, Dvar_input, Dvar_output): + Dvar_output[ifile] = {} #initialize dic for each files + + # Level variable is automatically read without the Halo + Dvar_output[ifile]['level'] = theFile.variables['level'][1:-1] + + # Time variable is automatically read (time since begging of the run) from the 1st variable of the asked variable to read + suffix, name_first_var = remove_PROC(Dvar_input[ifile][0]) + try: # It is possible that there is only one value (one time) in the .000 file, as such time series are not suitable and the following line can't be executed. The time variable is then not written + increment = theFile.variables[name_first_var+'___DATIM'][1,-1] - theFile.variables[name_first_var+'___DATIM'][0,-1] #-1 is the last entry of the date (current UTC time in seconds) + length_time = theFile.variables[name_first_var+'___DATIM'].shape[0] + Dvar_output[ifile]['time'] = np.arange(increment,increment*(length_time+1),increment) + except: + pass + + for var in Dvar_input[ifile]: #For each files + suffix, var_name = remove_PROC(var) + n_dim = theFile.variables[var].ndim + name_dim = theFile.variables[var].dimensions + + # First, test if the variable is a dimension/coordinate variable + if (n_dim ==0): # Scalaires variable + Dvar_output[ifile][var] = theFile.variables[var][0].data + pass + elif n_dim == 1: + Dvar_output[ifile][var_name] = theFile.variables[var][1:-1] # By default, the Halo is always removed because is not in the other variables in any .000 variable + pass + elif n_dim == 2: + Lsize1 = list_size1(n_dim, name_dim) + if Lsize1 == [True, False]: Dvar_output[ifile][var_name] = theFile.variables[var][0,1:-1] + pass + + Lsize1 = list_size1(n_dim, name_dim) + if Lsize1 == [True, False, False, True, True]: Dvar_output[ifile][var_name] = theFile.variables[var][0,:,:,0,0].T # Need to be transposed here + if Lsize1 == [True, True, False, True, False]: Dvar_output[ifile][var_name] = theFile.variables[var][0,0,:,0,:] + + return Dvar_output #Return the dic of [files][variables] + +def read_TIMESfiles_55(theFile, ifile, Dvar_input, Dvar_output, removeHALO=False): + """ + Read variables from MNH MASDEV >= 5.5.0 + Parameters : + - Dvar_input : dictionnary of {file : var}. var can be either + - a string = the variable name + - or a tuple of ('group_name','var_name') + If the variable desired is in a group_name and the group_name is not specified, it is assumed group_name = variable_name + except for specific variable as (cart, neb, clear, cs1, cs2, cs3) type + Return : + Dvar_output : dictionnary of Dvar_output[ifile][variables or tuple (group,variables) if the user specified a tuple] + """ + Dvar_output[ifile] = {} #initialize dic for each files + def read_var(theFile, Dvar_output, var): + suffix, var_name = remove_PROC(var) + try: # NetCDF4 Variables + n_dim = theFile.variables[var_name].ndim + # First, test if the variable is a dimension/coordinate variable + if (n_dim ==0): # Scalaires variable + Dvar_output[var_name] = theFile.variables[var_name][0].data + else: + if(removeHALO): + if n_dim == 1: + Dvar_output[var_name] = theFile.variables[var_name][1:-1] + elif n_dim == 2: + Dvar_output[var_name] = theFile.variables[var_name][1:-1,1:-1] + else: + raise NameError("Lecture des variables de dimension sup a 2 pas encore implementees pour fichiers .000") + else: + if n_dim == 1: + Dvar_output[var_name] = theFile.variables[var_name][:] + elif n_dim == 2: + Dvar_output[var_name] = theFile.variables[var_name][:,:] + else: + raise NameError("Lecture des variables de dimension sup a 2 pas encore implementees pour fichiers .000") + except KeyError: # NetCDF4 Group not specified by the user + if '(cart)' in var_name or '(neb)' in var_name or '(clear)' in var_name or '(cs1)' in var_name or '(cs2)' in var_name or '(cs3)' in var_name: + # If users specify the complete variable name with averaging type + group_name = get_group_from_varname(var_name) + else: + group_name = var_name + read_from_group(theFile, Dvar_output, var, var) + return Dvar_output + + def read_from_group(theFile, Dvar_output, group_name, var): + suffix, var_name = remove_PROC(var) + if group_name == 'TSERIES': #always 1D + Dvar_output[(group_name,var)] = theFile.groups['TSERIES'].variables[var][:] + elif group_name == 'ZTSERIES': #always 2D + Dvar_output[(group_name,var)] = theFile.groups['ZTSERIES'].variables[var][:,:].T + elif 'XTSERIES' in group_name: #always 2D + Dvar_output[(group_name,var)] = theFile.groups[group_name].variables[var][:,:].T + elif theFile.groups[group_name].type == 'TLES' : # LES type + try: #By default, most variables read are 2D cart and user does not specify it in the variable name + whites = ' '*(17 - len('(cart)') - len(var_name)) + Dvar_output[var] = theFile.groups[var].variables[var + whites + '(cart)'][:,:].T + except: + try: #Variable 3D sv,time_les, level_les + Dvar_output[var] = theFile.groups[group_name].variables[var][:,:,:] + except: + try: #Variable 2D with type of variable specified (cart, neb, clear, cs1, cs2, cs3) + Dvar_output[var] = theFile.groups[group_name].variables[var][:,:].T + except ValueError: # Variable 1D + Dvar_output[var] = theFile.groups[group_name].variables[var][:] + elif theFile.groups[group_name].type == 'CART': # Budget CART type + shapeVar = theFile.groups[group_name].variables[suffix].shape + Ltosqueeze=[] # Build a tuple with the number of the axis which are 0 dimensions to be removed by np.squeeze + if shapeVar[0]==1: Ltosqueeze.append(0) + if shapeVar[1]==1: Ltosqueeze.append(1) + if shapeVar[2]==1: Ltosqueeze.append(2) + if shapeVar[3]==1: Ltosqueeze.append(3) + Ltosqueeze=tuple(Ltosqueeze) + Dvar_output[group_name] = np.squeeze(theFile.groups[group_name].variables[suffix][:,:,:,:], axis=Ltosqueeze) + else: + raise NameError("Type de groups variables not implemented in read_MNHfile.py") + return Dvar_output + for var in Dvar_input[ifile]: #For each var + if type(var) == tuple: + Dvar_output[ifile] = read_from_group(theFile, Dvar_output, var[0], var[1]) + else: + Dvar_output[ifile] = read_var(theFile, Dvar_output, var) + + return Dvar_output #Return the dic of [files][variables] + +def list_size1(n_dim, named_dim): + Lsize1 = [] + for i in range(n_dim): + if 'size1' == named_dim[i]: + Lsize1.append(True) + else: + Lsize1.append(False) + return Lsize1 + +def remove_PROC(var): + if '___PROC' in var: + var_name = var[:-8] + suffix = "" # No need of suffix for MNHVERSION < 550 (suffix is for NetCDF4 group) + elif '___ENDF' in var or '___INIF' in var or '___AVEF' in var: + var_name = var[:-7] + suffix = var[-4:] + else: + var_name = var + suffix = '' + return suffix, var_name + +def get_group_from_varname(var): + group_name='' + for i in range(len(var)): + if var[i] is not ' ': + group_name+=var[i] + else: # As soon as the caracter is a blank, the group variable is set + break + return group_name diff --git a/src/LIB/RAD/ecrad-1.0.1_mnh/ifs/cos_sza.F90 b/src/LIB/RAD/ecrad-1.0.1_mnh/ifs/cos_sza.F90 index f02aeb1dc0d8b66f526824678b7bcea1428cb5f0..215743cfb0e67a32125a895a48f7114e5099eba5 100644 --- a/src/LIB/RAD/ecrad-1.0.1_mnh/ifs/cos_sza.F90 +++ b/src/LIB/RAD/ecrad-1.0.1_mnh/ifs/cos_sza.F90 @@ -135,7 +135,7 @@ DO JCOL = KSTART,KEND ENDDO ! Computation of solar hour angle from sunposn -ZTIME = TDTRAD_FULL%TIME + 0.5*XDTRAD +ZTIME = TDTRAD_FULL%XTIME + 0.5*XDTRAD ZUT = MOD( 24.0+MOD(ZTIME/3600.,24.0),24.0 ) ZTUT = ZUT - XTSIDER ZSOLANG = (ZTUT-12.0)*15.0*(RPI/180.) ! hour angle in radians diff --git a/src/LIB/RAD/ecrad-1.0.1_mnh/ifs/radiation_scheme.F90 b/src/LIB/RAD/ecrad-1.0.1_mnh/ifs/radiation_scheme.F90 index 4f00fba6f7b381a844ba27db13d6042dc9668d28..e0cdd612165c9401974af01bd5de8a1092087509 100644 --- a/src/LIB/RAD/ecrad-1.0.1_mnh/ifs/radiation_scheme.F90 +++ b/src/LIB/RAD/ecrad-1.0.1_mnh/ifs/radiation_scheme.F90 @@ -79,7 +79,7 @@ USE YOMHOOK , ONLY : LHOOK, DR_HOOK USE MODD_PARAM_ECRAD_n, ONLY : NAERMACC, NDECOLAT, XCLOUD_FRAC_STD, & ! replace YRERAD to get attributes & LAPPROXLWUPDATE, LAPPROXSWUPDATE USE MODD_RADIATIONS_n , ONLY : NSWB_MNH,NSWB_OLD -USE MODE_THERMO ! , ONLY QSATW_2D +USE MODE_THERMO , ONLY : QSAT USE MODD_DYN_n , ONLY : XTSTEP, NSTOP USE MODD_TIME , ONLY : TDTEXP USE MODD_TIME_n , ONLY : TDTMOD,TDTCUR @@ -336,7 +336,7 @@ thermodynamics%temperature_hl(KIDIA:KFDIA,KLEV+1) & ! & PPRESSURE, PTEMPERATURE, thermodynamics%h2o_sat_liq, 2) !MNH -thermodynamics%h2o_sat_liq(:,:) = QSATW_2D(REAL(PPRESSURE), REAL(PTEMPERATURE)) +thermodynamics%h2o_sat_liq(:,:) = QSAT(REAL(PPRESSURE), REAL(PTEMPERATURE)) thermodynamics%h2o_sat_liq(:,:) = thermodynamics%h2o_sat_liq(:,:) & & / (1.+thermodynamics%h2o_sat_liq(:,:)) ! mixing ratio => spec humid !MNH @@ -361,8 +361,8 @@ single_level%lw_emissivity(KIDIA:KFDIA,2) = PEMIS_WINDOW(KIDIA:KFDIA) ! Create the relevant seed from date and time get the starting day ! and number of minutes since start ! IDAY = NDD(NINDAT) ! NINDAT is AAAAMMDD initial date NDD extract DD as INTEGER -IDAY = TDTEXP%TDATE%DAY ! MNH -ITIM = NINT((TDTMOD%time-TDTCUR%time) / 60.0_JPRB) ! YRRIP contains timestep infos ; number of minutes since beginning +IDAY = TDTEXP%DATE%NDAY ! MNH +ITIM = NINT((TDTMOD%xtime-TDTCUR%xtime) / 60.0_JPRB) ! YRRIP contains timestep infos ; number of minutes since beginning DO JLON = KIDIA, KFDIA ! This method gives a unique value for roughly every 1-km square ! on the globe and every minute. ASIN(PGEMU)*60 gives rough diff --git a/src/LIB/SURCOUCHE/src/mode_field.f90 b/src/LIB/SURCOUCHE/src/mode_field.f90 index 082ab6328083801e8ddd309de81db5d265bb516e..041c3a85b1f926af62708756566e192c72a596ff 100644 --- a/src/LIB/SURCOUCHE/src/mode_field.f90 +++ b/src/LIB/SURCOUCHE/src/mode_field.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 2016-2020 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 2016-2021 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. @@ -4413,6 +4413,7 @@ IF (.NOT.ASSOCIATED(TFIELDLIST(IID)%TFIELD_C0D(KTO)%DATA)) THEN CALL PRINT_MSG(NVERB_DEBUG,'GEN','FIELDLIST_GOTO_MODEL',& 'TFIELDLIST(IID)%TFIELD_C0D(KTO)%DATA was not associated for '//TFIELDLIST(IID)%CMNHNAME) ALLOCATE(CHARACTER(LEN=4) :: TFIELDLIST(IID)%TFIELD_C0D(KTO)%DATA) + TFIELDLIST(IID)%TFIELD_C0D(KTO)%DATA='' END IF CSURF => TFIELDLIST(IID)%TFIELD_C0D(KTO)%DATA ! diff --git a/src/LIB/SURCOUCHE/src/mode_io_field_write.f90 b/src/LIB/SURCOUCHE/src/mode_io_field_write.f90 index 4ad2b0866ff78de3f94f55658457549b4e66725b..4e467082d9923068b982c5a07f8734fdce300d78 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_field_write.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_field_write.f90 @@ -391,7 +391,8 @@ subroutine IO_Field_create( tpfile, tpfield ) #ifdef MNH_IOCDF4 ! Write the variable attributes in the non-split file if ( tpfile%nmaster_rank==isp .and. gnc4 ) & - call IO_Field_header_split_write_nc4( tpfile, tzfield, tpfile%tncdims%tdims(tzfield%ndimlist(3))%nlen ) + call IO_Field_header_split_write_nc4( tpfile, tzfield, & + Int( tpfile%tncdims%tdims(tzfield%ndimlist(3))%nlen, kind = Kind( 1 ) ) ) end if #endif diff --git a/src/LIB/SURCOUCHE/src/mode_io_file_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_file_nc4.f90 index d2b3b5ab2311cb709fb78e0b05cc682dc200cfea..5fc23539af2b79f2eb7c989229da81b008eeab36 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_file_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_file_nc4.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 2018-2019 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 2018-2021 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. @@ -70,8 +70,8 @@ end subroutine IO_File_create_nc4 subroutine IO_File_close_nc4(tpfile,kstatus) use mode_io_tools_nc4, only: IO_Iocdf_dealloc_nc4 - type(tfiledata), intent(inout) :: tpfile - integer(kind=CDFINT), optional, intent(out) :: kstatus + type(tfiledata), intent(inout) :: tpfile + integer, optional, intent(out) :: kstatus integer(kind=CDFINT) :: istatus diff --git a/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 index 544dc32ce55ca53e12e8286519156f196e225f6b..f6d21f935b2095cfd24eed2a48e0a08a71839510 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 @@ -121,7 +121,7 @@ IF (IGRID==0) THEN ILEN = 1 END IF CASE (1) - call IO_Dim_find_create_nc4( tpfile, klen, iidx ) + call IO_Dim_find_create_nc4( tpfile, Int( klen, kind = CDFINT ), iidx ) tpdims(1) = tpfile%tncdims%tdims(iidx) ilen = tpdims(1)%nlen CASE DEFAULT @@ -170,7 +170,7 @@ ELSE ELSE IF ( YDIR == 'ZZ' ) THEN tpdims(1) = tpfile%tncdims%tdims( NMNHDIM_ARAKAWA(igrid,3) ) ELSE IF (JI==TPFIELD%NDIMS) THEN !Guess last dimension - call IO_Dim_find_create_nc4( tpfile, klen, iidx ) + call IO_Dim_find_create_nc4( tpfile, Int( klen, kind = CDFINT ), iidx ) tpdims(1) = tpfile%tncdims%tdims(iidx) END IF ilen = tpdims(1)%nlen @@ -326,7 +326,7 @@ if ( Trim( yprogram ) /= 'PGD' .and. Trim( yprogram ) /= 'NESPGD' .and. Trim( yp call IO_Add_dim_nc4( tpfile, NMNHDIM_LEVEL, 'level', IKU ) call IO_Add_dim_nc4( tpfile, NMNHDIM_LEVEL_W, 'level_w', IKU ) if ( tpfile%ctype /= 'MNHDIACHRONIC' ) & - call IO_Add_dim_nc4( tpfile, NMNHDIM_TIME, 'time', NF90_UNLIMITED ) + call IO_Add_dim_nc4( tpfile, NMNHDIM_TIME, 'time', Int( NF90_UNLIMITED, kind = Kind(1) ) ) end if if ( tpfile%ctype == 'MNHDIACHRONIC' .or. ( lpack .and. l2d ) ) then @@ -638,7 +638,7 @@ subroutine IO_Dim_find_create_nc4( tpfile, klen, kidx, hdimname) use modd_netcdf, only: tdimnc type(tfiledata), intent(in) :: tpfile -integer, intent(in) :: klen +integer(kind=CDFINT), intent(in) :: klen CHARACTER(LEN=*), OPTIONAL, INTENT(IN) :: HDIMNAME integer, intent(out) :: kidx !Position of the dimension in the dimension array @@ -686,9 +686,9 @@ if ( kidx == - 1 ) then Write( ysuffix, '( i0 )' ) klen tzncdims(inewsize)%cname = 'size' // Trim( ysuffix ) end if - tzncdims(inewsize)%nlen = Int( klen, kind = CDFINT ) + tzncdims(inewsize)%nlen = klen - istatus = NF90_DEF_DIM( tpfile%nncid, tzncdims(inewsize)%cname, Int( klen, kind = CDFINT ), tzncdims(inewsize)%nid ) + istatus = NF90_DEF_DIM( tpfile%nncid, tzncdims(inewsize)%cname, klen, tzncdims(inewsize)%nid ) if ( istatus /= NF90_NOERR ) & call IO_Err_handle_nc4( istatus, 'IO_Dim_find_create_nc4', 'NF90_DEF_DIM', Trim( tzncdims(inewsize)%cname) ) diff --git a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 index 497aca4aa476ee02d6fb6adbe6e22e01320e3b0c..a52005298762aa03c0acdd382f424a9a9d0b7a37 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 @@ -757,7 +757,7 @@ if ( tpfield%cmnhname == 'JMAX' .and. tpfile%tncdims%tdims(NMNHDIM_NJ)%nid == -1 end if #endif if ( tpfield%cmnhname == 'KMAX' .and. tpfile%tncdims%tdims(NMNHDIM_LEVEL)%nid == -1 ) then - call IO_Dim_find_create_nc4( tpfile, kfield + 2 * JPVEXT, iidx, 'Z' ) + call IO_Dim_find_create_nc4( tpfile, Int( kfield + 2 * JPVEXT, kind = CDFINT ), iidx, 'Z' ) end if END SUBROUTINE IO_Field_write_nc4_N0 @@ -998,7 +998,7 @@ KRESP = 0 ILEN = LEN(HFIELD) ISIZE = SIZE(HFIELD) -call IO_Field_create_nc4( tpfile, tpfield, kshape = [ ilen, isize ], kvarid = ivarid, oisempty = gisempty ) +call IO_Field_create_nc4( tpfile, tpfield, kshape = Int ([ ilen, isize ], kind = Kind( 1 ) ), kvarid = ivarid, oisempty = gisempty ) ! Write the data if ( .not. gisempty ) then @@ -1154,7 +1154,7 @@ end if ! Write the data if ( Size( pfield ) > 0 ) then istarts(:) = koffset(:) + 1 - istatus = NF90_PUT_VAR( tpfile%nncid, ivarid, pfield(:), start = istarts(:), count = Shape( pfield ) ) + istatus = NF90_PUT_VAR( tpfile%nncid, ivarid, pfield(:), start = istarts(:), count = Int( Shape( pfield ), kind = CDFINT ) ) if (istatus /= NF90_NOERR) & call IO_Err_handle_nc4( istatus, 'IO_Field_partial_write_nc4_X1', 'NF90_PUT_VAR', Trim( tpfield%cmnhname ), kresp ) end if @@ -1198,7 +1198,7 @@ end if ! Write the data if ( Size( pfield ) > 0 ) then istarts(:) = koffset(:) + 1 - istatus = NF90_PUT_VAR( tzfile%nncid, ivarid, pfield(:,:), start = istarts(:), count = Shape( pfield ) ) + istatus = NF90_PUT_VAR( tzfile%nncid, ivarid, pfield(:,:), start = istarts(:), count = Int( Shape( pfield ), kind = CDFINT ) ) if (istatus /= NF90_NOERR) & call IO_Err_handle_nc4( istatus, 'IO_Field_partial_write_nc4_X2', 'NF90_PUT_VAR', Trim( tzfield%cmnhname ), kresp ) end if @@ -1237,7 +1237,7 @@ end if ! Write the data if ( Size( pfield ) > 0 ) then istarts(:) = koffset(:) + 1 - istatus = NF90_PUT_VAR( tpfile%nncid, ivarid, pfield(:,:,:), start = istarts(:), count = Shape( pfield ) ) + istatus = NF90_PUT_VAR( tpfile%nncid, ivarid, pfield(:,:,:), start = istarts(:), count = Int( Shape( pfield ), kind = CDFINT ) ) if (istatus /= NF90_NOERR) & call IO_Err_handle_nc4( istatus, 'IO_Field_partial_write_nc4_X3', 'NF90_PUT_VAR', Trim( tpfield%cmnhname ), kresp ) end if @@ -1274,7 +1274,7 @@ end if ! Write the data if ( Size( pfield ) > 0 ) then istarts(:) = koffset(:) + 1 - istatus = NF90_PUT_VAR( tpfile%nncid, ivarid, pfield(:,:,:,:), start = istarts(:), count = Shape( pfield ) ) + istatus = NF90_PUT_VAR( tpfile%nncid, ivarid, pfield(:,:,:,:), start = istarts(:), count = Int( Shape( pfield ), kind = CDFINT ) ) if (istatus /= NF90_NOERR) & call IO_Err_handle_nc4( istatus, 'IO_Field_partial_write_nc4_X4', 'NF90_PUT_VAR', Trim( tpfield%cmnhname ), kresp ) end if @@ -1318,7 +1318,7 @@ end if ! Write the data if ( Size( kfield ) > 0 ) then istarts(:) = koffset(:) + 1 - istatus = NF90_PUT_VAR( tzfile%nncid, ivarid, kfield(:,:), start = istarts(:), count = Shape( kfield ) ) + istatus = NF90_PUT_VAR( tzfile%nncid, ivarid, kfield(:,:), start = istarts(:), count = Int( Shape( kfield ), kind = CDFINT ) ) if (istatus /= NF90_NOERR) & call IO_Err_handle_nc4( istatus, 'IO_Field_partial_write_nc4_N2', 'NF90_PUT_VAR', Trim( tzfield%cmnhname ), kresp ) end if @@ -1364,7 +1364,7 @@ end if ! Write the data if ( Size( kfield ) > 0 ) then istarts(:) = koffset(:) + 1 - istatus = NF90_PUT_VAR( tzfile%nncid, ivarid, kfield(:,:,:), start = istarts(:), count = Shape( kfield ) ) + istatus = NF90_PUT_VAR( tzfile%nncid, ivarid, kfield(:,:,:), start = istarts(:), count = Int( Shape( kfield ), kind = CDFINT ) ) if (istatus /= NF90_NOERR) & call IO_Err_handle_nc4( istatus, 'IO_Field_partial_write_nc4_N3', 'NF90_PUT_VAR', Trim( tzfield%cmnhname ), kresp ) end if @@ -1410,7 +1410,7 @@ end if ! Write the data if ( Size( kfield ) > 0 ) then istarts(:) = koffset(:) + 1 - istatus = NF90_PUT_VAR( tzfile%nncid, ivarid, kfield(:,:,:,:), start = istarts(:), count = Shape( kfield ) ) + istatus = NF90_PUT_VAR( tzfile%nncid, ivarid, kfield(:,:,:,:), start = istarts(:), count = Int( Shape( kfield ), kind = CDFINT ) ) if (istatus /= NF90_NOERR) & call IO_Err_handle_nc4( istatus, 'IO_Field_partial_write_nc4_N4', 'NF90_PUT_VAR', Trim( tzfield%cmnhname ), kresp ) end if diff --git a/src/MNH/ini_budget.f90 b/src/MNH/ini_budget.f90 index b5bc6f9ec702cf54ee5adec28b2583811af10d57..30d77166c7bfb08f66e72fcf5f4f9e94e0233d4b 100644 --- a/src/MNH/ini_budget.f90 +++ b/src/MNH/ini_budget.f90 @@ -4569,7 +4569,7 @@ subroutine Sourcelist_nml_compact( tpbudget, hbulist ) use modd_budget, only: NBULISTMAXLEN, tbudgetdata type(tbudgetdata), intent(in) :: tpbudget - character(len=*), dimension(:), allocatable, intent(inout) :: hbulist + character(len=NBULISTMAXLEN), dimension(:), allocatable, intent(inout) :: hbulist integer :: idx integer :: isource diff --git a/src/MNH/ini_modeln.f90 b/src/MNH/ini_modeln.f90 index 1e59f88b7f4939a6e3ca684a6a955dae86687166..dea7f4bcc0509d1db7b63b85daec8b7c3e4d1747 100644 --- a/src/MNH/ini_modeln.f90 +++ b/src/MNH/ini_modeln.f90 @@ -2266,14 +2266,14 @@ IF (CRAD == 'ECMW') THEN ZBARE(:,:) = 0. END IF ! - IF ( CAOP=='EXPL' .AND. LDUST ) THEN + IF ( CAOP=='EXPL' .AND. LDUST .AND. KMI==1) THEN ALLOCATE( XEXT_COEFF_WVL_LKT_DUST( NMAX_RADIUS_LKT_DUST, NMAX_SIGMA_LKT_DUST, NMAX_WVL_SW_DUST ) ) ALLOCATE( XEXT_COEFF_550_LKT_DUST( NMAX_RADIUS_LKT_DUST, NMAX_SIGMA_LKT_DUST ) ) ALLOCATE( XPIZA_LKT_DUST ( NMAX_RADIUS_LKT_DUST, NMAX_SIGMA_LKT_DUST, NMAX_WVL_SW_DUST ) ) ALLOCATE( XCGA_LKT_DUST ( NMAX_RADIUS_LKT_DUST, NMAX_SIGMA_LKT_DUST, NMAX_WVL_SW_DUST ) ) END IF ! - IF ( CAOP=='EXPL' .AND. LSALT ) THEN + IF ( CAOP=='EXPL' .AND. LSALT .AND. KMI==1) THEN ALLOCATE( XEXT_COEFF_WVL_LKT_SALT( NMAX_RADIUS_LKT_SALT, NMAX_SIGMA_LKT_SALT, NMAX_WVL_SW_SALT ) ) ALLOCATE( XEXT_COEFF_550_LKT_SALT( NMAX_RADIUS_LKT_SALT, NMAX_SIGMA_LKT_SALT ) ) ALLOCATE( XPIZA_LKT_SALT ( NMAX_RADIUS_LKT_SALT, NMAX_SIGMA_LKT_SALT, NMAX_WVL_SW_SALT ) ) diff --git a/src/MNH/ini_nsv.f90 b/src/MNH/ini_nsv.f90 index 3af5e4c350b856c6350277e2314263fb65ba2e8e..56b94ec176cacfb3ca48393fbf74517d78c08c09 100644 --- a/src/MNH/ini_nsv.f90 +++ b/src/MNH/ini_nsv.f90 @@ -68,6 +68,7 @@ END MODULE MODI_INI_NSV ! P. Wautelet 09/03/2021: move some chemistry initializations to ini_nsv ! P. Wautelet 10/03/2021: move scalar variable name initializations to ini_nsv ! P. Wautelet 10/03/2021: add CSVNAMES and CSVNAMES_A to store the name of all the scalar variables +! P. Wautelet 30/03/2021: move NINDICE_CCN_IMM and NIMM initializations from init_aerosol_properties to ini_nsv !------------------------------------------------------------------------------- ! !* 0. DECLARATIONS @@ -103,7 +104,7 @@ USE MODD_LG, ONLY: CLGNAMES, XLG1MIN, XLG2MIN, XLG3MIN USE MODD_LUNIT_n, ONLY: TLUOUT USE MODD_NSV USE MODD_PARAM_C2R2, ONLY: LSUPSAT -USE MODD_PARAM_LIMA, ONLY: NINDICE_CCN_IMM, NMOD_CCN, LSCAV, LAERO_MASS, & +USE MODD_PARAM_LIMA, ONLY: NINDICE_CCN_IMM, NIMM, NMOD_CCN, LSCAV, LAERO_MASS, & NMOD_IFN, NMOD_IMM, LHHONI, & LWARM, LCOLD, LRAIN USE MODD_PARAM_LIMA_COLD, ONLY: CLIMA_COLD_NAMES @@ -133,7 +134,6 @@ INTEGER, INTENT(IN) :: KMI ! model index ! CHARACTER(LEN=2) :: YNUM2 CHARACTER(LEN=3) :: YNUM3 -CHARACTER(LEN=JPSVNAMELGTMAX), DIMENSION(:,:), ALLOCATABLE :: YSVNAMES_TMP INTEGER :: ILUOUT INTEGER :: ISV ! total number of scalar variables INTEGER :: IMODEIDX, IMOMENTS @@ -231,6 +231,23 @@ IF (CCLOUD == 'LIMA' ) THEN NSV_LIMA_IMM_NUCL_A(KMI) = ISV ISV = ISV + MAX(1,NMOD_IMM) END IF + + IF ( NMOD_IFN > 0 ) THEN + IF ( .NOT. ALLOCATED( NIMM ) ) ALLOCATE( NIMM(NMOD_CCN) ) + NIMM(:) = 0 + IF ( ALLOCATED( NINDICE_CCN_IMM ) ) DEALLOCATE( NINDICE_CCN_IMM ) + ALLOCATE( NINDICE_CCN_IMM(MAX( 1, NMOD_IMM )) ) + IF (NMOD_IMM > 0 ) THEN + DO JI = 0, NMOD_IMM - 1 + NIMM(NMOD_CCN - JI) = 1 + NINDICE_CCN_IMM(NMOD_IMM - JI) = NMOD_CCN - JI + END DO +! ELSE IF (NMOD_IMM == 0) THEN ! PNIS exists but is 0 for the call to resolved_cloud +! NMOD_IMM = 1 +! NINDICE_CCN_IMM(1) = 0 + END IF + END IF + ! Homogeneous freezing of CCN IF (LCOLD .AND. LHHONI) THEN NSV_LIMA_HOM_HAZE_A(KMI) = ISV @@ -753,18 +770,6 @@ IF ( LBLOWSNOW ) THEN END IF END IF -! Allocate/reallocate CSVNAMES_A -IF ( .NOT. ALLOCATED( CSVNAMES_A ) ) ALLOCATE( CSVNAMES_A( NSV, KMI) ) -IF ( SIZE( CSVNAMES_A, 1 ) < NSV .OR. SIZE( CSVNAMES_A, 2 ) < KMI ) THEN - ALLOCATE( YSVNAMES_TMP(NSV, KMI) ) - DO JJ = 1, SIZE( CSVNAMES_A, 2 ) - DO JI = 1, SIZE( CSVNAMES_A, 1 ) - YSVNAMES_TMP(JI, JJ) = CSVNAMES_A(JI, JJ) - END DO - END DO - CALL MOVE_ALLOC( FROM = YSVNAMES_TMP, TO = CSVNAMES_A ) -END IF - !Fill CSVNAMES_A for model KMI DO JSV = 1, NSV_USER_A(KMI) WRITE( YNUM3, '( I3.3 )' ) JSV diff --git a/src/MNH/init_aerosol_properties.f90 b/src/MNH/init_aerosol_properties.f90 index 84f1a5bd0eca3a6f509a72b224f882d3dfe027d0..b52de24a753b5687a88bf2e42f6b6155596cdc4e 100644 --- a/src/MNH/init_aerosol_properties.f90 +++ b/src/MNH/init_aerosol_properties.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 2013-2019 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 2013-2021 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. @@ -36,23 +36,21 @@ END MODULE MODI_INIT_AEROSOL_PROPERTIES !! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O !! Philippe Wautelet: 22/01/2019: bugs correction: incorrect writes + unauthorized goto ! P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg -!! +! P. Wautelet 30/03/2021: move NINDICE_CCN_IMM and NIMM initializations from init_aerosol_properties to ini_nsv !------------------------------------------------------------------------------- ! !* 0. DECLARATIONS ! ------------ ! -USE MODD_PARAM_n, ONLY : CCLOUD USE MODD_LUNIT, ONLY : TLUOUT0 -USE MODD_PARAM_LIMA, ONLY : LWARM, LACTI, NMOD_CCN, HINI_CCN, HTYPE_CCN, & +USE MODD_PARAM_LIMA, ONLY : NMOD_CCN, HINI_CCN, HTYPE_CCN, & XR_MEAN_CCN, XLOGSIG_CCN, XRHO_CCN, & XKHEN_MULTI, XMUHEN_MULTI, XBETAHEN_MULTI, & XLIMIT_FACTOR, CCCN_MODES, LSCAV, & XACTEMP_CCN, XFSOLUB_CCN, & - LCOLD, LNUCL, NMOD_IFN, NSPECIE, CIFN_SPECIES, & + NMOD_IFN, NSPECIE, CIFN_SPECIES, & XMDIAM_IFN, XSIGMA_IFN, XRHO_IFN, XFRAC, XFRAC_REF, & - CINT_MIXING, NMOD_IMM, NINDICE_CCN_IMM, NIMM, & - NPHILLIPS + CINT_MIXING, NPHILLIPS ! use mode_msg ! @@ -359,22 +357,6 @@ IF ( NMOD_IFN .GE. 1 ) THEN XFRAC_REF(4)=0.06 END IF ! -! Immersion modes -! - IF (.NOT.(ALLOCATED(NIMM))) ALLOCATE(NIMM(NMOD_CCN)) - NIMM(:)=0 - IF (ALLOCATED(NINDICE_CCN_IMM)) DEALLOCATE(NINDICE_CCN_IMM) - ALLOCATE(NINDICE_CCN_IMM(MAX(1,NMOD_IMM))) - IF (NMOD_IMM .GE. 1) THEN - DO J = 0, NMOD_IMM-1 - NIMM(NMOD_CCN-J)=1 - NINDICE_CCN_IMM(NMOD_IMM-J) = NMOD_CCN-J - END DO -! ELSE IF (NMOD_IMM == 0) THEN ! PNIS existe mais vaut 0, pour l'appel à resolved_cloud -! NMOD_IMM = 1 -! NINDICE_CCN_IMM(1) = 0 - END IF -! END IF ! NMOD_IFN > 0 ! END SUBROUTINE INIT_AEROSOL_PROPERTIES diff --git a/src/MNH/modd_precision.f90 b/src/MNH/modd_precision.f90 index 0d8b16a390fe987c3b165d3d98da575cb00442ce..a759ddf1f11072a20864f52cc148e8e3fa66d79d 100644 --- a/src/MNH/modd_precision.f90 +++ b/src/MNH/modd_precision.f90 @@ -54,8 +54,13 @@ integer, parameter :: MNHREAL128 = selected_real_kind( p = 33, r = 4931 ) integer, parameter :: MNHINT32_MPI = MPI_INTEGER4 integer, parameter :: MNHINT64_MPI = MPI_INTEGER8 +#ifdef MNH_NO_MPI_LOGICAL48 +integer, parameter :: MNHLOG32_MPI = MPI_LOGICAL +integer, parameter :: MNHLOG64_MPI = MPI_LOGICAL +#else integer, parameter :: MNHLOG32_MPI = MPI_LOGICAL4 integer, parameter :: MNHLOG64_MPI = MPI_LOGICAL8 +#endif integer, parameter :: MNHREAL32_MPI = MPI_REAL4 integer, parameter :: MNHREAL64_MPI = MPI_REAL8 diff --git a/src/MNH/read_chem_data_netcdf_case.f90 b/src/MNH/read_chem_data_netcdf_case.f90 index faef2f0c5f4b090217d07037f93ecae55c76d6b8..a33a405bcb9b36950f8043001d4eaf173e0c3a78 100644 --- a/src/MNH/read_chem_data_netcdf_case.f90 +++ b/src/MNH/read_chem_data_netcdf_case.f90 @@ -192,12 +192,13 @@ TYPE(TFILEDATA),POINTER :: TZFILE ! For netcdf ! CHARACTER(LEN=40) :: yrecname +integer :: IKILEN integer(kind=CDFINT) :: istatus, incid, ivarid integer(kind=CDFINT) :: ilat_varid, ilon_varid, ilev_varid, itime_varid integer(kind=CDFINT) :: ihyam_varid, ihybm_varid, ip0_varid, it_varid, iq_varid, ips_varid integer(kind=CDFINT) :: irecid, ilatid, ilonid, ilevid, itimeid integer(kind=CDFINT) :: ilatlen, ilonlen, ilevlen, inrecs, itimelen -integer(kind=CDFINT) :: itimeindex, IKILEN +integer(kind=CDFINT) :: itimeindex INTEGER, DIMENSION(:), ALLOCATABLE :: ikinlo INTEGER(kind=CDFINT), DIMENSION(:), ALLOCATABLE :: icount3d, istart3d INTEGER(kind=CDFINT), DIMENSION(:), ALLOCATABLE :: icount2d, istart2d diff --git a/src/MNH/update_nsv.f90 b/src/MNH/update_nsv.f90 index 807307a817b591447011a8e4ba821bb32fec2d0c..6d5f9fdd0977068e6b0b0f5f3c98d7b709ecae50 100644 --- a/src/MNH/update_nsv.f90 +++ b/src/MNH/update_nsv.f90 @@ -37,6 +37,9 @@ use mode_msg IMPLICIT NONE INTEGER, INTENT(IN) :: KMI ! Model index + +CHARACTER(LEN=JPSVNAMELGTMAX), DIMENSION(:,:), ALLOCATABLE :: YSVNAMES_TMP +INTEGER :: JI, JJ ! ! STOP if INI_NSV has not be called yet IF (.NOT. LINI_NSV) THEN @@ -46,6 +49,20 @@ END IF ! Update the NSV_* variables from original NSV_*_A arrays ! that have been initialized in ini_nsv.f90 for model KMI ! + +! Allocate/reallocate CSVNAMES_A +IF ( .NOT. ALLOCATED( CSVNAMES_A ) ) ALLOCATE( CSVNAMES_A( NSV_A(KMI), KMI) ) +!If CSVNAMES_A is too small, enlarge it and transfer data +IF ( SIZE( CSVNAMES_A, 1 ) < NSV_A(KMI) .OR. SIZE( CSVNAMES_A, 2 ) < KMI ) THEN + ALLOCATE( YSVNAMES_TMP(NSV_A(KMI), KMI) ) + DO JJ = 1, SIZE( CSVNAMES_A, 2 ) + DO JI = 1, SIZE( CSVNAMES_A, 1 ) + YSVNAMES_TMP(JI, JJ) = CSVNAMES_A(JI, JJ) + END DO + END DO + CALL MOVE_ALLOC( FROM = YSVNAMES_TMP, TO = CSVNAMES_A ) +END IF + CSVNAMES => CSVNAMES_A(:,KMI) NSV = NSV_A(KMI) diff --git a/src/MNH/write_diachro.f90 b/src/MNH/write_diachro.f90 index 77c2c8eb61d7c7fa4e4f7c24ed161c6582b756c1..485909a62c4103ad9b3ada8e0f027453d1e58e45 100644 --- a/src/MNH/write_diachro.f90 +++ b/src/MNH/write_diachro.f90 @@ -977,7 +977,7 @@ select case ( idims ) !Correspond to FLYER_DIACHRO !Create local time dimension if ( isp == tzfile%nmaster_rank) then - istatus = NF90_DEF_DIM( igrpid, 'time_flyer', Size( pvar, 4), idimid ) + istatus = NF90_DEF_DIM( igrpid, 'time_flyer', Int( Size( pvar, 4), kind = CDFINT ), idimid ) if ( istatus /= NF90_NOERR ) & call IO_Err_handle_nc4( istatus, 'Write_diachro_nc4', 'NF90_DEF_DIM', Trim( tpfields(1)%cmnhname ) ) end if @@ -1095,7 +1095,7 @@ select case ( idims ) !Correspond to FLYER_DIACHRO !Create local time dimension if ( isp == tzfile%nmaster_rank) then - istatus = NF90_DEF_DIM( igrpid, 'time_flyer', Size( pvar, 4), idimid ) + istatus = NF90_DEF_DIM( igrpid, 'time_flyer', Int( Size( pvar, 4), kind = CDFINT ), idimid ) if ( istatus /= NF90_NOERR ) & call IO_Err_handle_nc4( istatus, 'Write_diachro_nc4', 'NF90_DEF_DIM', Trim( tpfields(1)%cmnhname ) ) end if diff --git a/src/MNH/write_lfifm1_for_diag_supp.f90 b/src/MNH/write_lfifm1_for_diag_supp.f90 index 1f5bbee65240bcc76f4e4cd27d07d0e501887eac..8bec988c742f330982d1e2dfe456820856cba45a 100644 --- a/src/MNH/write_lfifm1_for_diag_supp.f90 +++ b/src/MNH/write_lfifm1_for_diag_supp.f90 @@ -1288,41 +1288,61 @@ IF (LISOAL .AND.XISOAL(1)/=0.) THEN ! ********************* ! Cloud ! ********************* - IF (SIZE(XRT,4) >= 5) THEN - ZWORK31(:,:,:) = (XRT(:,:,:,2)+XRT(:,:,:,4)+XRT(:,:,:,5))*1.E3 - CALL ZINTER(ZWORK31, XZZ, ZWAL, ZAL, IIU, IJU, IKU, IKB, IAL, XUNDEF) - WHERE(ZWAL.EQ.XUNDEF) ZWAL=ZFILLVAL - TZFIELD%CMNHNAME = 'ALT_CLOUD' - TZFIELD%CSTDNAME = '' - TZFIELD%CLONGNAME = 'ALT_CLOUD' - TZFIELD%CUNITS = 'g kg-1' - TZFIELD%CDIR = 'XY' - TZFIELD%CCOMMENT = 'X_Y_cloud ALT' - TZFIELD%NGRID = 1 - TZFIELD%NTYPE = TYPEREAL - TZFIELD%NDIMS = 3 - TZFIELD%LTIMEDEP = .TRUE. - CALL IO_Field_write(TPFILE,TZFIELD,ZWAL) - END IF + ZWORK31(:,:,:) = 0. + IF (SIZE(XRT,4) >= 2) ZWORK31(:,:,:) = XRT(:,:,:,2) ! Rc + IF (SIZE(XRT,4) >= 4) ZWORK31(:,:,:) = ZWORK31(:,:,:) + XRT(:,:,:,4) !Ri + ZWORK31(:,:,:) = ZWORK31(:,:,:)*1.E3 + CALL ZINTER(ZWORK31, XZZ, ZWAL, ZAL, IIU, IJU, IKU, IKB, IAL, XUNDEF) + WHERE(ZWAL.EQ.XUNDEF) ZWAL=ZFILLVAL + TZFIELD%CMNHNAME = 'ALT_CLOUD' + TZFIELD%CSTDNAME = '' + TZFIELD%CLONGNAME = 'ALT_CLOUD' + TZFIELD%CUNITS = 'g kg-1' + TZFIELD%CDIR = 'XY' + TZFIELD%CCOMMENT = 'X_Y_cloud ALT' + TZFIELD%NGRID = 1 + TZFIELD%NTYPE = TYPEREAL + TZFIELD%NDIMS = 3 + TZFIELD%LTIMEDEP = .TRUE. + CALL IO_Field_write(TPFILE,TZFIELD,ZWAL) ! ********************* ! Precipitation ! ********************* - IF (SIZE(XRT,4) >= 6) THEN - ZWORK31(:,:,:) = (XRT(:,:,:,2)+XRT(:,:,:,6))*1.E3 - CALL ZINTER(ZWORK31, XZZ, ZWAL, ZAL, IIU, IJU, IKU, IKB, IAL, XUNDEF) - WHERE(ZWAL.EQ.XUNDEF) ZWAL=ZFILLVAL - TZFIELD%CMNHNAME = 'ALT_PRECIP' - TZFIELD%CSTDNAME = '' - TZFIELD%CLONGNAME = 'ALT_PRECIP' - TZFIELD%CUNITS = 'g kg-1' - TZFIELD%CDIR = 'XY' - TZFIELD%CCOMMENT = 'X_Y_precipitation ALT' - TZFIELD%NGRID = 1 - TZFIELD%NTYPE = TYPEREAL - TZFIELD%NDIMS = 3 - TZFIELD%LTIMEDEP = .TRUE. - CALL IO_Field_write(TPFILE,TZFIELD,ZWAL) - END IF + ZWORK31(:,:,:) = 0. + IF (SIZE(XRT,4) >= 3) ZWORK31(:,:,:) = XRT(:,:,:,3) ! Rr + IF (SIZE(XRT,4) >= 5) ZWORK31(:,:,:) = ZWORK31(:,:,:) + XRT(:,:,:,5) !Rsnow + IF (SIZE(XRT,4) >= 6) ZWORK31(:,:,:) = ZWORK31(:,:,:) + XRT(:,:,:,6) !Rgraupel + IF (SIZE(XRT,4) >= 7) ZWORK31(:,:,:) = ZWORK31(:,:,:) + XRT(:,:,:,7) !Rhail + ZWORK31(:,:,:) = ZWORK31(:,:,:)*1.E3 + CALL ZINTER(ZWORK31, XZZ, ZWAL, ZAL, IIU, IJU, IKU, IKB, IAL, XUNDEF) + WHERE(ZWAL.EQ.XUNDEF) ZWAL=ZFILLVAL + TZFIELD%CMNHNAME = 'ALT_PRECIP' + TZFIELD%CSTDNAME = '' + TZFIELD%CLONGNAME = 'ALT_PRECIP' + TZFIELD%CUNITS = 'g kg-1' + TZFIELD%CDIR = 'XY' + TZFIELD%CCOMMENT = 'X_Y_precipitation ALT' + TZFIELD%NGRID = 1 + TZFIELD%NTYPE = TYPEREAL + TZFIELD%NDIMS = 3 + TZFIELD%LTIMEDEP = .TRUE. + CALL IO_Field_write(TPFILE,TZFIELD,ZWAL) +! ********************* +! Potential temperature +! ********************* + CALL ZINTER(XTHT, XZZ, ZWAL, ZAL, IIU, IJU, IKU, IKB, IAL, XUNDEF) + WHERE(ZWAL.EQ.XUNDEF) ZWAL=ZFILLVAL + TZFIELD%CMNHNAME = 'ALT_THETA' + TZFIELD%CSTDNAME = '' + TZFIELD%CLONGNAME = 'ALT_THETA' + TZFIELD%CUNITS = 'K' + TZFIELD%CDIR = 'XY' + TZFIELD%CCOMMENT = 'X_Y_potential temperature ALT' + TZFIELD%NGRID = 1 + TZFIELD%NTYPE = TYPEREAL + TZFIELD%NDIMS = 3 + TZFIELD%LTIMEDEP = .TRUE. + CALL IO_Field_write(TPFILE,TZFIELD,ZWAL) ! ********************* ! Pressure ! ********************* diff --git a/src/Makefile b/src/Makefile index 3d140df7dbd7a8f51c4368348d6cfc88219b8ee6..51dc9e3b157e921db3b884df713ced5410b1597f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -347,8 +347,8 @@ cdf : $(CDF_MOD) $(CDF_MOD) : cd ${DIR_LIBAEC} && ./configure --disable-shared --prefix=${CDF_PATH} --libdir=${CDF_PATH}/lib64 CC="$(CC)" CFLAGS="$(HDF_OPT)" && \ $(MAKE) && $(MAKE) install && $(MAKE) clean - cd ${DIR_HDF} && ./configure --disable-shared --prefix=${CDF_PATH} --libdir=${CDF_PATH}/lib64 --with-szlib=${CDF_PATH}/include,${CDF_PATH}/lib64 \ - CC="$(CC)" CFLAGS="$(HDF_OPT)" LDFLAGS="-L${CDF_PATH}/lib64" LIBS="-lsz -laec -lz" && \ + cd ${DIR_HDF} && ./configure --enable-fortran --disable-shared --prefix=${CDF_PATH} --libdir=${CDF_PATH}/lib64 --with-szlib=${CDF_PATH}/include,${CDF_PATH}/lib64 \ + CC="$(CC)" CFLAGS="$(HDF_OPT)" FC="$(FC)" FCFLAGS="$(NETCDF_OPT)" LDFLAGS="-L${CDF_PATH}/lib64" LIBS="-lsz -laec -lz" && \ $(MAKE) && $(MAKE) install && $(MAKE) clean cd ${DIR_CDFC} && ./configure --disable-shared --prefix=${CDF_PATH} --libdir=${CDF_PATH}/lib64 --disable-dap \ CC="$(CC)" CFLAGS="$(NETCDF_OPT)" CPPFLAGS="${INC_NETCDF}" ${CDF_CONF} LDFLAGS="-L${CDF_PATH}/lib64" LIBS="-lhdf5_hl -lhdf5 -lsz -laec -lz" && \ diff --git a/src/Rules.LXifort.mk b/src/Rules.LXifort.mk index 6920bf3a78d09b9f98bb89d160c8c324cdfb6156..41d28547b5d3d70030bf351c349fe56b93f2f788 100644 --- a/src/Rules.LXifort.mk +++ b/src/Rules.LXifort.mk @@ -137,13 +137,13 @@ CPPFLAGS_SURCOUCHE += -DMNH_USE_MPI_STATUSES_IGNORE endif else ifeq "$(VER_MPI)" "MPIINTEL" +CPPFLAGS_SURCOUCHE += -DMNH_USE_MPI_STATUSES_IGNORE -DMNH_NO_MPI_LOGICAL48 ifneq "$(findstring TAU,$(XYZ))" "" F90 = tau_f90.sh export TAU_MAKEFILE?=/home/escj/PATCH/TAU/TAU-2.21.1-IFORT10-OMPI152-THREAD/x86_64/lib/Makefile.tau-mpi LIBS += -lz else F90 = mpiifort -CPPFLAGS_SURCOUCHE += -DMNH_USE_MPI_STATUSES_IGNORE endif ifeq "$(MNH_INT)" "8" OPT_BASE += -ilp64 diff --git a/src/SURFEX/prep_grib_grid.F90 b/src/SURFEX/prep_grib_grid.F90 index de1b379580cd645f181c31d7183c6667fa425616..b8c5b9c93775ec60da859ae7b66323e58d59b089 100644 --- a/src/SURFEX/prep_grib_grid.F90 +++ b/src/SURFEX/prep_grib_grid.F90 @@ -494,7 +494,6 @@ SELECT CASE (HGRIDTYPE) IF (IRET == 0 .OR. IMISSING/=1) THEN ! quasi-regular CALL GRIB_GET(IGRIB,'pl',ININLO_GRIB) XILO2=360.-360./(MAXVAL(ININLO_GRIB)) - print*,"XILO2=",XILO2 ENDIF DEALLOCATE(ININLO_GRIB) ENDIF diff --git a/src/configure b/src/configure index 339ae9d29850b02470d57cdb8820b04c1d844221..a09a94c9e7ce0318079f6ce455cf2456b8247838 100755 --- a/src/configure +++ b/src/configure @@ -8,10 +8,10 @@ if [ "x$XYZ" = "x" ] then # -export VERSION_MASTER=${VERSION_MASTER:-MNH-V5-4} -export VERSION_BUG=${VERSION_BUG:-4} +export VERSION_MASTER=${VERSION_MASTER:-MNH-V5-5} +export VERSION_BUG=${VERSION_BUG:-0} export VERSION_XYZ=${VERSION_XYZ:-${VERSION_MASTER}-${VERSION_BUG}${VER_OASIS:+-${VER_OASIS}}} -export VERSION_DATE=${VERSION_DATE:-"06/03/2020"} +export VERSION_DATE=${VERSION_DATE:-"19/03/2021"} export VERSION_LIBAEC=${VERSION_LIBAEC:-"0.3.4"} export VERSION_HDF=${VERSION_HDF:-"1.12.0"} export VERSION_CDFC=${VERSION_CDFC:-"4.7.4"} @@ -44,7 +44,7 @@ cd ${LOCAL}/conf TARG=$(uname -s -n) # case "$TARG" in -'Linux jean-zay'*) +'Linux jean-zay'*|'Linux idrsrv'*) export ARCH=${ARCH:-LXifort} export VER_MPI=${VER_MPI:-MPIINTEL} export OPTLEVEL=${OPTLEVEL:-O2} @@ -52,11 +52,15 @@ case "$TARG" in export VER_CDF=${VER_CDF:-CDFAUTO} export MNHENV=${MNHENV:-" module purge -module load intel-compilers/19.0.5 -module load intel-mpi/19.0.5 +module load intel-compilers/19.1.3 +module load intel-mpi/2019.9 ulimit -s unlimited export SLURM_CPU_BIND=none export I_MPI_PIN_PROCESSOR_LIST=all:map=spread +module load imagemagick/7.0.8-7 +module load anaconda-py3/2020.11 +conda activate climate_science + "} ;; 'Linux'*'occigen'*) @@ -348,11 +352,14 @@ export CC=gcc export VER_CDF=${VER_CDF:-CDFAUTO} export NEED_NCARG=${NEED_NCARG:-YES} export MNHENV=${MNHENV:-" -. /home/tools/intel/psxe2017/bin/ifortvars.sh intel64 -export MPI_ROOT=/usr/local/openmpi/1.6.5/ifort17.0.1.132 +. /home/tools/intel/psxe2018/bin/ifortvars.sh intel64 +export MPI_ROOT=/usr/local/openmpi/3.1.4/ifort18.0.2.199 export PATH=\$MPI_ROOT/bin:\$PATH export LD_LIBRARY_PATH=\$MPI_ROOT/lib64:\$LD_LIBRARY_PATH export MANPATH=\$MPI_ROOT/share/man:\$MANPATH +# For python graphic +source /home/sila/miniconda3/etc/profile.d/conda.sh +conda activate mnh-env_nuwa "} ;; 'Linux eos'*) @@ -526,8 +533,8 @@ fi if [ "x${VER_CDF}" == "xCDFAUTO" ] ;then ( cd $LOCAL/src/LIB ; [ ! -d libaec-${VERSION_LIBAEC} ] && tar xvfz libaec-${VERSION_LIBAEC}.tar.gz ) ( cd $LOCAL/src/LIB ; [ ! -d hdf5-${VERSION_HDF} ] && tar xvfz hdf5-${VERSION_HDF}.tar.gz ) -( cd $LOCAL/src/LIB ; [ ! -d netcdf-${VERSION_CDFC} ] && tar xvfz netcdf-c-${VERSION_CDFC}.tar.gz ) -( cd $LOCAL/src/LIB ; [ ! -d netcdf-cxx-${VERSION_CDFCXX} ] && tar xvfz netcdf-cxx4-${VERSION_CDFCXX}.tar.gz ) +( cd $LOCAL/src/LIB ; [ ! -d netcdf-c-${VERSION_CDFC} ] && tar xvfz netcdf-c-${VERSION_CDFC}.tar.gz ) +( cd $LOCAL/src/LIB ; [ ! -d netcdf-cxx4-${VERSION_CDFCXX} ] && tar xvfz netcdf-cxx4-${VERSION_CDFCXX}.tar.gz ) ( cd $LOCAL/src/LIB ; [ ! -d netcdf-fortran-${VERSION_CDFF} ] && tar xvfz netcdf-fortran-${VERSION_CDFF}.tar.gz ) fi # diff --git a/src/job_make_examples_BG b/src/job_make_examples_BG index 38146598843e829cf2918db6a0f445045b922dd9..8f18e061117c3a2ae65983ee927bb242926e7304 100755 --- a/src/job_make_examples_BG +++ b/src/job_make_examples_BG @@ -18,7 +18,7 @@ set -x cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-BG-R8I4-MNH-V5-4-4-MPIAUTO-O2 +. ../conf/profile_mesonh-BG-R8I4-MNH-V5-5-0-MPIAUTO-O2 #001_2Drelief 002_3Drelief 003_KW78 004_Reunion 007_16janvier diff --git a/src/job_make_examples_BGQ b/src/job_make_examples_BGQ index e8609776412ec371817098f0f6f0ad4befdd06bf..a6785fd9ff187b157b4567db85f44ebd08e982f0 100755 --- a/src/job_make_examples_BGQ +++ b/src/job_make_examples_BGQ @@ -18,7 +18,7 @@ cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-BGQ-R8I4-MNH-V5-4-4-MPIAUTO-O2NAN +. ../conf/profile_mesonh-BGQ-R8I4-MNH-V5-5-0-MPIAUTO-O2NAN set -x diff --git a/src/job_make_examples_BullX b/src/job_make_examples_BullX index ec1726f0ae3924f131397fb613b1879e890b65b1..2a29d889ee1533ecd009169d6427f4c2dada3b18 100755 --- a/src/job_make_examples_BullX +++ b/src/job_make_examples_BullX @@ -19,7 +19,7 @@ set -e hostname # Echo des commandes -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIINTEL-O3 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIINTEL-O3 export MONORUN="Mpirun -np 1 " export MPIRUN="Mpirun -np 2 " export POSTRUN="time " diff --git a/src/job_make_examples_BullX_belenos b/src/job_make_examples_BullX_belenos index 6411dafe3df591c4c8a9a3bdd2c468194545d14b..8bb139f87e3fb31f580e1865df1e4921a19c45ed 100755 --- a/src/job_make_examples_BullX_belenos +++ b/src/job_make_examples_BullX_belenos @@ -18,7 +18,7 @@ set -e hostname # Echo des commandes -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIAUTO-O3 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIAUTO-O3 export MONORUN="Mpirun -np 1 " export MPIRUN="Mpirun -np 2 " export POSTRUN="time " diff --git a/src/job_make_examples_BullX_irene b/src/job_make_examples_BullX_irene index 95e5349b354e15dd8b7dadbb70acea8fe8b3cd67..b59dd5bf59e0a9365cab6f715c89903575d63ad1 100755 --- a/src/job_make_examples_BullX_irene +++ b/src/job_make_examples_BullX_irene @@ -21,7 +21,7 @@ set +x # Nom de la machine hostname -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIAUTO-O2 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIAUTO-O2 set -x diff --git a/src/job_make_examples_BullX_irene_AMD b/src/job_make_examples_BullX_irene_AMD index cc3c5d60ba2d5a3c9c11c5428770a17e9d3a0c51..e2e9c6d7d98f1322c881ae0c0138fb4670e840e4 100755 --- a/src/job_make_examples_BullX_irene_AMD +++ b/src/job_make_examples_BullX_irene_AMD @@ -20,7 +20,7 @@ set +x # Nom de la machine hostname -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-AMD-MPIAUTO-O2 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-AMD-MPIAUTO-O2 set -x diff --git a/src/job_make_examples_BullX_occigen b/src/job_make_examples_BullX_occigen index e5217b9426f3616a6b9ad94cb5cfef891fea22bd..1a1cd8bc9c58bdc8ed8584db9caa25f46d608018 100755 --- a/src/job_make_examples_BullX_occigen +++ b/src/job_make_examples_BullX_occigen @@ -18,7 +18,7 @@ set -x # Nom de la machine hostname -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIINTEL-O2 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIINTEL-O2 export MONORUN="Mpirun -prepend-rank -np 1 " export MPIRUN="Mpirun -prepend-rank -np 4 " export POSTRUN="echo " diff --git a/src/job_make_examples_BullX_olympe b/src/job_make_examples_BullX_olympe index 7bbb559ee3399cca28445cab49fb056fec7e8e77..27f0e8c970502733f890ecd81837aea4f68acb54 100755 --- a/src/job_make_examples_BullX_olympe +++ b/src/job_make_examples_BullX_olympe @@ -17,7 +17,7 @@ set -x # Nom de la machine hostname -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIINTEL-O2 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIINTEL-O2 export MONORUN="mpirun -prepend-rank -np 1 " export MPIRUN="mpirun -prepend-rank -np 4 " export POSTRUN="echo " diff --git a/src/job_make_examples_CRAY_cca b/src/job_make_examples_CRAY_cca index a8b617cda3e39baaa161c33787c78916570b06f8..786947f40e6fdbe4689be5aae55636b36e17ec61 100755 --- a/src/job_make_examples_CRAY_cca +++ b/src/job_make_examples_CRAY_cca @@ -28,7 +28,7 @@ cd ${PBS_O_WORKDIR} ARCH=LXifort #ARCH=LXcray -. ../conf/profile_mesonh-${ARCH}-R8I4-MNH-V5-4-4-MPICRAY-O2 +. ../conf/profile_mesonh-${ARCH}-R8I4-MNH-V5-5-0-MPICRAY-O2 export MONORUN="aprun -n 1 " diff --git a/src/job_make_examples_HPE_jeanzay b/src/job_make_examples_HPE_jeanzay index 1e27a8821b2066e122b78c2e94e9d66bba0f61f9..bd03e566f6090cdf224e080e65c11f8bc549f233 100755 --- a/src/job_make_examples_HPE_jeanzay +++ b/src/job_make_examples_HPE_jeanzay @@ -19,7 +19,7 @@ set -x # Nom de la machine hostname -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIINTEL-O2 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIINTEL-O2 export MONORUN="Exec srun -l -n 1 --export=ALL numabind_core_slurm" export MPIRUN="Exec srun -l -n 4 --export=ALL numabind_core_slurm" export POSTRUN="echo " diff --git a/src/job_make_examples_IBM_ada b/src/job_make_examples_IBM_ada index 15a3d2e12cfa3a01e25b0818be80cd0ff4e1c722..a1b1b51f54543532d5eff7d9f115d950a6c83c80 100755 --- a/src/job_make_examples_IBM_ada +++ b/src/job_make_examples_IBM_ada @@ -19,7 +19,7 @@ cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIINTEL-O2 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIINTEL-O2 # Pour avoir l'echo des commandes set -x diff --git a/src/job_make_examples_IBM_sp6_vargas b/src/job_make_examples_IBM_sp6_vargas index 436d008c854912cefb77cdacd0872df02173287e..c8d65b89b0dd0089e8822d27a3264a4cc6a877d9 100755 --- a/src/job_make_examples_IBM_sp6_vargas +++ b/src/job_make_examples_IBM_sp6_vargas @@ -24,7 +24,7 @@ set -x cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-AIX64-R8I4-MNH-V5-4-4-MPIAUTO-O2 +. ../conf/profile_mesonh-AIX64-R8I4-MNH-V5-5-0-MPIAUTO-O2 #001_2Drelief 002_3Drelief 003_KW78 004_Reunion 007_16janvier diff --git a/src/job_make_examples_NEC_SX8 b/src/job_make_examples_NEC_SX8 index ed77d09517ba30e753894412a541138d2074d7c2..d33de70361b74d52899c0f8d9866686c76d1d115 100755 --- a/src/job_make_examples_NEC_SX8 +++ b/src/job_make_examples_NEC_SX8 @@ -18,7 +18,7 @@ hostname [ -d $PBS_O_WORKDIR ] && cd $PBS_O_WORKDIR # -. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-4-4-MPIAUTO-O4 +. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-5-0-MPIAUTO-O4 export MONORUN="Mpirun -np 1 " export MPIRUN="Mpirun -np 2 " diff --git a/src/job_make_examples_SX8 b/src/job_make_examples_SX8 index 42f2c8e4a8a41313d592044710b0f41a22f31839..fdd3553013dfc4ba5e40ff30945f81ebcf8a4acd 100755 --- a/src/job_make_examples_SX8 +++ b/src/job_make_examples_SX8 @@ -19,7 +19,7 @@ hostname [ -d $PBS_O_WORKDIR ] && cd $PBS_O_WORKDIR # -. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-4-4-MPIAUTO-O2 +. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-5-0-MPIAUTO-O2 export MONORUN="Mpirun -np 1 " export MPIRUN="Mpirun -np 2 " diff --git a/src/job_make_examples_cxa b/src/job_make_examples_cxa index efd6f0033cee95e6c7033e5b21afb08897be15bb..ef8507f6bb94d9d0ac2964f8b808c7dd99325022 100755 --- a/src/job_make_examples_cxa +++ b/src/job_make_examples_cxa @@ -34,7 +34,7 @@ echo SHELL=$SHELL cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-AIX64-R8I4-MNH-V5-4-4-MPIAUTO-O2 +. ../conf/profile_mesonh-AIX64-R8I4-MNH-V5-5-0-MPIAUTO-O2 ulimit -c 0 # pas de core diff --git a/src/job_make_mesonh_BG b/src/job_make_mesonh_BG index 71af86fb07d3dad8d9d32375c9b05d255e337e6f..ce08d470e8b49270a701f2b31ffd9461a2932efb 100755 --- a/src/job_make_mesonh_BG +++ b/src/job_make_mesonh_BG @@ -18,7 +18,7 @@ set -x cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-BG-R8I4-MNH-V5-4-4-MPIAUTO-O2 +. ../conf/profile_mesonh-BG-R8I4-MNH-V5-5-0-MPIAUTO-O2 #time gmake time gmake -r -j8 diff --git a/src/job_make_mesonh_BGQ b/src/job_make_mesonh_BGQ index 815ba0c5a17e429d95fb2ee1e1b1f4c6df23fef3..de9517f32dd279d686c4d1afa0991079a7662cc4 100755 --- a/src/job_make_mesonh_BGQ +++ b/src/job_make_mesonh_BGQ @@ -34,7 +34,7 @@ set -x cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-BGQ-R8I4-MNH-V5-4-4-MPIAUTO-O2NAN +. ../conf/profile_mesonh-BGQ-R8I4-MNH-V5-5-0-MPIAUTO-O2NAN case $LOADL_STEP_NAME in diff --git a/src/job_make_mesonh_BullX b/src/job_make_mesonh_BullX index 10c70674b13a2e331b7f9d78c5a86ad9cef031f6..967c115e1dcee2800b1b01ed89733a9e924bf30b 100755 --- a/src/job_make_mesonh_BullX +++ b/src/job_make_mesonh_BullX @@ -19,7 +19,7 @@ set -x # On va lancer la compilation dans le répertoire de lancement du job pwd -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIINTEL-O3 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIINTEL-O3 time gmake -j 4 time gmake -j 1 installmaster diff --git a/src/job_make_mesonh_BullX_belenos b/src/job_make_mesonh_BullX_belenos index 6d634f3c34ff9adae2955efbaab99616ecabfb08..5fe6d8a062e5c331d3e66c16aa044ee52ed5bbf6 100755 --- a/src/job_make_mesonh_BullX_belenos +++ b/src/job_make_mesonh_BullX_belenos @@ -16,7 +16,7 @@ set -x # On va lancer la compilation dans le répertoire de lancement du job pwd -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIAUTO-O3 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIAUTO-O3 time make -j 16 time make -j 1 installmaster diff --git a/src/job_make_mesonh_CRAY_cca b/src/job_make_mesonh_CRAY_cca index e669181470655a7afa5817c381c520072ea462e4..56dba703cf90a3b45a985cc4b68bc64551331a92 100755 --- a/src/job_make_mesonh_CRAY_cca +++ b/src/job_make_mesonh_CRAY_cca @@ -21,7 +21,7 @@ pwd ARCH=LXifort #ARCH=LXcray -. ../conf/profile_mesonh-${ARCH}-R8I4-MNH-V5-4-4-MPICRAY-O2 +. ../conf/profile_mesonh-${ARCH}-R8I4-MNH-V5-5-0-MPICRAY-O2 time gmake -j 4 2>&1 | tee sortie_compile_${ARCH}.$$ time gmake -j 4 2>&1 | tee sortie_compile_${ARCH}2.$$ diff --git a/src/job_make_mesonh_HPE_jeanzay b/src/job_make_mesonh_HPE_jeanzay index d5ea7ebfa0543ff3aa78088e46ebe0010e328466..0dfa8598dda30dfaef3ef7268e2e02d184cfc0d3 100755 --- a/src/job_make_mesonh_HPE_jeanzay +++ b/src/job_make_mesonh_HPE_jeanzay @@ -14,7 +14,7 @@ set -x # On va lancer la compilation dans le répertoire de lancement du job pwd -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIINTEL-O2 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIINTEL-O2 time gmake -j 16 time gmake -j 1 installmaster diff --git a/src/job_make_mesonh_IBM_ada b/src/job_make_mesonh_IBM_ada index bb8b9abf42c10de4bdfd6b8e76b515157eeda90f..bcdfcf110cdeb34e78dfcb55c06801c7ab1b2cd5 100755 --- a/src/job_make_mesonh_IBM_ada +++ b/src/job_make_mesonh_IBM_ada @@ -16,7 +16,7 @@ cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-MPIINTEL-O2 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-MPIINTEL-O2 # Pour avoir l'echo des commandes set -x diff --git a/src/job_make_mesonh_IBM_sp6_vargas b/src/job_make_mesonh_IBM_sp6_vargas index 9c26e4641ab7689adf99b61194a91bd747ad0578..991b70ff4868927d8c4f173879784e40260312cf 100755 --- a/src/job_make_mesonh_IBM_sp6_vargas +++ b/src/job_make_mesonh_IBM_sp6_vargas @@ -24,7 +24,7 @@ set -x cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-AIX64-R8I4-MNH-V5-4-4-MPIAUTO-O2 +. ../conf/profile_mesonh-AIX64-R8I4-MNH-V5-5-0-MPIAUTO-O2 time gmake -j1 gribapi time gmake -r -j8 diff --git a/src/job_make_mesonh_MFSX8 b/src/job_make_mesonh_MFSX8 index faf9365b793332ddba1315ed94ccab988f73ba37..811e5aa92ab70293537a9d11cbf048c80f1d0089 100644 --- a/src/job_make_mesonh_MFSX8 +++ b/src/job_make_mesonh_MFSX8 @@ -12,7 +12,7 @@ set -x # On va lancer la compilation dans le répertoire de lancement du job [ ${PBS_O_WORKDIR} ] && cd ${PBS_O_WORKDIR} -. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-4-4-MPIAUTO-O4 +. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-5-0-MPIAUTO-O4 time gmake -j 4 ########## compile on four processors to speedup the compilation time gmake -j 1 installmaster diff --git a/src/job_make_mesonh_NEC_SX8 b/src/job_make_mesonh_NEC_SX8 index 9bcb36b1b7758853de16817e61e8bb03d1206fae..75d68db4ade1024e25a21842fcad41eccb63f7e1 100755 --- a/src/job_make_mesonh_NEC_SX8 +++ b/src/job_make_mesonh_NEC_SX8 @@ -11,7 +11,7 @@ set -x # On va lancer la compilation dans le répertoire de lancement du job [ $PBS_O_WORKDIR ] && cd $PBS_O_WORKDIR -. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-4-4-MPIAUTO-O4 +. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-5-0-MPIAUTO-O4 time gmake -j 4 time gmake -j 4 # some time problem with first pass in parallel compilation diff --git a/src/job_make_mesonh_cxa b/src/job_make_mesonh_cxa index 98d324f50aee8ac00b49fc15a20509522c5c17eb..d531fb9a75484db4fa6dd5c88d509c2188454d9e 100755 --- a/src/job_make_mesonh_cxa +++ b/src/job_make_mesonh_cxa @@ -27,7 +27,7 @@ set -x cd $LOADL_STEP_INITDIR -. ../conf/profile_mesonh-AIX64-R8I4-MNH-V5-4-4-MPIAUTO-O2 +. ../conf/profile_mesonh-AIX64-R8I4-MNH-V5-5-0-MPIAUTO-O2 time gmake -r -j1 time gmake installmaster diff --git a/src/job_make_mesonh_user_BullX b/src/job_make_mesonh_user_BullX index 8dfcd279ef4f4fb009eb8262f6c825ee6882a233..0b982175890de1f9249f8f361a7b5e2492a5ce66 100755 --- a/src/job_make_mesonh_user_BullX +++ b/src/job_make_mesonh_user_BullX @@ -19,7 +19,7 @@ export VER_USER= ########## Your own USER Directory set -x # On va lancer la compilation dans le répertoire de lancement du job -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-${VER_USER}-MPIINTEL-O3 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-${VER_USER}-MPIINTEL-O3 time gmake user time gmake -j 1 installuser diff --git a/src/job_make_mesonh_user_BullX_belenos b/src/job_make_mesonh_user_BullX_belenos index 5d53cdf7649bb9baf1f391eeb431a61055b5c26f..fddbb21e59d239bc8be88461fc41d3f3fba6d353 100755 --- a/src/job_make_mesonh_user_BullX_belenos +++ b/src/job_make_mesonh_user_BullX_belenos @@ -18,7 +18,7 @@ set -x # On va lancer la compilation dans le répertoire de lancement du job pwd -. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-4-4-${VER_USER}-MPIAUTO-O3 +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-5-0-${VER_USER}-MPIAUTO-O3 time make user -j 2 time make -j 1 installuser diff --git a/src/job_make_mesonh_user_MFSX8 b/src/job_make_mesonh_user_MFSX8 index 0e0ab4c9f22c549a5b710695fa5caa76d869214a..e6a87c197a2c5157aa4a5cc82bf8a50189b1e157 100644 --- a/src/job_make_mesonh_user_MFSX8 +++ b/src/job_make_mesonh_user_MFSX8 @@ -14,7 +14,7 @@ set -x [ ${PBS_O_WORKDIR} ] && cd ${PBS_O_WORKDIR} -. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-4-4-${VER_USER}-MPIAUTO-O4 +. ../conf/profile_mesonh-SX8-R8I4-MNH-V5-5-0-${VER_USER}-MPIAUTO-O4 time gmake user time gmake -j 1 installuser