%N cospcset %F $MIR/src/subs/co.for
%D Change the spectral axis to the specified type.
%P rjs
%: coordinates
%B
      subroutine coSpcSet(lu, stype, frame, ispc, algo)

      integer   lu
      character stype*(*), frame*(*)
      integer   ispc
      character algo*(*)
  ---------------------------------------------------------------------
  Switch the spectral axis from its current type to another spectral
  type.

  Input:
    lu         Handle of the coordinate system.
    stype      Spectral world coordinate type to switch to (case-
               insensitive):
                 FREQ: frequency
                 ENER: photon energy (frequency-like)
                 WAVN: wavenumber (frequency-like)
                 VRAD: radio velocity (frequency-like)
                 WAVE: wavelength
                 VOPT: optical velocity (wavelength-like)
                 ZOPT: redshift (wavelength-like)
                 AWAV: air wavelength (optical regime)
                 VELO: apparent radial velocity (relativistic)
                 BETA: relativistic beta factor (v/c) (velocity-like)
               These may be suffixed with '-' and a spectral algorithm
               code (see below) which is ignored.

               stype may also be specified as 'VELOCITY' to switch from
               frequency to VRAD but leave VRAD and VOPT unchanged.

               stype may also be blank to revert to the spectral type
               specified in the image header.

               For backwards compatibility, the following AIPS-
               convention spectral types are also recognised:
               '{FREQ,VELO,FELO}{,-{OBS,HEL,LSR}}' meaning 'FREQ',
               'VRAD', and 'VOPT'.  Likewise, 'FREQUENCY', 'RADIO', and
               'OPTICAL'.  Note the ambiguity for 'VELO' (without
               '-{OBS,HEL,LSR}'); the standard FITS interpretation is
               used.

    frame      Spectral frame: 'TOPOCENT', 'BARYCENT', or 'LSRK', but
               only conversions between the last two are supported.

               The synonyms 'OBS', 'HEL', and 'LSR' are also supported.
               Also '{TOPO,BARY}CENT{RE,ER,RIC}'.

               frame may be blank to leave it unspecified or leave it
               as is, i.e. no Doppler shift, except that, for backwards
               compatibility, if stype was specified as one of the
               AIPS-convention types, '{FREQ,VELO,FELO}-{OBS,HEL,LSR}',
               then frame will be set from that.

  Output:
    ispc       Spectral axis number.
    algo       Three-letter FITS spectral algorithm code:
                '   ': linear
                'F2W': non-linear, frequency to wavelength-like
                'F2V': non-linear, frequency to velocity-like
                'F2A': non-linear, frequency to air wavelength-like
                'W2F': non-linear, wavelength to frequency-like
                'W2V': non-linear, wavelength to velocity-like
                'W2A': non-linear, wavelength to air wavelength-like
                'V2F': non-linear, velocity to frequency-like
                'V2W': non-linear, velocity to wavelength-like
                'V2A': non-linear, velocity to air wavelength-like
                'A2F': non-linear, air wavelength to frequency-like
                'A2W': non-linear, air wavelength to wavelength-like
                'A2V': non-linear, air wavelength to velocity-like
               where 'velocity' here means relativistic velocity, NOT
               radio velocity.

               For example, a linear frequency axis is linear when
               expressed as 'ENER', 'WAVN', or 'VRAD', but non-linear
               when expressed as optical velocity, i.e. 'VOPT-F2W'
               (previously called "FELO"), for which the algorithm code
               is 'F2W'.
