Kevin-
Kevin Manross wrote:
What follows are several questions I have been trying to figure out for
a while with little or no success. (Yes, I'm still climbing the VisAD
learning curve! ;-) I am very grateful to anyone who could shed light on
my darkness!
First topic:
I am working with a netCDF file that has the following data:
(lat_index, lon_index) -> DEM
Where *_index is not the actually lat or lon, but Lat or Lon from the
netCDF file (see below). Also DEM is the elevation from a Digital
Elevation Model.
I would like to obtain the following:
latitude = corner_lat - lat_index*LatGridSpacing
longitude = corner_lon + lon_index*LonGridSpacing
elevation = DEM
I have all the data I need in the netCDF file, specifically, (lat_index
= Lat, corner_lat = Latitude, LatGridSpacing = LatGridSpacing):
netcdf kiwaTerrain {
dimensions:
Lat = 1079 ;
Lon = 1298 ;
variables:
float DEM(Lat, Lon) ;
DEM:Units = "Meters" ;
// global attributes:
:TypeName = "DEM" ;
:DataType = "LatLonGrid" ;
:Latitude = 37.7833333333342 ;
:Longitude = -117.358333333342 ;
:Height = -9.09494701772928e-10 ;
:Time = 0 ;
:FractionalTime = 0. ;
:attributes = "" ;
:LatGridSpacing = 0.00833333333333 ;
:LonGridSpacing = 0.00833333333333 ;
:MissingData = -99900.f ;
:RangeFolded = -99901.f ;
data:
DEM
1764, 1766, 1792, 1769, 1769, 1748, 1744, 1718, 1713, 1705, 1689, 1667,
1648, 1643, 1639, 1637, 1638, 1645, 1648, 1660, 1676, 1688, 1695, 1702,
1727, 1757, 1826, 1878, 1805, 1812, 1822, 1751, 1715, 1690, 1666, 1655,
but would like to know how to extract the desired information from the
netCDF file so I can complete the equations above. Does VisAD have the
capability to extract such values?
The VisAD netCDF adapter does not do anything with global attributes.
You could use the netCDF classes in the VisAD distribution to get
a list of attributes:
NetcdfFile ncFile = new NetcdfFile(filename, true);
Attribute latSpace = ncFile.getAttribute("LatGridSpacing");
float latS = latSpace.getNumericValue().floatValue();
...
I've thought about modifying Plain to create a Tuple from the
global attributes, but sometimes there are more attributes than
data in a netCDF file. And, netCDF best practices would have
you use coordinate variables instead of global attributes to define
the lat/lon values at each point. ;-)
--------------
On another topic: I tried to create
Unit kilometer
try
{ kilometer = visad.data.units.Parser.parse("kilometer"); }
catch (ParseException P)
{ System.out.println("Parse exception: " + P); }
r = RealType.getRealType("R", kilometer, null);
h = RealType.getRealType("Height", kilometer, null);
s = RealType.getRealType("SlantRange", kilometer, null);
<snip>
xMap = new ScalarMap(s, Display.XAxis);
yMap = new ScalarMap(h, Display.YAxis);
but the unit(s) displayed are:
SlantRange: xxx.xxxxx 1000.0 m
Height: yyy.yyyyy 1000.0 m
I followed Tom Whittaker's example for defining units, but perhaps I am
missing something with the ScalarMap?
If you had:
Unit km = kilometer.clone("km");
and called ScalarMap.setOverrideUnit(km), I think you'd get your
listings in as km instead of the unit definition.
--------------
topic 3: DataReferenceImpl
I would like to create a line with one anchored point *and of constant
length*, basically a ray which the user can grab the outer end to trace
a circle.
The only examples I have seen so far are a line which uses one
"northing" point (Ugo's example in Section 6.4) and a line defined by
two moveable points.
Can I create such a line as described?
(whew)
Yes, but I'm going to have to let someone else answer (time
limitations).
Thank you very much for your help!
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
*************************************************************