Opened 10 years ago

Closed 10 years ago

#49 closed defect (fixed)

Troubles when date up to 9999 years

Reported by: ymipsl Owned by: ymipsl
Priority: minor Component: XIOS
Version: 1.0 Keywords:
Cc: acc@…

Description

Actually string date match only 4 digits. Extend it to take more digits

Yann

Change History (2)

comment:1 Changed 10 years ago by ymipsl

Mail from Andrew Coward about the ticket

Seb/Yann?, I have a colleague who has hit a snag with the io servers for a GYRE run doing more than 10,000 years.

The server throws up this error from date.cpp:

Error [StdIStream & operator >> (StdIStream & in, CDate & date)] : In file '/fibre/omfman/XIOS/src/date.cpp', line 105 -> Bad date format or not conform to calendar

I can avoid the problem by putting a mod operator on nyear in iom_init:

WRITE(cldate,"(i4.4,'-',i2.2,'-',i2.2,' 00:00:00')") nyear,nmonth,nday

CALL xios_set_context_attr(TRIM(clname), start_date=cldate )

becomes:

WRITE(cldate,"(i4.4,'-',i2.2,'-',i2.2,' 00:00:00')") MOD(nyear,10000),nmonth,nday

CALL xios_set_context_attr(TRIM(clname), start_date=cldate )

but this only works if the run restarts at the 10000 year boundary and I'm unclear what happens to the time axis on the server side in this case. Looking at the XIOS code, it appears that the year may be hard-limited to 4 characters, e.g.:
date.cpp, line 63:

s = out.width (4); c = out.fill ('0') ; out << date.year << '-';

but I'm unclear whether or not this matters.

Maybe all that is needed is to adapt the cldate string format in the same way as is done in iom_sdate:

IF( iyear < 10000 ) THEN ; clfmt = "i4.4,2i2.2" ! format used to write the date
ELSE ; WRITE(clfmt, "('i',i1,',2i2.2')") INT(LOG10(REAL(iyear,wp))) + 1
ENDIF

but I need confirmation that the XIOS servers can cope.

I haven't raised a ticket because I can't decide if this is a NEMO or a XIOS issue.

Best regards

comment:2 Changed 10 years ago by ymipsl

  • Cc acc@… added
  • Resolution set to fixed
  • Status changed from new to closed

Solved in rev r494

Note: See TracTickets for help on using tickets.