Thank you all very much for your responses!
Please read below for a follow-up qustion.
Don Murray wrote:
>
> Kevin Manross wrote:
>
>> 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. ;-)
Thanks, Don. This worked to extract the data that I was wanting.
Based on the netCDF file, when I display the data, the coords are
defined by the dimensions of the netCDF file (1079/1298).
Taking the data that I have extracted can I "force" a ScalarMap with
the extracted values? I.e. after calculating the actual Lat/Lon,
create a ScalarMap with those calculated ranges and then (hopefully) the
middle-click will display the actual Lat/Lon as well. It sounds like my
best bet may be just to rewrite the netCDF file to include the actual
lat/lon.
-------
Finally, regarding the Units question, I tried your suggestion but
received a compile error regarding static methods (still getting
familiar with Java).
RHIpanel.java:97: non-static method setOverrideUnit(visad.Unit) cannot
be referenced from a static context
ScalarMap.setOverrideUnit(km);
I have also tried
xMap.setOverrideUnit(km);
yMap.setOverrideUnit(km);
but still get the previous behavior (xxx.xxxx 1000.0 m)
Thanks again!
-kevin.
--
+------------------------------------------------------------+
Kevin L. Manross [KD5MYD] (405)-366-0557
CIMMS Research Associate kevin.manross@xxxxxxxx
[NSSL-WRDD/SWATN] http://www.cimms.ou.edu/~kmanross
"My opinions are my own and not representative of CIMMS, NSSL,
NOAA or any affiliates"
+------------------------------------------------------------+