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

Add argument iostat to `shpc_open`

parent 47f0fea9
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, pszaccess)
subroutine shpc_open(hshp, shpc_dir, pszaccess, iostat)
! Libraries:
USE jumble, only: new_unit
......@@ -16,34 +16,47 @@ contains
TYPE(shpc_slice_handler), intent(out):: hshp
character(len = *), intent(in):: shpc_dir
character(len = *), intent(in):: pszaccess ! should be "rb" or "rb+"
integer, optional, intent(out):: iostat
! Local:
integer unit
integer unit, iostat_extr
character(len = 12) orientation
!--------------------------------------------------------------------
call shp_open_03(hshp%extremum, shpc_dir // "/extremum", pszaccess)
call shp_open_03(hshp%outermost, shpc_dir // "/outermost_contour", &
pszaccess)
call shp_open_03(hshp%max_speed, shpc_dir // "/max_speed_contour", &
pszaccess)
call read_field_indices(hshp)
call new_unit(unit)
open(unit, file = shpc_dir // "/orientation.txt", status = "old", &
action = "read", position = "rewind")
read(unit, fmt = *) orientation
close(unit)
hshp%cyclone = trim(adjustl(orientation)) == "cyclones"
hshp%dir = shpc_dir
call new_unit(hshp%unit)
if (pszaccess == "rb") then
open(hshp%unit, file = hshp%dir // "/ishape_last.txt", &
status = "old", action = "read", position = "rewind")
call shp_open_03(hshp%extremum, shpc_dir // "/extremum", pszaccess, &
iostat_extr)
if (present(iostat)) iostat = iostat_extr
if (iostat_extr == 0) then
call shp_open_03(hshp%outermost, shpc_dir // "/outermost_contour", &
pszaccess)
call shp_open_03(hshp%max_speed, shpc_dir // "/max_speed_contour", &
pszaccess)
call read_field_indices(hshp)
call new_unit(unit)
open(unit, file = shpc_dir // "/orientation.txt", status = "old", &
action = "read", position = "rewind")
read(unit, fmt = *) orientation
close(unit)
hshp%cyclone = trim(adjustl(orientation)) == "cyclones"
hshp%dir = shpc_dir
call new_unit(hshp%unit)
if (pszaccess == "rb") then
open(hshp%unit, file = hshp%dir // "/ishape_last.txt", &
status = "old", action = "read", position = "rewind")
else
open(hshp%unit, file = hshp%dir // "/ishape_last.txt", &
status = "old", action = "readwrite", position = "append")
end if
else
open(hshp%unit, file = hshp%dir // "/ishape_last.txt", &
status = "old", action = "readwrite", position = "append")
if (.not. present(iostat)) then
print *, "shpc_open: failed"
print *, "shpc_dir = ", shpc_dir
print *, "pszaccess = ", pszaccess
stop 1
end if
end if
end subroutine shpc_open
......
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