Re: Table values as range in a FlatField

Hi Sylvain-

List1DSet does not support interpolation which is what it
is trying to do when packing values in the FlatField range.
Since there is no implied topology, there can be no interpolation.
You have a couple of options:

1) Don't use a DefaultSet with your RealType.  This is used
for packing of values in the ranges of a FlatField and might
not be needed depending on the number of samples you have. 
See section 3.9 of the VisAD Developer's Guide for information
on packing:

http://www.ssec.wisc.edu/~billh/guide.html#3.9

2) Replace the List1DSet with a Linear1DSet in this simple case:

      Linear1DSet list_set = new Linear1DSet(
                  RealType.getRealType("list_of_system_ids"),
                  1.0, 3.0, 3, null, null, null);

However, that might not be sufficient if you have non-linear
samples.  You could use a Gridded1DSet for non-linear samples
as long as the samples in the float[][]  were either 
ascending or descending:

      Gridded1DSet list_set =new Gridded1DSet(
                  RealType.getRealType("list_of_system_ids"),
                  new float[][] {{1.0f, 2.0f, 3.0f}}, 3);

or:

      Gridded1DSet list_set =new Gridded1DSet(
                  RealType.getRealType("list_of_system_ids"),
                  new float[][] {{3.0f, 2.0f, 1.0f}}, 3);
Don


"Letourneau, Sylvain" wrote:
> 
> Hi all,
> 
> I would like to know how can I define a FlatField with a range component
> taking table values (no topology).  I tried the following:
> 
> class TestTableValuesAsRange {
> 
>    public TestTableValuesAsRange()
>     throws RemoteException, VisADException
>    {
>       // Generate the index
>       RealType index = RealType.getRealType("index");
>       Set index_set = new Integer1DSet(index, 5);
> 
>       // My range component
>       List1DSet list_set =new List1DSet(new float[] {1.0f, 2.0f, 3.0f},
>                   RealType.getRealType("list_of_system_ids"), null, null);
> 
>       RealType id=RealType.getRealType("System_id", null, list_set);
> 
>       // Create a FunctionType ( index -> id )
>       FunctionType data_type = new FunctionType(index, id);
> 
>       // Create the flat field
>       FlatField aFlatField = new FlatField( data_type, index_set);
> 
>       // Put some samples values
>       aFlatField.setSamples(new double [][] {{1.0, 1.0, 2.0, 1.0, 3.0}});
> 
>       // Print out
>       System.out.println("Results is " + aFlatField);
> 
>    }
> 
>    public static void main (String[] args)
>        throws RemoteException, VisADException
>    {
>       TestTableValuesAsRange myTest = new TestTableValuesAsRange();
> 
>    }
> 
> }
> 
> but, i'm always getting:
> 
> Exception in thread "main" visad.UnimplementedException:
> List1DSet.valueToIndex
>         at visad.List1DSet.valueToIndex(List1DSet.java:82)
>         at visad.FlatField.packValues(FlatField.java:932)
>         at visad.FlatField.setSamples(FlatField.java:700)
>         at visad.FlatField.setSamples(FlatField.java:652)
>         at TestTableValuesAsRange.<init>(TestTableValuesAsRange.java:26)
>         at TestTableValuesAsRange.main(TestTableValuesAsRange.java:36)
> 
> Do I need to sub-class List1DSet in order to use it?  Can I do the same
> thing using something else?
> 
> Thanks,
> Sylvain Létourneau
> Research Officer
> National Research Council of Canada
> Montreal road, Building M-50
> Ottawa, Ontario Canada K1A 0R6
> Phone:(613) 990-1178
> Fax:(613) 952-0215

-- 
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************


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