@Test public void testLCseam() { // test seam crossing LambertConformal lc = new LambertConformal(40.0, 180.0, 20.0, 60.0); ProjectionPointImpl p1 = (ProjectionPointImpl) lc.latLonToProj(new LatLonPointImpl(0.0, -1.0), new ProjectionPointImpl()); ProjectionPointImpl p2 = (ProjectionPointImpl) lc.latLonToProj(new LatLonPointImpl(0.0, 1.0), new ProjectionPointImpl()); if (show) { System.out.printf(" p1= x=%f y=%f%n", p1.getX(), p1.getY()); System.out.printf(" p2= x=%f y=%f%n", p2.getX(), p2.getY()); } assert lc.crossSeam(p1, p2); }
private ProjectionCT makeLCProjection() throws NoSuchElementException { double latin1 = navInfo.getDouble( "Latin1"); double latin2 = navInfo.getDouble( "Latin2"); double lov = navInfo.getDouble( "Lov"); double la1 = navInfo.getDouble( "La1"); double lo1 = navInfo.getDouble( "Lo1"); // we have to project in order to find the origin LambertConformal lc = new LambertConformal(latin1, lov, latin1, latin2); ProjectionPointImpl start = (ProjectionPointImpl) lc.latLonToProj( new LatLonPointImpl( la1, lo1)); if (debug) System.out.println("start at proj coord "+start); startx = start.getX(); starty = start.getY(); nx = navInfo.getInt( "Nx"); ny = navInfo.getInt( "Ny"); dx = navInfo.getDouble( "Dx")/1000.0; // need to be km : unit conversion LOOK; dy = navInfo.getDouble( "Dy")/1000.0; // need to be km : unit conversion LOOK; return new ProjectionCT(grid_name, "FGDC", lc); }
private ProjectionCT makeLCProjection(NetcdfDataset ds, String name) throws NoSuchElementException { double centralLat = findAttributeDouble(ds, "centralLat"); double centralLon = findAttributeDouble(ds, "centralLon"); double rotation = findAttributeDouble(ds, "rotation"); // we have to project in order to find the origin LambertConformal lc = new LambertConformal(rotation, centralLon, centralLat, centralLat); double lat0 = findAttributeDouble(ds, "lat00"); double lon0 = findAttributeDouble(ds, "lon00"); ProjectionPointImpl start = (ProjectionPointImpl) lc.latLonToProj(new LatLonPointImpl(lat0, lon0)); if (debugProj) parseInfo.format("getLCProjection start at proj coord %s\n", start); startx = start.getX(); starty = start.getY(); return new ProjectionCT(name, "FGDC", lc); }
private ProjectionCT makeLCProjection(NetcdfDataset ds, String name) throws NoSuchElementException { double centralLat = findAttributeDouble(ds, "centralLat"); double centralLon = findAttributeDouble(ds, "centralLon"); double rotation = findAttributeDouble(ds, "rotation"); // we have to project in order to find the origin LambertConformal lc = new LambertConformal(rotation, centralLon, centralLat, centralLat); double lat0 = findAttributeDouble(ds, "lat00"); double lon0 = findAttributeDouble(ds, "lon00"); ProjectionPointImpl start = (ProjectionPointImpl) lc.latLonToProj(new LatLonPointImpl(lat0, lon0)); if (debugProj) parseInfo.format("getLCProjection start at proj coord %s%n", start); startx = start.getX(); starty = start.getY(); return new ProjectionCT(name, "FGDC", lc); }
private ProjectionCT makeLCProjection(NetcdfDataset ds, String name) throws NoSuchElementException { double centralLat = findAttributeDouble(ds, "centralLat"); double centralLon = findAttributeDouble(ds, "centralLon"); double rotation = findAttributeDouble(ds, "rotation"); // we have to project in order to find the origin LambertConformal lc = new LambertConformal(rotation, centralLon, centralLat, centralLat); double lat0 = findAttributeDouble(ds, "lat00"); double lon0 = findAttributeDouble(ds, "lon00"); ProjectionPointImpl start = (ProjectionPointImpl) lc.latLonToProj(new LatLonPointImpl(lat0, lon0)); if (debugProj) parseInfo.format("getLCProjection start at proj coord %s%n", start); startx = start.getX(); starty = start.getY(); return new ProjectionCT(name, "FGDC", lc); }
private ProjectionCT makeLCProjection() throws NoSuchElementException { double latin1 = navInfo.getDouble( "Latin1"); double latin2 = navInfo.getDouble( "Latin2"); double lov = navInfo.getDouble( "Lov"); double la1 = navInfo.getDouble( "La1"); double lo1 = navInfo.getDouble( "Lo1"); // we have to project in order to find the origin LambertConformal lc = new LambertConformal(latin1, lov, latin1, latin2); ProjectionPointImpl start = (ProjectionPointImpl) lc.latLonToProj( new LatLonPointImpl( la1, lo1)); if (debug) System.out.println("start at proj coord "+start); startx = start.getX(); starty = start.getY(); nx = navInfo.getInt( "Nx"); ny = navInfo.getInt( "Ny"); dx = navInfo.getDouble( "Dx")/1000.0; // need to be km : unit conversion LOOK; dy = navInfo.getDouble( "Dy")/1000.0; // need to be km : unit conversion LOOK; return new ProjectionCT(grid_name, "FGDC", lc); }
private ProjectionCT makeLCProjection() throws NoSuchElementException { double latin1 = navInfo.getDouble( "Latin1"); double latin2 = navInfo.getDouble( "Latin2"); double lov = navInfo.getDouble( "Lov"); double la1 = navInfo.getDouble( "La1"); double lo1 = navInfo.getDouble( "Lo1"); // we have to project in order to find the origin LambertConformal lc = new LambertConformal(latin1, lov, latin1, latin2); ProjectionPointImpl start = (ProjectionPointImpl) lc.latLonToProj( new LatLonPointImpl( la1, lo1)); if (debug) System.out.println("start at proj coord "+start); startx = start.getX(); starty = start.getY(); nx = navInfo.getInt( "Nx"); ny = navInfo.getInt( "Ny"); dx = navInfo.getDouble( "Dx")/1000.0; // need to be km : unit conversion LOOK; dy = navInfo.getDouble( "Dy")/1000.0; // need to be km : unit conversion LOOK; return new ProjectionCT(grid_name, "FGDC", lc); }
private ProjectionCT makeLCProjection(NetcdfDataset ds, String name, int nx, int ny) throws NoSuchElementException { double centralLat = findAttributeDouble( ds, "centralLat"); double centralLon = findAttributeDouble( ds, "centralLon"); double rotation = findAttributeDouble( ds, "rotation"); // lat0, lon0, par1, par2 LambertConformal proj = new LambertConformal(rotation, centralLon, centralLat, centralLat); // we have to project in order to find the origin double lat0 = findAttributeDouble( ds, "lat00"); double lon0 = findAttributeDouble( ds, "lon00"); ProjectionPointImpl start = (ProjectionPointImpl) proj.latLonToProj( new LatLonPointImpl( lat0, lon0)); if (debugProj) parseInfo.format("getLCProjection start at proj coord %s%n", start); startx = start.getX(); starty = start.getY(); // we will use the end to compute grid size LOOK may be wrong double latN = findAttributeDouble( ds, "latNxNy"); double lonN = findAttributeDouble( ds, "lonNxNy"); ProjectionPointImpl end = (ProjectionPointImpl) proj.latLonToProj( new LatLonPointImpl( latN, lonN)); dx = (end.getX() - startx) / nx; dy = (end.getY() - starty) / ny; if (debugProj) { parseInfo.format(" makeProjectionLC start at proj coord %f %f%n", startx, starty); parseInfo.format(" makeProjectionLC end at proj coord %f %f%n", end.getX(),end.getY()); double fdx = findAttributeDouble(ds, "dxKm"); double fdy = findAttributeDouble(ds, "dyKm"); parseInfo.format(" makeProjectionLC calc dx= %f file dx= %f%n",dx,fdx); parseInfo.format(" makeProjectionLC calc dy= %f file dy= %f%n",dy,fdy); } return new ProjectionCT(name, "FGDC", proj); }
private ProjectionCT makeLCProjection(NetcdfDataset ds, String name, int nx, int ny) throws NoSuchElementException { double centralLat = findAttributeDouble( ds, "centralLat"); double centralLon = findAttributeDouble( ds, "centralLon"); double rotation = findAttributeDouble( ds, "rotation"); // lat0, lon0, par1, par2 LambertConformal proj = new LambertConformal(rotation, centralLon, centralLat, centralLat); // we have to project in order to find the origin double lat0 = findAttributeDouble( ds, "lat00"); double lon0 = findAttributeDouble( ds, "lon00"); ProjectionPointImpl start = (ProjectionPointImpl) proj.latLonToProj( new LatLonPointImpl( lat0, lon0)); if (debugProj) parseInfo.format("getLCProjection start at proj coord %s%n", start); startx = start.getX(); starty = start.getY(); // we will use the end to compute grid size LOOK may be wrong double latN = findAttributeDouble( ds, "latNxNy"); double lonN = findAttributeDouble( ds, "lonNxNy"); ProjectionPointImpl end = (ProjectionPointImpl) proj.latLonToProj( new LatLonPointImpl( latN, lonN)); dx = (end.getX() - startx) / nx; dy = (end.getY() - starty) / ny; if (debugProj) { parseInfo.format(" makeProjectionLC start at proj coord %f %f%n", startx, starty); parseInfo.format(" makeProjectionLC end at proj coord %f %f%n", end.getX(),end.getY()); double fdx = findAttributeDouble(ds, "dxKm"); double fdy = findAttributeDouble(ds, "dyKm"); parseInfo.format(" makeProjectionLC calc dx= %f file dx= %f%n",dx,fdx); parseInfo.format(" makeProjectionLC calc dy= %f file dy= %f%n",dy,fdy); } return new ProjectionCT(name, "FGDC", proj); }
private ProjectionCT makeLCProjection(NetcdfDataset ds, String name, int nx, int ny) throws NoSuchElementException { double centralLat = findAttributeDouble( ds, "centralLat"); double centralLon = findAttributeDouble( ds, "centralLon"); double rotation = findAttributeDouble( ds, "rotation"); // lat0, lon0, par1, par2 LambertConformal proj = new LambertConformal(rotation, centralLon, centralLat, centralLat); // we have to project in order to find the origin double lat0 = findAttributeDouble( ds, "lat00"); double lon0 = findAttributeDouble( ds, "lon00"); ProjectionPointImpl start = (ProjectionPointImpl) proj.latLonToProj( new LatLonPointImpl( lat0, lon0)); if (debugProj) parseInfo.format("getLCProjection start at proj coord %s\n", start); startx = start.getX(); starty = start.getY(); // we will use the end to compute grid size LOOK may be wrong double latN = findAttributeDouble( ds, "latNxNy"); double lonN = findAttributeDouble( ds, "lonNxNy"); ProjectionPointImpl end = (ProjectionPointImpl) proj.latLonToProj( new LatLonPointImpl( latN, lonN)); dx = (end.getX() - startx) / nx; dy = (end.getY() - starty) / ny; if (debugProj) { parseInfo.format(" makeProjectionLC start at proj coord %f %f\n", startx, starty); parseInfo.format(" makeProjectionLC end at proj coord %f %f\n", end.getX(),end.getY()); double fdx = findAttributeDouble(ds, "dxKm"); double fdy = findAttributeDouble(ds, "dyKm"); parseInfo.format(" makeProjectionLC calc dx= %f file dx= %f\n",dx,fdx); parseInfo.format(" makeProjectionLC calc dy= %f file dy= %f\n",dy,fdy); } return new ProjectionCT(name, "FGDC", proj); }