C+ C NAME: C iHOSArch C PURPOSE: C For a given set of orbital Helios coordinates, try to determine C on which architecture the numbers originated C CATEGORY: C I/O: HOS C CALLING SEQUENCE: function iHOSArch(T,R,L) C INPUTS: (read only) C T real day of year (with time of day as fraction) C R real heliocentric distance (AU) C L real geocentric ecliptic longitude of the Sun C OUTPUTS: C iD integer if the architecture was determined then the appropriate C architecture bit is set (HOS__OS_VMS, HOS__OS_DOS C or HOS__OS_UNIX) is set, and the other two are cleared. C (Linux numbers are the same as DOS numbers so we don't need a Linux bit). C In addition one of the spacecraft bits (HOS__AA or HOS__BB) is set. C if the architecture could not be determined then all C architecture and spacecraft bits are cleared (and iD=0 is returned). C CALLS: C CvR4, BadR4, pInfR4, Say, HOSOrbID C INCLUDE: include 'dirspec.h' include 'hos_e9.h' C RESTRICTIONS: C I don't think this is bullet proof, but it's pretty good. C PROCEDURE: C Most (but not all) of the Helios photometer files were written on VMS. C When files are read on a different architecture then they where written on then C the numbers need to be converted to native format. C This function is applied to a set of orbital numbers just read from a file C to decide what the architecture of origin is. C Currently VMS, DOS, and Unix are potential candidates. Linux is implicitly C supported (recognized as DOS). C C The current test consist of converting to each of the candidate architecture C and checking the results. C C - first check whether the converted number are valid real*4 numbers by C comparing with BadR4() and pInfR4(). C C If the numbers are valid, check for 'reasonable' values: C - check the range of R: the Helios spacecraft moved between 0.3 and 1.0 AU C so we test whether R is in the range [0.25,1.05] AU. C - check the range of L: presumably the ecliptic longitude is between 0 and C 360 degrees. Check for the range [-360,720]. C - check the range of T: presumably the day of year is between 0 and 366. C Check for the range [-400,800] C C If it passes both tests, call HOSOrbid to find the year and spacecraft C that best fits the coordinates. This gives a minimum distance between actual C and calculated orbital location. C MODIFICATION HISTORY: C MAY-2000, Paul Hick (UCSD; pphick@ucsd.edu) C- real T real R real L real LL integer kOS(3) /HOS__OS_VMS, HOS__OS_DOS, HOS__OS_UNIX/ integer kSC(2) /HOS__AA, HOS__BB/ logical bGoodNumber logical bInRange bGoodNumber(X) = X .ne. Bad .and. X .ne. pInf .and. X .ne. -pInf bInRange(T,R,L) = 0.25 .lt. R .and. R .lt. 1.05 .and. & -360 .lt. L .and. L .lt. 720 .and. & -400 .lt. T .and. T .lt. 800 Bad = BadR4() pInf = pInfR4() dRMinVMS = pInf dRMinDOS = pInf dRMinUnix = pInf !------- ! Assume it is from a VMS file. Convert from VMS to native format TT = T RR = R LL = L call CvR4(OS__VMS,1,TT) call CvR4(OS__VMS,1,RR) call CvR4(OS__VMS,1,LL) iHOSArch = HOS__NULL if (bGoodNumber(TT) .and. bGoodNumber(RR) .and. bGoodNumber(LL)) then if (bInRange(TT,RR,LL)) then LL = mod(LL+180.,360.) call HOSOrbID(TT,RR,LL,iSc,iYr, dRMinVMS) iHOSArch = iHOSArch+HOS__OS_VMS end if end if !------- ! Assume it is from a DOS (or Linux) file. Convert from DOS to native format TT = T RR = R LL = L call CvR4(OS__DOS,1,TT) call CvR4(OS__DOS,1,RR) call CvR4(OS__DOS,1,LL) if (bGoodNumber(TT) .and. bGoodNumber(RR) .and. bGoodNumber(LL)) then if (bInRange(TT,RR,LL)) then LL = mod(LL+180.,360.) call HOSOrbID(TT,RR,LL,iSc,iYr, dRMinDOS) iHOSArch = iHOSArch+HOS__OS_DOS end if end if !------- ! Assume it is from a Unix file. Convert from Unix to native format TT = T RR = R LL = L call CvR4(OS__UNIX,1,TT) call CvR4(OS__UNIX,1,RR) call CvR4(OS__UNIX,1,LL) if (bGoodNumber(TT) .and. bGoodNumber(RR) .and. bGoodNumber(LL)) then if (bInRange(TT,RR,LL)) then LL = mod(LL+180.,360.) call HOSOrbID(TT,RR,LL,iSc,iYr, dRMinUnix) iHOSArch = iHOSArch+HOS__OS_UNIX end if end if dRMin = min(dRMinVMS, dRMinDOS, dRMinUnix) ! Clear architecture and s/c bits iHOSArch = iHOSArch-iand(iHOSArch,HOS__OS_ALL)-iand(iHOSArch,HOS__AB) if (dRMin .eq. pInf) then call Say('iHOSArch','E','NoArch','Could not determine source architecture') else iOS = 1 if (dRMin .eq. dRMinDOS) then iOS = 2 else if (dRMin .eq. dRMinUnix) then iOS = 3 end if iHOSArch = kOS(iOS)+kSC(iSc) ! Set proper architecture and s/c bits end if return end