public static int [ ] TG_FTOI ( int [ ] iftime , int start ) { int [ ] intdtf = new int [ 3 ] ; // If there is no forecast information, the string is stored as // date and time. if ( iftime [ start ] < 100000000 ) { intdtf [ 0 ] = iftime [ start ] ; intdtf [ 1 ] = iftime [ start + 1 ] ; intdtf [ 2 ] = 0 ; // Otherwise, decode date/time and forecast info from the // two integers. } else { // The first word contains MMDDYYHHMM. This must be turned // into YYMMDD and HHMM. intdtf [ 0 ] = iftime [ start ] / 10000 ; intdtf [ 1 ] = iftime [ start ] - intdtf [ 0 ] * 10000 ; int mmdd = intdtf [ 0 ] / 100 ; int iyyy = intdtf [ 0 ] - mmdd * 100 ; intdtf [ 0 ] = iyyy * 10000 + mmdd ; // The forecast time remains the same. intdtf [ 2 ] = iftime [ start + 1 ] ; } return intdtf ; }
This subroutine converts the two integers stored in a grid file into three integers containing the date time and forecast time .