resampling problem

Hi everybody,

until now I resampled an Irregular2DSet resembling a terrain surface, for
achieving a 
profile line the following way, which worked very well:
        RealType x2 = RealType.getRealType("x");
        RealType y2 = RealType.getRealType("y");
        RealType height2 = RealType.getRealType("height");
        RealTupleType xy2 = new RealTupleType(x2, y2);
        FunctionType terrain_type2 = new FunctionType(xy2,height2);
        Irregular2DSet set2 = new Irregular2DSet(
                                xy2,
                        new float[][] { eastValues,northValues });
        FlatField terrain2 = new FlatField(terrain_type2,set2);
        terrain2.setSamples(new float[][] { heightValues});
                                                

        // Why 2000 points? Try and error, it was okay for
        // dataset with max. 50 points.
        // The more points, the better fit of the profile to the terrain.
        double[][] lineCoordinates = new double[2][2000];
        double j = -1;
        for (int i = 0; i < 2000; i++) {
                lineCoordinates[0][i] = linePointCalc.x +j * lineVector.x;
                lineCoordinates[1][i] = linePointCalc.y +j * lineVector.y;
                j = j + 0.001;                          
        }
        Gridded2DDoubleSet gridded2DSet
                                new Gridded2DDoubleSet(xy2,
                                lineCoordinates, 2000);                 
        FlatField line =(FlatField) terrain2.resample(
                                        gridded2DSet,
                                        Data.WEIGHTED_AVERAGE,
                                        Data.NO_ERRORS);                        
        System.out.println(line.toString());
        
Now I have a grid data set with a lot more points so I want to use a
Linear2DSet as my original data set instead of the Irregular2DSet 
(which is very slow now, because I have many more terrain points):

        RealType eastV =RealType.getRealType("eastValues");
        RealType northV =RealType.getRealType("northValues");
        RealType heightV =RealType.getRealType("heightValues");
        domain_tuple = new RealTupleType(eastV, northV);
        func_en_h = new FunctionType(domain_tuple,heightV);
        domain_set = new Linear2DSet(
                                domain_tuple,
                                northMin,
                                northMax,
                                nRows,
                                eastMin,
                                eastMax,
                                nCols);
                        
        double[][] flat_samples = new double[1][nCols *nRows];
        for (int c = 0; c < (nRows); c++) {
                for (int r = 0; r < (nCols); r++) {
                        // dgm 1 x y z
                        flat_samples[0][c * nCols + r] =height[c * nCols + r];
                }
        }
        vals_ff = new FlatField(func_en_h, domain_set);
        vals_ff.setSamples(flat_samples, false);                        
                                                
        // Why 2000 points? Try and error, it was okay for
        // dataset with max. 50 points.
        // The more points, the better fit of the profile to the terrain.
        double[][] lineCoordinates = new double[2][2000];                       
        double j = -1;
        for (int i = 0; i < 2000; i++) {
                lineCoordinates[0][i] = linePointCalc.x + j *lineVector.x;
                lineCoordinates[1][i] = linePointCalc.y + j *lineVector.y;
                j = j + 0.001;                          
        }
                        
        Gridded2DDoubleSet gridded2DSet
                new Gridded2DDoubleSet(domain_tuple,
                        lineCoordinates, 2000);                 
        FlatField line =(FlatField) vals_ff.resample(
                                        gridded2DSet,
                                        Data.WEIGHTED_AVERAGE,
                                        Data.NO_ERRORS);                        
                        
        System.out.println(line.toString());
                        
The problem is, that I only get missing values in the FlatField line. What
am I doing wrong?
Thanks for your help.

Greetings Desiree


oooooooooooooooooooooooooooooooooooooooooooooooo
Desiree Hilbring

Institut fuer Photogrammetrie und Fernerkundung  
Universitaet Karlsruhe, Germany
email: hilbring@xxxxxxxxxxxxxxxxxxxx             
# 0721 6083676                                   
oooooooooooooooooooooooooooooooooooooooooooooooo



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