""" -*- python -*-
This script tests the Hammer-Aito transfrom

Copyright (C) 2001, 2003 The Board of Trustees of 
The Leland Stanford Junior University.  All Rights Reserved.  

Author: Paul_Kunz@slac.stanford.edu

$Id: hammer.py.in,v 1.16 2004/09/24 15:30:52 pfkeb Exp $

"""
import setPath
from load_hippo import app, canvas

# Create empty ntuple
from hippo import NTuple
nt = NTuple( )

# Register ntuple to make visible to application
from hippo import NTupleController
ntc = NTupleController.instance()
ntc.registerNTuple ( nt )

latcol = []
loncol = []
isolatcol = []
isoloncol = []
isozerocol = [] 
lon = -180.0
while lon <= 180.0:
    lat = -90.0
    while lat <= 90.0:
        latcol.append ( lat )
        loncol.append ( lon )
        isolatcol.append ( lat )
        isoloncol.append ( lon )
        isozerocol.append ( 0. )
        lat = lat + 10.
    lon = lon + 10.
    
nt.addColumn ( "Lon", loncol )
nt.addColumn ( "Lat", latcol )
nt.addColumn ( "IsoLat", isolatcol )
nt.addColumn ( "IsoLon", isoloncol )
nt.addColumn ( "Zeros", isozerocol )
nt.setTitle ( "Hammer-Aito Transform" )

from hippo import Display

d1 = Display ("Scatter Plot", nt, ('Lon', 'Lat' ))
canvas.addDisplay( d1 )

d2 = Display ("Scatter Plot", nt, ('Lon', 'Lat' ))
d2.setTransform ( 'HammerAito' )
canvas.addDisplay( d2 )

d3 = Display ( "XYZ Plot", nt, ('Lon', 'Lat', 'IsoLat' ))
d3.setTransform ( 'HammerAito' )
canvas.addDisplay ( d3 )

d4 = Display ( "XYZ Plot", nt, ('Lon', 'Lat', 'IsoLon' ))
d4.setTransform ( 'HammerAito' )
canvas.addDisplay ( d4 )

# Z values of all zeros should not crash program or get RGB errors
d5 = Display ( "XYZ Plot", nt, ('Lon', 'Lat', 'Zeros' ))
d5.setTransform ( 'HammerAito' )
canvas.addDisplay ( d5 )

