cdm/src/main/java/ucar/nc2/ft2/simpgeometry/CFPoint.java
public Point setupPoint(NetcdfDataset set, Variable vari, int index)
	{
		// Points are much simpler, node_count is used multigeometries so it's a bit different
		// No need for the index finder here, unless there is a multipoint
		Array xPts = null;
		Array yPts = null;
		Integer ind = (int)index;
		Variable nodeCounts = null;
		boolean multi = false;
		SimpleGeometryIndexFinder indexFinder = null;

		List<CoordinateAxis> axes = set.getCoordinateAxes();
		CoordinateAxis x = null; CoordinateAxis y = null;
		
		String[] nodeCoords = vari.findAttributeIgnoreCase(CF.NODE_COORDINATES).getStringValue().split(" ");
		
		// Look for x and y
		
		for(CoordinateAxis ax : axes){
			
			if(ax.getFullName().equals(nodeCoords[0])) x = ax;
			if(ax.getFullName().equals(nodeCoords[1])) y = ax;
		}
		
		// Node count is used very differently in points
		// Similar use to part_node_count in other geometries
		String node_c_str = vari.findAttValueIgnoreCase(CF.NODE_COUNT, "");
		
		if(!node_c_str.equals("")) {
			nodeCounts = set.findVariable(node_c_str);
			indexFinder = new SimpleGeometryIndexFinder(nodeCounts);
			multi = true;
		}
		
		try {
			
			//
			if(multi)
			{
				xPts = x.read( indexFinder.getBeginning(index) + ":" + indexFinder.getEnd(index) ).reduce();
				yPts = y.read( indexFinder.getBeginning(index) + ":" + indexFinder.getEnd(index) ).reduce();
			}
			
			else
			{
				xPts = x.read( ind.toString() ).reduce();
				yPts = y.read( ind.toString() ).reduce();
				this.x = xPts.getDouble(0);
				this.y = yPts.getDouble(0);
			}
		
			// Set points
			if(!multi) {
				this.x = xPts.getDouble(0);
				this.y = yPts.getDouble(0);
				
				// Set data of each
				switch(vari.getRank()) {
				
				case 2:
					this.setData(vari.read(CFSimpleGeometryHelper.getSubsetString(vari, index)).reduce());
					break;
					
				case 1:
					this.setData(vari.read("" + index));
					break;
					
				default:
					throw new InvalidDataseriesException(InvalidDataseriesException.RANK_MISMATCH);	// currently do not support anything but dataseries and scalar associations
				
				}
				
			}
		
			else {
				IndexIterator itrX = xPts.getIndexIterator();
				IndexIterator itrY = yPts.getIndexIterator();
				this.next = null;
				this.prev = null;
				
				Point point = this;
		
				// x and y should have the same shape (size), will add some handling on this
				while(itrX.hasNext()) {
					point.setX(itrX.getDoubleNext());
					point.setY(itrY.getDoubleNext());
					
					// Set data of each
					switch(vari.getRank()) {
					
					case 2:
						point.setData(vari.read(CFSimpleGeometryHelper.getSubsetString(vari, index)).reduce());
						break;
						
					case 1:
						point.setData(vari.read("" + index));
						break;
						
					default:
						throw new InvalidDataseriesException(InvalidDataseriesException.RANK_MISMATCH);	// currently do not support anything but dataseries and scalar associations
					
					}

					point.setNext(new CFPoint()); // -1 is a default value, it gets assigned eventually
					point = point.getNext();
				}
				
				// Clean up the last point since it will be invalid
				point = point.getPrev();
				point.setNext(null);
			}
		
		} catch (IOException e) {

			e.printStackTrace();
			return null;
		
		} catch (InvalidRangeException e) {
			
			e.printStackTrace();
			return null;
		} catch (InvalidDataseriesException e) {

			e.printStackTrace();
			return null;
		}
		
		return this;
	}
public Point setupPoint(NetcdfDataset set, Variable vari, int index)
	{
		// Points are much simpler, node_count is used multigeometries so it's a bit different
		// No need for the index finder here, unless there is a multipoint
		Array xPts = null;
		Array yPts = null;
		Integer ind = (int)index;
		Variable nodeCounts = null;
		boolean multi = false;
		SimpleGeometryIndexFinder indexFinder = null;

		List<CoordinateAxis> axes = set.getCoordinateAxes();
		CoordinateAxis x = null; CoordinateAxis y = null;
		
		String[] nodeCoords = vari.findAttributeIgnoreCase(CF.NODE_COORDINATES).getStringValue().split(" ");
		
		// Look for x and y
		
		for(CoordinateAxis ax : axes){
			
			if(ax.getFullName().equals(nodeCoords[0])) x = ax;
			if(ax.getFullName().equals(nodeCoords[1])) y = ax;
		}
		
		// Node count is used very differently in points
		// Similar use to part_node_count in other geometries
		String node_c_str = vari.findAttValueIgnoreCase(CF.NODE_COUNT, "");
		
		if(!node_c_str.equals("")) {
			nodeCounts = set.findVariable(node_c_str);
			indexFinder = new SimpleGeometryIndexFinder(nodeCounts);
			multi = true;
		}
		
		try {
			
			//
			if(multi)
			{
				xPts = x.read( indexFinder.getBeginning(index) + ":" + indexFinder.getEnd(index) ).reduce();
				yPts = y.read( indexFinder.getBeginning(index) + ":" + indexFinder.getEnd(index) ).reduce();
			}
			
			else
			{
				xPts = x.read( ind.toString() ).reduce();
				yPts = y.read( ind.toString() ).reduce();
				this.x = xPts.getDouble(0);
				this.y = yPts.getDouble(0);
			}
		
			// Set points
			if(!multi) {
				this.x = xPts.getDouble(0);
				this.y = yPts.getDouble(0);
				
				// Set data of each
				switch(vari.getRank()) {
				
				case 2:
					this.setData(vari.read(CFSimpleGeometryHelper.getSubsetString(vari, index)).reduce());
					break;
					
				case 1:
					this.setData(vari.read("" + index));
					break;
					
				default:
					throw new InvalidDataseriesException(InvalidDataseriesException.RANK_MISMATCH);	// currently do not support anything but dataseries and scalar associations
				
				}
				
			}
		
			else {
				IndexIterator itrX = xPts.getIndexIterator();
				IndexIterator itrY = yPts.getIndexIterator();
				this.next = null;
				this.prev = null;
				
				Point point = this;
		
				// x and y should have the same shape (size), will add some handling on this
				while(itrX.hasNext()) {
					point.setX(itrX.getDoubleNext());
					point.setY(itrY.getDoubleNext());
					
					// Set data of each
					switch(vari.getRank()) {
					
					case 2:
						point.setData(vari.read(CFSimpleGeometryHelper.getSubsetString(vari, index)).reduce());
						break;
						
					case 1:
						point.setData(vari.read("" + index));
						break;
						
					default:
						throw new InvalidDataseriesException(InvalidDataseriesException.RANK_MISMATCH);	// currently do not support anything but dataseries and scalar associations
					
					}

					point.setNext(new CFPoint()); // -1 is a default value, it gets assigned eventually
					point = point.getNext();
				}
				
				// Clean up the last point since it will be invalid
				point = point.getPrev();
				point.setNext(null);
			}
		
		} catch (IOException e) {

			e.printStackTrace();
			return null;
		
		} catch (InvalidRangeException e) {
			
			e.printStackTrace();
			return null;
		} catch (InvalidDataseriesException e) {

			e.printStackTrace();
			return null;
		}
		
		return this;
	}
public Point setupPoint ( NetcdfDataset set , Variable vari , int index ) { // Points are much simpler, node_count is used multigeometries so it's a bit different
 // No need for the index finder here, unless there is a multipoint
 Array xPts = null ; Array yPts = null ; Integer ind = ( int ) index ; Variable nodeCounts = null ; boolean multi = false ; SimpleGeometryIndexFinder indexFinder = null ; List < CoordinateAxis > axes = set . getCoordinateAxes ( ) ; CoordinateAxis x = null ; CoordinateAxis y = null ; String [ ] nodeCoords = vari . findAttributeIgnoreCase ( CF . NODE_COORDINATES ) . getStringValue ( ) . split ( " " ) ; // Look for x and y
 for ( CoordinateAxis ax : axes ) { if ( ax . getFullName ( ) . equals ( nodeCoords [ 0 ] ) ) x = ax ; if ( ax . getFullName ( ) . equals ( nodeCoords [ 1 ] ) ) y = ax ; } // Node count is used very differently in points
 // Similar use to part_node_count in other geometries
 String node_c_str = vari . findAttValueIgnoreCase ( CF . NODE_COUNT , "" ) ; if ( ! node_c_str . equals ( "" ) ) { nodeCounts = set . findVariable ( node_c_str ) ; indexFinder = new SimpleGeometryIndexFinder ( nodeCounts ) ; multi = true ; } try { //
 if ( multi ) { xPts = x . read ( indexFinder . getBeginning ( index ) + ":" + indexFinder . getEnd ( index ) ) . reduce ( ) ; yPts = y . read ( indexFinder . getBeginning ( index ) + ":" + indexFinder . getEnd ( index ) ) . reduce ( ) ; } else { xPts = x . read ( ind . toString ( ) ) . reduce ( ) ; yPts = y . read ( ind . toString ( ) ) . reduce ( ) ; this . x = xPts . getDouble ( 0 ) ; this . y = yPts . getDouble ( 0 ) ; } // Set points
 if ( ! multi ) { this . x = xPts . getDouble ( 0 ) ; this . y = yPts . getDouble ( 0 ) ; // Set data of each
 switch ( vari . getRank ( ) ) { case 2 : this . setData ( vari . read ( CFSimpleGeometryHelper . getSubsetString ( vari , index ) ) . reduce ( ) ) ; break ; case 1 : this . setData ( vari . read ( "" + index ) ) ; break ; default : throw new InvalidDataseriesException ( InvalidDataseriesException . RANK_MISMATCH ) ; // currently do not support anything but dataseries and scalar associations
 } } else { IndexIterator itrX = xPts . getIndexIterator ( ) ; IndexIterator itrY = yPts . getIndexIterator ( ) ; this . next = null ; this . prev = null ; Point point = this ; // x and y should have the same shape (size), will add some handling on this
 while ( itrX . hasNext ( ) ) { point . setX ( itrX . getDoubleNext ( ) ) ; point . setY ( itrY . getDoubleNext ( ) ) ; // Set data of each
 switch ( vari . getRank ( ) ) { case 2 : point . setData ( vari . read ( CFSimpleGeometryHelper . getSubsetString ( vari , index ) ) . reduce ( ) ) ; break ; case 1 : point . setData ( vari . read ( "" + index ) ) ; break ; default : throw new InvalidDataseriesException ( InvalidDataseriesException . RANK_MISMATCH ) ; // currently do not support anything but dataseries and scalar associations
 } point . setNext ( new CFPoint ( ) ) ; // -1 is a default value, it gets assigned eventually
 point = point . getNext ( ) ; } // Clean up the last point since it will be invalid
 point = point . getPrev ( ) ; point . setNext ( null ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; } catch ( InvalidRangeException e ) { e . printStackTrace ( ) ; return null ; } catch ( InvalidDataseriesException e ) { e . printStackTrace ( ) ; return null ; } return this ; }
Given a dataset, variable, and index, automatically populates this Point and
returns it. If not found, returns null.

@param dataset which the variable is a part of
@param vari the variable which has a geometry attribute
@param index of the point within the variable
@return return a point
Given a dataset variable and index automatically populates this Point and returns it . If not found returns null .