Skip to content

Commit

Permalink
fixes to astronomy
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 authored and mlee03 committed Aug 16, 2023
1 parent b7f244e commit b3f38fb
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions astronomy/astronomy.F90
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ subroutine astronomy_init (latb, lonb)
if (period == 0) then
period_time_type = length_of_year()
call get_time (period_time_type, seconds, days)
period = int(seconds_per_day * days + seconds)
period = int(seconds_per_day) * days + seconds
else
period_time_type = set_time(period,0)
endif
Expand Down Expand Up @@ -518,27 +518,32 @@ subroutine astronomy_init (latb, lonb)

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(r8_kind))
is_valid = .true.
end select
end select
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(r8_kind))
is_valid = .true.
end select
end select
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
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', 'latb and/or lonb are not valid types', FATAL)
end if
elseif (present(latb) .and. .not. present(lonb)) then
call error_mesg ('astronomy_mod', 'lat and lon must both be present', FATAL)
else
call error_mesg ('astronomy_mod', 'lat and lon must both be present', FATAL)
elseif (present(lonb) .and. .not. present(latb)) then
call error_mesg ('astronomy_mod', 'lat and lon must both be present', FATAL)
endif

!---------------------------------------------------------------------
Expand Down Expand Up @@ -574,7 +579,7 @@ subroutine get_period_integer (period_out)
! define length of year in seconds.
!--------------------------------------------------------------------
call get_time (period_time_type, seconds, days)
period_out = int(seconds_per_day * days + seconds)
period_out = int(seconds_per_day) * days + seconds


end subroutine get_period_integer
Expand Down

0 comments on commit b3f38fb

Please sign in to comment.