@Test
public void checkGridCoordSystem_findXYindexFromLatLonBounded()
throws IOException
{
GridDataset gd = GridDataset.open( datasetLocation );
GridDatatype hsGrid = gd.findGridDatatype( "hs" );
GridCoordSystem coordSys = hsGrid.getCoordinateSystem();
CalendarDate date = coordSys.getTimeAxis1D().getCalendarDate(0);
int[] xy = coordSys.findXYindexFromLatLonBounded( lat, lon, null );
assertEquals( i, xy[0] );
assertEquals( j, xy[1] );
GridAsPointDataset hsGridAsPoint = new GridAsPointDataset( Collections.singletonList( hsGrid ));
GridAsPointDataset.Point point = hsGridAsPoint.readData( hsGrid, date, lat, lon );
assertEquals( lat, point.lat, 0.001 );
assertEquals( lon, point.lon, 0.001 );
}
}