Time series exports in TELEMAC¶
1 - Run the validation test¶
To run this notebook, install opentelemac conda package:
mamba create -n telemac_test opentelemac
mamba activate telemac_test
then, install ipykernel
an xarray-selafin
pip install ipykernel xarray-selafin hvplot holoviews jupyter-bokeh
In [1]:
!$HOMETEL
/bin/bash: line 1: /home/tomsail/miniconda3/envs/telemac_compil_test/opentelemac: Is a directory
change HOMETEL to the repo where the source code and the example are:
In [2]:
%env HOMETEL=/home/tomsail/work/opentelemac
env: HOMETEL=/home/tomsail/work/opentelemac
In [23]:
!head -30 $SYSTELCFG
### ### See http://wiki.opentelemac.org/doku.php?id=installation_notes_2_beta ### On how to install telemac ### # _____ _______________________________ # ____/ TELEMAC Project Definitions /______________________________/ # [Configurations] #configs: gnu.dynamic configs: gnu.dynamic gnu.dynamic.debug # _____ ____________________________________ # ____/ General /___________________________________/ # Global declaration used for all configurations [general] language: 2 modules: system version: main # sfx_zip: gztar sfx_lib: .a sfx_obj: .o sfx_mod: .mod sfx_exe: # # val_root: /home/tomsail/work/opentelemac/examples # val_rank: all # mods_all: -I <config>
recompile the source code (already done before in this case)
Here we test a dev branch called nearest-node-ts
for nearest neighbor interpolation
In [4]:
!compile_telemac.py
Loading Options and Configurations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _ _ _ | | | | | | _ __ ___ __ _ _ __ ___ ___ | |_ ______ _ __ ___ __| | ___ ______ | |_ ___ | '_ \ / _ \ / _` || '__| / _ \/ __|| __||______|| '_ \ / _ \ / _` | / _ \|______|| __|/ __| | | | || __/| (_| || | | __/\__ \| |_ | | | || (_) || (_| || __/ | |_ \__ \ |_| |_| \___| \__,_||_| \___||___/ \__| |_| |_| \___/ \__,_| \___| \__||___/ _ _ | | (_) __ _ _ __ _ _ __| | _ _ _ __ __ _ _ __ ___ _ ___ / _` || '_ \ | | | | / _` || | | || '_ \ / _` || '_ ` _ \ | | / __| | (_| || | | || |_| | _ | (_| || |_| || | | || (_| || | | | | || || (__ \__, ||_| |_| \__,_|(_) \__,_| \__, ||_| |_| \__,_||_| |_| |_||_| \___| __/ | __/ | |___/ |___/ Scanning the source code for: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gnu.dynamic: +> Scibian 10 dynamic build using GFortran 8.3.0 and Open MPI. +> root: /home/tomsail/work/opentelemac +> module: ad / api / artemis / bief damocles / gaia / gretel / hermes identify_liq_bnd / khione / mascaret / nestor parallel / partel / postel3d / special stbtel / telemac2d / telemac3d / tomawac waqtel Compiling from the tree top api plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top artemis plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top damocles plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top gredelhyd_autop plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top gredelmet_autop plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top gredelpts_autop plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top gredelseg_autop plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top grehis_autop plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top gretel plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top identify_liq_bnd plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top HOMERE_MASCARET plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to compile C object +> There is no need to compile C object - completed: .../opentelemac/builds/gnu.dynamic/lib/libmascaret.so +> There is no need to create the associated executable Compiling from the tree top partel plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top partel_para plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top partel_prelim plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top postel3d plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top stbtel plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top telemac2d plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top telemac3d plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Compiling from the tree top tomawac plus dependents ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> There is no need to compile any object +> There is no need to package any library +> There is no need to create the associated executable Building the Python API ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~> Wrap_api built ~> Generating the API Python wrapper ~> First part of F2PY passed ~> Second part of F2PY passed ~> Generating the Hermes Python wrapper ~> First part of F2PY passed ~> Second part of F2PY passed My work is done
check if the changes in the code are correct
In [20]:
!tail -20 $HOMETEL/sources/utils/bief/out_history.F90
IF(ABS(X(I)-X1).LT.EPS.AND.ABS(X(I)-X1).LT.EPS) IP(K)=I ENDDO ENDIF WRITE(LU,*) WRITE(LU,*) 'SOURCE POINT ',K,'PUT ON POINT' WRITE(LU,*) X1,' AND ',Y1 D2 = SQRT(P_MIN(DIST2)) WRITE(LU,*) 'LOCATED AT ',D2,' METRES' ! LINE FEED FOR THE LISTING IF(K.EQ.NP) WRITE(LU,*) ENDIF ENDDO ENDIF ! !----------------------------------------------------------------------- ! RETURN END SUBROUTINE NEAREST_NODE END MODULE OUT_HISTORY
run 3D coupling test case:
In [7]:
!validate_telemac.py $HOMETEL/examples/tomawac/3Dcoupling/vnv_3d_coupling.py
Loading Options and Configurations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _ _ _ | | | | | | _ __ ___ __ _ _ __ ___ ___ | |_ ______ _ __ ___ __| | ___ ______ | |_ ___ | '_ \ / _ \ / _` || '__| / _ \/ __|| __||______|| '_ \ / _ \ / _` | / _ \|______|| __|/ __| | | | || __/| (_| || | | __/\__ \| |_ | | | || (_) || (_| || __/ | |_ \__ \ |_| |_| \___| \__,_||_| \___||___/ \__| |_| |_| \___/ \__,_| \___| \__||___/ +> gnu.dynamic: stbtel, khione, gaia, postel3d, waqtel, courlis, tomawac, mascaret, telemac3d, telemac2d, artemis, nestor, python3 Validation < 1/1 > of <root>/examples/tomawac/3Dcoupling/vnv_3d_coupling.py ~> Checking keyword/rubrique coherence ~> Checking keyword/rubrique coherence ~> vnv_1: Nothing to do (up-to-date) ~> vnv_2: Nothing to do (up-to-date) ~> vnv_3: Nothing to do (up-to-date) ~> vnv_4: Nothing to do (up-to-date) ~> vnv_5: Nothing to do (up-to-date) ~> vnv_6: Nothing to do (up-to-date) ~> vnv_7: Nothing to do (up-to-date) ~> vnv_8: Nothing to do (up-to-date) ~> vnv_9: Nothing to do (up-to-date) ~> vnv_10: Nothing to do (up-to-date) ~> vnv_11: Nothing to do (up-to-date) ~> vnv_12: Nothing to do (up-to-date) ~> vnv_13: Nothing to do (up-to-date) ~> vnv_14: Nothing to do (up-to-date) +> checking epsilon between files ./vnv_3d_coupling/vnv_1/gnu.dynamic/r3d_littoral.slf and f3d_littoral.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 4.440892098500626e-16 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_2/gnu.dynamic/r3d_littoral.slf and f3d_littoral.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 5.684341886080802e-14 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_1/gnu.dynamic/r3d_littoral.slf and ./vnv_3d_coupling/vnv_2/gnu.dynamic/r3d_littoral.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 5.684341886080802e-14 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_1/gnu.dynamic/tom_littoral.slf and fom_littoral.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 0.0 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_2/gnu.dynamic/tom_littoral.slf and fom_littoral.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 0.0 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_1/gnu.dynamic/tom_littoral.slf and ./vnv_3d_coupling/vnv_2/gnu.dynamic/tom_littoral.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 0.0 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_3/gnu.dynamic/r3d_littoralcoup.slf and f3d_littoralcoup.slf: - Difference for variable ELEVATION Z: 3.725290298461914e-09 (eps=0.0001) - Difference for variable VELOCITY U: 7.450580596923828e-09 (eps=0.006) - Difference for variable VELOCITY V: 5.960464477539063e-08 (eps=0.007) - Difference for variable VELOCITY W: 1.862645149230957e-09 (eps=0.0004) - Difference for variable USTOKES: 9.313225746154785e-10 (eps=2e-05) - Difference for variable VSTOKES: 3.725290298461914e-09 (eps=5e-05) - Difference for variable WSTOKES: 2.3283064365386963e-10 (eps=6e-06) +> checking epsilon between files ./vnv_3d_coupling/vnv_3/gnu.dynamic/tom_couplittoral.slf and fom_couplittoral.slf: - Difference for variable WAVE HEIGHT HM0: 5.960464477539063e-08 (eps=0.005) - Difference for variable MEAN DIRECTION: 9.5367431640625e-07 (eps=0.1) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 7.450580596923828e-09 (eps=0.0002) - Difference for variable VELOCITY U: 7.450580596923828e-09 (eps=0.007) - Difference for variable VELOCITY V: 7.450580596923828e-09 (eps=0.003) - Difference for variable FORCE FX: 1.1641532182693481e-10 (eps=6e-06) - Difference for variable FORCE FY: 9.313225746154785e-10 (eps=2e-05) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=0.02) +> checking epsilon between files ./vnv_3d_coupling/vnv_3/gnu.dynamic/r3d_littoralcoup.slf and ./vnv_3d_coupling/vnv_4/gnu.dynamic/r3d_littoralcoup.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 8.881784197001252e-16 (eps=1e-08) - Difference for variable USTOKES: 0.0 (eps=1e-08) - Difference for variable VSTOKES: 0.0 (eps=1e-08) - Difference for variable WSTOKES: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_3/gnu.dynamic/tom_couplittoral.slf and ./vnv_3d_coupling/vnv_4/gnu.dynamic/tom_couplittoral.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 0.0 (eps=3e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 5.684341886080802e-14 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_3/gnu.dynamic/r2d_hist.slf and f2d_histcoup.slf: - Difference for variable VELOCITY U: 1.4551915228366852e-11 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable FREE SURFACE: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_4/gnu.dynamic/r2d_hist.slf and f2d_histcoup.slf: - Difference for variable VELOCITY U: 1.4551915228366852e-11 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable FREE SURFACE: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_3/gnu.dynamic/r3d_hist.slf and f3d_histcoup.slf: - Difference for variable ELEVATION Z: 9.313225746154785e-10 (eps=1e-08) - Difference for variable VELOCITY U: 1.1641532182693481e-10 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 2.3283064365386963e-10 (eps=1e-08) - Difference for variable USTOKES: 0.0 (eps=1e-08) - Difference for variable VSTOKES: 0.0 (eps=1e-08) - Difference for variable WSTOKES: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_4/gnu.dynamic/r3d_hist.slf and f3d_histcoup.slf: - Difference for variable ELEVATION Z: 9.313225746154785e-10 (eps=1e-08) - Difference for variable VELOCITY U: 1.1641532182693481e-10 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 2.3283064365386963e-10 (eps=1e-08) - Difference for variable USTOKES: 0.0 (eps=1e-08) - Difference for variable VSTOKES: 0.0 (eps=1e-08) - Difference for variable WSTOKES: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_3/gnu.dynamic/r2d_hist.slf and ./vnv_3d_coupling/vnv_4/gnu.dynamic/r2d_hist.slf: - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable FREE SURFACE: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_3/gnu.dynamic/r3d_hist.slf and ./vnv_3d_coupling/vnv_4/gnu.dynamic/r3d_hist.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 0.0 (eps=1e-08) - Difference for variable USTOKES: 0.0 (eps=1e-08) - Difference for variable VSTOKES: 0.0 (eps=1e-08) - Difference for variable WSTOKES: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_13/gnu.dynamic/r2d_hist.slf and f2d_histcoup.slf: - Difference for variable VELOCITY U: 1.4551915228366852e-11 (eps=0.0001) - Difference for variable VELOCITY V: 0.0 (eps=0.0001) - Difference for variable WATER DEPTH: 0.0 (eps=0.0001) - Difference for variable FREE SURFACE: 0.0 (eps=0.0001) +> checking epsilon between files ./vnv_3d_coupling/vnv_13/gnu.dynamic/r3d_hist.slf and f3d_histcoup.slf: - Difference for variable ELEVATION Z: 9.313225746154785e-10 (eps=0.0001) - Difference for variable VELOCITY U: 1.1641532182693481e-10 (eps=0.0001) - Difference for variable VELOCITY V: 0.0 (eps=0.0001) - Difference for variable VELOCITY W: 2.3283064365386963e-10 (eps=0.0001) - Difference for variable USTOKES: 0.0 (eps=0.0001) - Difference for variable VSTOKES: 0.0 (eps=0.0001) - Difference for variable WSTOKES: 0.0 (eps=0.0001) +> checking epsilon between files ./vnv_3d_coupling/vnv_14/gnu.dynamic/r2d_hist.slf and f2d_histcoup.slf: - Difference for variable VELOCITY U: 1.4551915228366852e-11 (eps=0.0001) - Difference for variable VELOCITY V: 0.0 (eps=0.0001) - Difference for variable WATER DEPTH: 0.0 (eps=0.0001) - Difference for variable FREE SURFACE: 0.0 (eps=0.0001) +> checking epsilon between files ./vnv_3d_coupling/vnv_14/gnu.dynamic/r3d_hist.slf and f3d_histcoup.slf: - Difference for variable ELEVATION Z: 9.313225746154785e-10 (eps=0.0001) - Difference for variable VELOCITY U: 1.1641532182693481e-10 (eps=0.0001) - Difference for variable VELOCITY V: 0.0 (eps=0.0001) - Difference for variable VELOCITY W: 2.3283064365386963e-10 (eps=0.0001) - Difference for variable USTOKES: 0.0 (eps=0.0001) - Difference for variable VSTOKES: 0.0 (eps=0.0001) - Difference for variable WSTOKES: 0.0 (eps=0.0001) +> checking epsilon between files ./vnv_3d_coupling/vnv_5/gnu.dynamic/r3d_littoral_diff.slf and f3d_littoral_diff.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 4.547473508864641e-13 (eps=1e-08) - Difference for variable VELOCITY W: 1.7763568394002505e-15 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_5/gnu.dynamic/tom_littoral_diff.slf and fom_littoral_diff.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 3.76158192263132e-36 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_5/gnu.dynamic/r3d_littoral_diff.slf and ./vnv_3d_coupling/vnv_6/gnu.dynamic/r3d_littoral_diff.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 4.547473508864641e-13 (eps=1e-08) - Difference for variable VELOCITY W: 7.275957614183426e-12 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_5/gnu.dynamic/tom_littoral_diff.slf and ./vnv_3d_coupling/vnv_6/gnu.dynamic/tom_littoral_diff.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 3.0844971765576824e-35 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_7/gnu.dynamic/r3d_couplittoral_diff.slf and f3d_couplittoral_diff.slf: - Difference for variable ELEVATION Z: 3.725290298461914e-09 (eps=1e-08) - Difference for variable VELOCITY U: 1.4901161193847656e-08 (eps=6e-08) - Difference for variable VELOCITY V: 5.960464477539063e-08 (eps=6e-08) - Difference for variable VELOCITY W: 1.862645149230957e-09 (eps=1e-08) - Difference for variable USTOKES: 9.313225746154785e-10 (eps=6e-08) - Difference for variable VSTOKES: 1.862645149230957e-09 (eps=1e-08) - Difference for variable WSTOKES: 2.3283064365386963e-10 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_7/gnu.dynamic/tom_3Dcouplittoral_diff.slf and fom_couplittoral_diff.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 0.0 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 3.725290298461914e-09 (eps=1e-08) - Difference for variable VELOCITY V: 3.725290298461914e-09 (eps=1e-08) - Difference for variable FORCE FX: 2.2737367544323206e-13 (eps=1e-08) - Difference for variable FORCE FY: 3.725290298461914e-09 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_7/gnu.dynamic/r3d_couplittoral_diff.slf and ./vnv_3d_coupling/vnv_8/gnu.dynamic/r3d_couplittoral_diff.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 7.275957614183426e-12 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 3.637978807091713e-12 (eps=1e-08) - Difference for variable USTOKES: 0.0 (eps=1e-08) - Difference for variable VSTOKES: 0.0 (eps=1e-08) - Difference for variable WSTOKES: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_7/gnu.dynamic/tom_3Dcouplittoral_diff.slf and ./vnv_3d_coupling/vnv_8/gnu.dynamic/tom_3Dcouplittoral_diff.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 0.0 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 3.552713678800501e-15 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_9/gnu.dynamic/r3d_littoral.slf and f3d_littoral.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 4.440892098500626e-16 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_9/gnu.dynamic/tom_littoral.slf and fom_littoral.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 0.0 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_9/gnu.dynamic/r3d_littoral.slf and ./vnv_3d_coupling/vnv_10/gnu.dynamic/r3d_littoral.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 5.684341886080802e-14 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_9/gnu.dynamic/tom_littoral.slf and ./vnv_3d_coupling/vnv_10/gnu.dynamic/tom_littoral.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 0.0 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_11/gnu.dynamic/r3d_couplittoral_same.slf and f3d_littoralcoup.slf: - Difference for variable ELEVATION Z: 3.725290298461914e-09 (eps=0.0001) - Difference for variable VELOCITY U: 7.450580596923828e-09 (eps=0.006) - Difference for variable VELOCITY V: 5.960464477539063e-08 (eps=0.007) - Difference for variable VELOCITY W: 1.862645149230957e-09 (eps=0.0004) - Difference for variable USTOKES: 9.313225746154785e-10 (eps=2e-05) - Difference for variable VSTOKES: 3.725290298461914e-09 (eps=5e-05) - Difference for variable WSTOKES: 2.3283064365386963e-10 (eps=6e-06) +> checking epsilon between files ./vnv_3d_coupling/vnv_11/gnu.dynamic/tom_3Dcouplittoral_same.slf and fom_couplittoral.slf: - Difference for variable WAVE HEIGHT HM0: 5.960464477539063e-08 (eps=0.005) - Difference for variable MEAN DIRECTION: 9.5367431640625e-07 (eps=0.1) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 7.450580596923828e-09 (eps=0.0002) - Difference for variable VELOCITY U: 7.450580596923828e-09 (eps=0.007) - Difference for variable VELOCITY V: 7.450580596923828e-09 (eps=0.003) - Difference for variable FORCE FX: 1.1641532182693481e-10 (eps=6e-06) - Difference for variable FORCE FY: 9.313225746154785e-10 (eps=2e-05) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=0.02) +> checking epsilon between files ./vnv_3d_coupling/vnv_11/gnu.dynamic/r3d_couplittoral_same.slf and ./vnv_3d_coupling/vnv_12/gnu.dynamic/r3d_couplittoral_same.slf: - Difference for variable ELEVATION Z: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 0.0 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable VELOCITY W: 8.881784197001252e-16 (eps=1e-08) - Difference for variable USTOKES: 0.0 (eps=1e-08) - Difference for variable VSTOKES: 0.0 (eps=1e-08) - Difference for variable WSTOKES: 0.0 (eps=1e-08) +> checking epsilon between files ./vnv_3d_coupling/vnv_11/gnu.dynamic/tom_3Dcouplittoral_same.slf and ./vnv_3d_coupling/vnv_12/gnu.dynamic/tom_3Dcouplittoral_same.slf: - Difference for variable WAVE HEIGHT HM0: 0.0 (eps=1e-08) - Difference for variable MEAN DIRECTION: 0.0 (eps=1e-08) - Difference for variable BOTTOM: 0.0 (eps=1e-08) - Difference for variable WATER DEPTH: 0.0 (eps=1e-08) - Difference for variable VELOCITY U: 5.684341886080802e-14 (eps=1e-08) - Difference for variable VELOCITY V: 0.0 (eps=1e-08) - Difference for variable FORCE FX: 0.0 (eps=1e-08) - Difference for variable FORCE FY: 0.0 (eps=1e-08) - Difference for variable PEAK PERIOD TPR5: 0.0 (eps=1e-08) ~> Plotting img/fond ~> Plotting img/resultscoupVert ~> Plotting img/resultscoupVert2 ~> Plotting img/resultshori ~> Plotting img/HM01 ~> Plotting img/resultscoupVert3 ~> Plotting img/resultscoupVert23 ~> Plotting img/resultshori3 ~> Plotting img/HM03 ~> Plotting img/mesh5T3D ~> Plotting img/mesh5WAC ~> Plotting img/HM05 ~> Plotting img/HM07 My work is done
2 - Visualise and compare 1D / 2D results¶
compare file exports
In [8]:
import os
hist_file2D = os.environ['HOMETEL'] + "/examples/tomawac/3Dcoupling/vnv_3d_coupling/vnv_14/gnu.dynamic/r2d_hist.slf"
out_file2D = os.environ['HOMETEL'] + "/examples/tomawac/3Dcoupling/vnv_3d_coupling/vnv_14/gnu.dynamic/r2d_littoralcoup.slf"
hist_file_WAC=os.environ['HOMETEL'] + "/examples/tomawac/3Dcoupling/vnv_3d_coupling/vnv_14/gnu.dynamic/tom_hist.slf"
out_fileWAC = os.environ['HOMETEL'] + "/examples/tomawac/3Dcoupling/vnv_3d_coupling/vnv_14/gnu.dynamic/tom_couplittoral.slf"
In [9]:
import xarray as xr
ds1D = xr.open_dataset(hist_file2D);ds1D
ds2D = xr.open_dataset(out_file2D);ds2D
Out[9]:
<xarray.Dataset> Size: 3kB Dimensions: (time: 21, node: 8) Coordinates: x (node) float32 32B ... y (node) float32 32B ... * time (time) datetime64[ns] 168B 1900-01-01 ... 1900-01-01T00:16:40 Dimensions without coordinates: node Data variables: U (time, node) float32 672B ... V (time, node) float32 672B ... H (time, node) float32 672B ... S (time, node) float32 672B ... Attributes: title: HISTORY FILE language: en float_size: 4 endian: > params: (1, 0, 0, 0, 0, 0, 0, 8, 0, 1) ipobo: [1 2 3 4 5 6 7 8] ikle2: [[1]\n [2]\n [3]\n [4]\n [5]\n [6]\n [7]\n [8]] variables: {'U': ('VELOCITY U', 'M/S'), 'V': ('VELOCITY V', 'M/S'), 'H'... date_start: (1900, 1, 1, 0, 0, 0)
Out[9]:
<xarray.Dataset> Size: 719kB Dimensions: (time: 21, node: 2091) Coordinates: x (node) float32 8kB ... y (node) float32 8kB ... * time (time) datetime64[ns] 168B 1900-01-01 ... 1900-01-01T00:16:40 Dimensions without coordinates: node Data variables: U (time, node) float32 176kB ... V (time, node) float32 176kB ... H (time, node) float32 176kB ... S (time, node) float32 176kB ... Attributes: title: TELEMAC 3D : COUPLAGE TOMAWAC language: en float_size: 4 endian: > params: (1, 0, 0, 0, 0, 0, 0, 180, 0, 1) ipobo: [1 2 3 ... 0 0 0] ikle2: [[ 1 2 181]\n [ 1 181 180]\n [ 2 3 181]\n ..... variables: {'U': ('VELOCITY U', 'M/S'), 'V': ('VELOCITY V', 'M/S'), 'H'... date_start: (1900, 1, 1, 0, 0, 0)
Use hvplot package for inter-active visualisation
In [11]:
import hvplot.xarray
In [26]:
ds2D.hvplot.scatter(x='x', y='y', c='S', s = 20)*ds1D.hvplot.scatter(x='x', y='y', c='S', s= 150, line_color = 'k')
Out[26]:
BokehModel(combine_events=True, render_bundle={'docs_json': {'9d6fddcb-a0bf-492c-8f57-4cf73ac29669': {'version…
In [28]:
def plot_1D(ds, var):
plot = ds[var].isel(node=0).hvplot.line(label = "node 0")
for node in range(len(ds.node))[1:]:
plot *= ds[var].isel(node=node).hvplot.line(label = f"node {node}")
return plot
plot_1D(ds1D, "S")
Out[28]:
In [14]:
hist_WAC = xr.open_dataset(hist_file_WAC);hist_WAC
dsWAC = xr.open_dataset(out_fileWAC);dsWAC
Out[14]:
<xarray.Dataset> Size: 6kB Dimensions: (time: 21, node: 8) Coordinates: x (node) float32 32B ... y (node) float32 32B ... * time (time) datetime64[ns] 168B 1900-01-01 ... 1900-01-01T00:16:40 Dimensions without coordinates: node Data variables: WH (time, node) float32 672B ... THETAW (time, node) float32 672B ... B (time, node) float32 672B ... H (time, node) float32 672B ... U (time, node) float32 672B ... V (time, node) float32 672B ... FORCE FX (time, node) float32 672B ... FORCE FY (time, node) float32 672B ... PPT (time, node) float32 672B ... Attributes: title: HISTORY FILE language: en float_size: 4 endian: > params: (1, 0, 0, 0, 0, 0, 0, 8, 0, 0) ipobo: [1 2 3 4 5 6 7 8] ikle2: [[1]\n [2]\n [3]\n [4]\n [5]\n [6]\n [7]\n [8]] variables: {'WH': ('WAVE HEIGHT HM0', 'M'), 'THETAW': ('MEAN DIRECTION'... date_start: (1900, 1, 1, 0, 0, 0)
Out[14]:
<xarray.Dataset> Size: 845kB Dimensions: (time: 11, node: 2091) Coordinates: x (node) float32 8kB ... y (node) float32 8kB ... * time (time) datetime64[ns] 88B 1900-01-01 ... 1900-01-01T00:16:40 Dimensions without coordinates: node Data variables: WH (time, node) float32 92kB ... THETAW (time, node) float32 92kB ... B (time, node) float32 92kB ... H (time, node) float32 92kB ... U (time, node) float32 92kB ... V (time, node) float32 92kB ... FORCE FX (time, node) float32 92kB ... FORCE FY (time, node) float32 92kB ... PPT (time, node) float32 92kB ... Attributes: title: LITTORAL language: en float_size: 4 endian: > params: (1, 0, 0, 0, 0, 0, 0, 180, 0, 0) ipobo: [1 2 3 ... 0 0 0] ikle2: [[ 1 2 181]\n [ 1 181 180]\n [ 2 3 181]\n ..... variables: {'WH': ('WAVE HEIGHT HM0', 'M'), 'THETAW': ('MEAN DIRECTION'... date_start: (1900, 1, 1, 0, 0, 0)
Here you might get errors because the history fille has more time steps than the 2D TOMAWAC output
In [15]:
dsWAC.hvplot.scatter(x='x', y='y', c='WH', s = 20)*hist_WAC.hvplot.scatter(x='x', y='y', c='WH', s= 150, line_color = 'k')
Out[15]:
BokehModel(combine_events=True, render_bundle={'docs_json': {'359b8d90-c828-4841-ba26-d18ccb7bf4a6': {'version…
In [16]:
plot_1D(hist_WAC, "WH")
Out[16]:
In [19]:
hist_file3D = os.environ['HOMETEL'] + "/examples/tomawac/3Dcoupling/vnv_3d_coupling/vnv_14/gnu.dynamic/r3d_hist.slf"
ds = xr.open_dataset(hist_file3D)
SERAFIN VALIDATION ERROR: The number of nodes per element is not equal to 6
--------------------------------------------------------------------------- SerafinValidationError Traceback (most recent call last) Cell In[19], line 2 1 hist_file3D = os.environ['HOMETEL'] + "/examples/tomawac/3Dcoupling/vnv_3d_coupling/vnv_14/gnu.dynamic/r3d_hist.slf" ----> 2 ds = xr.open_dataset(hist_file3D) File ~/miniconda3/envs/telemac_compil_test/lib/python3.11/site-packages/xarray/backends/api.py:611, in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, inline_array, chunked_array_type, from_array_kwargs, backend_kwargs, **kwargs) 599 decoders = _resolve_decoders_kwargs( 600 decode_cf, 601 open_backend_dataset_parameters=backend.open_dataset_parameters, (...) 607 decode_coords=decode_coords, 608 ) 610 overwrite_encoded_chunks = kwargs.pop("overwrite_encoded_chunks", None) --> 611 backend_ds = backend.open_dataset( 612 filename_or_obj, 613 drop_variables=drop_variables, 614 **decoders, 615 **kwargs, 616 ) 617 ds = _dataset_from_backend_dataset( 618 backend_ds, 619 filename_or_obj, (...) 629 **kwargs, 630 ) 631 return ds File ~/miniconda3/envs/telemac_compil_test/lib/python3.11/site-packages/xarray_selafin/xarray_backend.py:271, in SelafinBackendEntrypoint.open_dataset(self, filename_or_obj, drop_variables, decode_times, lazy_loading, lang) 260 def open_dataset( 261 self, 262 filename_or_obj, (...) 269 ): 270 # Initialize SELAFIN reader --> 271 slf = read_serafin(filename_or_obj, lang) 272 is_2d = slf.header.is_2d 274 # Prepare dimensions, coordinates, and data variables File ~/miniconda3/envs/telemac_compil_test/lib/python3.11/site-packages/xarray_selafin/xarray_backend.py:25, in read_serafin(f, lang) 23 resin = Serafin.Read(f, lang) 24 resin.__enter__() ---> 25 resin.read_header() 26 resin.get_time() 27 return resin File ~/miniconda3/envs/telemac_compil_test/lib/python3.11/site-packages/xarray_selafin/Serafin.py:1027, in Read.read_header(self) 1023 """! 1024 @brief Read the file header and check the file consistency 1025 """ 1026 self.header = SerafinHeader(lang=self.language) -> 1027 self.header.from_file(self.file, self.file_size) File ~/miniconda3/envs/telemac_compil_test/lib/python3.11/site-packages/xarray_selafin/Serafin.py:892, in SerafinHeader.from_file(self, file, file_size) 889 raise SerafinValidationError("The magic number is not equal to one") 890 file.read(4) --> 892 self._check_dim() 894 # determine the number of nodes in 2D 895 if self.is_2d: File ~/miniconda3/envs/telemac_compil_test/lib/python3.11/site-packages/xarray_selafin/Serafin.py:200, in SerafinHeader._check_dim(self) 198 else: 199 if self.nb_nodes_per_elem != 6: --> 200 raise SerafinValidationError( 201 "The number of nodes per element is not equal to 6" 202 ) 203 if self.nb_planes < 2: 204 raise SerafinValidationError("The number of planes is less than 2") SerafinValidationError: The number of nodes per element is not equal to 6
Here we need to fix the xarray-selafin for reading time series outputs for 3D models.
To be continued...