prism_calc_newdate_double.F90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------
00002 ! Copyright 2006-2010, CERFACS, Toulouse, France.
00003 ! Copyright 2006-2010, SGI Germany, Munich, Germany.
00004 ! Copyright 2006-2010, NEC Europe Ltd., London, UK.
00005 ! All rights reserved. Use is subject to OASIS4 license terms.
00006 !-----------------------------------------------------------------------
00007 !BOP
00008 !
00009 ! !ROUTINE: PRISM_Calc_newdate_double
00010 !
00011 ! !INTERFACE:
00012 
00013 subroutine prism_calc_newdate_double ( date, date_incr, ierror )
00014 !
00015 ! !USES:
00016 !
00017   use PRISM, dummy_interface => prism_calc_newdate_double
00018   use PRISM_calendar
00019 
00020   use PSMILE, only : ch_id, len_cvs_string
00021 
00022   implicit none
00023 !
00024 ! !INPUT PARAMETERS:
00025 !
00026   Double Precision, Intent(In)            :: date_incr
00027 !
00028 ! !INPUT/OUTPUT PARAMETERS:
00029 !
00030   Type (PRISM_Time_struct), Intent(InOut) :: date
00031 !
00032 ! !OUTPUT PARAMETERS:
00033 !
00034   Integer, Intent(Out)                    :: ierror
00035 !
00036 ! !LOCAL VARIABLES
00037 !
00038   Double Precision :: julian_day, julian_sec
00039 
00040   Integer          :: add_days
00041 !
00042 ! !DESCRIPTION:
00043 !
00044 ! Subroutine "prism_calc_newdate_double" add or substracts a time increment
00045 !  in seconds to the PRISM_Time_Struct dependent on the sign of date_incr.
00046 !  If date_incr is negative abs(date_incr) will be subtracted, in case
00047 !  sign is positive date_incr will be added.
00048 !
00049 !
00050 !
00051 ! !REVISION HISTORY:
00052 !   Date      Programmer   Description
00053 ! ----------  ----------   -----------
00054 ! 04.02.09    R. Redler    created
00055 !
00056 !EOP
00057 !----------------------------------------------------------------------
00058 !
00059 ! $Id: prism_calc_newdate_double.F90 2325 2010-04-21 15:00:07Z valcke $
00060 ! $Author: valcke $
00061 !
00062   Character(len=len_cvs_string), save :: mycvs = 
00063       '$Id: prism_calc_newdate_double.F90 2325 2010-04-21 15:00:07Z valcke $'
00064 !
00065 !----------------------------------------------------------------------
00066 
00067 #ifdef VERBOSE
00068       print *, trim(ch_id), ': prism_calc_newdate_double '
00069 
00070       call psmile_flushstd
00071 #endif /* VERBOSE */
00072 
00073 !----------------------------------------------------------------------
00074 
00075   ierror   = 0
00076   add_days = 0
00077 
00078   call psmile_date2ju ( date, julian_day, julian_sec )
00079 
00080   julian_sec = julian_sec + date_incr
00081   add_days   = floor(julian_sec / 86400.0)
00082   julian_day = julian_day + add_days
00083   julian_sec = julian_sec - float(add_days) * 86400.0
00084 
00085   call psmile_ju2date ( date, julian_day, julian_sec )
00086 
00087 !----------------------------------------------------------------------
00088 #ifdef VERBOSE
00089       print *, trim(ch_id), ': prism_calc_newdate_double eof ierror ', ierror
00090 
00091       call psmile_flushstd
00092 #endif /* VERBOSE */
00093 !----------------------------------------------------------------------
00094 
00095 end subroutine prism_calc_newdate_double

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1