C+ C NAME: C HOSWrite C PURPOSE: C Write Helios data file C CATEGORY: C I/O: Helios C CALLING SEQUENCE: subroutine HOSWrite(iD,cFile,nT,iT,NN,TT,PP,CC,FF,RR,LL,nS,ZZ) C INPUTS: C iD integer identifies data properties C each bit identifies a property defined in include file hos_e9.h C Bits are set by summing parameters defined in the include file. C C Bits used are: C HOS__SWAP_SECT: if set sectors are assumed to be ordered by C modified sector number (see PROCEDURE). C HOS__NONORM: no-normalization bit; passed to iHOSWrite C cFile character*(*) name of file to be updated C nT integer (not used) C iT integer number of records C NN(iT) integer record number C Only record numbers which have the C sign bit set will be updated C TT(iT) real times (day of year) C PP(iT) integer photometer (1/2/3) C CC(iT) integer colors (1/2/3, 101/102/103) C FF(iT) integer filters (1/2/3/4/5) C RR(iT) real heliocentric distance (AU) C LL(iT) real ecliptic longitude of Sun C nS integer # sectors C ZZ(nS,iT) real intensities C OUTPUTS: C Output to new Helios file C CALLS: C iArrI4ValuePresent, bOpenFile, ArrR4Copy, iHOSWrite, cInt2Str, Say, iFreeLun C INCLUDE: include 'openfile.h' include 'hos_e9.h' C SIDE EFFECTS: C > Arguments nT and NN are not used. C (the arguments are kept only to keep the argument lists of C href=HOSRead=, href=HOSUpdate= and HOSWrite identical). C RESTRICTIONS: C The setting of the 4th digit of iD should be the same as used C in the call to HOSRead used to fill the arrays. C PROCEDURE: C > The arrays are usually read using HOSRead (the argument lists C of HOSUpdate, HOSWrite and HOSRead are identical). The record number array C NN refers to the file read by HOSRead C > By default (HOS__SWAP_SECT not set) the nS sectors of the intensity C array are assumed to refer to sectors 1..nS/2,33-nS/2,..32, and are C written to file in that order. C > If HOS__SWAP_SECT is set, the sectors are assumed to be ordered by C modified sector number: 1-nS/2,...nS/2, corresponding to normal C sector numbers: 33-nS/2,..32,1,..,nS/2, i.e. the first and second C half are swapped. The sectors will be swapped back into normal order C before being written to file by iHOSWrite. C MODIFICATION HISTORY: C SEP-1998, Paul Hick (UCSD/CASS) C MAY-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu), updated handling of data properties in iD C- integer iD character cFile*(*) integer nT integer iT integer NN(*) real TT(*) integer PP(*) integer CC(*) integer FF(*) real RR(*) real LL(*) integer nS real ZZ(*) character cInt2Str*14 character cSay*8 /'HOSWrite'/ logical bOpenFile logical bSwap real Z(32) if (iArrI4ValuePresent(iT,PP,3) .eq. iT) then iRecl = 6 else iRecl = nS+5 end if if (bOpenFile(OPN__HOS+OPN__NEW+OPN__TRYINPUT+OPN__STOP,iU,cFile,iRecl)) then iDD = iand(iD,HOS__NONORM) bSwap = iand(iD,HOS__SWAP_SECT) .ne. 0 iS = nS/2 iW = 0 do iR=1,iT iZt = (iR-1)*nS+1 if (PP(iR) .ne. 3 .and. bSwap) then call ArrR4Copy(nS,ZZ(iZt),Z) ! Copy nS sectors into Z call ArrR4Copy(iS,Z ,ZZ(iZt+iS))! Swap 1st and last nS/2 sectors .. call ArrR4Copy(iS,Z(iS+1),ZZ(iZt ))! .. in reverse order end if if (iHOSWrite(iDD,iU,iRecl,iR, & TT(iR),PP(iR),CC(iR),FF(iR),RR(iR),LL(iR),nS,ZZ(iZt)) .eq. 0) iW = iW+1 end do iU = iFreeLun(iU) end if call Say(cSay,'I',cFile,'# records written: '//cInt2Str(iW)) return end