Changeset 236 for IOIPSL/trunk/src/calendar.f90
- Timestamp:
- 01/21/08 14:44:35 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
IOIPSL/trunk/src/calendar.f90
r11 r236 5 5 !- This is the calendar which going to be used to do all 6 6 !- 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 !- 13 26 !- As one can see it is difficult to go from one calendar to the other. 14 27 !- All operations involving julian days will be wrong. 15 28 !- This calendar will lock as soon as possible 16 !- the length of the year and 29 !- the length of the year and forbid any further modification. 17 30 !- 18 31 !- For the non leap-year calendar the method is still brute force. … … 235 248 INTEGER :: l,n,i,jd,j,d,m,y,ml 236 249 INTEGER :: add_day 250 REAL :: eps_day = SPACING(one_day) 237 251 !--------------------------------------------------------------------- 238 252 lock_one_year = .TRUE. … … 240 254 jd = julian_day 241 255 sec = julian_sec 242 IF (sec > one_day) THEN256 IF (sec > (one_day-eps_day)) THEN 243 257 add_day = INT(sec/one_day) 244 258 sec = sec-add_day*one_day 245 259 jd = jd+add_day 246 260 ENDIF 247 IF (sec < 0.) THEN261 IF (sec < -eps_day) THEN 248 262 sec = sec+one_day 249 263 jd = jd-1 … … 295 309 SUBROUTINE tlen2itau (input_str,dt,date,itau) 296 310 !--------------------------------------------------------------------- 297 !- This subroutine transforms a st ing containing a time length311 !- This subroutine transforms a string containing a time length 298 312 !- into a number of time steps. 299 313 !- To do this operation the date (in julian days is needed as the … … 388 402 REAL FUNCTION itau2date (itau,date0,deltat) 389 403 !--------------------------------------------------------------------- 390 !- This function transforms itau into a date. The date w hith which404 !- This function transforms itau into a date. The date with which 391 405 !- the time axis is going to be labeled 392 406 !- … … 410 424 !=== 411 425 !- 412 SUBROUTINE itau2ymds (itau,deltat,year,month,da te,sec)413 !--------------------------------------------------------------------- 414 !- This subroutine transforms itau into a date. The date w hith which426 SUBROUTINE itau2ymds (itau,deltat,year,month,day,sec) 427 !--------------------------------------------------------------------- 428 !- This subroutine transforms itau into a date. The date with which 415 429 !- the time axis is going to be labeled 416 430 !- … … 420 434 !- 421 435 !- OUTPUT 422 !- year : year436 !- year : year 423 437 !- month : month 424 !- da te : date425 !- sec : seconds since midnight438 !- day : day 439 !- sec : seconds since midnight 426 440 !--------------------------------------------------------------------- 427 441 IMPLICIT NONE … … 430 444 REAL,INTENT(IN) :: deltat 431 445 !- 432 INTEGER,INTENT(OUT) :: year,month,da te446 INTEGER,INTENT(OUT) :: year,month,day 433 447 REAL,INTENT(OUT) :: sec 434 448 !- … … 436 450 REAL :: julian_sec 437 451 !--------------------------------------------------------------------- 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 438 458 julian_day = start_day 439 459 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) 442 461 !----------------------- 443 462 END SUBROUTINE itau2ymds
Note: See TracChangeset
for help on using the changeset viewer.