Skip to content
Snippets Groups Projects
Commit afb6bc27 authored by RODIER Quentin's avatar RODIER Quentin
Browse files

Quentin 19/07/2022: add turb mesonh KTEST to test online LES diag and netCDF...

Quentin 19/07/2022: add turb mesonh KTEST to test online LES diag and netCDF groups + change mesonh/aux/mode_budget to MNH/budget.f90
parent 2ff066b9
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ set -e ...@@ -8,7 +8,7 @@ set -e
# Repertoire où MNH-V5-5-0_PHYEX.tar.gz modifie pour accueillir PHYEX se trouve # Repertoire où MNH-V5-5-0_PHYEX.tar.gz modifie pour accueillir PHYEX se trouve
#TARGZDIR=$HOME #TARGZDIR=$HOME
availTests="007_16janvier/008_run2, 007_16janvier/008_run2_turb3D, COLD_BUBBLE/002_mesonh" availTests="007_16janvier/008_run2, 007_16janvier/008_run2_turb3D, COLD_BUBBLE/002_mesonh, ARMLES/RUN, COLD_BUBBLE_3D/002_mesonh,"
defaultTest="007_16janvier/008_run2" defaultTest="007_16janvier/008_run2"
separator='_' #- be carrefull, gmkpack (at least on belenos) has multiple allergies (':', '.', '@') separator='_' #- be carrefull, gmkpack (at least on belenos) has multiple allergies (':', '.', '@')
#- seprator must be in sync with prep_code.sh separator #- seprator must be in sync with prep_code.sh separator
...@@ -220,6 +220,10 @@ if [ $compilation -eq 1 ]; then ...@@ -220,6 +220,10 @@ if [ $compilation -eq 1 ]; then
# Supress some files if they are not used anymore # Supress some files if they are not used anymore
! grep -i MODI_COMPUTE_ENTR_DETR $(ls MNH/*compute_updraft* PHYEX/turb/*compute_updraft* 2>/dev/null) && rm -f MNH/compute_entr_detr.f90 ! grep -i MODI_COMPUTE_ENTR_DETR $(ls MNH/*compute_updraft* PHYEX/turb/*compute_updraft* 2>/dev/null) && rm -f MNH/compute_entr_detr.f90
! grep -i MODI_TH_R_FROM_THL_RT_ $(ls MNH/compute_entr_detr.f90 MNH/compute_entr_detr.f90 PHYEX/turb/mode_compute_updraft*.f90 MNH/ice_adjust_bis.f90 MNH/prep_ideal_case.f90 MNH/set_rsou.f90 2>/dev/null) > /dev/null && rm -f MNH/th_r_from_thl_rt_1d.f90 MNH/th_r_from_thl_rt_2d.f90 MNH/th_r_from_thl_rt_3d.f90 ! grep -i MODI_TH_R_FROM_THL_RT_ $(ls MNH/compute_entr_detr.f90 MNH/compute_entr_detr.f90 PHYEX/turb/mode_compute_updraft*.f90 MNH/ice_adjust_bis.f90 MNH/prep_ideal_case.f90 MNH/set_rsou.f90 2>/dev/null) > /dev/null && rm -f MNH/th_r_from_thl_rt_1d.f90 MNH/th_r_from_thl_rt_2d.f90 MNH/th_r_from_thl_rt_3d.f90
# Routine that changed names (if mode_budget.f90 is present)
set +e
mv -f PHYEX/aux/mode_budget.f90 MNH/budget.f90
set -e
#Configure and compilation #Configure and compilation
command -v module && modulelist=$(module -t list 2>&1 | tail -n +2) #save loaded modules command -v module && modulelist=$(module -t list 2>&1 | tail -n +2) #save loaded modules
...@@ -284,6 +288,12 @@ if [ $check -eq 1 ]; then ...@@ -284,6 +288,12 @@ if [ $check -eq 1 ]; then
elif [ $t == COLD_BUBBLE/002_mesonh ]; then elif [ $t == COLD_BUBBLE/002_mesonh ]; then
path_user=$path_user_beg/MY_RUN/KTEST/COLD_BUBBLE/002_mesonh$path_user_end path_user=$path_user_beg/MY_RUN/KTEST/COLD_BUBBLE/002_mesonh$path_user_end
path_ref=$path_ref_beg/MY_RUN/KTEST/COLD_BUBBLE/002_mesonh$path_ref_end path_ref=$path_ref_beg/MY_RUN/KTEST/COLD_BUBBLE/002_mesonh$path_ref_end
elif [ $t == COLD_BUBBLE_3D/002_mesonh ]; then
path_user=$path_user_beg/MY_RUN/KTEST/COLD_BUBBLE_3D/002_mesonh$path_user_end
path_ref=$path_ref_beg/MY_RUN/KTEST/COLD_BUBBLE_3D/002_mesonh$path_ref_end
elif [ $t == ARMLES/RUN ]; then
path_user=$path_user_beg/MY_RUN/KTEST/ARMLES/RUN$path_user_end
path_ref=$path_ref_beg/MY_RUN/KTEST/ARMLES/RUN$path_ref_end
else else
echo "cas $t non reconnu" echo "cas $t non reconnu"
fi fi
...@@ -340,7 +350,63 @@ if [ $check -eq 1 ]; then ...@@ -340,7 +350,63 @@ if [ $check -eq 1 ]; then
echo "Compare with ncdump..." echo "Compare with ncdump..."
if [ -f $file1 -a -f $file2 ]; then if [ -f $file1 -a -f $file2 ]; then
set +e set +e
diff <(ncdump $file1 | head -c 27350) <(ncdump $file2 | head -c 27350) diff <(ncdump $file1 | head -c 27300) <(ncdump $file2 | head -c 27300)
t=$?
set -e
allt=$(($allt+$t))
else
[ ! -f $file1 ] && echo " $file1 is missing"
[ ! -f $file2 ] && echo " $file2 is missing"
allt=$(($allt+1))
fi
fi
if [ $case == COLD_BUBBLE_3D ]; then
echo "Compare with python..."
# Compare variable of both Synchronous and Diachronic files with printing difference
file1=$path_user/BUBBL.1.CEN4T.001.nc
file2=$path_ref/BUBBL.1.CEN4T.001.nc
file3=$path_user/BUBBL.1.CEN4T.000.nc
file4=$path_ref/BUBBL.1.CEN4T.000.nc
set +e
$PHYEXTOOLSDIR/compare.py --f1 $file1 --f2 $file2 --f3 $file3 --f4 $file4
t=$?
set -e
allt=$(($allt+$t))
#Check bit-repro before date of creation of Synchronous file from ncdump of all values (pb with direct .nc file checks)
echo "Compare with ncdump..."
if [ -f $file1 -a -f $file2 ]; then
set +e
diff <(ncdump $file1 | head -c 27300) <(ncdump $file2 | head -c 27300)
t=$?
set -e
allt=$(($allt+$t))
else
[ ! -f $file1 ] && echo " $file1 is missing"
[ ! -f $file2 ] && echo " $file2 is missing"
allt=$(($allt+1))
fi
fi
if [ $case == ARMLES ]; then
echo "Compare with python..."
# Compare variable of both Synchronous and Diachronic files with printing difference
file1=$path_user/ARM__.1.CEN4T.001.nc
file2=$path_ref/ARM__.1.CEN4T.001.nc
file3=$path_user/ARM__.1.CEN4T.000.nc
file4=$path_ref/ARM__.1.CEN4T.000.nc
set +e
$PHYEXTOOLSDIR/compare.py --f1 $file1 --f2 $file2 --f3 $file3 --f4 $file4
t=$?
set -e
allt=$(($allt+$t))
#Check bit-repro before date of creation of Synchronous file from ncdump of all values (pb with direct .nc file checks)
echo "Compare with ncdump..."
if [ -f $file1 -a -f $file2 ]; then
set +e
diff <(ncdump $file1 | head -c 62889) <(ncdump $file2 | head -c 62889)
t=$? t=$?
set -e set -e
allt=$(($allt+$t)) allt=$(($allt+$t))
......
...@@ -2,6 +2,32 @@ ...@@ -2,6 +2,32 @@
import xarray as xr import xarray as xr
avail_groups=['Stations/sta1',
'LES_budgets/Miscellaneous/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/Miscellaneous/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/Mean/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/Mean/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/Resolved/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/Resolved/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/Subgrid/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/Subgrid/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/Surface/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/Surface/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/BU_KE/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/BU_KE/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/BU_THL2/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/BU_THL2/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/BU_WTHL/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/BU_WTHL/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/BU_RT2/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/BU_RT2/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/BU_WRT/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/BU_WRT/Cartesian/Time_averaged/Not_normalized/cart/',
'LES_budgets/BU_THLR/Cartesian/Not_time_averaged/Not_normalized/cart/',
'LES_budgets/BU_THLR/Cartesian/Time_averaged/Not_normalized/cart/']
def compareBACKUPFiles(file_user, file_ref): def compareBACKUPFiles(file_user, file_ref):
status = 0 status = 0
da = xr.open_dataset(file_user) da = xr.open_dataset(file_user)
...@@ -56,6 +82,26 @@ def compareTSERIESFiles(file_user, file_ref): ...@@ -56,6 +82,26 @@ def compareTSERIESFiles(file_user, file_ref):
print(var, ecart_min, ecart_moy, ecart_max) print(var, ecart_min, ecart_moy, ecart_max)
except: except:
pass pass
# Groups comparison
for grp in avail_groups:
try:
nk=len(da['level_les'])
da = xr.open_dataset(file_user, group=grp)
da2 = xr.open_dataset(file_ref, group=grp)
variables = list(da.keys())
print(grp)
for var in variables:
try:
ecart_min = float(da2[var][:,:nk-JPVEXT].min())-float(da[var][:,:nk-JPVEXT].min())
ecart_moy = float(da2[var][:,:nk-JPVEXT].mean())-float(da[var][:,:nk-JPVEXT].mean())
ecart_max = float(da2[var][:,:nk-JPVEXT].max())-float(da[var][:,:nk-JPVEXT].max())
if (ecart_min !=0 or ecart_moy !=0 or ecart_max !=0):
status += 1
print(var, ecart_min, ecart_moy, ecart_max)
except:
pass
except:
pass
return status return status
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment