public static SphericalCoordinate jauAtoiq(String type,
            double ob1, double ob2, Astrom astrom
            )
    {
        char c;
        double c1, c2, sphi, cphi, ce, xaeo, yaeo, zaeo, v[] = new double[3],
        xmhdo, ymhdo, zmhdo, az, sz, zdo, refa, refb, tz, dref,
        zdt, xaet, yaet, zaet, xmhda, ymhda, zmhda,
        f, xhd, yhd, zhd, xpl, ypl, w;


        /* Coordinate type. */
        c = type.charAt(0);

        /* Coordinates. */
        c1 = ob1;
        c2 = ob2;

        /* Sin, cos of latitude. */
        sphi = astrom.sphi;
        cphi = astrom.cphi;

        /* Standardize coordinate type. */
        if ( c == 'r' || c == 'R' ) {
            c = 'R';
        } else if ( c == 'h' || c == 'H' ) {
            c = 'H';
        } else {
            c = 'A';
        }

        /* If Az,ZD, convert to Cartesian (S=0,E=90). */
        if ( c == 'A' ) {
            ce = sin(c2);
            xaeo = - cos(c1) * ce;
            yaeo = sin(c1) * ce;
            zaeo = cos(c2);

        } else {

            /* If RA,Dec, convert to HA,Dec. */
            if ( c == 'R' ) c1 = astrom.eral - c1;

            /* To Cartesian -HA,Dec. */
            v = jauS2c ( -c1, c2 );
            xmhdo = v[0];
            ymhdo = v[1];
            zmhdo = v[2];

            /* To Cartesian Az,El (S=0,E=90). */
            xaeo = sphi*xmhdo - cphi*zmhdo;
            yaeo = ymhdo;
            zaeo = cphi*xmhdo + sphi*zmhdo;
        }

        /* Azimuth (S=0,E=90). */
        az = ( xaeo != 0.0 || yaeo != 0.0 ) ? atan2(yaeo,xaeo) : 0.0;

        /* Sine of observed ZD, and observed ZD. */
        sz = sqrt ( xaeo*xaeo + yaeo*yaeo );
        zdo = atan2 ( sz, zaeo );

        /*
         * Refraction
         * ----------
         */

        /* Fast algorithm using two constant model. */
        refa = astrom.refa;
        refb = astrom.refb;
        tz = sz / zaeo;
        dref = ( refa + refb*tz*tz ) * tz;
        zdt = zdo + dref;

        /* To Cartesian Az,ZD. */
        ce = sin(zdt);
        xaet = cos(az) * ce;
        yaet = sin(az) * ce;
        zaet = cos(zdt);

        /* Cartesian Az,ZD to Cartesian -HA,Dec. */
        xmhda = sphi*xaet + cphi*zaet;
        ymhda = yaet;
        zmhda = - cphi*xaet + sphi*zaet;

        /* Diurnal aberration. */
        f = ( 1.0 + astrom.diurab*ymhda );
        xhd = f * xmhda;
        yhd = f * ( ymhda - astrom.diurab );
        zhd = f * zmhda;

        /* Polar motion. */
        xpl = astrom.xpl;
        ypl = astrom.ypl;
        w = xpl*xhd - ypl*yhd + zhd;
        v[0] = xhd - xpl*w;
        v[1] = yhd + ypl*w;
        v[2] = w - ( xpl*xpl + ypl*ypl ) * zhd;

        /* To spherical -HA,Dec. */
        SphericalCoordinate co = jauC2s(v);

        /* Right ascension. */
        co.alpha = jauAnp(astrom.eral + co.alpha);

        return co;
        /* Finished. */


    }