//
// GridCoordinateSystem.java
//

/*
VisAD system for interactive analysis and visualization of numerical
data.  Copyright (C) 1996 - 2017 Bill Hibbard, Curtis Rueden, Tom
Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and
Tommy Jasmin.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/

package visad;

/**
   GridCoordinateSystem is the VisAD CoordinateSystem class
   for grids defined by GriddedSets.

It should be used as the CoordinateSystem of an IntegerSet describing the set of grid values (so the dimensions of the IntegerSet should match the dimensions of the GriddedSet argument to the GridCoordinateSystem constructor) where the reference RealTupleType describes the value space of the GriddedSet.

*/ public class GridCoordinateSystem extends CoordinateSystem { private GriddedSet set; private int dimension; /** construct a CoordinateSystem for grid coordinates (e.g., (row, column, level) in 3-D) relative to the value space of set; for example, if satellite pixel locations are defined by explicit latitudes and longitude, these could be used to construct a Gridded2DSet which could then be used to construct a GridCoordinateSystem for (ImageLine, ImageElement) coordinates relative to reference coordinates (Latitude, Longitude) */ public GridCoordinateSystem(GriddedSet s) throws VisADException { super(((SetType) s.getType()).getDomain(), null); set = s; dimension = set.getDimension(); } /** Returns the GriddedSet associated with this instance. @return The GriddedSet associated with this instance. */ public GriddedSet getGriddedSet() { return set; } public double[][] toReference(double[][] tuples) throws VisADException { if (tuples == null || tuples.length != dimension) { throw new CoordinateSystemException("GridCoordinateSystem." + "toReference: tuples wrong dimension"); } double[][] values = Set.floatToDouble(set.gridToValue(Set.doubleToFloat(tuples))); Unit[] units_in = set.getSetUnits(); Unit[] units_out = getReference().getDefaultUnits(); ErrorEstimate[] errors_out = new ErrorEstimate[1]; for (int i=0; i

Ads help maintain this website.