Changeset 236


Ignore:
Timestamp:
01/21/08 14:44:35 (16 years ago)
Author:
bellier
Message:

calendar :

  • modification of tests to get rid of a truncation error in the determination of the date change.
  • addition in "itau2ymds" of a message to inform usage of undefined elements (call with "ioconf_startdate" not done)

restcom :

  • some orthographic correction

JB

Location:
IOIPSL/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • IOIPSL/trunk/src/calendar.f90

    r11 r236  
    55!- This is the calendar which going to be used to do all 
    66!- calculations on time. Three types of calendars are possible : 
    7 !-  - gregorian : The normal calendar. The time origin for the 
    8 !-                julian day in this case is 24 Nov -4713 
    9 !-  - nolap : A 365 day year without leap years. 
    10 !-            The origin for the julian days is in this case 1 Jan 0 
    11 !-  - xxxd : Year of xxx days with month of equal length. 
    12 !-           The origin for the julian days is then also 1 Jan 0 
     7!- 
     8!-  - gregorian : 
     9!-      The normal calendar. The time origin for the 
     10!-      julian day in this case is 24 Nov -4713 
     11!-      (other names : 'standard','proleptic_gregorian') 
     12!-  - noleap : 
     13!-      A 365 day year without leap years. 
     14!-      The origin for the julian days is in this case 1 Jan 0 
     15!-      (other names : '365_day','365d') 
     16!-  - all_leap : 
     17!-      A 366 day year with leap years. 
     18!-      The origin for the julian days is in this case ???? 
     19!-      (other names : '366_day','366d' 
     20!-  - julian : 
     21!-      same as gregorian, but with all leap century years 
     22!-  - xxxd : 
     23!-      Year of xxx days with month of equal length. 
     24!-      The origin for the julian days is then also 1 Jan 0 
     25!- 
    1326!- As one can see it is difficult to go from one calendar to the other. 
    1427!- All operations involving julian days will be wrong. 
    1528!- This calendar will lock as soon as possible 
    16 !- the length of the year and  forbid any further modification. 
     29!- the length of the year and forbid any further modification. 
    1730!- 
    1831!- For the non leap-year calendar the method is still brute force. 
     
    235248  INTEGER :: l,n,i,jd,j,d,m,y,ml 
    236249  INTEGER :: add_day 
     250  REAL :: eps_day = SPACING(one_day) 
    237251!--------------------------------------------------------------------- 
    238252  lock_one_year = .TRUE. 
     
    240254  jd = julian_day 
    241255  sec = julian_sec 
    242   IF (sec > one_day) THEN 
     256  IF (sec > (one_day-eps_day)) THEN 
    243257    add_day = INT(sec/one_day) 
    244258    sec = sec-add_day*one_day 
    245259    jd = jd+add_day 
    246260  ENDIF 
    247   IF (sec < 0.) THEN 
     261  IF (sec < -eps_day) THEN 
    248262    sec = sec+one_day 
    249263    jd = jd-1 
     
    295309SUBROUTINE tlen2itau (input_str,dt,date,itau) 
    296310!--------------------------------------------------------------------- 
    297 !- This subroutine transforms a sting containing a time length 
     311!- This subroutine transforms a string containing a time length 
    298312!- into a number of time steps. 
    299313!- To do this operation the date (in julian days is needed as the 
     
    388402REAL FUNCTION itau2date (itau,date0,deltat) 
    389403!--------------------------------------------------------------------- 
    390 !- This function transforms itau into a date. The date whith which 
     404!- This function transforms itau into a date. The date with which 
    391405!- the time axis is going to be labeled 
    392406!- 
     
    410424!=== 
    411425!- 
    412 SUBROUTINE itau2ymds (itau,deltat,year,month,date,sec) 
    413 !--------------------------------------------------------------------- 
    414 !- This subroutine transforms itau into a date. The date whith which 
     426SUBROUTINE itau2ymds (itau,deltat,year,month,day,sec) 
     427!--------------------------------------------------------------------- 
     428!- This subroutine transforms itau into a date. The date with which 
    415429!- the time axis is going to be labeled 
    416430!- 
     
    420434!- 
    421435!- OUTPUT 
    422 !-   year : year 
     436!-   year  : year 
    423437!-   month : month 
    424 !-   date : date 
    425 !-   sec  : seconds since midnight 
     438!-   day   : day 
     439!-   sec   : seconds since midnight 
    426440!--------------------------------------------------------------------- 
    427441  IMPLICIT NONE 
     
    430444  REAL,INTENT(IN)    :: deltat 
    431445!- 
    432   INTEGER,INTENT(OUT) :: year,month,date 
     446  INTEGER,INTENT(OUT) :: year,month,day 
    433447  REAL,INTENT(OUT)    :: sec 
    434448!- 
     
    436450  REAL    :: julian_sec 
    437451!--------------------------------------------------------------------- 
     452  IF (.NOT.lock_startdate) THEN 
     453    CALL ipslerr (2,'itau2ymds', & 
     454 &   'You try to call this function, itau2ymds, but you didn''t', & 
     455 &   ' call ioconf_startdate to initialize date0 in calendar.', & 
     456 &   ' Please call ioconf_startdate before itau2ymds.') 
     457  ENDIF 
    438458  julian_day = start_day 
    439459  julian_sec = start_sec+REAL(itau)*deltat 
    440 !- 
    441   CALL ju2ymds_internal (julian_day,julian_sec,year,month,date,sec) 
     460  CALL ju2ymds_internal (julian_day,julian_sec,year,month,day,sec) 
    442461!----------------------- 
    443462END SUBROUTINE itau2ymds 
  • IOIPSL/trunk/src/restcom.f90

    r122 r236  
    3737!- 
    3838  INTEGER,PARAMETER :: & 
    39  &  max_var=200, max_file=50, max_dim=NF90_MAX_VAR_DIMS 
     39 &  max_var=500, max_file=50, max_dim=NF90_MAX_VAR_DIMS 
    4040!- 
    4141  CHARACTER(LEN=9),SAVE :: calend_str='unknown' 
     
    4545!- 
    4646  INTEGER,SAVE :: nbfiles = 0  
    47   INTEGER,SAVE :: netcdf_id(max_file,2) = -1 
     47  INTEGER,DIMENSION(max_file,2),SAVE :: netcdf_id = -1 
    4848!- 
    4949! Description of the content of the 'in' files and the 'out' files. 
     
    6767! Time step and time origine in the input file. 
    6868!- 
    69   REAL,SAVE :: deltat(max_file), timeorig(max_file) 
     69  REAL,DIMENSION(max_file),SAVE :: deltat,timeorig 
    7070!- 
    7171! Description of the axes in the output file 
     
    7474!   itau_out  : Time step which is written on this index of the file 
    7575!- 
    76   INTEGER,SAVE :: tstp_out(max_file) 
    77   INTEGER,SAVE :: itau_out(max_file) 
     76  INTEGER,DIMENSION(max_file),SAVE :: tstp_out,itau_out 
    7877!- 
    7978! Description of the axes in the output file 
    8079!- 
     80! For the ?ax_infs variable the following order is used : 
     81!   ?ax_infs (if,in,1) = size of axis 
     82!   ?ax_infs (if,in,2) = id of dimension 
    8183! Number of x,y and z axes in the output file :  
    8284!   ?ax_nb(if) 
    83 ! For the ?ax_infs variable the following order is used : 
    84 !   ?ax_infs (if, in,1) = size of axis 
    85 !   ?ax_infs (if, in,2) = id of dimension 
    86 !- 
    87   INTEGER,SAVE :: & 
    88  &  xax_infs(max_file,max_dim,2), yax_infs(max_file,max_dim,2),& 
    89  &  zax_infs(max_file,max_dim,2), qax_infs(max_file,max_dim,2) 
    90   INTEGER,SAVE :: & 
    91  &  xax_nb(max_file)=0, yax_nb(max_file)=0, & 
    92  &  zax_nb(max_file)=0, qax_nb(max_file)=0 
     85!- 
     86  INTEGER,DIMENSION(max_file,max_dim,2),SAVE :: & 
     87 &  xax_infs,yax_infs,zax_infs 
     88  INTEGER,DIMENSION(max_file),SAVE :: & 
     89 &  xax_nb=0,yax_nb=0,zax_nb=0 
    9390!- 
    9491! Description of the time axes in the input and output files 
     
    656653  INTEGER :: ncfid,iret,it,iax,iv,tszij 
    657654  INTEGER,ALLOCATABLE :: tmp_index(:,:) 
    658   REAL,ALLOCATABLE  :: tmp_julian(:,:) 
    659   CHARACTER(LEN=80)  :: itau_orig,tax_orig,calendar 
     655  REAL,ALLOCATABLE :: tmp_julian(:,:) 
     656  CHARACTER(LEN=80) :: itau_orig,tax_orig,calendar 
    660657  CHARACTER(LEN=9) :: tmp_cal 
    661658  INTEGER :: year0,month0,day0,hours0,minutes0,seci 
    662   REAL ::sec0,un_jour,un_an,date0_ju,ttmp 
     659  REAL :: sec0,un_jour,un_an,date0_ju,ttmp 
    663660  CHARACTER :: strc 
    664661!- 
     
    718715    itau_orig = & 
    719716      itau_orig(INDEX(itau_orig,'since')+6:LEN_TRIM(itau_orig)) 
    720     iret = NF90_GET_ATT & 
    721  &           (ncfid,tind_varid_in(fid),'tstep_sec',timestep) 
    722 !--- 
    723 !-- This time origine will dominate as it is linked to the time steps. 
     717    iret = & 
     718 &    NF90_GET_ATT(ncfid,tind_varid_in(fid),'tstep_sec',timestep) 
     719!--- 
     720!-- This time origin will dominate as it is linked to the time steps. 
    724721!--- 
    725722    READ (UNIT=itau_orig,FMT='(I4.4,5(a,I2.2))') & 
     
    16621659    IF (zax_infs(fid,1,1) > 0) req_sz = req_sz*zax_infs(fid,1,1) 
    16631660  ELSE 
    1664     CALL ipslerr (3,'resput_opp_r1d', & 
     1661    CALL ipslerr (3,'restput_opp_r1d', & 
    16651662      'Unable to performe an operation on this variable as it has', & 
    16661663      'a second and third dimension',vname_q) 
     
    17111708       scal,req_sz,buff_tmp2) 
    17121709  ELSE 
    1713     CALL ipslerr (3,'resput_opp_r1d', & 
     1710    CALL ipslerr (3,'restput_opp_r1d', & 
    17141711      'The operation you wish to do on the variable for the ', & 
    17151712       & 'restart file is not allowed.',topp) 
     
    17651762    IF (yax_infs(fid,1,1) > 0) req_sz = req_sz*yax_infs(fid,1,1) 
    17661763  ELSE 
    1767     CALL ipslerr (3,'resput_opp_r2d', & 
     1764    CALL ipslerr (3,'restput_opp_r2d', & 
    17681765      'Unable to performe an operation on this variable as it has', & 
    17691766      'a second and third dimension',vname_q) 
     
    17711768!- 
    17721769  IF (jjm < 1) THEN 
    1773     CALL ipslerr (3,'resput_opp_r2d', & 
     1770    CALL ipslerr (3,'restput_opp_r2d', & 
    17741771      'Please specify a second dimension which is the', & 
    17751772      'layer on which the operations are performed',vname_q) 
     
    18241821    ENDDO 
    18251822  ELSE 
    1826     CALL ipslerr (3,'resput_opp_r2d', & 
     1823    CALL ipslerr (3,'restput_opp_r2d', & 
    18271824      'The operation you wish to do on the variable for the ', & 
    18281825      'restart file is not allowed.',topp) 
Note: See TracChangeset for help on using the changeset viewer.