private void makeRanges() { for (ucar.nc2.dt.GridDataset.Gridset gset : getGridsets()) { GridCoordSystem gcs = gset.getGeoCoordSystem(); LatLonRect llbb = gcs.getLatLonBoundingBox(); if (llbbMax == null) llbbMax = llbb; else llbbMax.extend(llbb); CalendarDateRange dateRange = gcs.getCalendarDateRange(); if (dateRange != null) { if (dateRangeMax == null) dateRangeMax = dateRange; else dateRangeMax.extend(dateRange); } } }
private void makeRanges() { for (ucar.nc2.dt.GridDataset.Gridset gset : getGridsets()) { GridCoordSystem gcs = gset.getGeoCoordSystem(); LatLonRect llbb = gcs.getLatLonBoundingBox(); if (llbbMax == null) llbbMax = llbb; else llbbMax.extend(llbb); CalendarDateRange dateRange = gcs.getCalendarDateRange(); if (dateRange != null) { if (dateRangeMax == null) dateRangeMax = dateRange; else dateRangeMax.extend(dateRange); } } }
private void makeRanges() { for (ucar.nc2.dt.GridDataset.Gridset gset : getGridsets()) { GridCoordSystem gcs = gset.getGeoCoordSystem(); ProjectionRect bb = gcs.getBoundingBox(); if (projBB == null) projBB = bb; else projBB.add(bb); LatLonRect llbb = gcs.getLatLonBoundingBox(); if (llbbMax == null) llbbMax = llbb; else llbbMax.extend(llbb); CalendarDateRange dateRange = gcs.getCalendarDateRange(); if (dateRange != null) { if (dateRangeMax == null) dateRangeMax = dateRange; else dateRangeMax = dateRangeMax.extend(dateRange); } } }
Iterator iter = gridDs.getGridsets().iterator(); while (iter.hasNext()) { GridDataset.Gridset gridset = (GridDataset.Gridset) iter.next();
private void testCoordinates(String filename, double startLat, double startLon, double endLat, double endLon) throws IOException, InvalidRangeException { System.out.printf("%n***Open %s%n", filename); NetcdfDataset ncd = NetcdfDataset.openDataset(filename); GridDataset gds = new GridDataset(ncd); GridCoordSystem gsys = null; ProjectionImpl p = null; for (ucar.nc2.dt.GridDataset.Gridset g : gds.getGridsets()) { gsys = g.getGeoCoordSystem(); for (CoordinateTransform t : gsys.getCoordinateTransforms()) { if (t instanceof ProjectionCT) { p = ((ProjectionCT)t).getProjection(); break; } } } assert p != null; CoordinateAxis1D xaxis = (CoordinateAxis1D) gsys.getXHorizAxis(); CoordinateAxis1D yaxis = (CoordinateAxis1D) gsys.getYHorizAxis(); p.projToLatLon(xaxis.getCoordValue(0), yaxis.getCoordValue(0) ); LatLonPoint start1 = p.projToLatLon(xaxis.getCoordValue(0), yaxis.getCoordValue(0)); LatLonPoint start2 = p.projToLatLon(xaxis.getCoordValue((int)xaxis.getSize()-1), yaxis.getCoordValue((int)yaxis.getSize()-1)); System.out.printf( "start = %f %f%n", start1.getLatitude(), start1.getLongitude()); System.out.printf( "end = %f %f%n", start2.getLatitude(), start2.getLongitude()); assert start1.nearlyEquals(new LatLonPointImpl(startLat, startLon), 2.0E-4); assert start2.nearlyEquals(new LatLonPointImpl(endLat, endLon), 2.0E-4); ncd.close(); }