From be3fe85a933ca98b3bc60e6ec54eb9dc0b20474b Mon Sep 17 00:00:00 2001 From: Caitlyn Mcallister Date: Wed, 2 Aug 2023 15:14:18 -0400 Subject: [PATCH] fix select types --- astronomy/astronomy.F90 | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/astronomy/astronomy.F90 b/astronomy/astronomy.F90 index 07f850190c..724fadbb0d 100644 --- a/astronomy/astronomy.F90 +++ b/astronomy/astronomy.F90 @@ -516,28 +516,31 @@ subroutine astronomy_init (latb, lonb) !-------------------------------------------------------------------- ! check that no invalid types (integers or characters) are given as optional arg + is_valid=.false. if (present(latb) .and. present(lonb)) then select type (latb) type is (real(r4_kind)) - select type (lonb) - type is (real(r4_kind)) - is_valid = .true. - end select - type is (real(r8_kind)) + select type (lonb) + type is (real(r4_kind)) + is_valid = .true. + end select + type is (real(r8_kind)) select type (lonb) type is (real(r8_kind)) is_valid = .true. + end select end select - end select - jd = size(latb,2) - 1 - id = size(lonb,1) - 1 - allocate (cosz_ann(id, jd)) - allocate (solar_ann(id, jd)) - allocate (fracday_ann(id, jd)) - total_pts = jd*id - elseif (present(latb) .and. .not. present(lonb)) then - call error_mesg ('astronomy_mod', 'lat and lon must both be present', FATAL) + end if + + if(is_valid) then + jd = size(latb,2) - 1 + id = size(lonb,1) - 1 + allocate (cosz_ann(id, jd)) + allocate (solar_ann(id, jd)) + allocate (fracday_ann(id, jd)) + total_pts = jd*id else + call error_mesg ('astronomy_mod', 'lat and lon must both be present', FATAL) endif !---------------------------------------------------------------------