Hi Michelle:
So, are you saying that you first let the SpreadSheet set up the
Scalar->DisplayScalar mappings, then you want to redefine these in the
code you included? I guess I don't understand why you just don't
define them yourself the first time? Or maybe that is not something the
SpreadSheet allows (I know next to nothing about the SpreadSheet...).
I do use one "cell" of the spreadSheet alot, though, through the
"plot()" method in JPythonMethods. It uses a single BasicSSCell to show
the Data object in, and there is a signature that allows you to define
the mappings when you create the cell. If you don't need the full power
of the SpreadSheet, you might check that out.
Anyway, I guess I'm way out of my element here...so I'll have to let
someone else address this.
Sorry...
tom
Kam, Michelle C wrote:
Hi Tom,
Attached is an example of a file I am working with. When you load it
into a spreadsheet cell and then open up the mapping dialog box, you see
"index" listed at the top of the "map from" column along with other
input fields like q1, q2,..etc. I'm prespecifying what the input fields
get mapped to such as latitude, longitude, flow1 x. But as Tom pointed
out, when "index" is mapped to "Iso-contour", a "terminal legal"
exception is thrown. Therefore, I'm trying to find out when the mappings
that I generate produce that specific mapping so that I can then treat
this scenario as a special case.
That is why I was wondering if there was a way to extract the
corresponding VisAD "mapTo" value for input field "index" after my
mappings are setup. This is where I set up my mappings that I randomly
generated in another class:
public void setCellMapping(int width, int height) throws
VisADException, RemoteException {
//System.out.println("In setCellMapping() and
width = " + width + "height = " + height);
int fields = theJgapAPI.field_count; //limit on
for loop
int cellsAcross = mySS.NumVisX; //3 for now
int cell_number = (width + (cellsAcross *
height)); //used as arg to getMappingForCell()
//ScalarMap[] theMaps = new ScalarMap[fields];
//array that will be passed into setMaps()
Data[] myData
mySS.DisplayCells[width][height].getData();
Vector myVector = new Vector(fields); //capacity
= 10 because there are 10 input fields in small.v5d
int useless = DataUtility.getScalarTypes(myData,
myVector, false, true); //will setup the myVector structure holding
input fields scalar types
Vector nonNullMappings = new Vector();
for (int i = 0; i < fields; i++) {
//System.out.println("in
setCellMapping() and i = " + i);
int assignment
theJgapAPI.getMappingForCell(cell_number, i);
DisplayRealType mapTo
mappings[assignment];
RealType mapFrom = (RealType)
myVector.get(i);
if (mapTo != null) {
nonNullMappings.add(new
ScalarMap(mapFrom, mapTo));
}
}
ScalarMap[] theMaps = new
ScalarMap[nonNullMappings.size()];
nonNullMappings.copyInto(theMaps);
//theMaps[i] = new ScalarMap(mapFrom,
mapTo);
//System.out.println("mapFrom = " +
mapFrom);
//System.out.println("mapTo = "+mapTo);
//String name = mapsFrom[i]; //string
name of input field i for this file, small.v5d for now
//RealType mapFrom
RealType.getRealType(name); //constructs a RealType object from a given
String name
//theMaps[i] = new ScalarMap(mapFrom,
mapTo);
mySS.DisplayCells[width][height].setMaps(theMaps);
}
Thanks,
Michelle
Michelle Kam (408) 742-2881
Lockheed Martin Space Systems Co. SSM/ATC/MSIS
B/153 O/L922
1111 Lockheed Martin Way, Sunnyvale, CA 94089
--
Tom Whittaker (tomw@xxxxxxxxxxxxx)
University of Wisconsin-Madison
Space Science and Engineering Center
Cooperative Institute for Meteorological Satellite Studies
Phone/VoiceMail: 608.262.2759