Skip to content

Commit

Permalink
Allow dates with fewer than 4 digit years. For example,
Browse files Browse the repository at this point in the history
a WRF forecast to check out the weather in June 622 when 
traveling from Mecca to Medina.  This issue was already fixed 
in WPS (Michael Duda).  The same type of fix is applied here:
turn the "I4" formats to "I4.4" in a single file.

No tests have been done for negative years, and forecasts
with 5-digit years would also fail.

M    module_date_time.F



git-svn-id: https://svn-wrf-model.cgd.ucar.edu/trunk@7693 b0b5d27b-6f0f-0410-a2a3-cb1e977edc3d
  • Loading branch information
davegill committed Oct 10, 2014
1 parent 7a618c0 commit 3d236a5
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions share/module_date_time.F
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ SUBROUTINE geth_idts (ndate, odate, idts)
scold = 0
olen = LEN(odate)

READ(odate(1:4), '(I4)') yrold
READ(odate(1:4), '(I4.4)') yrold
#ifdef PLANET
READ(odate(6:10), '(I5)') dyold
moold=0.
Expand All @@ -225,7 +225,7 @@ SUBROUTINE geth_idts (ndate, odate, idts)
scnew = 0
nlen = LEN(ndate)

READ(ndate(1:4), '(I4)') yrnew
READ(ndate(1:4), '(I4.4)') yrnew
#ifdef PLANET
READ(ndate(6:10), '(I5)') dynew
monew=0.
Expand Down Expand Up @@ -509,7 +509,7 @@ SUBROUTINE geth_newdate (ndate, odate, idt)
! Use internal READ statements to convert the CHARACTER string
! date into INTEGER components.

READ(odate(1:4), '(I4)') yrold
READ(odate(1:4), '(I4.4)') yrold
#ifdef PLANET
READ(odate(6:10), '(I5)') dyold
moold=0.
Expand Down Expand Up @@ -773,20 +773,20 @@ SUBROUTINE geth_newdate (ndate, odate, idt)

ELSE IF (nlen.eq.19.or.nlen.eq.20) THEN
WRITE(ndate(1:19),19) yrnew, monew, dynew, hrnew, minew, scnew
19 format(I4,'-',I2.2,'-',I2.2,'_',I2.2,':',I2.2,':',I2.2)
19 format(I4.4,'-',I2.2,'-',I2.2,'_',I2.2,':',I2.2,':',I2.2)
IF (nlen.eq.20) ndate = ndate(1:19)//'.'

ELSE IF (nlen.eq.16) THEN
WRITE(ndate,16) yrnew, monew, dynew, hrnew, minew
16 format(I4,'-',I2.2,'-',I2.2,'_',I2.2,':',I2.2)
16 format(I4.4,'-',I2.2,'-',I2.2,'_',I2.2,':',I2.2)

ELSE IF (nlen.eq.13) THEN
WRITE(ndate,13) yrnew, monew, dynew, hrnew
13 format(I4,'-',I2.2,'-',I2.2,'_',I2.2)
13 format(I4.4,'-',I2.2,'-',I2.2,'_',I2.2)

ELSE IF (nlen.eq.10) THEN
WRITE(ndate,10) yrnew, monew, dynew
10 format(I4,'-',I2.2,'-',I2.2)
10 format(I4.4,'-',I2.2,'-',I2.2)

END IF

Expand Down Expand Up @@ -835,18 +835,18 @@ SUBROUTINE split_date_char ( date , century_year , month , day , hour , minute ,

INTEGER , INTENT(OUT) :: century_year , month , day , hour , minute , second , ten_thousandth

READ(date,FMT='( I4)') century_year
READ(date,FMT='( I4.4)') century_year
#ifdef PLANET
month = 0
READ(date,FMT='( 5X,I5)') day
READ(date,FMT='( 5X,I5.5)') day
#else
READ(date,FMT='( 5X,I2)') month
READ(date,FMT='( 8X,I2)') day
READ(date,FMT='( 5X,I2.2)') month
READ(date,FMT='( 8X,I2.2)') day
#endif
READ(date,FMT='(11X,I2)') hour
READ(date,FMT='(14X,I2)') minute
READ(date,FMT='(17X,I2)') second
READ(date,FMT='(20X,I4)') ten_thousandth
READ(date,FMT='(11X,I2.2)') hour
READ(date,FMT='(14X,I2.2)') minute
READ(date,FMT='(17X,I2.2)') second
READ(date,FMT='(20X,I4.4)') ten_thousandth

END SUBROUTINE split_date_char

Expand Down

0 comments on commit 3d236a5

Please sign in to comment.