Re: Reversed axes and connect the dots?

Hi John-

John Osborne wrote:


Thanks for your suggestions. Yes, our depths are stored as positive numbers. Using a RealType.Altitude, I was confused how to set the units to what you suggested. RealType.Altitude is a static class and I don't see a method in RealType or it's parent classes for setting units--it appears to only happen in the constructors for RealType (or through the new factory methods). I also tried reversing the max and min for the axis using setRange but that didn't work either--the data points disappeared and the axis showed the usual orientation.



The default units of RealType.Altitude are CommonUnit.meter.  Think
of this as metadata.  When you create a Data object (Real, Set,
FlatField, etc), you can set the actual units of the values.
So, if you were creating a Real for depth values, you could
use:

Real depthAt100m
   new Real(RealType.Altitude, 100, CommonUnit.meter.scale(-1));

This says that the actual unit of the data is negative meters even
though the metadata has units of CommonUnit.meter.

Alternatively, you could negate your value and do:

Real depthAt100m
    new Real(RealType.Altitude, -100);

If you are creating a Set of lat, lon, depth values, you could
do something like:

Gridded3DSet lld
   new Gridded3DSet(RealTupleType.LatitudeLongitudeAltitude,
                    values,
                    numlats,
                    numLons,
                    numAlts,
                    (CoordinateSystem) null,
                     new Unit[] { CommonUnit.degree,
                                  CommonUnit.degree,
                                  CommonUnit.meter.scale(-1) },
                     (ErrorEstimate[]) null);

where values would be the lat,lon, depth values at each
grid point (if this was a grid).  If it is a set of points
down something like a salinity profile, you would just
use the constructor for a Gridded3DSet of manifold dimension
1, where lengthX is just the total number of points.  Again,
you could also just negate the values for depth and not
worry about the constructors with units.  In that case,
the unit is the default from RealType.Altitude.

If you are creating a FlatField, then use the appropriate
constructor which allows you to set Units or again, negate
your values.

If you were mapping RealType.Altitude to Display.ZAxis, you
would probably want to set the range on that ScalarMap
to be (-maxDepth, 0).  That would display the profile
with the greatest depth (lowest Altitude) at the bottom.

Don





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