Opened 13 years ago
Closed 13 years ago
#267 closed defect (fixed)
Corrections to ropp_io_read_ncdf_get.f90
Reported by: | Ian Culverwell | Owned by: | Ian Culverwell |
---|---|---|---|
Priority: | normal | Milestone: | 6.0 |
Component: | ropp_io | Version: | 5.0 |
Keywords: | lahey95, READ, string-to-integer | Cc: |
Description (last modified by )
ROPP6.0 beta testing with the (unsupported) Lahey95 compiler revealed a small problem while converting string to integer with READ statement. Problem sorted (by user): replace
READ(proc_date, "(i4.4,1x,i2.2,1x,i2.2,1x,i2.2,1x,i2.2,1x,i2.2,1x,i3.3)") & data%DTpro%Year, & data%DTpro%Month, & data%DTpro%Day, & data%DTpro%Hour, & data%DTpro%Minute, & data%DTpro%Second, & data%DTpro%Msec
with
READ(proc_date(1:4) , *) data%DTpro%Year READ(proc_date(6:7) , *) data%DTpro%Month READ(proc_date(9:10) , *) data%DTpro%Day READ(proc_date(12:13), *) data%DTpro%Hour READ(proc_date(15:16), *) data%DTpro%Minute READ(proc_date(18:19), *) data%DTpro%Second READ(proc_date(21:23), *) data%DTpro%Msec
Works OK for other compilers a in test code, and for the make test tests.
Putting in ROPP6.0.
Change history (3)
comment:1 by , 13 years ago
Component: | ROPP (all) → I/O |
---|
comment:2 by , 13 years ago
Description: | modified (diff) |
---|
comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Passes test folder; closing ticket.
(NB: We might get problems if the various parts of proc_date were not convertable to integers, eg if proc_date(1:4)='abcd' for some reason. If this happens, we could check that the ascii equivalent of each byte lies in the range of the ascii equivalent the numerals (48-57). Don't bother yet.)
Not so fast, matey. ROPP test folder testing showed that the READ(proc_date(1:4) , *) business failed when proc_date(1:4) was fully blank. (Oddly, READ(proc_date(1:4) , "(i4.4)") - which generally failed on Lahey95 - coped OK with this, and returned zero as expected.)
Since the time elements of data%DTpro are initialised, it's safe to simply prefix the READ statements by IF ones:
This seems to work OK.