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

Read the initial date from `date_range.txt`

Rather than from the shapefiles. Following commit 63b99b52. Moreover,
the DBF file may be empty, as in the test
`Successive_overlap_periodic`, and then the call to
`dbf_read_attribute_03` would crash.
parent 9f04ff0c
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,6 @@ program test_overlap ...@@ -2,7 +2,6 @@ program test_overlap
! Libraries: ! Libraries:
use jumble, only: get_command_arg_dyn, read_opcol, new_unit, ediff1d, assert use jumble, only: get_command_arg_dyn, read_opcol, new_unit, ediff1d, assert
use shapelib_03, only: dbf_read_attribute_03
use config_graph_m, only: config_graph, copy, max_delta, cyclone use config_graph_m, only: config_graph, copy, max_delta, cyclone
use derived_types, only: snapshot, ori_slice_handler, shpc_slice_meta use derived_types, only: snapshot, ori_slice_handler, shpc_slice_meta
...@@ -15,7 +14,7 @@ program test_overlap ...@@ -15,7 +14,7 @@ program test_overlap
implicit none implicit none
character(len = :), allocatable:: shpc_dir character(len = :), allocatable:: shpc_dir, slice_dir
integer:: k_test_1 = 0, k_test_2 = 1, i_slice = 0 integer:: k_test_1 = 0, k_test_2 = 1, i_slice = 0
integer unit, i, n_dates integer unit, i, n_dates
type(snapshot), allocatable:: flow(:) ! (max_delta + 1) type(snapshot), allocatable:: flow(:) ! (max_delta + 1)
...@@ -39,13 +38,18 @@ program test_overlap ...@@ -39,13 +38,18 @@ program test_overlap
call ori_slice_open(hshp, trim(shpc_dir), cyclone, i_slice, & call ori_slice_open(hshp, trim(shpc_dir), cyclone, i_slice, &
with_proj = .not. uniform_lon_lat, pszaccess = "rb") with_proj = .not. uniform_lon_lat, pszaccess = "rb")
call dbf_read_attribute_03(ssm%d0, hshp%extremum, hshp%extr_date, ishape = 0) allocate(character(len(shpc_dir) + 12):: slice_dir)
write(slice_dir, fmt = '(a, "/Slice_", i0)') shpc_dir, i_slice
call new_unit(unit)
open(unit, file = trim(slice_dir) // "/date_range.txt", &
STATUS = "old", action = "read", position = "rewind")
read(unit, fmt = *) ssm%d0
close(unit)
call read_opcol(ssm%ishape_last, hshp%unit, my_lbound = ssm%d0) call read_opcol(ssm%ishape_last, hshp%unit, my_lbound = ssm%d0)
n_dates = size(ssm%ishape_last) n_dates = size(ssm%ishape_last)
call assert(ssm%d0 <= [k_test_1, k_test_2] .and. [k_test_1, k_test_2] & call assert(ssm%d0 <= [k_test_1, k_test_2] .and. [k_test_1, k_test_2] &
< ssm%d0 + n_dates, "test_overlap k_test_1, k_test_2") < ssm%d0 + n_dates, "test_overlap k_test_1, k_test_2")
e_overestim = maxval([ssm%ishape_last(ssm%d0) + 1, ediff1d(ssm%ishape_last)]) e_overestim = maxval([ssm%ishape_last(ssm%d0) + 1, ediff1d(ssm%ishape_last)])
call new_unit(unit)
open(unit, file = "e_overestim.txt", status = "replace", action = "write") open(unit, file = "e_overestim.txt", status = "replace", action = "write")
write(unit, fmt = *) e_overestim write(unit, fmt = *) e_overestim
close(unit) close(unit)
......
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