integer*4 function cabb_eop_setup( UTCTAG, o_string ) c Extracts the eop data from the iersa.file file, which is c derived from the IERSA Bulletin A data file. c Each line in the iersa.file file has the following values c mjd, x, y, dut1, dutc c Where: c mjd = modified Julian day c (x,y) define the position of the axis of rotation of the earth c as angular offsets from the nominal pole c x = polar coordinate along the Greenwich meridian in arc secs c y = polar coordinate along the 90 deg W meridian in arc secs c dut1 = UT1 - UTC in seconds c dutc = TAI - UTC in seconds c c Fills CALC database common area with tables of values c centred around the day given in the UTCTAG input c c Returns 0 if all OK c Returns -1 on error, with error message in o_string c implicit none integer*2 UTCTAG(*) character*(*) o_string c CALC database common area include 'CALCDB.i' integer*4 year, mon, day, ihr, imn, stat integer*4 i character*80 str real*8 dmjd0 integer*4 mjd0 real*8 x, y, dut1 integer*4 mjd, dutc integer*4 mjd_target, start_offset_days c real*8 sla_dat c -------------------------------------------------------------- c Number of entries in wobble and ut1 tables c - must be even and >= 4 and <= 20 ( defined in CALC ) c These values are used to interpolate to the current date/time nwob = 4 ! CALC database nut1 = nwob ! CALC database start_offset_days = ( nwob / 2 ) - 1 year = utctag(1) mon = utctag(2) day = utctag(3) ihr = utctag(4) imn = utctag(5) call sla_caldj( year, mon, day, dmjd0, stat ) if (stat .ne. 0) then write( o_string, 10) year, mon, day 10 format ('SLA_caldj error: input (yyyy mm dd) : ', I5, 2I3 ) go to 1099 end if mjd0 = INT( dmjd0 + 0.01 ) c Open iersa.file - defined in environment variable 'IERSA_FILE' call get_environment_variable( 'IERSA_FILE', str ) if( str(1:8) .eq. ' ' ) then o_string = 'IERSA_FILE Environment NOT SET' go to 1099 end if open (unit=66, file=str, status='old', ERR=1096 ) c Look for first entry for table mjd_target = mjd0 - start_offset_days mjd = 0 do while( mjd .lt. mjd_target ) read ( 66, '(A)', ERR=1097, END=1097 ) str read ( str, *, ERR=1097, END=1097 ) mjd, x, y, dut1, dutc end do c Should have found initial target - read next three do i = 1, nwob if( mjd .ne. mjd_target ) then write( o_string, 50 ) mjd_target, mjd 50 format( 'ERROR - expecting mjd ', I6, 1 ', found ', I6 ) go to 1098 end if c TESTING !!!!!!!! print 33, mjd, x, y, dut1, dutc 33 format( ' IERSA data: ', I6, 3E15.5, I4 ) c Axis of rotation offset polar coordinates - CALC requires milliarcsec fwobxy(1,i) = x * 1000.0d0 ! CALC data base fwobxy(2,i) = y * 1000.0d0 ! CALC data base c TAI - UT1 for CALC - Note: This is independent of leap second changes c fut1pt(i) = sla_dat(mjd0) - dut1 fut1pt(i) = DFLOAT( dutc ) - dut1 ! CALC data base mjd_target = mjd_target + 1 if( i .lt. nwob ) then read ( 66, '(A)', END=1097, ERR=1097 ) str read ( str, *, END=1097, ERR=1097 ) mjd, x, y, dut1, dutc end if end do c Fill CALC database c Julian date of first entry in wobble table fwobin(1) = DFLOAT( mjd0 - start_offset_days ) + 2400000.5d0 c Icrement in days fwobin(2) = 1.0d0 c Number of points in table fwobin(3) = DFLOAT( nwob ) c fut1in(1-3) same as fwobin(1-3) do i = 1, 3 fut1in(i) = fwobin(i) end do c fut1in(4) = The units of the UT1 tabular array per second. fut1in(4) = 1.d0 c Following describes time rate of change of TAI-UTC c The epoch taiutc(1) = 0. c The value in sec. c taiutc(2) = sla_dat(mjd0) taiutc(2) = dutc c The time rate of change - sec/sec taiutc(3) = 0. c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! c Still need to work out the significance of the following c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! nepoch = 2 rotepo(1,1) = fwobin(1) rotepo(1,2) = fwobin(1) + 2. rotepo(2,1) = 0. rotepo(2,2) = 0. c END Fill CALC database c Normal return close( 66 ) cabb_eop_setup = 0 return c ERROR returns 1096 continue write( o_string, 90 ) TRIM( str ) 90 format( 'ERROR opening EOP file: ', A ) go to 1099 1097 continue write( o_string, 95 ) mjd_target 95 format( 'Read ERROR - looking for mjd ', I6 ) 1098 continue close( 66 ) 1099 continue cabb_eop_setup = -1 return end