private static FieldImpl makePointObs(FlatField timeStep, DateTime dt, String function)
            throws VisADException, RemoteException {
        final boolean doMax = function.equals(FUNC_MAX);
        final boolean doMin = function.equals(FUNC_MIN);
        if (timeStep == null) {
            return null;
        }
        SampledSet domain    = getSpatialDomain(timeStep);
        int        numPoints = domain.getLength();
        Integer1DSet points = new Integer1DSet(RealType.getRealType("index"),
                numPoints);
        TupleType tt = getParamType(timeStep);
        TupleType rangeType = new TupleType(new MathType[] {
                RealTupleType.LatitudeLongitudeAltitude,
                RealType.Time,
                tt });
        FieldImpl ff = new FieldImpl(
                new FunctionType(
                        ((SetType) points.getType()).getDomain(),
                        rangeType), points);
        float[][] samples  = timeStep.getFloats(false);
        float[][] geoVals  = getEarthLocationPoints((GriddedSet) domain);
        boolean   isLatLon = isLatLonOrder(domain);
        int       latIndex = isLatLon
                ? 0
                : 1;
        int       lonIndex = isLatLon
                ? 1
                : 0;
        boolean   haveAlt  = geoVals.length > 2;
        float   pMin   = Float.POSITIVE_INFINITY;
        float   pMax   = Float.NEGATIVE_INFINITY;
        int index = 0;
        for (int i = 0; i < numPoints; i++) {
            float lat = geoVals[latIndex][i];
            float lon = geoVals[lonIndex][i];
            float alt = haveAlt
                    ? geoVals[2][i]
                    : 0;
            if ((lat == lat) && (lon == lon)) {
                if ( !(alt == alt)) {
                    alt = 0;
                }
                if(doMax && (float)timeStep.getValues(i)[0] >= pMax){
                    pMax = (float)timeStep.getValues(i)[0];
                    index = i;
                } else if(doMin && (float)timeStep.getValues(i)[0] < pMin){
                    pMin = (float)timeStep.getValues(i)[0];
                    index = i;
                }
            }
        }
        float alt0  = haveAlt
                ? geoVals[2][index]
                : 0;
        EarthLocation el0 = new EarthLocationLite(geoVals[latIndex][index], geoVals[lonIndex][index], alt0);
        // TODO:  make this  more efficient
        PointObTuple pot = new PointObTuple(el0, dt,
                timeStep.getSample(index), rangeType);
        ff.setSample(0, pot, false, false);
        return ff;
    }
private static FieldImpl makePointObs(FlatField timeStep, DateTime dt, String function)
            throws VisADException, RemoteException {
        final boolean doMax = function.equals(FUNC_MAX);
        final boolean doMin = function.equals(FUNC_MIN);
        if (timeStep == null) {
            return null;
        }
        SampledSet domain    = getSpatialDomain(timeStep);
        int        numPoints = domain.getLength();
        Integer1DSet points = new Integer1DSet(RealType.getRealType("index"),
                numPoints);
        TupleType tt = getParamType(timeStep);
        TupleType rangeType = new TupleType(new MathType[] {
                RealTupleType.LatitudeLongitudeAltitude,
                RealType.Time,
                tt });
        FieldImpl ff = new FieldImpl(
                new FunctionType(
                        ((SetType) points.getType()).getDomain(),
                        rangeType), points);
        float[][] samples  = timeStep.getFloats(false);
        float[][] geoVals  = getEarthLocationPoints((GriddedSet) domain);
        boolean   isLatLon = isLatLonOrder(domain);
        int       latIndex = isLatLon
                ? 0
                : 1;
        int       lonIndex = isLatLon
                ? 1
                : 0;
        boolean   haveAlt  = geoVals.length > 2;
        float   pMin   = Float.POSITIVE_INFINITY;
        float   pMax   = Float.NEGATIVE_INFINITY;
        int index = 0;
        for (int i = 0; i < numPoints; i++) {
            float lat = geoVals[latIndex][i];
            float lon = geoVals[lonIndex][i];
            float alt = haveAlt
                    ? geoVals[2][i]
                    : 0;
            if ((lat == lat) && (lon == lon)) {
                if ( !(alt == alt)) {
                    alt = 0;
                }
                if(doMax && (float)timeStep.getValues(i)[0] >= pMax){
                    pMax = (float)timeStep.getValues(i)[0];
                    index = i;
                } else if(doMin && (float)timeStep.getValues(i)[0] < pMin){
                    pMin = (float)timeStep.getValues(i)[0];
                    index = i;
                }
            }
        }
        float alt0  = haveAlt
                ? geoVals[2][index]
                : 0;
        EarthLocation el0 = new EarthLocationLite(geoVals[latIndex][index], geoVals[lonIndex][index], alt0);
       
        PointObTuple pot = new PointObTuple(el0, dt,
                timeStep.getSample(index), rangeType);
        ff.setSample(0, pot, false, false);
        return ff;
    }
private static fieldimpl makepointobs(flatfield timestep, datetime dt, string function) throws visadexception, remoteexception { final boolean domax = function.equals(func_max); final boolean domin = function.equals(func_min); if (timestep == null) { return null; } sampledset domain = getspatialdomain(timestep); int numpoints = domain.getlength(); integer1dset points = new integer1dset(realtype.getrealtype("index"), numpoints); tupletype tt = getparamtype(timestep); tupletype rangetype = new tupletype(new mathtype[] { realtupletype.latitudelongitudealtitude, realtype.time, tt }); fieldimpl ff = new fieldimpl( new functiontype( ((settype) points.gettype()).getdomain(), rangetype), points); float[][] samples = timestep.getfloats(false); float[][] geovals = getearthlocationpoints((griddedset) domain); boolean islatlon = islatlonorder(domain); int latindex = islatlon ? 0 : 1; int lonindex = islatlon ? 1 : 0; boolean havealt = geovals.length > 2; float pmin = float.positive_infinity; float pmax = float.negative_infinity; int index = 0; for (int i = 0; i < numpoints; i++) { float lat = geovals[latindex][i]; float lon = geovals[lonindex][i]; float alt = havealt ? geovals[2][i] : 0; if ((lat == lat) && (lon == lon)) { if ( !(alt == alt)) { alt = 0; } if(domax && (float)timestep.getvalues(i)[0] >= pmax){ pmax = (float)timestep.getvalues(i)[0]; index = i; } else if(domin && (float)timestep.getvalues(i)[0] < pmin){ pmin = (float)timestep.getvalues(i)[0]; index = i; } } } float alt0 = havealt ? geovals[2][index] : 0; earthlocation el0 = new earthlocationlite(geovals[latindex][index], geovals[lonindex][index], alt0); pointobtuple pot = new pointobtuple(el0, dt, timestep.getsample(index), rangetype); ff.setsample(0, pot, false, false); return ff; }