NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

GridCoordinateSystem

Hi-

I'm trying to use the GridCoordinateSystem class to support
a domain with a time and space varying vertical coordinate.
I have a domain:

(lon, lat, s_rho)

where s_rho is dependent on some other variables.  I wanted
to create a CoordinateSystem which would transform

(lon, lat, s_rho) <-> (Longtitude, Latitude, Altitude).

My idea was to create a new domain with at RealTupleType
of (lon,lat, s_rho) and a GridCoordinateSystem to tranform
to (Longitude, Latitude, Altitude).  To create the
GridCoordinateSystem, I created a new Gridded3DSet, replacing
the s_rho values with the Altitude values at each point:

    GriddedSet defaultSet = createLonLatSRho();
    RealTupleType setType = ((SetType)defaultSet.getType()).getDomain();
    float[][] samples = defaultSet.getSamples();
    samples[2] = getAltitudeValuesAtEachPoint();
    RealType[] types = setType.getRealComponents();
    RealTupleType newDomainType
        new RealTupleType(types[0], types[1], RealType.Altitude)
    int[] lengths = defaultSet.getLengths();
    Unit[] newDomainUnits = newDomainType.getDefaultUnits();
    newDomainUnits[2] = CommonUnit.meters;
    Gridded3DSet newDomain = new Gridded3DSet(
        newDomainType, samples, lengths[0], lengths[1], lengths[2],
                null, newDomainUnits, null, false, false);
    CoordinateSystem gcs = new GridCoordinateSystem(newDomain);
    RealTupleType newSetType
       new RealTupleType(setType.getRealComponents(), gcs, null);
    defaultSet = new Gridded3DSet(newSetType, defaultSet.getSamples(),
                     lengths[0], lengths[1], lengths[2],
                     null, dset.getSetUnits(), oldErrors, false);

(not sure if the above compiles, just more of a guide to what
I'm trying to do).

What I get is an Exception in RealTupleType:

visad.UnitException: RealTupleType: CoordinateSystem Units must be convertable with default Units
        at visad.RealTupleType.<init>(RealTupleType.java:183)

because in GridCoordinateSystem, the default units are set to
null in the constructor and the DefaultUnits of the set are
(degree, degree, "").

Am I going about this all wrong?  Should I use an EmpericalCS
instead?

Don


--
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
"There's someone in my head, but it's not me"    Roger Waters
*************************************************************



  • 2004 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: