Changeset 2475 in lmdz_wrf


Ignore:
Timestamp:
Apr 26, 2019, 8:53:56 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `GDATE': Subroutine to compute the gregorian calendar date (year,month,day) given the julian date (JD)
  • `JD': Fucntion to compute the julian date (JD) given a gregorian calendar
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/module_generic.f90

    r2359 r2475  
    1212!   by a list of grid-point coordinates
    1313! GetInNamelist: Subroutine to get a paramter from a namelistfile
     14! GDATE: Subroutine to compute the gregorian calendar date (year,month,day) given the julian date (JD)
    1415! get_xyconlimits: Subroutine for getting the limits of contiguous values from a given point in a 2D matrix
    1516! index_list_coordsI: Function to provide the index of a given coordinate within a list of integer coordinates
     
    2021! Index2DArrayR: Function to provide the first index of a given value inside a 2D real array
    2122! Index2DArrayR_K: Function to provide the first index of a given value inside a 2D real(r_k) array
     23! JD: Fucntion to compute the julian date (JD) given a gregorian calendar
    2224! Nvalues_2DArrayI: Number of different values of a 2D integer array
    2325! mat2DPosition: Function to provide the i, j indices of a given value inside a 2D matrix
     
    11431145  END SUBROUTINE from_coordlist_2DRKmatrix
    11441146
     1147  INTEGER FUNCTION JD (year,month,day)
     1148! Fucntion to compute the julian date (JD) given a gregorian calendar
     1149!   FROM: https://aa.usno.navy.mil/faq/docs/JD_Formula.php
     1150
     1151  IMPLICIT NONE
     1152
     1153  INTEGER, INTENT(in)                                    :: year,month,day
     1154
     1155! Local
     1156  INTEGER                                                :: I,J,K
     1157
     1158  I= year
     1159  J= month
     1160  K= day
     1161
     1162  PRINT *,1461*(I+4800+(J-14)/12)/4, 1461*(I+4800+(J-14)/12)/4.
     1163
     1164  JD= K-32075+1461*(I+4800+(J-14)/12)/4+367*(J-2-(J-14)/12*12)/12-3*((I+4900+(J-14)/12)/100)/4
     1165
     1166  END FUNCTION JD
     1167
     1168  SUBROUTINE GDATE(jd,year,month,day)
     1169  ! Subroutine to compute the gregorian calendar date (year,month,day) given the julian date (JD)
     1170
     1171    IMPLICIT NONE
     1172
     1173    INTEGER, INTENT(in)                                  :: jd
     1174    INTEGER, INTENT(out)                                 :: year,month,day
     1175! Local
     1176    INTEGER                                              ::  I,J,K,L,N
     1177
     1178    L= JD+68569
     1179    N= 4*L/146097
     1180    L= L-(146097*N+3)/4
     1181    I= 4000*(L+1)/1461001
     1182    L= L-1461*I/4+31
     1183    J= 80*L/2447
     1184    K= L-2447*J/80
     1185    L= J/11
     1186    J= J+2-12*L
     1187    I= 100*(N-49)+I+L
     1188
     1189    year= I
     1190    month= J
     1191    day= K
     1192
     1193    RETURN
     1194
     1195  END SUBROUTINE GDATE
     1196
    11451197END MODULE module_generic
Note: See TracChangeset for help on using the changeset viewer.