From af2f6c98d55a9e497f4ed8e93f6ac8369b1ea34e Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Thu, 17 Jun 2021 23:33:13 +0200 Subject: [PATCH] Rename triplet to collection Rename triplet to collection, `shp_tr` to shpc, shpt to shpc in comments, identifiers and file names. --- Common/derived_types.f90 | 4 +-- Common/read_eddy.f90 | 4 +-- Common/read_field_indices.f90 | 4 +-- Common/read_snapshot.f90 | 4 +-- Common/shp_tr_open.f90 | 31 ----------------- Common/{shp_tr_close.f90 => shpc_close.f90} | 12 +++---- Common/{shp_tr_create.f90 => shpc_create.f90} | 20 +++++------ Common/shpc_open.f90 | 31 +++++++++++++++++ Common/write_eddy.f90 | 4 +-- Convert_Matlab/inst_eddies_HDF5.py | 16 ++++----- Inst_eddies/Analysis/triplet_dump.sh | 4 +-- Inst_eddies/CMakeLists.txt | 4 +-- Inst_eddies/Tests/CMakeLists.txt | 18 +++++----- Inst_eddies/Tests/test_get_1_outerm.f90 | 12 +++---- Inst_eddies/Tests/test_nearby_extr.f90 | 12 +++---- Inst_eddies/Tests/test_set_all_outerm.f90 | 16 ++++----- Inst_eddies/Tests/test_set_max_speed.f90 | 23 ++++++------- Inst_eddies/config.f90 | 14 ++++---- Inst_eddies/inst_eddies.f90 | 20 +++++------ Inst_eddies/write_aux.f90 | 8 ++--- Overlap/Analysis/plot_traj.py | 12 +++---- Overlap/Analysis/renumber_interp.py | 12 +++---- Overlap/Analysis/report_graph.py | 8 ++--- Overlap/Analysis/report_graph_int.py | 10 +++--- Overlap/CMakeLists.txt | 6 ++-- Overlap/Tests/CMakeLists.txt | 34 +++++++++---------- Overlap/Tests/test_get_dispatch_snap.f90 | 21 ++++++------ Overlap/Tests/test_overlap.f90 | 27 +++++++-------- Overlap/Tests/test_read_eddy.f90 | 18 +++++----- Overlap/Tests/test_read_snapshot.f90 | 12 +++---- Overlap/Tests/test_send_recv.f90 | 14 ++++---- Overlap/Tests/test_write_overlap.f90 | 12 +++---- Overlap/Tests/write_snapshot.f90 | 12 +++---- Overlap/eddy_graph.f90 | 20 +++++------ Overlap/eddy_graph_in.sh | 2 +- Overlap/get_snapshot.f90 | 8 ++--- Overlap/overlap.f90 | 6 ++-- Overlap/write_overlap.f90 | 4 +-- 38 files changed, 248 insertions(+), 251 deletions(-) delete mode 100644 Common/shp_tr_open.f90 rename Common/{shp_tr_close.f90 => shpc_close.f90} (57%) rename Common/{shp_tr_create.f90 => shpc_create.f90} (83%) create mode 100644 Common/shpc_open.f90 diff --git a/Common/derived_types.f90 b/Common/derived_types.f90 index d621ba47..bf15e871 100644 --- a/Common/derived_types.f90 +++ b/Common/derived_types.f90 @@ -66,7 +66,7 @@ module derived_types real, parameter:: missing_ssh = 1e4 ! flag for undefined SSH real, parameter:: missing_speed = 1e4 ! flag for missing max speed - type shp_tr ! shapefile triplet + type shpc ! shapefile collection TYPE(shpfileobject) extremum ! shapefile extremum TYPE(shpfileobject) outermost ! shapefile outermost_contour TYPE(shpfileobject) max_speed ! shapefile max_speed_contour @@ -77,7 +77,7 @@ module derived_types integer out_r_eq_area, out_ssh, out_date, out_eddy_index, out_radius4 integer max_speed_r_eq_area, max_speed_ssh, max_speed_date, & max_speed_eddy_index - end type Shp_tr + end type Shpc private shpfileobject diff --git a/Common/read_eddy.f90 b/Common/read_eddy.f90 index 7c2be89c..3bb7486c 100644 --- a/Common/read_eddy.f90 +++ b/Common/read_eddy.f90 @@ -15,7 +15,7 @@ contains use shapelib, only: shpobject, shpdestroyobject use shapelib_03, only: shp_read_object_03, dbf_read_attribute_03 - use derived_types, only: eddy, shp_tr + use derived_types, only: eddy, shpc type(eddy), intent(out):: e ! All components are defined. Components delta_in and delta_out @@ -23,7 +23,7 @@ contains integer, intent(out):: d ! date integer, intent(out):: i ! eddy index - TYPE(shp_tr), intent(in):: hshp + TYPE(shpc), intent(in):: hshp integer, intent(in):: ishape ! 0-based ! Local: diff --git a/Common/read_field_indices.f90 b/Common/read_field_indices.f90 index 34fb80c9..3ff2a9f1 100644 --- a/Common/read_field_indices.f90 +++ b/Common/read_field_indices.f90 @@ -10,9 +10,9 @@ contains use ezmpi, only: ezmpi_bcast use shapelib_03, only: dbf_get_field_index_03 - use derived_types, only: shp_tr + use derived_types, only: shpc - TYPE(shp_tr), intent(inout):: hshp + TYPE(shpc), intent(inout):: hshp integer, intent(in):: rank !--------------------------------------------------------------------- diff --git a/Common/read_snapshot.f90 b/Common/read_snapshot.f90 index 1226d513..cfd08581 100644 --- a/Common/read_snapshot.f90 +++ b/Common/read_snapshot.f90 @@ -13,12 +13,12 @@ contains use contour_531, only: convert_to_ind use nr_util, only: assert - use derived_types, only: snapshot, eddy, shp_tr + use derived_types, only: snapshot, eddy, shpc use read_eddy_m, only: read_eddy type(snapshot), intent(out):: s ! completely defined integer, intent(in):: k ! date index - TYPE(shp_tr), intent(in):: hshp + TYPE(shpc), intent(in):: hshp real, intent(in):: corner(:) ! (2) longitude and latitude of the ! corner of the whole grid in input NetCDF, in rad diff --git a/Common/shp_tr_open.f90 b/Common/shp_tr_open.f90 deleted file mode 100644 index e6032aa1..00000000 --- a/Common/shp_tr_open.f90 +++ /dev/null @@ -1,31 +0,0 @@ -module shp_tr_open_m - - implicit none - -contains - - subroutine shp_tr_open(hshp, shp_tr_dir, rank) - - ! Libraries: - use shapelib_03, only: shp_open_03 - - use derived_types, only: shp_tr - use read_field_indices_m, only: read_field_indices - - TYPE(shp_tr), intent(out):: hshp - character(len = *), intent(in):: shp_tr_dir - integer, intent(in):: rank - - !-------------------------------------------------------------------- - - call shp_open_03(hshp%extremum, shp_tr_dir // "/extremum", & - pszaccess = "rb") - call shp_open_03(hshp%outermost, shp_tr_dir // "/outermost_contour", & - pszaccess = "rb") - call shp_open_03(hshp%max_speed, shp_tr_dir // "/max_speed_contour", & - pszaccess = "rb") - call read_field_indices(hshp, rank) - - end subroutine shp_tr_open - -end module shp_tr_open_m diff --git a/Common/shp_tr_close.f90 b/Common/shpc_close.f90 similarity index 57% rename from Common/shp_tr_close.f90 rename to Common/shpc_close.f90 index f4b0460e..9ee71014 100644 --- a/Common/shp_tr_close.f90 +++ b/Common/shpc_close.f90 @@ -1,17 +1,17 @@ -module shp_tr_close_m +module shpc_close_m implicit none contains - subroutine shp_tr_close(hshp) + subroutine shpc_close(hshp) ! Libraries: use shapelib, only: shpclose - use derived_types, only: shp_tr + use derived_types, only: shpc - TYPE(shp_tr), intent(inout):: hshp + TYPE(shpc), intent(inout):: hshp !------------------------------------------------------------- @@ -19,6 +19,6 @@ contains CALL shpclose(hshp%outermost) CALL shpclose(hshp%max_speed) - end subroutine shp_tr_close + end subroutine shpc_close -end module shp_tr_close_m +end module shpc_close_m diff --git a/Common/shp_tr_create.f90 b/Common/shpc_create.f90 similarity index 83% rename from Common/shp_tr_create.f90 rename to Common/shpc_create.f90 index b23df255..0967bef5 100644 --- a/Common/shp_tr_create.f90 +++ b/Common/shpc_create.f90 @@ -1,23 +1,23 @@ -module shp_tr_create_m +module shpc_create_m implicit none contains - subroutine shp_tr_create(hshp, shp_tr_dir) + subroutine shpc_create(hshp, shpc_dir) ! Libraries: use shapelib, only: shpt_point, shpt_polygon, ftdouble, ftinteger use shapelib_03, only: shp_create_03, dbf_add_field_03 - use derived_types, only: shp_tr + use derived_types, only: shpc - TYPE(shp_tr), intent(out):: hshp - character(len = *), intent(in):: shp_tr_dir + TYPE(shpc), intent(out):: hshp + character(len = *), intent(in):: shpc_dir !--------------------------------------------------------------------- - call shp_create_03(shp_tr_dir // "/extremum", shpt_point, & + call shp_create_03(shpc_dir // "/extremum", shpt_point, & hshp%extremum) call dbf_add_field_03(hshp%extr_ssh, hshp%extremum, 'ssh', ftdouble, & nwidth = 13, ndecimals = 6) @@ -34,7 +34,7 @@ contains call dbf_add_field_03(hshp%extr_speed, hshp%extremum, 'speed', ftdouble, & nwidth = 13, ndecimals = 6) - call shp_create_03(shp_tr_dir // "/outermost_contour", shpt_polygon, & + call shp_create_03(shpc_dir // "/outermost_contour", shpt_polygon, & hshp%outermost) call dbf_add_field_03(hshp%out_r_eq_area, hshp%outermost, & 'r_eq_area', ftdouble, nwidth = 10, ndecimals = 4) @@ -47,7 +47,7 @@ contains call dbf_add_field_03(hshp%out_radius4, hshp%outermost, 'radius4', & ftinteger, nwidth = 2, ndecimals = 0) - call shp_create_03(shp_tr_dir // "/max_speed_contour", shpt_polygon, & + call shp_create_03(shpc_dir // "/max_speed_contour", shpt_polygon, & hshp%max_speed) call dbf_add_field_03(hshp%max_speed_r_eq_area, hshp%max_speed, & 'r_eq_area', ftdouble, nwidth = 10, ndecimals = 4) @@ -58,6 +58,6 @@ contains call dbf_add_field_03(hshp%max_speed_eddy_index, hshp%max_speed, & 'eddy_index', ftinteger, nwidth = 5, ndecimals = 0) - end subroutine shp_tr_create + end subroutine shpc_create -end module shp_tr_create_m +end module shpc_create_m diff --git a/Common/shpc_open.f90 b/Common/shpc_open.f90 new file mode 100644 index 00000000..a0e5af20 --- /dev/null +++ b/Common/shpc_open.f90 @@ -0,0 +1,31 @@ +module shpc_open_m + + implicit none + +contains + + subroutine shpc_open(hshp, shpc_dir, rank) + + ! Libraries: + use shapelib_03, only: shp_open_03 + + use derived_types, only: shpc + use read_field_indices_m, only: read_field_indices + + TYPE(shpc), intent(out):: hshp + character(len = *), intent(in):: shpc_dir + integer, intent(in):: rank + + !-------------------------------------------------------------------- + + call shp_open_03(hshp%extremum, shpc_dir // "/extremum", & + pszaccess = "rb") + call shp_open_03(hshp%outermost, shpc_dir // "/outermost_contour", & + pszaccess = "rb") + call shp_open_03(hshp%max_speed, shpc_dir // "/max_speed_contour", & + pszaccess = "rb") + call read_field_indices(hshp, rank) + + end subroutine shpc_open + +end module shpc_open_m diff --git a/Common/write_eddy.f90 b/Common/write_eddy.f90 index 41e01d20..841fc8d9 100644 --- a/Common/write_eddy.f90 +++ b/Common/write_eddy.f90 @@ -14,10 +14,10 @@ contains use shapelib_03, only: shp_append_point_03, dbf_write_attribute_03, & shp_append_object_03, shp_append_null_03 - use derived_types, only: eddy, missing_speed, shp_tr + use derived_types, only: eddy, missing_speed, shpc type(eddy), intent(in):: e - TYPE(shp_tr), intent(in):: hshp + TYPE(shpc), intent(in):: hshp integer, intent(in):: days_1950 ! date integer, intent(in):: i ! eddy index diff --git a/Convert_Matlab/inst_eddies_HDF5.py b/Convert_Matlab/inst_eddies_HDF5.py index b46a962e..9b0dd1a6 100755 --- a/Convert_Matlab/inst_eddies_HDF5.py +++ b/Convert_Matlab/inst_eddies_HDF5.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -"""Converts adt_YYYY-MM-DD.mat files to a triplet of shapefiles. The +"""Converts adt_YYYY-MM-DD.mat files to a collection of shapefiles. The mat files should be in HDF5 format. The data in each input file is the set of detected instantaneous eddies at a given date. @@ -96,24 +96,24 @@ else: final_date = my_date factories = [dict(writers = {}, cell_name = "Anticyclonic_Cell", - cyclone = False, SHP_triplet = "Snapshot_anti"), + cyclone = False, SHPC = "Snapshot_anti"), dict(writers = {}, cell_name = "Cyclonic_Cell", cyclone = True, - SHP_triplet = "Snapshot_cyclo")] + SHPC = "Snapshot_cyclo")] for f in factories: - file = path.join(f["SHP_triplet"], "extremum") + file = path.join(f["SHPC"], "extremum") f["writers"]["extr"] = shapefile.Writer(file, shapeType = shapefile.POINT) - file = path.join(f["SHP_triplet"], "outermost_contour") + file = path.join(f["SHPC"], "outermost_contour") f["writers"]["outer"] = shapefile.Writer(file, shapeType = shapefile.POLYGON) - file = path.join(f["SHP_triplet"], "max_speed_contour") + file = path.join(f["SHPC"], "max_speed_contour") f["writers"]["max_speed"] = shapefile.Writer(file, shapeType = shapefile.POLYGON) define_fields(f["writers"]) - file = path.join(f["SHP_triplet"], "ishape_last.txt") + file = path.join(f["SHPC"], "ishape_last.txt") f["writers"]["ishape_last"] = open(file, "w") # First date, get X and Y: @@ -142,5 +142,5 @@ nml = f90nml.Namelist() nml["grid_nml"] = dict(corner_deg = [X[0], Y[0]], nlon = X.size, nlat = Y.size) for f in factories: - nml.write(path.join(f["SHP_triplet"], "grid_nml.txt"), force = True) + nml.write(path.join(f["SHPC"], "grid_nml.txt"), force = True) for k, v in f["writers"].items(): v.close() diff --git a/Inst_eddies/Analysis/triplet_dump.sh b/Inst_eddies/Analysis/triplet_dump.sh index 9cef069f..567db996 100755 --- a/Inst_eddies/Analysis/triplet_dump.sh +++ b/Inst_eddies/Analysis/triplet_dump.sh @@ -1,8 +1,8 @@ -# Dumps the content of a triplet of shapefiles, dbf and shp. +# Dumps the content of a collection of shapefiles, dbf and shp. if (($# != 1)) then - echo "Required argument: directory containing triplet of shapefiles" + echo "Required argument: directory containing collection of shapefiles" exit 1 fi diff --git a/Inst_eddies/CMakeLists.txt b/Inst_eddies/CMakeLists.txt index 3864345b..b67461b0 100644 --- a/Inst_eddies/CMakeLists.txt +++ b/Inst_eddies/CMakeLists.txt @@ -4,8 +4,8 @@ add_executable(inst_eddies inst_eddies.f90 good_contour.f90 ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 mean_speed.f90 inside_4.f90 set_all_outerm.f90 ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 nearby_extr.f90 get_var.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90 write_aux.f90 config.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 nearby_extr.f90 get_var.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90 write_aux.f90 config.f90) target_include_directories(inst_eddies PRIVATE ${fortrangis_INCLUDE_DIR}) diff --git a/Inst_eddies/Tests/CMakeLists.txt b/Inst_eddies/Tests/CMakeLists.txt index c5d7a4f5..49229f54 100644 --- a/Inst_eddies/Tests/CMakeLists.txt +++ b/Inst_eddies/Tests/CMakeLists.txt @@ -4,9 +4,9 @@ add_executable(test_get_1_outerm good_contour.f90 ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 get_1_outerm.f90 ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 ${CMAKE_CURRENT_LIST_DIR}/test_get_1_outerm.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90) target_link_libraries(test_get_1_outerm geometry NetCDF95::netcdf95 shapelib_03 contour_531 nr_util jumble NetCDF_Fortran::NetCDF_Fortran) @@ -21,9 +21,9 @@ add_executable(test_set_all_outerm local_extrema.f90 get_1_outerm.f90 good_contour.f90 ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 nearby_extr.f90 get_var.f90 ${CMAKE_CURRENT_LIST_DIR}/test_set_all_outerm.f90 - config.f90 ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 + config.f90 ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90) target_link_libraries(test_set_all_outerm geometry NetCDF95::netcdf95 numer_rec_95 shapelib_03 contour_531 jumble nr_util @@ -83,8 +83,8 @@ add_executable(test_nearby_extr nearby_extr.f90 ${CMAKE_SOURCE_DIR}/Common/read_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90 ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_open.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90) target_link_libraries(test_nearby_extr NetCDF95::netcdf95 shapelib_03 contour_531 jumble nr_util NetCDF_Fortran::NetCDF_Fortran ezmpi @@ -109,11 +109,11 @@ add_executable(test_set_max_speed good_contour.f90 max_speed_contour_ssh.f90 mean_speed.f90 ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 inside_4.f90 ${CMAKE_CURRENT_LIST_DIR}/test_set_max_speed.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_open.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90 ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90) target_link_libraries(test_set_max_speed geometry numer_rec_95 diff --git a/Inst_eddies/Tests/test_get_1_outerm.f90 b/Inst_eddies/Tests/test_get_1_outerm.f90 index dedc8fbd..18ac59bb 100644 --- a/Inst_eddies/Tests/test_get_1_outerm.f90 +++ b/Inst_eddies/Tests/test_get_1_outerm.f90 @@ -9,10 +9,10 @@ program test_get_1_outerm nf95_gw_var, find_coord, nf95_get_att use nr_util, only: deg_to_rad, assert - use derived_types, only: eddy, shp_tr, null_ssh_contour, missing_speed + use derived_types, only: eddy, shpc, null_ssh_contour, missing_speed use get_1_outerm_m, only: get_1_outerm - use shp_tr_close_m, only: shp_tr_close - use shp_tr_create_m, only: shp_tr_create + use shpc_close_m, only: shpc_close + use shpc_create_m, only: shpc_create use write_eddy_m, only: write_eddy implicit none @@ -30,7 +30,7 @@ program test_get_1_outerm ! level of innermost contour, for each extremum logical:: cyclone = .true. - TYPE(shp_tr) hshp + TYPE(shpc) hshp character(len = 30) time_unit real time type(eddy) e @@ -110,9 +110,9 @@ program test_get_1_outerm e%radius4 = - 1 e%valid = .true. e%interpolated = .false. - call shp_tr_create(hshp, shp_tr_dir = "SHPC") + call shpc_create(hshp, shpc_dir = "SHPC") call write_eddy(e, hshp, days_1950, i = 1) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) print *, 'Created "SHPC".' else print *, "Could not find an outermost contour." diff --git a/Inst_eddies/Tests/test_nearby_extr.f90 b/Inst_eddies/Tests/test_nearby_extr.f90 index 84ff33d7..11f00354 100644 --- a/Inst_eddies/Tests/test_nearby_extr.f90 +++ b/Inst_eddies/Tests/test_nearby_extr.f90 @@ -6,17 +6,17 @@ program test_nearby_extr use nr_util, only: deg_to_rad, assert, rad_to_deg use shapelib_03, only: dbf_read_attribute_03 - use derived_types, only: snapshot, shp_tr + use derived_types, only: snapshot, shpc use nearby_extr_m, only: nearby_extr use read_snapshot_m, only: read_snapshot - use shp_tr_close_m, only: shp_tr_close - use shp_tr_open_m, only: shp_tr_open + use shpc_close_m, only: shpc_close + use shpc_open_m, only: shpc_open implicit none character(len = :), allocatable:: shpc_dir type(snapshot) s - TYPE(shp_tr) hshp + TYPE(shpc) hshp integer k1, unit, ishape_last, l real corner_deg(2) @@ -50,12 +50,12 @@ program test_nearby_extr read(unit, fmt = *) ishape_last ! first date close(unit) - call shp_tr_open(hshp, trim(shpc_dir), rank = 0) + call shpc_open(hshp, trim(shpc_dir), rank = 0) call dbf_read_attribute_03(k1, hshp%extremum, hshp%extr_date, ishape = 0) call read_snapshot(s, k1, hshp, corner_deg * deg_to_rad, & step_deg * deg_to_rad, nlon, nlat, copy = 0, k1 = k1, & ishape_last = [ishape_last]) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) nearby = nearby_extr(s%extr_map, s%list_vis, i = 4) print *, "nearby:" diff --git a/Inst_eddies/Tests/test_set_all_outerm.f90 b/Inst_eddies/Tests/test_set_all_outerm.f90 index 474ab404..2aab08d8 100644 --- a/Inst_eddies/Tests/test_set_all_outerm.f90 +++ b/Inst_eddies/Tests/test_set_all_outerm.f90 @@ -10,11 +10,11 @@ program test_set_all_outerm use nr_util, only: pi, assert, deg_to_rad, rad_to_deg, twopi use config_m, only: config, max_radius_deg, min_radius - use derived_types, only: snapshot, shp_tr, null_ssh_contour, missing_speed + use derived_types, only: snapshot, shpc, null_ssh_contour, missing_speed use get_var_m, only: get_var use set_all_outerm_m, only: set_all_outerm - use shp_tr_close_m, only: shp_tr_close - use shp_tr_create_m, only: shp_tr_create + use shpc_close_m, only: shpc_close + use shpc_create_m, only: shpc_create use write_eddy_m, only: write_eddy implicit none @@ -35,7 +35,7 @@ program test_set_all_outerm real step_deg(2), step(2) ! longitude and latitude steps, in degrees and rad logical periodic ! grid is periodic in longitude - TYPE(shp_tr) hshp_cyclo, hshp_anti + TYPE(shpc) hshp_cyclo, hshp_anti !-------------------------------------------------------------- @@ -88,8 +88,8 @@ program test_set_all_outerm s%list_vis(i)%radius4 = 0 end do - call shp_tr_create(hshp_cyclo, shp_tr_dir = "SHPC_cyclo") - call shp_tr_create(hshp_anti, shp_tr_dir = "SHPC_anti") + call shpc_create(hshp_cyclo, shpc_dir = "SHPC_cyclo") + call shpc_create(hshp_anti, shpc_dir = "SHPC_anti") n_cyclo = 0 n_anti = 0 @@ -105,8 +105,8 @@ program test_set_all_outerm print *, "s%number_vis_extr = ", s%number_vis_extr - CALL shp_tr_close(hshp_cyclo) - CALL shp_tr_close(hshp_anti) + CALL shpc_close(hshp_cyclo) + CALL shpc_close(hshp_anti) print *, 'Created shapefile collections in SHPC_cyclo and SHPC_anti.' print *, "Average number of points per outermost contour: ", & sum(s%list_vis%out_cont%n_points) / real(s%number_vis_extr) diff --git a/Inst_eddies/Tests/test_set_max_speed.f90 b/Inst_eddies/Tests/test_set_max_speed.f90 index 65cb02d1..39f5dfc2 100644 --- a/Inst_eddies/Tests/test_set_max_speed.f90 +++ b/Inst_eddies/Tests/test_set_max_speed.f90 @@ -11,12 +11,12 @@ program test_set_max_speed find_coord, nf95_inquire_dimension use nr_util, only: deg_to_rad - use derived_types, only: eddy, shp_tr + use derived_types, only: eddy, shpc use read_eddy_m, only: read_eddy use set_max_speed_m, only: set_max_speed - use shp_tr_close_m, only: shp_tr_close - use shp_tr_create_m, only: shp_tr_create - use shp_tr_open_m, only: shp_tr_open + use shpc_close_m, only: shpc_close + use shpc_create_m, only: shpc_create + use shpc_open_m, only: shpc_open use write_eddy_m, only: write_eddy implicit none @@ -27,8 +27,8 @@ program test_set_max_speed real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1 type(eddy) e real corner(2), step(2) ! in rad - TYPE(shp_tr) hshp - character(len = :), allocatable:: shp_tr_dir + TYPE(shpc) hshp + character(len = :), allocatable:: shpc_dir real, allocatable:: outside_points(:, :) ! (2, :) longitude and ! latitude, in rad, of all the extrema except the target extremum @@ -44,8 +44,7 @@ program test_set_max_speed call mpi_abort(MPI_Comm_world, errorcode = 1) end if - call get_command_arg_dyn(1, shp_tr_dir, & - "Required argument: SHP-triplet-directory") + call get_command_arg_dyn(1, shpc_dir, "Required argument: SHPC-directory") print *, "Reading from h.nc..." call nf95_open("h.nc", nf90_nowrite, ncid) @@ -81,9 +80,9 @@ program test_set_max_speed call nf95_close(ncid) print *, "Reading from shapefiles..." - call shp_tr_open(hshp, shp_tr_dir, rank = 0) + call shpc_open(hshp, shpc_dir, rank = 0) call read_eddy(e, d, i, hshp, ishape = 0) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) print *, "Reading from outside_points.csv..." call new_unit(unit) @@ -105,9 +104,9 @@ program test_set_max_speed step = 0.25 * deg_to_rad call set_max_speed(e, nint((e%coord_extr - corner) / step) + 1, & outside_points, ssh, u, v, corner, step) - call shp_tr_create(hshp, shp_tr_dir = "SHPC") + call shpc_create(hshp, shpc_dir = "SHPC") call write_eddy(e, hshp, d, i) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) print *, 'Created "SHPC".' call mpi_finalize diff --git a/Inst_eddies/config.f90 b/Inst_eddies/config.f90 index 9cb8351b..df075558 100644 --- a/Inst_eddies/config.f90 +++ b/Inst_eddies/config.f90 @@ -26,21 +26,21 @@ contains write(unit = error_unit, nml = main_nml) write(unit = error_unit, fmt = *) "config: Enter namelist main_nml." read(unit = *, nml = main_nml) - call write_nml(shp_tr_dir = "SHPC_cyclo") - call write_nml(shp_tr_dir = "SHPC_anti") + call write_nml(shpc_dir = "SHPC_cyclo") + call write_nml(shpc_dir = "SHPC_anti") end subroutine config !********************************************************************* - subroutine write_nml(shp_tr_dir) + subroutine write_nml(shpc_dir) use, intrinsic:: ISO_FORTRAN_ENV ! Libraries: use jumble, only: new_unit - character(len = *), intent(in):: shp_tr_dir + character(len = *), intent(in):: shpc_dir ! Local: integer unit, iostat @@ -49,14 +49,14 @@ contains !---------------------------------------------------------------------- call new_unit(unit) - open(unit, file = shp_tr_dir // "/used_nml.txt", status = "replace", & + open(unit, file = shpc_dir // "/used_nml.txt", status = "replace", & action = "write", iostat = iostat, iomsg = iomsg) - ! (This also allows us to verify that the directory shp_tr_dir exists.) + ! (This also allows us to verify that the directory shpc_dir exists.) if (iostat /= 0) then write(unit = error_unit, fmt = *) "write_nml: ", trim(iomsg) write(unit = error_unit, fmt = *) 'write_nml: ', & - 'Have you created the directory "', shp_tr_dir, '"?' + 'Have you created the directory "', shpc_dir, '"?' stop 1 end if diff --git a/Inst_eddies/inst_eddies.f90 b/Inst_eddies/inst_eddies.f90 index 0403b0cc..2b7e9587 100644 --- a/Inst_eddies/inst_eddies.f90 +++ b/Inst_eddies/inst_eddies.f90 @@ -11,20 +11,20 @@ program inst_eddies use nr_util, only: assert, deg_to_rad, twopi, pi use config_m, only: config, max_radius_deg, min_radius - use derived_types, only: snapshot, null_ssh_contour, missing_speed, shp_tr + use derived_types, only: snapshot, null_ssh_contour, missing_speed, shpc use get_var_m, only: get_var use nearby_extr_m, only: nearby_extr use set_all_outerm_m, only: set_all_outerm use set_max_speed_m, only: set_max_speed - use shp_tr_close_m, only: shp_tr_close - use shp_tr_create_m, only: shp_tr_create + use shpc_close_m, only: shpc_close + use shpc_create_m, only: shpc_create use write_aux_m, only: write_aux use write_eddy_m, only: write_eddy implicit none type(snapshot) s - TYPE(shp_tr) hshp_cyclo, hshp_anti + TYPE(shpc) hshp_cyclo, hshp_anti integer i, days_1950, n_cyclo, n_anti integer ncid, dimid, varid, copy @@ -177,8 +177,8 @@ program inst_eddies ! Write snapshot: - call shp_tr_create(hshp_cyclo, shp_tr_dir = "SHPC_cyclo") - call shp_tr_create(hshp_anti, shp_tr_dir = "SHPC_anti") + call shpc_create(hshp_cyclo, shpc_dir = "SHPC_cyclo") + call shpc_create(hshp_anti, shpc_dir = "SHPC_anti") n_cyclo = 0 n_anti = 0 @@ -192,13 +192,13 @@ program inst_eddies end if end do - CALL shp_tr_close(hshp_cyclo) - CALL shp_tr_close(hshp_anti) + CALL shpc_close(hshp_cyclo) + CALL shpc_close(hshp_anti) print *, 'inst_eddies: Created shapefile collections in SHPC_cyclo and ', & 'SHPC_anti.' call write_aux(corner_deg, step_deg, nlon, nlat, n_cyclo, & - shp_tr_dir = "SHPC_cyclo") + shpc_dir = "SHPC_cyclo") call write_aux(corner_deg, step_deg, nlon, nlat, n_anti, & - shp_tr_dir = "SHPC_anti") + shpc_dir = "SHPC_anti") end program inst_eddies diff --git a/Inst_eddies/write_aux.f90 b/Inst_eddies/write_aux.f90 index a4c831ca..373ce935 100644 --- a/Inst_eddies/write_aux.f90 +++ b/Inst_eddies/write_aux.f90 @@ -4,7 +4,7 @@ module write_aux_m contains - subroutine write_aux(corner_deg, step_deg, nlon, nlat, n_shapes, shp_tr_dir) + subroutine write_aux(corner_deg, step_deg, nlon, nlat, n_shapes, shpc_dir) ! Write auxiliary files "grid_nml.txt" and "ishape_last.txt". @@ -27,7 +27,7 @@ contains ! the grid is global integer, intent(in):: n_shapes - character(len = *), intent(in):: shp_tr_dir + character(len = *), intent(in):: shpc_dir ! Local: namelist /grid_nml/ corner_deg, step_deg, nlon, nlat @@ -36,12 +36,12 @@ contains !-------------------------------------------------------------------- call new_unit(unit) - open(unit, file = shp_tr_dir // "/grid_nml.txt", status = "replace", & + open(unit, file = shpc_dir // "/grid_nml.txt", status = "replace", & action = "write") write(unit, nml = grid_nml) close(unit) - open(unit, file = shp_tr_dir // "/ishape_last.txt", status = "replace", & + open(unit, file = shpc_dir // "/ishape_last.txt", status = "replace", & action = "write") write(unit, fmt = *) n_shapes - 1 close(unit) diff --git a/Overlap/Analysis/plot_traj.py b/Overlap/Analysis/plot_traj.py index d79f6269..42c9d41a 100755 --- a/Overlap/Analysis/plot_traj.py +++ b/Overlap/Analysis/plot_traj.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -"""Must be run from directory containing edgelist.csv and SHP-triplet +"""Must be run from directory containing edgelist.csv and SHPC directory for interpolated eddies. """ @@ -102,8 +102,8 @@ if __name__ == "__main__": import time parser = argparse.ArgumentParser(description = __doc__) - parser.add_argument("shp_tr_dir", help = "directory containing triplet of " - "shapefiles, with visible eddies at all dates") + parser.add_argument("shpc_dir", help = "directory containing SHPC, with " + "visible eddies at all dates") parser.add_argument("-l", "--label", choices = ["root", "leaf", "split", "merge"]) parser.add_argument("-s", "--save", metavar = "format", @@ -129,7 +129,7 @@ if __name__ == "__main__": print("Reading edge list in current directory...") t0 = time.perf_counter() - G = report_graph.read_eddy_graph("edgelist.csv", args.shp_tr_dir) + G = report_graph.read_eddy_graph("edgelist.csv", args.shpc_dir) if args.time: t1 = time.perf_counter() @@ -157,7 +157,7 @@ if __name__ == "__main__": print("Reading edge list in current directory...") t0 = time.perf_counter() - G = report_graph.read_eddy_graph("edgelist.csv", args.shp_tr_dir) + G = report_graph.read_eddy_graph("edgelist.csv", args.shpc_dir) if args.time: t1 = time.perf_counter() @@ -180,7 +180,7 @@ if __name__ == "__main__": print("Reading edge lists in current directory...") t0 = time.perf_counter() - G = report_graph.read_eddy_graph("edgelist.csv", args.shp_tr_dir) + G = report_graph.read_eddy_graph("edgelist.csv", args.shpc_dir) if args.time: t1 = time.perf_counter() diff --git a/Overlap/Analysis/renumber_interp.py b/Overlap/Analysis/renumber_interp.py index 04af8107..45f17e8d 100755 --- a/Overlap/Analysis/renumber_interp.py +++ b/Overlap/Analysis/renumber_interp.py @@ -20,7 +20,7 @@ import shutil parser = argparse.ArgumentParser() parser.add_argument("input_dir", - help = "containing the shpt of interpolated eddies and " + help = "containing the SHPC of interpolated eddies and " "edge list") args = parser.parse_args() @@ -41,7 +41,7 @@ lon = [] lat = [] date_index = [] eddy_index_old = [] -my_input = path.join(args.input_dir, "SHP_triplet") +my_input = path.join(args.input_dir, "SHPC") with fiona.open(my_input, layer = "extremum") as extremum: for record in extremum: @@ -71,7 +71,7 @@ for ishape in ind: for layer in fiona.listlayers(my_input): with fiona.open(my_input, layer = layer) as src: - with fiona.open("SHP_triplet", "w", layer = layer, **src.meta) as sink: + with fiona.open("SHPC", "w", layer = layer, **src.meta) as sink: for ishape in ind: record = src[int(ishape)] @@ -90,9 +90,9 @@ i = np.searchsorted(ishape_last, 0) # (Ensure that the first line corresponds to the first date present in # interpolated eddies.) -np.savetxt("SHP_triplet/ishape_last.txt", ishape_last[i:], fmt = "%d") -my_input = path.join(args.input_dir, "SHP_triplet/grid_nml.txt") -shutil.copy(my_input, "SHP_triplet") +np.savetxt("SHPC/ishape_last.txt", ishape_last[i:], fmt = "%d") +my_input = path.join(args.input_dir, "SHPC/grid_nml.txt") +shutil.copy(my_input, "SHPC") for orientation in ["cyclo", "anti"]: my_input = path.join(args.input_dir, f"edgelist_{orientation}.csv") diff --git a/Overlap/Analysis/report_graph.py b/Overlap/Analysis/report_graph.py index 406a82d2..7890368f 100755 --- a/Overlap/Analysis/report_graph.py +++ b/Overlap/Analysis/report_graph.py @@ -11,8 +11,8 @@ from os import path from networkx import nx_agraph import os -def read_eddy_graph(edgelist, shp_tr_dir = None, read_interp = True): - """shp_tr_dir is for visible eddies.""" +def read_eddy_graph(edgelist, shpc_dir = None, read_interp = True): + """shpc_dir is for visible eddies.""" G = nx.DiGraph() @@ -49,9 +49,9 @@ def read_eddy_graph(edgelist, shp_tr_dir = None, read_interp = True): print("Trying to read data on interpolated eddies but ", f"{extr_file} is not readable") - if shp_tr_dir is not None: + if shpc_dir is not None: # Read and set attributes of Visible eddies: - extr_file = path.join(shp_tr_dir, "extremum") + extr_file = path.join(shpc_dir, "extremum") set_attribute(G, extr_file) else: print(edgelist, "not readable") diff --git a/Overlap/Analysis/report_graph_int.py b/Overlap/Analysis/report_graph_int.py index b6921270..9c273ce1 100755 --- a/Overlap/Analysis/report_graph_int.py +++ b/Overlap/Analysis/report_graph_int.py @@ -29,8 +29,8 @@ def date_eddy_to_node(d, eddy_index, e_overestim, d_init): """ return (d- d_init) * e_overestim + eddy_index -def read_eddy_graph(edgelist, shp_tr_dir = None, read_interp = True): - """shp_tr_dir is for visible eddies.""" +def read_eddy_graph(edgelist, shpc_dir = None, read_interp = True): + """shpc_dir is for visible eddies.""" if os.access(edgelist, os.R_OK): G = nx.read_edgelist(edgelist, create_using = nx.DiGraph, @@ -46,7 +46,7 @@ def read_eddy_graph(edgelist, shp_tr_dir = None, read_interp = True): # Assuming that the directory containing the interpolated # eddies is in the same location as edgelist: - extr_file = path.join(dir_edgelist, "SHP_triplet", "extremum.shp") + extr_file = path.join(dir_edgelist, "SHPC", "extremum.shp") if os.access(extr_file, os.R_OK): set_attribute(G, extr_file) @@ -54,9 +54,9 @@ def read_eddy_graph(edgelist, shp_tr_dir = None, read_interp = True): print("Trying to read data on interpolated eddies but ", f"{extr_file} is not readable") - if shp_tr_dir is not None: + if shpc_dir is not None: # Read and set attributes of Visible eddies: - extr_file = path.join(shp_tr_dir, "extremum") + extr_file = path.join(shpc_dir, "extremum") set_attribute(G, extr_file) else: print(edgelist, "not readable") diff --git a/Overlap/CMakeLists.txt b/Overlap/CMakeLists.txt index 25225fc6..c67dcd98 100644 --- a/Overlap/CMakeLists.txt +++ b/Overlap/CMakeLists.txt @@ -1,8 +1,8 @@ add_executable(eddy_graph eddy_graph.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 get_snapshot.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_open.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 get_snapshot.f90 overlap.f90 dispatch_snapshot.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90 ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 ${CMAKE_SOURCE_DIR}/Common/read_snapshot.f90 recv_snapshot.f90 candidate_overlap.f90 spher_polygon_area.f90 diff --git a/Overlap/Tests/CMakeLists.txt b/Overlap/Tests/CMakeLists.txt index 91afd320..46eb1020 100644 --- a/Overlap/Tests/CMakeLists.txt +++ b/Overlap/Tests/CMakeLists.txt @@ -7,10 +7,10 @@ add_executable(test_overlap ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90 ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 candidate_overlap.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 write_overlap.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 write_overlap.f90 ${CMAKE_CURRENT_LIST_DIR}/test_overlap.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90 unit_edge_m.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_open.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90 unit_edge_m.f90) target_link_libraries(test_overlap shapelib_03 geometry contour_531 gpc_f ezmpi nr_util jumble MPI::MPI_Fortran) @@ -21,7 +21,7 @@ target_include_directories(test_overlap PRIVATE ${fortrangis_INCLUDE_DIR}) add_executable(test_read_snapshot ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 ${CMAKE_SOURCE_DIR}/Common/read_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90 @@ -29,8 +29,8 @@ add_executable(test_read_snapshot ${CMAKE_CURRENT_LIST_DIR}/test_read_snapshot.f90 ${CMAKE_SOURCE_DIR}/Tests/write_extr_map.f90 ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_open.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90) target_link_libraries(test_read_snapshot NetCDF95::netcdf95 shapelib_03 contour_531 gpc_f ezmpi nr_util jumble @@ -64,13 +64,13 @@ target_include_directories(test_weight PRIVATE ${fortrangis_INCLUDE_DIR}) add_executable(test_read_eddy ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 ${CMAKE_CURRENT_LIST_DIR}/test_read_eddy.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_open.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90) target_link_libraries(test_read_eddy shapelib_03 contour_531 gpc_f ezmpi nr_util MPI::MPI_Fortran) @@ -81,10 +81,10 @@ target_include_directories(test_read_eddy PRIVATE ${fortrangis_INCLUDE_DIR}) add_executable(test_write_overlap ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 write_overlap.f90 ${CMAKE_CURRENT_LIST_DIR}/test_write_overlap.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90 unit_edge_m.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90 unit_edge_m.f90) target_link_libraries(test_write_overlap shapelib_03 contour_531 nr_util jumble) target_include_directories(test_write_overlap PRIVATE ${fortrangis_INCLUDE_DIR}) @@ -96,13 +96,13 @@ add_executable(test_send_recv recv_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 ${CMAKE_SOURCE_DIR}/Common/read_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90 ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90 ${CMAKE_SOURCE_DIR}/Tests/write_extr_map.f90 ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_open.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90) target_link_libraries(test_send_recv PRIVATE MPI::MPI_Fortran shapelib_03 ezmpi nr_util contour_531 gpc_f NetCDF95::netcdf95 @@ -119,13 +119,13 @@ add_executable(test_get_dispatch_snap ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/read_snapshot.f90 recv_snapshot.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 ${CMAKE_SOURCE_DIR}/Tests/write_extr_map.f90 ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90 send_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 - ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90) + ${CMAKE_SOURCE_DIR}/Common/shpc_open.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90) target_link_libraries(test_get_dispatch_snap shapelib_03 jumble contour_531 ezmpi NetCDF95::netcdf95 gpc_f nr_util diff --git a/Overlap/Tests/test_get_dispatch_snap.f90 b/Overlap/Tests/test_get_dispatch_snap.f90 index 388e5269..9aebed2a 100644 --- a/Overlap/Tests/test_get_dispatch_snap.f90 +++ b/Overlap/Tests/test_get_dispatch_snap.f90 @@ -10,19 +10,19 @@ program test_get_dispatch_snap use nr_util, only: assert, deg_to_rad use shapelib_03, only: dbf_read_attribute_03 - use derived_types, only: snapshot, shp_tr + use derived_types, only: snapshot, shpc use dispatch_snapshot_m, only: dispatch_snapshot use get_snapshot_m, only: get_snapshot use send_snapshot_m, only: send_snapshot - use shp_tr_close_m, only: shp_tr_close - use shp_tr_open_m, only: shp_tr_open + use shpc_close_m, only: shpc_close + use shpc_open_m, only: shpc_open use write_snapshot_m, only: write_snapshot implicit none - character(len = :), allocatable:: shp_tr_dir + character(len = :), allocatable:: shpc_dir type(snapshot) s - TYPE(shp_tr) hshp + TYPE(shpc) hshp integer k_begin, k1, copy, rank, n_proc, k_end, n_dates integer unit_isolated, unit_number_eddies @@ -44,7 +44,7 @@ program test_get_dispatch_snap integer:: k = - 1 integer, allocatable:: ishape_last(:) - ! shape index (0-based) in the triplet of shapefiles of the last + ! shape index (0-based) in the collection of shapefiles of the last ! shape at a given date index namelist /main_nml/ corner, step, nlon, nlat, dist_lim, k @@ -60,8 +60,7 @@ program test_get_dispatch_snap call mpi_abort(MPI_Comm_world, errorcode = 1) end if - call get_command_arg_dyn(1, shp_tr_dir, & - "Required argument: SHP-triplet-directory") + call get_command_arg_dyn(1, shpc_dir, "Required argument: SHPC-directory") if (rank == 0) then write(unit = error_unit, nml = main_nml) @@ -77,7 +76,7 @@ program test_get_dispatch_snap "test_get_dispatch_snap dist_lim") copy = merge(dist_lim, 0, periodic) call read_column(ishape_last, & - file = trim(shp_tr_dir) // "/ishape_last.txt") + file = trim(shpc_dir) // "/ishape_last.txt") n_dates = size(ishape_last) call new_unit(unit_isolated) open(unit_isolated, file = "isolated_nodes.txt", status = "replace", & @@ -96,7 +95,7 @@ program test_get_dispatch_snap call ezmpi_bcast(n_dates, root = 0) if (rank /= 0) allocate(ishape_last(n_dates)) call ezmpi_bcast(ishape_last, root = 0) - call shp_tr_open(hshp, trim(shp_tr_dir), rank) + call shpc_open(hshp, trim(shpc_dir), rank) if (rank == 0) call dbf_read_attribute_03(k1, hshp%extremum, hshp%extr_date, & ishape = 0) call ezmpi_bcast(k1, root = 0) @@ -110,7 +109,7 @@ program test_get_dispatch_snap call get_snapshot(s, nlon, nlat, ishape_last, corner * deg_to_rad, & step * deg_to_rad, copy, hshp, k1, k, k_end, rank, n_proc, max_delta = 1) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) call dispatch_snapshot(s, unit_isolated, unit_number_eddies, rank, k_begin, & max_delta = 1, k = k) diff --git a/Overlap/Tests/test_overlap.f90 b/Overlap/Tests/test_overlap.f90 index 9ee40908..72fdf9fd 100644 --- a/Overlap/Tests/test_overlap.f90 +++ b/Overlap/Tests/test_overlap.f90 @@ -9,24 +9,24 @@ program test_overlap use nr_util, only: deg_to_rad, assert use shapelib_03, only: dbf_read_attribute_03 - use derived_types, only: snapshot, shp_tr + use derived_types, only: snapshot, shpc use overlap_m, only: overlap use read_snapshot_m, only: read_snapshot - use shp_tr_close_m, only: shp_tr_close - use shp_tr_create_m, only: shp_tr_create - use shp_tr_open_m, only: shp_tr_open + use shpc_close_m, only: shpc_close + use shpc_create_m, only: shpc_create + use shpc_open_m, only: shpc_open use unit_edge_m, only: open_edge_file, unit_edge use write_overlap_m, only: init_interpolated_eddy implicit none - character(len = :), allocatable:: shp_tr_dir + character(len = :), allocatable:: shpc_dir integer k1 integer:: k_test_1 = 20454, k_test_2 = 20455 integer unit, i, copy, rank, n_proc integer, allocatable:: ishape_last(:) type(snapshot), allocatable:: flow(:) ! (max_delta + 1) - TYPE(shp_tr) hshp + TYPE(shpc) hshp real:: corner_deg(2) = [huge(0.), huge(0.)], corner(2) ! longitude and latitude of the corner of the whole grid, in degrees @@ -56,10 +56,9 @@ program test_overlap call mpi_abort(MPI_Comm_world, errorcode = 1) end if - call get_command_arg_dyn(1, shp_tr_dir, & - "Required argument: SHP-triplet-directory") + call get_command_arg_dyn(1, shpc_dir, "Required argument: SHPC-directory") call new_unit(unit) - open(unit, file = shp_tr_dir // "/grid_nml.txt", status = "old", & + open(unit, file = shpc_dir // "/grid_nml.txt", status = "old", & action = "read", position = "rewind") read(unit, nml = grid_nml) close(unit) @@ -80,14 +79,14 @@ program test_overlap step = step_deg * deg_to_rad allocate(flow(max_delta + 1)) call read_column(ishape_last, & - file = trim(shp_tr_dir) // "/ishape_last.txt") - call shp_tr_open(hshp, trim(shp_tr_dir), rank = 0) + file = trim(shpc_dir) // "/ishape_last.txt") + call shpc_open(hshp, trim(shpc_dir), rank = 0) call dbf_read_attribute_03(k1, hshp%extremum, hshp%extr_date, ishape = 0) call read_snapshot(flow(1), k_test_1, hshp, corner, step, nlon, nlat, copy, & k1, ishape_last) call read_snapshot(flow(max_delta + 1), k_test_2, hshp, corner, step, nlon, & nlat, copy, k1, ishape_last) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) print *, "Enter flow(1)%list_vis%delta_out (array with ", & flow(1)%number_vis_extr, " values):" read *, flow(1)%list_vis%delta_out @@ -103,13 +102,13 @@ program test_overlap // '"successor eddy subscript"' write(unit_edge, fmt = *) "k1 i1 k2 i2 weight" - call shp_tr_create(hshp, shp_tr_dir = "SHPC") + call shpc_create(hshp, shpc_dir = "SHPC") call init_interpolated_eddy call overlap(flow, nlon, nlat, periodic, dist_lim, hshp, k = k_test_2, & delta = max_delta, j = max_delta + 1) close(unit_edge) print *, 'Created file "edgelist.csv".' - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) print *, 'Created shapefiles for interpolated eddies in SHPC.' print *, k_test_1, ":" diff --git a/Overlap/Tests/test_read_eddy.f90 b/Overlap/Tests/test_read_eddy.f90 index d3d628b4..0f84f54a 100644 --- a/Overlap/Tests/test_read_eddy.f90 +++ b/Overlap/Tests/test_read_eddy.f90 @@ -3,29 +3,29 @@ program test_read_eddy ! Libraries: use mpi_f08, only: mpi_init, mpi_finalize - use derived_types, only: eddy, shp_tr + use derived_types, only: eddy, shpc use read_eddy_m, only: read_eddy - use shp_tr_close_m, only: shp_tr_close - use shp_tr_create_m, only: shp_tr_create - use shp_tr_open_m, only: shp_tr_open + use shpc_close_m, only: shpc_close + use shpc_create_m, only: shpc_create + use shpc_open_m, only: shpc_open use write_eddy_m, only: write_eddy implicit none type(eddy) e integer k, i - TYPE(shp_tr) hshp + TYPE(shpc) hshp !------------------------------------------------------------------------- call mpi_init - call shp_tr_open(hshp, "SHPC_old", rank = 0) + call shpc_open(hshp, "SHPC_old", rank = 0) call read_eddy(e, k, i, hshp, ishape = 0) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) - call shp_tr_create(hshp, shp_tr_dir = "SHPC") + call shpc_create(hshp, shpc_dir = "SHPC") call write_eddy(e, hshp, k, i) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) print *, 'Created shapefiles in SHPC.' call mpi_finalize diff --git a/Overlap/Tests/test_read_snapshot.f90 b/Overlap/Tests/test_read_snapshot.f90 index 1c04ee32..81aac67f 100644 --- a/Overlap/Tests/test_read_snapshot.f90 +++ b/Overlap/Tests/test_read_snapshot.f90 @@ -8,17 +8,17 @@ program test_read_snapshot use nr_util, only: deg_to_rad, assert use shapelib_03, only: dbf_read_attribute_03 - use derived_types, only: snapshot, shp_tr + use derived_types, only: snapshot, shpc use read_snapshot_m, only: read_snapshot - use shp_tr_close_m, only: shp_tr_close - use shp_tr_open_m, only: shp_tr_open + use shpc_close_m, only: shpc_close + use shpc_open_m, only: shpc_open use write_snapshot_m, only: write_snapshot implicit none character(len = :), allocatable:: shpc_dir type(snapshot) s - TYPE(shp_tr) hshp + TYPE(shpc) hshp integer k1, copy, unit, ishape_last real:: corner_deg(2) = [0.125, - 59.875] @@ -68,11 +68,11 @@ program test_read_snapshot read(unit, fmt = *) ishape_last ! first date close(unit) - call shp_tr_open(hshp, trim(shpc_dir), rank = 0) + call shpc_open(hshp, trim(shpc_dir), rank = 0) call dbf_read_attribute_03(k1, hshp%extremum, hshp%extr_date, ishape = 0) call read_snapshot(s, k1, hshp, corner_deg * deg_to_rad, & step_deg * deg_to_rad, nlon, nlat, copy, k1, [ishape_last]) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) call write_snapshot(s, corner_deg, step_deg, nlon, nlat, copy, k1) call mpi_finalize diff --git a/Overlap/Tests/test_send_recv.f90 b/Overlap/Tests/test_send_recv.f90 index fd1de1da..a7a4f0be 100644 --- a/Overlap/Tests/test_send_recv.f90 +++ b/Overlap/Tests/test_send_recv.f90 @@ -11,12 +11,12 @@ program test_send_recv use nr_util, only: deg_to_rad, assert use shapelib_03, only: dbf_read_attribute_03 - use derived_types, only: snapshot, shp_tr + use derived_types, only: snapshot, shpc use read_snapshot_m, only: read_snapshot use recv_snapshot_m, only: recv_snapshot use send_snapshot_m, only: send_snapshot - use shp_tr_close_m, only: shp_tr_close - use shp_tr_open_m, only: shp_tr_open + use shpc_close_m, only: shpc_close + use shpc_open_m, only: shpc_open use write_eddy_m, only: write_eddy use write_snapshot_m, only: write_snapshot @@ -41,10 +41,10 @@ program test_send_recv namelist /main_nml/ dist_lim namelist /grid_nml/ corner_deg, step_deg, nlon, nlat logical periodic ! grid is periodic in longitude - TYPE(shp_tr) hshp + TYPE(shpc) hshp integer, allocatable:: ishape_last(:) - ! shape index (0-based) in the triplet of shapefiles of the last + ! shape index (0-based) in the collection of shapefiles of the last ! shape at a given date index !--------------------------------------------------------------------- @@ -98,13 +98,13 @@ program test_send_recv if (rank == 1) allocate(ishape_last(n_dates)) call ezmpi_bcast(ishape_last, root = 0) - call shp_tr_open(hshp, trim(shpc_dir), rank) + call shpc_open(hshp, trim(shpc_dir), rank) if (rank == 0) call dbf_read_attribute_03(k1, hshp%extremum, hshp%extr_date, & ishape = 0) call ezmpi_bcast(k1, root = 0) if (rank == 1) call read_snapshot(s, k1, hshp, corner_deg * deg_to_rad, & step_deg * deg_to_rad, nlon, nlat, copy, k1, ishape_last) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) if (rank == 1) then call send_snapshot(s, dest = 0, tag = k1) diff --git a/Overlap/Tests/test_write_overlap.f90 b/Overlap/Tests/test_write_overlap.f90 index 86b9bf0f..3f1ae908 100644 --- a/Overlap/Tests/test_write_overlap.f90 +++ b/Overlap/Tests/test_write_overlap.f90 @@ -2,9 +2,9 @@ program test_write_overlap use, intrinsic:: ISO_FORTRAN_ENV - use derived_types, only: shp_tr - use shp_tr_close_m, only: shp_tr_close - use shp_tr_create_m, only: shp_tr_create + use derived_types, only: shpc + use shpc_close_m, only: shpc_close + use shpc_create_m, only: shpc_create use unit_edge_m, only: open_edge_file, unit_edge use write_overlap_m, only: write_overlap, init_interpolated_eddy @@ -14,7 +14,7 @@ program test_write_overlap integer:: k = 2, delta = 1, m = 0 real:: coord_extr_1(2) = [0., 0.], coord_extr_2(2) = [0., 0.] ! in rad real:: ssh_extr_1 = 0., ssh_extr_2 = 0. - TYPE(shp_tr) hshp + TYPE(shpc) hshp namelist /main_nml/ k, delta, m, coord_extr_1, ssh_extr_1, coord_extr_2, & ssh_extr_2 @@ -33,7 +33,7 @@ program test_write_overlap // '"successor eddy subscript"' write(unit_edge, fmt = *) "k1 i1 k2 i2 weight" - call shp_tr_create(hshp, shp_tr_dir = "SHPC") + call shpc_create(hshp, shpc_dir = "SHPC") call init_interpolated_eddy call write_overlap(hshp, k, delta, i1 = 1, i2 = 2, m = m, & i_interp = 10 + [(j_interp, j_interp = 1, delta - 1)], & @@ -41,7 +41,7 @@ program test_write_overlap coord_extr_2 = coord_extr_2, ssh_extr_2 = ssh_extr_2, w = 0.) close(unit_edge) print *, 'Created file "edgelist.csv".' - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) print *, 'Created shapefiles in SHPC.' end program test_write_overlap diff --git a/Overlap/Tests/write_snapshot.f90 b/Overlap/Tests/write_snapshot.f90 index 01cdb108..9f22fcf5 100644 --- a/Overlap/Tests/write_snapshot.f90 +++ b/Overlap/Tests/write_snapshot.f90 @@ -9,9 +9,9 @@ contains ! Libraries: use nr_util, only: arth - use derived_types, only: snapshot, shp_tr - use shp_tr_close_m, only: shp_tr_close - use shp_tr_create_m, only: shp_tr_create + use derived_types, only: snapshot, shpc + use shpc_close_m, only: shpc_close + use shpc_create_m, only: shpc_create use write_eddy_m, only: write_eddy use write_extr_map_m, only: write_extr_map @@ -30,19 +30,19 @@ contains integer, intent(in):: copy, k ! Local: - TYPE(shp_tr) hshp + TYPE(shpc) hshp integer i !----------------------------------------------------------------- - call shp_tr_create(hshp, shp_tr_dir = "SHPC") + call shpc_create(hshp, shpc_dir = "SHPC") ! Write snapshot: do i = 1, s%number_vis_extr call write_eddy(s%list_vis(i), hshp, k, i) end do - CALL shp_tr_close(hshp) + CALL shpc_close(hshp) print *, 'Created shapefiles in SHPC.' print *, "Number of extrema:", s%number_vis_extr diff --git a/Overlap/eddy_graph.f90 b/Overlap/eddy_graph.f90 index 927ef7c5..996eb050 100644 --- a/Overlap/eddy_graph.f90 +++ b/Overlap/eddy_graph.f90 @@ -10,14 +10,14 @@ program eddy_graph use nr_util, only: assert, deg_to_rad use shapelib_03, only: dbf_read_attribute_03 - use derived_types, only: snapshot, shp_tr + use derived_types, only: snapshot, shpc use dispatch_snapshot_m, only: dispatch_snapshot use get_snapshot_m, only: get_snapshot use overlap_m, only: overlap use unit_edge_m, only: open_edge_file, unit_edge - use shp_tr_open_m, only: shp_tr_open - use shp_tr_close_m, only: shp_tr_close - use shp_tr_create_m, only: shp_tr_create + use shpc_open_m, only: shpc_open + use shpc_close_m, only: shpc_close + use shpc_create_m, only: shpc_create use write_overlap_m, only: init_interpolated_eddy implicit none @@ -56,8 +56,8 @@ program eddy_graph ! shape at a given date index integer unit_isolated, unit_number_eddies, unit - TYPE(shp_tr) hshp - TYPE(shp_tr) hshp_interp ! for interpolated eddies + TYPE(shpc) hshp + TYPE(shpc) hshp_interp ! for interpolated eddies type(snapshot), allocatable:: flow(:) character(len = 30) file @@ -115,7 +115,7 @@ program eddy_graph if (rank /= 0) allocate(ishape_last(n_dates)) call ezmpi_bcast(ishape_last, root = 0) - call shp_tr_open(hshp, trim(shpc_dir), rank) + call shpc_open(hshp, trim(shpc_dir), rank) if (rank == 0) call dbf_read_attribute_03(k1, hshp%extremum, hshp%extr_date, & ishape = 0) call ezmpi_bcast(k1, root = 0) @@ -135,7 +135,7 @@ program eddy_graph ! We do not write the title line. That will be handled by eddy_graph.sh. write(unit = file, fmt = '("SHPC_", i0)') rank - call shp_tr_create(hshp_interp, shp_tr_dir = trim(file)) + call shpc_create(hshp_interp, shpc_dir = trim(file)) call init_interpolated_eddy k_begin = k1 + (rank * n_dates) / n_proc @@ -203,8 +203,8 @@ program eddy_graph ! 5. Back matter - CALL shp_tr_close(hshp_interp) - CALL shp_tr_close(hshp) + CALL shpc_close(hshp_interp) + CALL shpc_close(hshp) close(unit_isolated) close(unit_number_eddies) close(unit_edge) diff --git a/Overlap/eddy_graph_in.sh b/Overlap/eddy_graph_in.sh index c38bb357..dcd7096f 100755 --- a/Overlap/eddy_graph_in.sh +++ b/Overlap/eddy_graph_in.sh @@ -7,7 +7,7 @@ if (($# != 2)) then - echo "Usage: eddy_graph.sh N_PROC INPUT_SHP_TRIPLET" + echo "Usage: eddy_graph.sh N_PROC INPUT_SHPC" exit 1 fi diff --git a/Overlap/get_snapshot.f90 b/Overlap/get_snapshot.f90 index 518a2d25..fc04c173 100644 --- a/Overlap/get_snapshot.f90 +++ b/Overlap/get_snapshot.f90 @@ -7,7 +7,7 @@ contains subroutine get_snapshot(s, nlon, nlat, ishape_last, corner, step, copy, & hshp, k1, k, k_end, rank, n_proc, max_delta) - use derived_types, only: snapshot, shp_tr + use derived_types, only: snapshot, shpc use read_snapshot_m, only: read_snapshot use recv_snapshot_m, only: recv_snapshot @@ -15,7 +15,7 @@ contains integer, intent(in):: nlon, nlat integer, intent(in):: ishape_last(:) - ! shape index (0-based) in the triplet of shapefiles of the last + ! shape index (0-based) in the collection of shapefiles of the last ! shape at a given date index real, intent(in):: corner(:) ! (2) longitude and latitude of the @@ -23,8 +23,8 @@ contains real, intent(in):: step(:) ! (2) longitude and latitude steps, in rad integer, intent(in):: copy - TYPE(shp_tr), intent(in):: hshp - integer, intent(in):: k1 ! first date index in the triplet of shapefiles + TYPE(shpc), intent(in):: hshp + integer, intent(in):: k1 ! first date index in the collection of shapefiles integer, intent(in):: k ! date index integer, intent(in):: k_end ! last date index analyzed by this MPI process integer, intent(in):: rank ! of MPI process diff --git a/Overlap/overlap.f90 b/Overlap/overlap.f90 index 9c1aec61..da2433e5 100644 --- a/Overlap/overlap.f90 +++ b/Overlap/overlap.f90 @@ -19,7 +19,7 @@ contains use nr_util, only: twopi use candidate_overlap_m, only: candidate_overlap - use derived_types, only: snapshot, shp_tr + use derived_types, only: snapshot, shpc use spher_polygon_area_m, only: spher_polygon_area use spher_polyline_area_m, only: spher_polyline_area use weight_m, only: weight @@ -33,8 +33,8 @@ contains ! We look for an overlapping eddy at dist_lim (in grid points) of ! the extremum of a given eddy. - ! Triplet of shapefiles to which any interpolated eddy will be written: - TYPE(shp_tr), intent(in):: hshp_interp + ! Collection of shapefiles to which any interpolated eddy will be written: + TYPE(shpc), intent(in):: hshp_interp integer, intent(in):: k ! date index integer, intent(in):: delta ! between 1 and max_delta diff --git a/Overlap/write_overlap.f90 b/Overlap/write_overlap.f90 index 6df325e8..5d5a793c 100644 --- a/Overlap/write_overlap.f90 +++ b/Overlap/write_overlap.f90 @@ -18,11 +18,11 @@ contains ! Libraries: use nr_util, only: twopi - use derived_types, only: shp_tr + use derived_types, only: shpc use unit_edge_m, only: unit_edge use write_eddy_m, only: write_eddy - TYPE(shp_tr), intent(in):: hshp_interp + TYPE(shpc), intent(in):: hshp_interp integer, intent(in):: k ! date index integer, intent(in):: delta, i1, i2, m integer, intent(in):: i_interp(:) ! (delta - 1) -- GitLab