Hi all, I have a model grid based on some projection, say LambertCC, and a
base map. Of course the base map values are lat,lon, as would be any obs
etc, so I define a MapProjectionAdapter as a display side coord sys
(snarfed from visad/examples and also from the idv code base), so I
get scalarmaps for RealType.Latitude, Longitude to Display.YAxis and
Display.XAxis.
Now, for my grid, I used to do this (assume projection has false
easting/northing such that grid point 1,1 maps to 0 meters in x and y)
addGrid( int rows, int cols, int spacing ) {
RealType x = RealType.getRealType( "x" );
same for y
RealTypeTuple rtt = new RealTupleType( x, y );
Linear2DSet domain = new Linear2DSet( rtt, 0, rows-1*spacing, 0,
cols -1 * spacing, cols );
ScalarMap sx = new ScalarMap( x, Display.XAxis );
same for y, add maps sx, sy to display
So data of type x,y use their own scalar maps to display axes,
independently of any lat,lon typed data.
Now, as I delve into visad more, and noting some comments by Bill, I see
that I could do it this alternate way
addGrid( int rows, cols, spacing ) {
RealType x = RealType.getRealType( "x", CommonUnit.METER );
same for y
RealTupleType ref = new RealTupleType( x, y, mapProjection.getReference()
);
and build the domain as before (supplying coordsys units from the
mapprojection). No scalar maps for any x or y realType are needed.
So, is there a "best way" of the two?? Seems to me that the latter is
cleaner but more expensive? For each grid point, we use the projection's
coord sys to transform grid x,y -> lat, lon but then to map that value to
the display side we have to go through the inverse? If I had scalar maps
straight from x and y I would avoid this (??)
Performance looks about the same on initial testing, but not much to go as
as yet...
Any help and comments appreciated.
Stuart