Skip to content
Snippets Groups Projects
Commit f95ce1f1 authored by RIETTE Sébastien's avatar RIETTE Sébastien
Browse files

Allow the simulation to be run in the user pack

parent 213b8aa0
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,6 @@ fi ...@@ -71,7 +71,6 @@ fi
# exit 3 # exit 3
#fi #fi
fromdir=$commit
if echo $commit | grep '/' > /dev/null; then if echo $commit | grep '/' > /dev/null; then
name=MNH-V5-5-0-$(echo $commit | sed 's/\//_/g') name=MNH-V5-5-0-$(echo $commit | sed 's/\//_/g')
[ $suppress -eq 1 -a -d $MNHPACK/$name ] && rm -rf $MNHPACK/$name [ $suppress -eq 1 -a -d $MNHPACK/$name ] && rm -rf $MNHPACK/$name
...@@ -80,6 +79,32 @@ else ...@@ -80,6 +79,32 @@ else
[ $suppress -eq 1 -a -d $MNHPACK/$name ] && rm -rf $MNHPACK/$name [ $suppress -eq 1 -a -d $MNHPACK/$name ] && rm -rf $MNHPACK/$name
fi fi
#Two possibilities are supported for the simulations
# - they can be done in the the pack we are currently checking
# - they can be done in the reference pack
#They are done in the current pack except if the reference pack
#already contains a tested simulation
run_in_ref=$(ls -d $REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2_* | tail -1 |wc -l)
if [ $run_in_ref -eq 1 ]; then
path_user_beg=$REFDIR/MNH-V5-5-0
path_user_end=_$commit
path_ref_beg=$REFDIR/MNH-V5-5-0
if [ "$reference" == "" ]; then
path_ref_end=
else
path_ref_end=_$reference
fi
else
path_user_beg=$MNHPACK/$name
path_user_end=
path_ref_end=
if [ "$reference" == "" ]; then
path_ref_beg=$REFDIR/MNH-V5-5-0
else
path_ref_beg=$MNHPACK/MNH-V5-5-0-$reference
fi
fi
if [ $compilation -eq 1 ]; then if [ $compilation -eq 1 ]; then
echo "### Compilation of commit $commit" echo "### Compilation of commit $commit"
...@@ -174,9 +199,22 @@ if [ $run -ge 1 ]; then ...@@ -174,9 +199,22 @@ if [ $run -ge 1 ]; then
exit 6 exit 6
fi fi
cd $REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/ if [ $run_in_ref -eq 1 ]; then
[ ! -d 008_run2_$commit ] && cp -R 008_run2 008_run2_$commit cd $REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/
cd $REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2_$commit [ ! -d 008_run2_$commit ] && cp -R 008_run2 008_run2_$commit
cd $REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2_$commit
else
cd $MNHPACK/$name/MY_RUN/KTEST/007_16janvier/
for rep in ???_*; do
if [ $rep != 008_run2 ]; then
rm -rf $rep
ln -s $REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/$rep .
fi
done
[ -d 008_run2 ] && rm -rf 008_run2
cp -R $REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2 .
cd 008_run2
fi
set +e #file ends with a test that can return false set +e #file ends with a test that can return false
[ $compilation -eq 0 ] && . $MNHPACK/$name/conf/profile_mesonh-LXgfortran-R8I4-MNH-V5-5-0-MPIAUTO-DEBUG [ $compilation -eq 0 ] && . $MNHPACK/$name/conf/profile_mesonh-LXgfortran-R8I4-MNH-V5-5-0-MPIAUTO-DEBUG
...@@ -188,32 +226,35 @@ fi ...@@ -188,32 +226,35 @@ fi
if [ $check -eq 1 ]; then if [ $check -eq 1 ]; then
allt=0 allt=0
echo "### Check commit $commit against commit $reference" echo "### Check commit $commit against commit $reference"
path_user=$path_user_beg/MY_RUN/KTEST/007_16janvier/008_run2$path_user_end
path_ref=$path_ref_beg/MY_RUN/KTEST/007_16janvier/008_run2$path_ref_end
if [ ! -d $path_user ]; then
echo "$path_user is missing, please run the simulation"
exit 7
fi
if [ ! -d $path_ref ]; then
echo "$path_ref is missing, please run the reference simulation"
exit 8
fi
echo "Compare with python..." echo "Compare with python..."
# Compare variable of both Synchronous and Diachronic files with printing difference # Compare variable of both Synchronous and Diachronic files with printing difference
set +e set +e
if [ "$reference" == "" ]; then $PHYEXTOOLSDIR/compare.py $path_user $path_ref
$PHYEXTOOLSDIR/compare.py $commit ref
else
$PHYEXTOOLSDIR/compare.py $commit $reference
fi
t=$? t=$?
set -e set -e
allt=$(($allt+$t)) allt=$(($allt+$t))
#Check bit-repro after date of creation of Synchronous file from ncdump of all values (pb with direct .nc file checks) #Check bit-repro before date of creation of Synchronous file from ncdump of all values (pb with direct .nc file checks)
file1=$REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2_$commit/16JAN.1.12B18.001.nc file1=$path_user/16JAN.1.12B18.001.nc
if [ "$reference" == "" ]; then file2=$path_ref/16JAN.1.12B18.001.nc
file2="$REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2/16JAN.1.12B18.001.nc"
else
file2=$REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2_$reference/16JAN.1.12B18.001.nc
fi
echo "Compare with ncdump..." echo "Compare with ncdump..."
set +e set +e
diff <(ncdump $file1 | head -c 62889) <(ncdump $file2 | head -c 62889) diff <(ncdump $file1 | head -c 62889) <(ncdump $file2 | head -c 62889)
t=$? t=$?
set -e set -e
allt=$(($allt+$t)) allt=$(($allt+$t))
#rm -f dump_$commit dump_$reference
if [ $allt -eq 0 ]; then if [ $allt -eq 0 ]; then
status="OK" status="OK"
......
#!/usr/bin/env python3 #!/usr/bin/env python3
import xarray as xr import xarray as xr
import os
REFDIR = os.environ['REFDIR'] def compareFiles(path_user, path_ref):
def compareFiles(file1, file2):
status = 0 status = 0
path_user = REFDIR + 'MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2_' + file1
if file2 == "ref":
path_ref = REFDIR + 'MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2'
else:
path_ref = REFDIR + 'MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2_' + file2
filen = '16JAN.1.12B18.001.nc' filen = '16JAN.1.12B18.001.nc'
da = xr.open_dataset(path_user + '/' + filen) da = xr.open_dataset(path_user + '/' + filen)
...@@ -51,7 +43,7 @@ if __name__ == "__main__": ...@@ -51,7 +43,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Compare toutes les variables si trouvées dans les deux fichiers') parser = argparse.ArgumentParser(description='Compare toutes les variables si trouvées dans les deux fichiers')
value = argparse.ArgumentParser() value = argparse.ArgumentParser()
parser.add_argument('file1', metavar='file1', type=str, help="file1 user ") parser.add_argument('file1', metavar='file1', type=str, help="file1 user ")
parser.add_argument('file2', metavar='file2', type=str, help="file2 reference; ref for MNH-V5-5-0 reference") parser.add_argument('file2', metavar='file2', type=str, help="file2 reference")
args = parser.parse_args() args = parser.parse_args()
sys.exit(compareFiles(args.file1, args.file2)) sys.exit(compareFiles(args.file1, args.file2))
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