Ignore:
Timestamp:
2014-12-15T17:42:49+01:00 (7 years ago)
Author:
timgraham
Message:

Merged branches/2014/dev_MERGE_2014 back onto the trunk as follows:

In the working copy of branch ran:
svn merge svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk@HEAD
1 conflict in LIM_SRC_3/limdiahsb.F90
Resolved by keeping the version from dev_MERGE_2014 branch
and commited at r4989

In working copy run:
svn switch svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk
to switch working copy

Run:
svn merge —reintegrate svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2014/dev_MERGE_2014
to merge the branch into the trunk - no conflicts at this stage.

Location:
trunk/NEMOGCM/TOOLS/OBSTOOLS
Files:
1 edited
7 copied

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/TOOLS/OBSTOOLS/src/date_utils.F90

    r3000 r4990  
    3434 
    3535   END SUBROUTINE add_date 
     36 
     37 
     38   SUBROUTINE add_days_to_date(initial_date,days,final_date) 
     39 
     40      ! Add a number of days to initial_date and return it in final_date 
     41 
     42      IMPLICIT NONE 
     43 
     44 
     45      !! Arguments 
     46      INTEGER,INTENT(in) :: initial_date ! Initial date (YYYYMMDD) 
     47      INTEGER,INTENT(in) :: days         ! Number of days to add 
     48      INTEGER,INTENT(out) :: final_date  ! Final date (YYYYMMDD) 
     49 
     50      !! Local variables 
     51 
     52      INTEGER :: isec,imin,ihours,iyear,imon,iday ! temporary results 
     53      REAL(dp):: juld 
     54 
     55      ! Account for lack of hours in date format (initial_date*100) 
     56      CALL split_date(initial_date*100,iyear,imon,iday,ihours) 
     57 
     58      CALL greg2jul(0,0,ihours,iday,imon,iyear,juld) 
     59 
     60      juld=juld+REAL(days) 
     61 
     62      CALL jul2greg(isec,imin,ihours,iday,imon,iyear,juld) 
     63 
     64      final_date=(iyear*1000000+imon*10000+iday*100+ihours)/100 
     65 
     66   END SUBROUTINE add_days_to_date 
     67 
    3668 
    3769   SUBROUTINE split_date(iyyyymmddhh,iyyyy,imm,idd,ihh) 
     
    379411   END FUNCTION diffdate 
    380412 
     413   INTEGER FUNCTION difftime(itime1,itime2) 
     414 
     415      ! Compute difference in minutes between times 
     416      ! Assumes HHMM or HMM or MM or M format for dates 
     417      ! 
     418      ! ORDER MATTERS - itime1 is ealier time 
     419      ! Result is an integer number of minutes 
     420 
     421      IMPLICIT NONE 
     422      INTEGER, INTENT(IN) :: itime1,itime2    ! Times to be diffed. 
     423      INTEGER :: imin1, imin2, ihr1, ihr2 
     424 
     425      ihr1 = (itime1/100) 
     426      ihr2 = (itime2/100) 
     427       
     428      imin1 = (itime1 - ihr1*100) + (60 * ihr1) 
     429      imin2 = (itime2 - ihr2*100) + (60 * ihr2) 
     430       
     431      ! Assume that itime2 is later, so wrap around midnight if necessary. 
     432      IF (imin2 < imin1) THEN 
     433         imin2 = imin2 + 24*60 
     434      END IF 
     435       
     436      difftime = imin2 - imin1 
     437       
     438   END FUNCTION difftime 
     439 
     440 
     441   INTEGER FUNCTION add_mins_to_time(itime1, imin_add) 
     442 
     443      ! Add number of minutes onto given time 
     444      ! Assumes time in HHMM or HMM or MM or M format 
     445      ! 
     446      ! Result is in HHMM format 
     447 
     448      IMPLICIT NONE 
     449      INTEGER, INTENT(IN) :: itime1,imin_add 
     450      INTEGER :: imin1, ihr1, imin2, ihr2 
     451 
     452      ihr1 = (itime1/100) 
     453       
     454      ! itime1 in minutes from previous midnight 
     455      imin1 = (itime1 - ihr1*100) + (60 * ihr1) 
     456       
     457      imin1 = imin1 + imin_add 
     458       
     459      ! Add 1day if time went nagative 
     460      IF (imin1 < 0) THEN 
     461         imin1 = imin1 + 24*60 
     462      END IF 
     463       
     464      ! Turn number of minutes back into HHMM 
     465      ihr2 = imin1/60 
     466      imin2 = imin1 - ihr2*60 
     467 
     468      DO 
     469         IF (ihr2<0) THEN 
     470            ihr2 = ihr2 + 24 
     471         ELSE IF (ihr2>=24) THEN 
     472            ihr2 = ihr2 - 24 
     473         END IF 
     474         IF ((ihr2>=0).OR.(ihr2<24)) EXIT 
     475      END DO 
     476 
     477      add_mins_to_time = ihr2*100 + imin2 
     478    
     479   END FUNCTION add_mins_to_time 
     480 
    381481 
    382482END MODULE date_utils 
Note: See TracChangeset for help on using the changeset viewer.