Re: Spreadsheet & Remote Data Servers

Hi James,

I'll think you will find that what is happening is that when you subtract two 
data items which have OffsetUnits the
resulting data interval is given the base unit without the offset. Degrees C 
are represented as an OffsetUnit from degrees
kelvin. When  getting a temperature interval of two values in degree C the 
resulting data value will have the absolute
unit which is Kelvin. Thus degree C - degree C results in an interval measured 
in degree K. In your case the interval is
always 0 degrees K which gets converted to -273.15 degC when it is displayed.

Tim.

James Kelly wrote:

> Thanks Curtis & Dave,
>
> That's pretty cool! [One of the problems I had was using a different version 
> of
> visad.jar on the client].
>
> I can now load  up live temerature data in the spreadsheet and see the various
> cells update in real time.
> However, when I try to do some cell arithmetic, I get unexpected results.
> I've verified this with the attached data file temperature.csv which has data 
> in
> the form x-> temperature.
>
> Note that the temperature is in degrees Celsius.
>
> I load the file into cell A1, and also into cell B1.
> I map x to x and temperature to y, and see the data as expected.
> In cell A2, I enter the formula A1d1-B1d1, and do the mappings, and expect to
> see a straight line of temperature = 0 degC, but what I actually get is a
> straight line of temperature = -273.15 degC
>
> Any ideas?
>
> James.
>
> Curtis Rueden wrote:
>
> > Hi James,
> >
> > >Can I get the spreadsheet to load data which is available via a remote
> > >data server other than the spreadsheet.
> > >This remote data server is the usual VisAD RemoteServerImpl which
> > >provides  the data  via RemoteDataReferences.
> >
> > Yes, you can get the SpreadSheet to recognize data from pretty much
> > any RMI server, as long as you follow the simple naming conventions.
> >
> > For an RMI server at my.ip.com, if you name it "MyServer", and the name
> > of the DataReference is "DataRef", then you'd access the data object in
> > the SpreadSheet using the string:
> >     rmi://my.ip.com/MyServer/DataRef
> >
> > To help you out, I've written a little example that creates a
> > RemoteServer and loads a data object into it.  (The source code is
> > at the bottom of this email.)  Start it up by typing:
> >     java MiniDataServer ServerName DataName dataFile
> >
> > where ServerName is the desired name for the RMI server, DataName is
> > the desired name for the data reference, and dataFile is the name of
> > the data file to load up and serve.  Be sure you start up rmiregistry
> > before running MiniDataServer.
> >
> > Then, load up the SpreadSheet and try:
> >     rmi://ip.address/ServerName/DataName
> > (where ip.address is your machine's IP address) and you should see
> > the data in the SpreadSheet cell.
> >
> > Please let me know if you have any more trouble with this.
> >
> > Good luck,
> > Curtis
> >
> > -----------------------------------------
> > // MiniDataServer.java
> >
> > import java.awt.event.*;
> > import java.net.*;
> > import java.rmi.*;
> > import javax.swing.*;
> > import visad.*;
> > import visad.data.*;
> > import visad.java2d.DisplayImplJ2D;
> >
> > public class MiniDataServer {
> >
> >   public static void main(String[] args) throws Exception {
> >     if (args.length < 3) {
> >       System.err.println("Please specify three command line arguments:");
> >       System.err.println("  - Server name (e.g., MyServer)");
> >       System.err.println("  - Cell name (e.g., A1)");
> >       System.err.println("  - Data file (e.g., mydata.nc)");
> >       System.exit(-1);
> >     }
> >     String server = args[0];
> >     String cell = args[1];
> >     String file = args[2];
> >
> >     // load data
> >     System.out.println("Loading " + file + "...");
> >     DefaultFamily loader = new DefaultFamily("loader");
> >     Data data = loader.open(file);
> >
> >     // set up display
> >     System.out.println("Setting up display...");
> >     ScalarMap[] maps = data.getType().guessMaps(false);
> >     DisplayImplJ2D display = new DisplayImplJ2D("MiniDataServer");
> >     for (int i=0; i<maps.length; i++) display.addMap(maps[i]);
> >     DataReferenceImpl ref = new DataReferenceImpl(cell);
> >     ref.setData(data);
> >     display.addReference(ref);
> >
> >     // start up remote server
> >     System.out.println("Starting remote server...");
> >     RemoteServerImpl rsi = null;
> >     try {
> >       rsi = new RemoteServerImpl();
> >       Naming.rebind("///" + server, rsi);
> >     }
> >     catch (java.rmi.ConnectException exc) {
> >       System.err.println("Please run rmiregistry first.");
> >       System.exit(-2);
> >     }
> >     catch (MalformedURLException exc) {
> >       System.err.println("Error binding server; try a different name.");
> >       System.exit(-3);
> >     }
> >     catch (RemoteException exc) {
> >       System.err.println("Error binding server:");
> >       exc.printStackTrace();
> >       System.exit(-4);
> >     }
> >     rsi.addDataReference(ref);
> >
> >     // set up GUI
> >     System.out.println("Bringing up display...");
> >     JFrame frame = new JFrame("Mini data server");
> >     JPanel pane = new JPanel();
> >     pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS));
> >     frame.setContentPane(pane);
> >     pane.add(display.getComponent());
> >     frame.addWindowListener(new WindowAdapter() {
> >       public void windowClosing(WindowEvent e) { System.exit(0); }
> >     });
> >     frame.pack();
> >     frame.show();
> >   }
> >
> > }
>
> --
> James Kelly
> Regional Computing and Distributed Systems        Bureau of Meteorology
> PO Box 1289K                                  Melbourne 3001, Australia
> Phone: 61-3-9669-4724 Fax: 61-3-9669-4128     Email: J.Kelly@xxxxxxxxxx
>
>   ------------------------------------------------------------------------
>                       Name: temperature.csv
>    temperature.csv    Type: Microsoft Excel Comma Separated Values File 
> (application/x-unknown-content-type-Excel.CSV)
>                   Encoding: base64

--
Tim Stevenson
Senior Systems Engineer, Surpac Software International
162A Roslyn Avenue, Blackmans Bay,
Tasmania, Australia, 7052
Phone/Fax: +61 3 6229 4610
Email: tims@xxxxxxxxxx



  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: