From 1a126bf5de6afcd2886f4b5e9fa04816ce362231 Mon Sep 17 00:00:00 2001
From: rinkk <karsten.rink@ufz.de>
Date: Fri, 27 Sep 2019 11:56:32 +0200
Subject: [PATCH] added tests for netcdf to vtu conversion

---
 .gitattributes                                |  1 +
 Applications/Utils/Tests.cmake                | 24 +++++++++++++++++++
 Tests/Data/FileConverter/slim_100897_198.nc   |  3 +++
 Tests/Data/FileConverter/slim_100897_198.vtu  |  3 +++
 .../sresa1b_ncar_ccsm3-example.nc             |  3 +++
 .../sresa1b_ncar_ccsm3-example.vtu            |  3 +++
 6 files changed, 37 insertions(+)
 create mode 100644 Tests/Data/FileConverter/slim_100897_198.nc
 create mode 100644 Tests/Data/FileConverter/slim_100897_198.vtu
 create mode 100644 Tests/Data/FileConverter/sresa1b_ncar_ccsm3-example.nc
 create mode 100644 Tests/Data/FileConverter/sresa1b_ncar_ccsm3-example.vtu

diff --git a/.gitattributes b/.gitattributes
index 4468522e11a..b6e96457378 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -27,6 +27,7 @@
 *.pvtu* filter=lfs diff=lfs merge=lfs -text
 *.gif filter=lfs diff=lfs merge=lfs -text
 *.mp4 filter=lfs diff=lfs merge=lfs -text
+*.nc filter=lfs diff=lfs merge=lfs -text
 web/resources/_gen/**/*.content filter=lfs diff=lfs merge=lfs -text
 # Gocad files
 *.sg filter=lfs diff=lfs merge=lfs -text
diff --git a/Applications/Utils/Tests.cmake b/Applications/Utils/Tests.cmake
index 6fffe0a5ed3..95de6c8b718 100644
--- a/Applications/Utils/Tests.cmake
+++ b/Applications/Utils/Tests.cmake
@@ -285,3 +285,27 @@ AddTest(
     DIFF_DATA
     AmmerSubsurfaceGrid.vtu AmmerGridOutput.vtu MaterialIDs MaterialIDs 0 0
 )
+
+if(OGS_USE_NETCDF)
+    AddTest(
+        NAME NetCDF_2D_Test
+        PATH FileConverter/
+        EXECUTABLE NetCdfConverter
+        EXECUTABLE_ARGS -i sresa1b_ncar_ccsm3-example.nc -o ${Data_BINARY_DIR}/FileConverter/sresa1b_ncar_ccsm3-example.vtu -v pr -t 0 --dim1 2 --dim2 1 --timestep-first 0 --timestep-last 0 -e tri
+        REQUIREMENTS NOT OGS_USE_MPI
+        TESTER vtkdiff
+        DIFF_DATA
+        sresa1b_ncar_ccsm3-example.vtu sresa1b_ncar_ccsm3-example.vtu pr pr 1e-16 0
+    )
+
+    AddTest(
+        NAME NetCDF_3D_Test
+        PATH FileConverter/
+        EXECUTABLE NetCdfConverter
+        EXECUTABLE_ARGS -i slim_100897_198.nc -o ${Data_BINARY_DIR}/FileConverter/slim_100897_198.vtu -v NO -t 0 --dim1 3 --dim2 2 --dim3 1 --timestep-first 0 --timestep-last 0 -e hex
+        REQUIREMENTS NOT OGS_USE_MPI
+        TESTER vtkdiff
+        DIFF_DATA
+        slim_100897_198.vtu slim_100897_198.vtu NO NO 1e-16 0
+    )
+endif()
diff --git a/Tests/Data/FileConverter/slim_100897_198.nc b/Tests/Data/FileConverter/slim_100897_198.nc
new file mode 100644
index 00000000000..0127d346117
--- /dev/null
+++ b/Tests/Data/FileConverter/slim_100897_198.nc
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cb278e02f075784b28241b476a1745dcad93131d9751415afbf00b9657e01718
+size 5352788
diff --git a/Tests/Data/FileConverter/slim_100897_198.vtu b/Tests/Data/FileConverter/slim_100897_198.vtu
new file mode 100644
index 00000000000..a81f426f1ec
--- /dev/null
+++ b/Tests/Data/FileConverter/slim_100897_198.vtu
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8ceec1ea5ea0967e7111c945e5e41032a8351a60bddd5ecc8675ef40ab46432e
+size 4462866
diff --git a/Tests/Data/FileConverter/sresa1b_ncar_ccsm3-example.nc b/Tests/Data/FileConverter/sresa1b_ncar_ccsm3-example.nc
new file mode 100644
index 00000000000..4b6338fe11b
--- /dev/null
+++ b/Tests/Data/FileConverter/sresa1b_ncar_ccsm3-example.nc
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2c2047ee329654f3bebf0a4b0d99eada50f1183728a3c7c129b0bc50d404511b
+size 2767916
diff --git a/Tests/Data/FileConverter/sresa1b_ncar_ccsm3-example.vtu b/Tests/Data/FileConverter/sresa1b_ncar_ccsm3-example.vtu
new file mode 100644
index 00000000000..8be050ca1bb
--- /dev/null
+++ b/Tests/Data/FileConverter/sresa1b_ncar_ccsm3-example.vtu
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4dc1627a4ea12e0d223c59f7155ad22eda205fbd0a8f4745516d08cd9a80f63f
+size 4644854
-- 
GitLab