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

Use `cont_list_m`

It is a little simpler to use `cont_list_m` and we then have the speed
in `cont_list.dbf`. The pre-existing `cont_list` shapefile is now open
for read access only.
parent 53dc1248
No related branches found
No related tags found
No related merge requests found
...@@ -3,12 +3,12 @@ program test_set_max_speed ...@@ -3,12 +3,12 @@ program test_set_max_speed
! Libraries: ! Libraries:
use contour_531, only: convert_to_ind, null_polyline use contour_531, only: convert_to_ind, null_polyline
use gpc_f, only: shp_read_pol, polygon use gpc_f, only: shp_read_pol, polygon
use jumble, only: get_command_arg_dyn, assert, deg_to_rad, rad_to_deg use jumble, only: get_command_arg_dyn, assert, deg_to_rad
use shapelib, only: shpfileobject, shpclose, shpt_polygon use shapelib, only: shpfileobject, shpclose
use shapelib_03, only: shp_open_03, shp_get_info_03, dbf_read_attribute_03, & use shapelib_03, only: shp_open_03, shp_get_info_03, dbf_read_attribute_03
dbf_write_attribute_03, shp_append_object_03
use config_m, only: config use config_m, only: config
use cont_list_m, only: create_cont_list, close_cont_list
use derived_types, only: eddy, shpc_slice_handler, ssh_contour use derived_types, only: eddy, shpc_slice_handler, ssh_contour
use input_ssh_m, only: input_ssh use input_ssh_m, only: input_ssh
use read_eddy_m, only: read_eddy use read_eddy_m, only: read_eddy
...@@ -22,7 +22,7 @@ program test_set_max_speed ...@@ -22,7 +22,7 @@ program test_set_max_speed
logical cyclone logical cyclone
logical periodic ! grid is periodic in longitude logical periodic ! grid is periodic in longitude
integer nlon, nlat, d, eddy_index, n_cont, i, ishape, i_outer integer nlon, nlat, d, eddy_index, n_cont, i, ishape
real, allocatable:: ssh(:, :) ! (nlon, nlat) sea-surface height, in m real, allocatable:: ssh(:, :) ! (nlon, nlat) sea-surface height, in m
real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1 real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1
type(eddy) e type(eddy) e
...@@ -79,7 +79,7 @@ program test_set_max_speed ...@@ -79,7 +79,7 @@ program test_set_max_speed
! Define cont_list: ! Define cont_list:
call shp_open_03(hshp, "cont_list", "rb+") call shp_open_03(hshp, "cont_list", "rb")
call shp_get_info_03(hshp, n_cont) call shp_get_info_03(hshp, n_cont)
call assert(1 <= n_cont, n_cont <= n_max_cont - 1, & call assert(1 <= n_cont, n_cont <= n_max_cont - 1, &
"test_set_max_speed n_cont") "test_set_max_speed n_cont")
...@@ -100,27 +100,19 @@ program test_set_max_speed ...@@ -100,27 +100,19 @@ program test_set_max_speed
ishape = ishape) ishape = ishape)
end do end do
i_outer = n_cont call shpclose(hshp)
call create_cont_list
call set_max_speed(e%speed_cont, e%max_speed, cont_list, n_cont, & call set_max_speed(e%speed_cont, e%max_speed, cont_list, n_cont, &
e%extr%coord, ssh(llc(1):urc(1), llc(2):urc(2)), & e%extr%coord, ssh(llc(1):urc(1), llc(2):urc(2)), &
u(llc(1):urc(1), llc(2):urc(2)), v(llc(1):urc(1), llc(2):urc(2)), & u(llc(1):urc(1), llc(2):urc(2)), v(llc(1):urc(1), llc(2):urc(2)), &
corner_window, step) corner_window, step)
call close_cont_list
do i = i_outer + 1, n_cont
call shp_append_object_03(ishape, hshp, shpt_polygon, &
cont_list(i)%points * rad_to_deg)
call dbf_write_attribute_03(hshp, ishape, ifield = 0, &
fieldvalue = cont_list(i)%ssh)
end do
call shpclose(hshp)
call shpc_create(hshpc, shpc_dir = "SHPC", cyclone = cyclone, slice = 0, & call shpc_create(hshpc, shpc_dir = "SHPC", cyclone = cyclone, slice = 0, &
grid_lon_lat = .true.) grid_lon_lat = .true.)
call write_eddy(e, hshpc, d, eddy_index) call write_eddy(e, hshpc, d, eddy_index)
write(hshpc%unit, fmt = *) 0 write(hshpc%unit, fmt = *) 0
CALL shpc_close(hshpc) CALL shpc_close(hshpc)
print *, 'test_set_max_speed: Created "SHPC", modified "cont_list".' print *, 'test_set_max_speed: Created "SHPC" and "cont_list".'
else else
print *, "No outermost contour found." print *, "No outermost contour found."
end if end if
......
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