Skip to content
Snippets Groups Projects
Commit 99ed3165 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Bug fix: add argument pszaccess to `shpc_open`

Because now there is a case when we want to open in appending mode: in
program `inst_eddies`.
parent 90198c8d
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@ module shpc_open_m
contains
subroutine shpc_open(hshp, shpc_dir, rank)
subroutine shpc_open(hshp, shpc_dir, rank, pszaccess)
! Libraries:
#ifdef HAVE_MPI
......@@ -19,6 +19,7 @@ contains
TYPE(shpc), intent(out):: hshp
character(len = *), intent(in):: shpc_dir
integer, intent(in):: rank ! should be 0 if not in MPI program
character(len = *), intent(in):: pszaccess ! should be "rb" or "rb+"
! Local:
integer unit
......@@ -26,12 +27,11 @@ contains
!--------------------------------------------------------------------
call shp_open_03(hshp%extremum, shpc_dir // "/extremum", &
pszaccess = "rb")
call shp_open_03(hshp%extremum, shpc_dir // "/extremum", pszaccess)
call shp_open_03(hshp%outermost, shpc_dir // "/outermost_contour", &
pszaccess = "rb")
pszaccess)
call shp_open_03(hshp%max_speed, shpc_dir // "/max_speed_contour", &
pszaccess = "rb")
pszaccess)
call read_field_indices(hshp, rank)
if (rank == 0) then
......
......@@ -48,7 +48,7 @@ program test_nearby_extr
read(unit, fmt = *) ishape_last ! first date
close(unit)
call shpc_open(hshp, trim(shpc_dir), rank = 0)
call shpc_open(hshp, trim(shpc_dir), rank = 0, pszaccess = "rb")
call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0)
call read_snapshot(s, hshp, nlon, nlat, d_init, k = 0, &
corner = corner_deg * deg_to_rad, step = step_deg * deg_to_rad, &
......
......@@ -80,7 +80,7 @@ program test_set_max_speed
call nf95_close(ncid)
print *, "Reading from shapefiles..."
call shpc_open(hshp, shpc_dir, rank = 0)
call shpc_open(hshp, shpc_dir, rank = 0, pszaccess = "rb")
call read_eddy(e, d, i, hshp, ishape = 0)
CALL shpc_close(hshp)
......
......@@ -182,8 +182,10 @@ program inst_eddies
inquire(file = "SHPC_cyclo/extremum.shp", exist = exist)
if (exist) then
call shpc_open(hshp_cyclo, shpc_dir = "SHPC_cyclo", rank = 0)
call shpc_open(hshp_anti, shpc_dir = "SHPC_anti", rank = 0)
call shpc_open(hshp_cyclo, shpc_dir = "SHPC_cyclo", rank = 0, &
pszaccess = "rb+")
call shpc_open(hshp_anti, shpc_dir = "SHPC_anti", rank = 0, &
pszaccess = "rb+")
else
call shpc_create(hshp_cyclo, shpc_dir = "SHPC_cyclo", cyclone = .true.)
call shpc_create(hshp_anti, shpc_dir = "SHPC_anti", cyclone = .false.)
......
......@@ -92,7 +92,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 shpc_open(hshp, trim(shpc_dir), rank)
call shpc_open(hshp, trim(shpc_dir), rank, pszaccess = "rb")
if (rank == 0) call dbf_read_attribute_03(d_init, hshp%extremum, &
hshp%extr_date, ishape = 0)
call ezmpi_bcast(d_init, root = 0)
......
......@@ -71,7 +71,7 @@ program test_overlap
call assert(0 <= [k_test_1, k_test_2] .and. [k_test_1, k_test_2] < n_dates, &
"test_overlap k_test_1, k_test_2")
e_overestim = maxval([ishape_last(1) + 1, ediff1d(ishape_last)])
call shpc_open(hshp, trim(shpc_dir), rank = 0)
call shpc_open(hshp, trim(shpc_dir), rank = 0, pszaccess = "rb")
call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0)
open(unit, file = "node_id_param.json", status = "replace", &
action = "write")
......
......@@ -15,7 +15,7 @@ program test_read_eddy
!-------------------------------------------------------------------------
call shpc_open(hshp, "SHPC_old", rank = 0)
call shpc_open(hshp, "SHPC_old", rank = 0, pszaccess = "rb")
call read_eddy(e, k, i, hshp, ishape = 0)
CALL shpc_close(hshp)
......
......@@ -66,7 +66,7 @@ program test_read_snapshot
read(unit, fmt = *) ishape_last ! first date
close(unit)
call shpc_open(hshp, trim(shpc_dir), rank = 0)
call shpc_open(hshp, trim(shpc_dir), rank = 0, pszaccess = "rb")
call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0)
call read_snapshot(s, hshp, nlon, nlat, d_init, k = 0, &
corner = corner_deg * deg_to_rad, step = step_deg * deg_to_rad, &
......
......@@ -98,7 +98,7 @@ program test_send_recv
if (rank == 1) allocate(ishape_last(n_dates))
call ezmpi_bcast(ishape_last, root = 0)
call shpc_open(hshp, trim(shpc_dir), rank)
call shpc_open(hshp, trim(shpc_dir), rank, pszaccess = "rb")
if (rank == 0) call dbf_read_attribute_03(d_init, hshp%extremum, &
hshp%extr_date, ishape = 0)
call ezmpi_bcast(d_init, root = 0)
......
......@@ -116,7 +116,7 @@ program eddy_graph
call ezmpi_bcast(ishape_last, root = 0)
call ezmpi_bcast(e_overestim, root = 0)
call shpc_open(hshp, trim(shpc_dir), rank)
call shpc_open(hshp, trim(shpc_dir), rank, pszaccess = "rb")
if (rank == 0) call dbf_read_attribute_03(d_init, hshp%extremum, &
hshp%extr_date, ishape = 0)
call ezmpi_bcast(d_init, root = 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment