Re: elevation becomes altitude

Don Murray wrote:

John-

John J Brecht wrote:

After a long hiatus, I'm back to my VisAD project! I'm trying to get some old code working with the latest version of VisAD and I'm having this problem.

I am trying to create some data sets with the following MathType:

(Time, ((Longitude, Latitude) -> (Overlay, Elevation)))

where "overlay" is something like temperature or precipitation. The overlays for some set of such data sets always cover the same geographic region, and thus I use the same elevation file for each one. My source data sets are in the form of text files, which I convert to NetCDF files with a small app I wrote. When I open a data set created in this way in the VisAD spreadsheet, I find that my elevation data have become "altitude." Why is this? How do I prevent it? My code to create the elevation MathType looks like this:

RealType elevation = RealType.getRealType("Elevation", SI.meter);



When a netCDF file is read in, it uses the StandardQuantity
database to create a controlled vocabulary for netCDF variables.
Thus, something named "time" with units compatible with
seconds will be given a RealType of RealType.Time.  Same is
true for a variable "lat" with units compatible with degrees
which will end up with RealType.Latitude for a RealType.
Elevation with units of length (m, ft, km) ends up with
a RealType of RealType.Altitude.  If it was an Elevation
angle with units of degrees, it would not get the RealType.Altitude
labelling.  You could add an alias to RealType.Altitude of
"Elevation" if you want to use Elevation instead of Altitude,
but this is not done automatically.

That sounds like the solution I'm looking for. I see these two methods in the API docs:

QuantityDB add(java.lang.String[] definitions, java.lang.String[] aliases)
         Adds the given quantities and aliases to the database.
void add(java.lang.String name, java.lang.String unitSpec) Adds a quantity to the database given a name and a display unit specification.

I take it I should use the first one, correct? I also want to keep my temperature units as Celsius or Farenheit rather than have them converted to Kelvin. Can I accomplish this in the same way? Is the overall way to do this to call StandardQuantityDB.instance(), use the add() methods to modify it, and then initialize my Plain object with the custom QuantityDB? E.g:

StandardQuantityDB qdb = StandardQuantityDB.instance();
String[] definitions = new String[] {"Elevation", "m", Temperature", "degF"};
String[] aliases = new String[] {"Elevation", "Temperature"};
QuantityDB myQdb = qdb.add(definitions, aliases);
Plain saver = new Plain(myQdb);


When should the other add method be used? Why does one add method return a new QuantityDB while the other operates on the existing one?

thanks!

-john





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