diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 366045140500dbe8f5b427ee14d86c84c707cc2b..013a8977bd8908da3a85ef0a347e6e11c3e2ff9a 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -207,3 +207,16 @@ target_include_directories(test_spher_polyline_area PRIVATE ${contour_531_INCLUDE_DIR}) target_link_libraries(test_spher_polyline_area ${geometry_LIBRARY}) + +# test_interpolate_eddy + +add_executable(test_interpolate_eddy derived_types.f90 init_shapefiles.f90 + read_eddy.f90 write_eddy.f90 read_field_indices.f90 interpolate_eddy.f90 + ${CMAKE_CURRENT_LIST_DIR}/test_interpolate_eddy.f90) + +target_include_directories(test_interpolate_eddy PRIVATE + ${contour_531_INCLUDE_DIR} ${fortrangis_INCLUDE_DIR}) + +target_link_libraries(test_interpolate_eddy ${contour_531_LIBRARY} + ${shapelib_03_LIBRARY} ${fortrangis_LIBRARY} ${fortranc_LIBRARY} + ${shapelib_LIBRARY} ${GPC_F_LIBRARY} ${GPC_LIBRARY}) diff --git a/Tests/Input/Snapshot_region_1/extremum.dbf b/Tests/Input/Snapshot_region_1/extremum.dbf new file mode 100644 index 0000000000000000000000000000000000000000..b31c2ce0b927d50f427b0005f79792b7467691f9 Binary files /dev/null and b/Tests/Input/Snapshot_region_1/extremum.dbf differ diff --git a/Tests/Input/Snapshot_region_1/extremum.shp b/Tests/Input/Snapshot_region_1/extremum.shp new file mode 100644 index 0000000000000000000000000000000000000000..cf63ca639fe83064f1232e56a60e990653335eeb Binary files /dev/null and b/Tests/Input/Snapshot_region_1/extremum.shp differ diff --git a/Tests/Input/Snapshot_region_1/extremum.shx b/Tests/Input/Snapshot_region_1/extremum.shx new file mode 100644 index 0000000000000000000000000000000000000000..f13703c3cd11ecde24edd34b3af4507d40d73b48 Binary files /dev/null and b/Tests/Input/Snapshot_region_1/extremum.shx differ diff --git a/Tests/Input/Snapshot_region_1/max_speed_contour.dbf b/Tests/Input/Snapshot_region_1/max_speed_contour.dbf new file mode 100644 index 0000000000000000000000000000000000000000..e5f933715f14735908f0e9cfd5728bd99b1270f0 Binary files /dev/null and b/Tests/Input/Snapshot_region_1/max_speed_contour.dbf differ diff --git a/Tests/Input/Snapshot_region_1/max_speed_contour.shp b/Tests/Input/Snapshot_region_1/max_speed_contour.shp new file mode 100644 index 0000000000000000000000000000000000000000..2914ec9b1911440c834dac449ebb17f7d12a5fdc Binary files /dev/null and b/Tests/Input/Snapshot_region_1/max_speed_contour.shp differ diff --git a/Tests/Input/Snapshot_region_1/max_speed_contour.shx b/Tests/Input/Snapshot_region_1/max_speed_contour.shx new file mode 100644 index 0000000000000000000000000000000000000000..52af03cc0cf154f9843ad95df346964468663691 Binary files /dev/null and b/Tests/Input/Snapshot_region_1/max_speed_contour.shx differ diff --git a/Tests/Input/Snapshot_region_1/mkdir_run_stdout.txt b/Tests/Input/Snapshot_region_1/mkdir_run_stdout.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e821a08760df102f008415dd5e8a2e3b043c7ca --- /dev/null +++ b/Tests/Input/Snapshot_region_1/mkdir_run_stdout.txt @@ -0,0 +1,18 @@ ++ mkdir Snapshot ++ /home/guez/build/Ifort/Detection_eddies_debug/extraction_eddies + &MAIN_NML + MIN_AMP = 1.0000000E-03 , + MAX_RADIUS = 2*20, + MIN_RADIUS = 25.00000 + / + Enter namelist main_nml. + &MAIN_NML + MIN_AMP = 1.0000000E-03 , + MAX_RADIUS = 2*20, + MIN_RADIUS = 25.00000 + / + periodic = F + Number of extrema: 8 + Created shapefile "Snapshot/extremum". + Created shapefile "Snapshot/outermost_contour". + Created shapefile "Snapshot/max_speed_contour". diff --git a/Tests/Input/Snapshot_region_1/outermost_contour.dbf b/Tests/Input/Snapshot_region_1/outermost_contour.dbf new file mode 100644 index 0000000000000000000000000000000000000000..760a7ab04ba886015c0dc823332e6043431929da Binary files /dev/null and b/Tests/Input/Snapshot_region_1/outermost_contour.dbf differ diff --git a/Tests/Input/Snapshot_region_1/outermost_contour.shp b/Tests/Input/Snapshot_region_1/outermost_contour.shp new file mode 100644 index 0000000000000000000000000000000000000000..8bf66e5873cdc323754bc8bc394abc3b144cd0e7 Binary files /dev/null and b/Tests/Input/Snapshot_region_1/outermost_contour.shp differ diff --git a/Tests/Input/Snapshot_region_1/outermost_contour.shx b/Tests/Input/Snapshot_region_1/outermost_contour.shx new file mode 100644 index 0000000000000000000000000000000000000000..16c83fef35f2c919684f8622173c8d37bb7613c1 Binary files /dev/null and b/Tests/Input/Snapshot_region_1/outermost_contour.shx differ diff --git a/Tests/short_tests.json b/Tests/short_tests.json index 1481c522bed31708dd08fb795e2decc85c2a338e..df39275718d140cb1fda015338e61bc8e302a581 100644 --- a/Tests/short_tests.json +++ b/Tests/short_tests.json @@ -318,5 +318,12 @@ "title" : "Successive_overlap_global", "description": "Global grid, normal 0.25° resolution.", "stdin_filename": "$src_dir/Tests/Input/successive_overlap_global_nml.txt" + }, + { + "args": ["$src_dir/mkdir_run.sh", "$build_dir/test_interpolate_eddy"], + "required": + [["$src_dir/Tests/Input/Snapshot_region_1", "Snapshot_old"]], + "title": "Interpolate_eddy", + "input" : "&main_nml ISHAPE_2 = 2, k2 = 20457, k = 20456/\n" } ] diff --git a/Tests/test_interpolate_eddy.f90 b/Tests/test_interpolate_eddy.f90 new file mode 100644 index 0000000000000000000000000000000000000000..3bc20691532aee300aa206d54f0490aadf900873 --- /dev/null +++ b/Tests/test_interpolate_eddy.f90 @@ -0,0 +1,58 @@ +program test_interpolate_eddy + + use, intrinsic:: ISO_FORTRAN_ENV + + ! Libraries: + use shapelib, only: shpfileobject, shpclose + use shapelib_03, only: shp_open_03 + + use derived_types, only: eddy + use init_shapefiles_m, only: init_shapefiles + use interpolate_eddy_m, only: interpolate_eddy + use read_eddy_m, only: read_eddy + use read_field_indices_m, only: read_field_indices + use write_eddy_m, only: write_eddy + + implicit none + + type(eddy) e1, e2 + integer k1, i + integer:: k2 = 90001, k = 90000, ishape_1 = 0, ishape_2 = 1 + TYPE(shpfileobject) hshp_extremum ! shapefile extremum + TYPE(shpfileobject) hshp_outermost ! shapefile outermost_contour + TYPE(shpfileobject) hshp_max_speed ! shapefile max_speed_contour + namelist /main_nml/ ishape_1, ishape_2, k2, k + + !------------------------------------------------------------------------- + + write(unit = error_unit, nml = main_nml) + write(unit = error_unit, fmt = *) "Enter namelist main_nml." + read(unit = *, nml = main_nml) + write(unit = *, nml = main_nml) + + call shp_open_03(hshp_extremum, "Snapshot_old/extremum", pszaccess = "rb") + call shp_open_03(hshp_outermost, "Snapshot_old/outermost_contour", & + pszaccess = "rb") + call shp_open_03(hshp_max_speed, "Snapshot_old/max_speed_contour", & + pszaccess = "rb") + call read_field_indices(hshp_extremum, hshp_outermost, hshp_max_speed) + call read_eddy(e1, k1, i, hshp_extremum, hshp_outermost, hshp_max_speed, & + ishape_1) + call read_eddy(e2, k1, i, hshp_extremum, hshp_outermost, hshp_max_speed, & + ishape_2) + CALL shpclose(hshp_extremum) + CALL shpclose(hshp_outermost) + CALL shpclose(hshp_max_speed) + + call init_shapefiles(hshp_extremum, hshp_outermost, hshp_max_speed) + + call write_eddy(interpolate_eddy(e1, e2, k1, k2, k), hshp_extremum, & + hshp_outermost, hshp_max_speed, k, i = 1) + CALL shpclose(hshp_extremum) + print *, 'Created shapefile "extremum".' + CALL shpclose(hshp_outermost) + print *, 'Created shapefile "outermost_contour".' + CALL shpclose(hshp_max_speed) + print *, 'Created shapefile "max_speed_contour".' + +end program test_interpolate_eddy