Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hc_jday and replace with "compute_days_between" for HYCOM forcing #597

Merged
merged 4 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cicecore/cicedynB/general/ice_forcing.F90
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module ice_forcing
use ice_communicate, only: my_task, master_task
use ice_calendar, only: istep, istep1, &
msec, mday, mmonth, myear, yday, daycal, &
daymo, days_per_year, hc_jday
daymo, days_per_year, compute_days_between
use ice_fileunits, only: nu_diag, nu_forcing
use ice_exit, only: abort_ice
use ice_read_write, only: ice_open, ice_read, &
Expand Down Expand Up @@ -4607,8 +4607,8 @@ subroutine hycom_atm_data
call icepack_query_parameters(Tffresh_out=Tffresh)
call icepack_query_parameters(secday_out=secday)

! current time in HYCOM jday units
hcdate = hc_jday(myear,0,0)+ yday+msec/secday
! current time in HYCOM jday units (HYCOM ref year: 1900,12,31,000000)
hcdate = real(compute_days_between(1900,12,31,myear,mmonth,mday)) + msec/secday

mhrib marked this conversation as resolved.
Show resolved Hide resolved
! Init recnum try
recnum=min(max(oldrecnum,1),Njday_atm-1)
Expand Down
48 changes: 0 additions & 48 deletions cicecore/shared/ice_calendar.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ module ice_calendar
public :: set_date_from_timesecs ! set model date from time in seconds
! (relative to init date)
! needed for binary restarts
public :: hc_jday ! converts "calendar" date to HYCOM julian day

! semi-private, only used directly by unit tester
public :: compute_elapsed_days ! compute elapsed days since 0000-01-01
Expand Down Expand Up @@ -916,53 +915,6 @@ subroutine calendar_time2date(atimesecs,ayear,amon,aday,asec,year_ref,mon_ref,da

end subroutine calendar_time2date

!=======================================================================

real(kind=dbl_kind) function hc_jday(iyear,imm,idd,ihour)
!--------------------------------------------------------------------
! converts "calendar" date to HYCOM julian day:
! 1) year,month,day,hour (4 arguments)
! 2) year,doy,hour (3 arguments)
!
! HYCOM model day is calendar days since 31/12/1900
!--------------------------------------------------------------------
real(kind=dbl_kind) :: dtime
integer(kind=int_kind) :: iyear,iyr,imm,idd,idoy,ihr
integer(kind=int_kind), optional :: ihour
integer (kind=int_kind) :: n

if (present(ihour)) then
!-----------------
! yyyy mm dd HH
!-----------------
iyr=iyear-1901
dtime = floor(365.25_dbl_kind*iyr)*c1 + idd*c1 + ihour/24._dbl_kind
if (mod(iyr,4)==3) then
do n = 1,imm-1
dtime = dtime + daymo366(n)
enddo
else
do n = 1,imm-1
dtime = dtime + daymo365(n)
enddo
endif

else
!-----------------
! yyyy DOY HH
!-----------------
ihr = idd ! redefine input
idoy = imm ! redefine input
iyr = iyear - 1901
dtime = floor(365.25_dbl_kind*iyr)*c1 + idoy*c1 + ihr/24._dbl_kind

endif

hc_jday=dtime

return
end function hc_jday

!=======================================================================

end module ice_calendar
Expand Down