Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
Hi Andrew, > I've been comparing RealTypes a bit, and it has just stopped working. > I'm assuming that it's ok to use == on RealTypes as they seem to be > a global sort of thing. I am interested in testing the equality > of the name and units etc, so I'm not using RealType.equals(). > > The problem is that the comparison's behaviour changes after > I create a DefaultFamily. Hi Andrew, I altered your code a bit, and got these results with jdb... To summarise, when you include the DefaultFamily, your second RealType is actually an instance of visad.data.netcdf.Quantity. But that's as far as I've got, you're on your own now. :) ---------------------- Without DefaultFamily: $ jdb T Initializing jdb... > stop at T:17 Deferring breakpoint T:17. It will be set after the class is loaded. > run run T > VM Started: Set deferred breakpoint request T:17 Hello Breakpoint hit: thread="main", T.main(), line=17, bci=22 17 System.out.println("( " + main[1] print T.lat T.lat = instance of visad.RealType(id=263) main[1] print T.lat2 T.lat2 = instance of visad.RealType(id=263) main[1] cont ( Latitude = Latitude )= true lat : Latitude deg null 0 lat2: Latitude deg null 0 The application exited $ ----------------------------- With DefaultFamily: $ jdb T Initializing jdb... > stop at T:17 Deferring breakpoint T:17. It will be set after the class is loaded. > run run T > VM Started: Set deferred breakpoint request T:17 Hello Breakpoint hit: thread="main", T.main(), line=17, bci=32 17 System.out.println("( " + main[1] print T.lat T.lat = instance of visad.RealType(id=339) main[1] print T.lat2 T.lat2 = instance of visad.data.netcdf.Quantity(id=340) main[1] cont ( Latitude = Latitude )= false lat : Latitude deg null 0 lat2: Latitude deg null 0 The application exited $ ------------------------ Here's the code: import visad.*; import visad.data.DefaultFamily; public class T { static RealType lat, lat2; public static void main(String[] args) { System.out.println("Hello"); //DefaultFamily defaultFamily = new DefaultFamily("dflt"); lat = RealType.Latitude; lat2 = RealType.getRealType("Latitude"); System.out.println("( " + lat + " = " + lat2 + " )= " + (lat == lat2)); System.out.println("lat : "+lat+" " +lat.getDefaultUnit()+" " +lat.getDefaultSet()+" " +lat.getAttributeMask()); System.out.println("lat2: "+lat+" " +lat2.getDefaultUnit()+" " +lat2.getDefaultSet()+" " +lat2.getAttributeMask()); } } -- Russell Steicke -- Fortune says: Don't quit now, we might just as well lock the door and throw away the key.
visad
archives: