NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Xinman, Following Bill's suggestions, and using the notation conventions I suggested in a recent email, I had a go at the Time Series Display question you raised earlier (17 Nov). The code is attached as TimeSeries.txt To try it out: * copy it to your visad\examples directory * rename it TimeSeries.java * compile (eg javac *.java) * run (java TimeSeries) I've deliberately used a 2D display rather than a 3D display, as we are doing some tests on IBM AIX workstations which don't have Java 3D :-( ( for those interested the IBM beta release of Java 2 for AIX 4.3.3 looks ok so far: only 1 problem we have noticed relating to loading resources) Hope this helps, James "From: Bill Hibbard " wrote: > Hi Xinman, > > I'm in the UK and can only answer briefly. Study these > Sections of the VisAD Developers Guide: > > 3.1.14 Application Example: Synthesizing MathTypes > 3.2.14 Application Example: Synthesizing Fields > > and also visad/examples/Test03.java. > > You need to Construct a FunctionType: > > (RealType.Time -> temperature) > > and use DateTime to help construct a Linear1DSet for your > dates/times (which appear to be evenly spaced - if they > weren't you'd construct a Gridded1DDoubleSet instead of > the Linear1DSet). > > Then construct a FlatField from these, and call setSamples() > to put your temperature values in it. > > Then construct a DisplayImplJ3D (or DisplayImplJ2D), link > it to your FlatField (as in Test03.java or any other > example), and construct ScalarMaps: > > ScalarMap(RealType.Time, Display.XAxis) > ScalarMap(temperature, Display.YAxis) > > and addMap() these to the DisplayImplJ*D. Study the guide > and the examples, and hopefully it will become clear. > > Cheers, > Bill > ---------------------------------------------------------- > Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706 > hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738 > http://www.ssec.wisc.edu/~billh/vis.html -- James Kelly Supervisor of Regional Development Bureau of Meteorology PO Box 1289K Melbourne 3001, Australia Phone: 61-3-9669-4724 Fax: 61-3-9669-4128 Email: J.Kelly@xxxxxxxxxx
/* VisAD system for interactive analysis and visualization of numerical data. Copyright (C) 1996 - 1999 Bill Hibbard, Curtis Rueden, Tom Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and Tommy Jasmin. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ // // Time Series, based on Test03 // by James Kelly Dec 1999 // import java.awt.Component; import java.rmi.RemoteException; import visad.*; import visad.java2d.DisplayRendererJ2D; import visad.java2d.DisplayImplJ2D; import visad.util.AnimationWidget; public class TimeSeries extends UISkeleton { public TimeSeries() { } public TimeSeries(String[] args) throws RemoteException, VisADException { super(args); } DisplayImpl[] setupServerDisplays() throws RemoteException, VisADException { DisplayImpl[] diDisplay = new DisplayImpl[1]; diDisplay[0] = new DisplayImplJ2D("display"); return diDisplay; } void setupServerData(LocalDisplay[] diDisplay) throws RemoteException, VisADException { // // PART 1 : define the meta data (math types) // // define all RealTypes (rt) and RealType Arrays (rta) RealType rtTemperature = new RealType("rtTemperature", null, null); RealType[] rtaTemperature = {rtTemperature}; RealType[] rtaTime = {RealType.Time}; // define all RealTypeTypes (rtt) from RealType Arrays (rta) RealTupleType rttTemperature = new RealTupleType(rtaTemperature); RealTupleType rttTime = new RealTupleType(rtaTime); // define all FunctionTypes (ft) which are mappings from one rtt to another rtt FunctionType ftTime2Temperature = new FunctionType(rttTime, rttTemperature); // // PART 2 : create the actual data, based on the meta data (math types) // // now create some data which samples the above functions // This data is known as a Field, and in this case a FlatField // int iNtimes1 = 4; // time series test // 2 May 99, 15:51:00 double dStart = new DateTime(1999, 122, 57060).getValue(); Set sl1dsTime = // 4 times: t+0,+1000,+2000,+3000 new Linear1DSet(rttTime, dStart, dStart + 3000.0, iNtimes1); // now define a dataset which varies with time (with null data values) // which has 4 time steps FlatField ffTime2Temperature = new FlatField(ftTime2Temperature, sl1dsTime); double dMinTemp = 10.0; double[][] daaTemperature = {{dMinTemp, dMinTemp + 5.0, dMinTemp + 10.0, dMinTemp + 15.0}}; // // set data values for datasets (FlatFields) // ffTime2Temperature.setSamples(daaTemperature); diDisplay[0].addMap(new ScalarMap(rtTemperature, Display.YAxis)); diDisplay[0].addMap(new ScalarMap(RealType.Time, Display.XAxis)); diDisplay[0].addMap(new ConstantMap(0.1, Display.Green)); diDisplay[0].addMap(new ConstantMap(0.5, Display.Blue)); // diDisplay[0].addMap(new ConstantMap(0.5, Display.Red)); diDisplay[0].addMap(new ScalarMap(rtTemperature, Display.Red)); DataReferenceImpl driTemperatures new DataReferenceImpl("driTemperatures"); driTemperatures.setData(ffTime2Temperature); diDisplay[0].addReference(driTemperatures, null); } // String getFrameTitle() { return "VisAD Time Series Display"; } public String toString() { return ": Time Series Display of Temperature"; } public static void main(String[] args) throws RemoteException, VisADException { new TimeSeries(args); } }
visad
archives: