src/atlas/projection/detail/CubedSphereEquiAnglProjection.cc
// -------------------------------------------------------------------------------------------------
// input should be Willems xy coordinate in degrees
//
input should be Willems xy coordinate in degrees
input should be Willems xy coordinate in degrees
void CubedSphereEquiAnglProjection::xy2lonlat(double crd[]) const {
    if (debug) {
        Log::info() << "xy2lonlat start xy = " << crd[LON] << " " << crd[LAT] << std::endl;
    }
    static const double rsq3 = 1.0 / std::sqrt(3.0);
    double xyz[3];
    double ab[2];  
    idx_t t;       
    CubedSphereProjectionBase::xy2alphabetat(crd, t, ab);
    if (debug) {
        Log::debug() << "equiangular xy2lonlat:: crd t ab  : " << crd[0] << " " << crd[1] << " " << t << " " << ab[0]
                     << " " << ab[1] << std::endl;
    }
    xyz[0] = -rsq3;
    xyz[1] = -rsq3 * std::tan(ab[0] * deg2rad);
    xyz[2] = -rsq3 * std::tan(ab[1] * deg2rad);
    CubedSphereProjectionBase::xy2lonlat_post(xyz, t, crd);
    if (debug) {
        Log::info() << "end of equiangular xy2lonlat lonlat = " << crd[LON] << " " << crd[LAT] << std::endl;
    }
}
void CubedSphereEquiAnglProjection :: xy2lonlat ( double crd [ ] ) const { if ( debug ) { Log :: info ( ) << " " << crd [ LON ] << " " << crd [ LAT ] << std :: endl ; } static const double rsq3 = 1.0 / std :: sqrt ( 3.0 ) ; double xyz [ 3 ] ; double ab [ 2 ] ; idx_t t ; CubedSphereProjectionBase :: xy2alphabetat ( crd , t , ab ) ; if ( debug ) { Log :: debug ( ) << " " << crd [ 0 ] << " " << crd [ 1 ] << " " << t << " " << ab [ 0 ] << " " << ab [ 1 ] << std :: endl ; } xyz [ 0 ] = - rsq3 ; xyz [ 1 ] = - rsq3 * std :: tan ( ab [ 0 ] * deg2rad ) ; xyz [ 2 ] = - rsq3 * std :: tan ( ab [ 1 ] * deg2rad ) ; CubedSphereProjectionBase :: xy2lonlat_post ( xyz , t , crd ) ; if ( debug ) { Log :: info ( ) << " " << crd [ LON ] << " " << crd [ LAT ] << std :: endl ; } }
input should be Willems xy coordinate in degrees
input should be Willems xy coordinate in degrees
// alpha-beta coordinate // tile index // calculate xy (in degrees) to alpha beta (in radians) and t - tile index.