public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = computeTheta(latLon.getLongitude()); double term = earth.isSpherical() ? n2 * Math.sin(fromLat) : n * MapMath.qsfn(Math.sin(fromLat), e, one_es); double rho = c - term; if (rho < 0.0) throw new RuntimeException("F"); rho = dd * Math.sqrt(rho); double toX = rho * Math.sin(theta); double toY = rho0 - rho * Math.cos(theta); result.setLocation(totalScale * toX + falseEasting, totalScale * toY + falseNorthing); return result; }
public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = computeTheta(latLon.getLongitude()); double term = earth.isSpherical() ? n2 * Math.sin(fromLat) : n * MapMath.qsfn(Math.sin(fromLat), e, one_es); double rho = c - term; if (rho < 0.0) throw new RuntimeException("F"); rho = dd * Math.sqrt(rho); double toX = rho * Math.sin(theta); double toY = rho0 - rho * Math.cos(theta); result.setLocation(totalScale * toX + falseEasting, totalScale * toY + falseNorthing); return result; }
public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = computeTheta(latLon.getLongitude()); double term = earth.isSpherical() ? n2 * Math.sin(fromLat) : n * MapMath.qsfn(Math.sin(fromLat), e, one_es); double rho = c - term; if (rho < 0.0) throw new RuntimeException("F"); rho = dd * Math.sqrt(rho); double toX = rho * Math.sin(theta); double toY = rho0 - rho * Math.cos(theta); result.setLocation(totalScale * toX + falseEasting, totalScale * toY + falseNorthing); return result; }
public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl xy) { double lam = Math.toRadians( latlon.getLongitude() - lon0); double phi = Math.toRadians( latlon.getLatitude()); if (earth.isSpherical()) { xy.x = scaleFactor * lam; xy.y = Math.sin(phi) / scaleFactor; } else { xy.x = scaleFactor * lam; xy.y = .5 * MapMath.qsfn(Math.sin(phi), e, one_es) / scaleFactor; } xy.setLocation(totalScale * xy.x + falseEasting, totalScale * xy.y + falseNorthing); return xy; }
if (!earth.isSpherical()) { en = MapMath.enfn(es); switch (mode) {
if (!earth.isSpherical()) { en = MapMath.enfn(es); switch (mode) {
boolean secant = Math.abs(phi1 - phi2) >= EPS10; if (!earth.isSpherical()) { // not spherical LOOK CHANGE
boolean secant = Math.abs(phi1 - phi2) >= EPS10; if (!earth.isSpherical()) { // not spherical LOOK CHANGE
boolean secant = Math.abs(phi1 - phi2) >= EPS10; if (!earth.isSpherical()) { // not spherical LOOK CHANGE
public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl lp) { double x = (ppt.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double y = (ppt.getY() - falseNorthing) / totalScale; if (earth.isSpherical()) { y *= scaleFactor; double t = Math.abs(y); if (t - MapMath.EPS10 <= 1.) { if (t >= 1.) { lp.setLatitude( Math.toDegrees(y < 0. ? -MapMath.HALFPI : MapMath.HALFPI)); } else { lp.setLatitude( Math.toDegrees(Math.asin(y))); } lp.setLongitude(Math.toDegrees( x / scaleFactor)); } else { throw new IllegalStateException(); } } else { lp.setLatitude( Math.toDegrees(MapMath.authlat(Math.asin(2. * y * scaleFactor / qp), apa))); lp.setLongitude( lon0 + Math.toDegrees( x / scaleFactor)); } return lp; }
public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl lp) { double x = (ppt.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double y = (ppt.getY() - falseNorthing) / totalScale; if (earth.isSpherical()) { y *= scaleFactor; double t = Math.abs(y); if (t - MapMath.EPS10 <= 1.) { if (t >= 1.) { lp.setLatitude( Math.toDegrees(y < 0. ? -MapMath.HALFPI : MapMath.HALFPI)); } else { lp.setLatitude( Math.toDegrees(Math.asin(y))); } lp.setLongitude(Math.toDegrees( x / scaleFactor)); } else { throw new IllegalStateException(); } } else { lp.setLatitude( Math.toDegrees(MapMath.authlat(Math.asin(2. * y * scaleFactor / qp), apa))); lp.setLongitude( lon0 + Math.toDegrees( x / scaleFactor)); } return lp; }
public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl lp) { double x = (ppt.getX() - falseEasting) / totalScale; // assumes cartesion coords in km double y = (ppt.getY() - falseNorthing) / totalScale; if (earth.isSpherical()) { y *= scaleFactor; double t = Math.abs(y); if (t - MapMath.EPS10 <= 1.) { if (t >= 1.) { lp.setLatitude( Math.toDegrees(y < 0. ? -MapMath.HALFPI : MapMath.HALFPI)); } else { lp.setLatitude( Math.toDegrees(Math.asin(y))); } lp.setLongitude(Math.toDegrees( x / scaleFactor)); } else { throw new IllegalStateException(); } } else { lp.setLatitude( Math.toDegrees(MapMath.authlat(Math.asin(2. * y * scaleFactor / qp), apa))); lp.setLongitude( lon0 + Math.toDegrees( x / scaleFactor)); } return lp; }
public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl xy) { double lam = Math.toRadians( latlon.getLongitude() - lon0); double phi = Math.toRadians( latlon.getLatitude()); if (earth.isSpherical()) { xy.setLocation(scaleFactor * lam, Math.sin(phi) / scaleFactor); } else { xy.setLocation(scaleFactor * lam, .5 * MapMath.qsfn(Math.sin(phi), e, one_es) / scaleFactor); } xy.setLocation(totalScale * xy.getX() + falseEasting, totalScale * xy.getY() + falseNorthing); return xy; }
public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl xy) { double lam = Math.toRadians( latlon.getLongitude() - lon0); double phi = Math.toRadians( latlon.getLatitude()); if (earth.isSpherical()) { xy.setLocation(scaleFactor * lam, Math.sin(phi) / scaleFactor); } else { xy.setLocation(scaleFactor * lam, .5 * MapMath.qsfn(Math.sin(phi), e, one_es) / scaleFactor); } xy.setLocation(totalScale * xy.getX() + falseEasting, totalScale * xy.getY() + falseNorthing); return xy; }
private void addParameters() { addParameter(CF.GRID_MAPPING_NAME, CF.LATITUDE_LONGITUDE); if (earth.isSpherical()) addParameter(CF.EARTH_RADIUS, earth.getEquatorRadius()); else { addParameter(CF.SEMI_MAJOR_AXIS, earth.getEquatorRadius()); addParameter(CF.SEMI_MINOR_AXIS, earth.getPoleRadius()); } }
public GdsHorizCoordSys makeHorizCoordSys() { boolean northPole = (projCenterFlag & 128) == 0; double latOrigin = northPole ? 90.0 : -90.0; // Why the scale factor?. according to GRIB docs: // "Grid lengths are in units of meters, at the 60 degree latitude circle nearest to the pole" // since the scale factor at 60 degrees = k = 2*k0/(1+sin(60)) [Snyder,Working Manual p157] // then to make scale = 1 at 60 degrees, k0 = (1+sin(60))/2 = .933 double scale; if (Double.isNaN(lad)) { // LOOK ?? scale = 0.9330127018922193; } else { scale = (1.0 + Math.sin(Math.toRadians( Math.abs(lad)))) / 2; } ProjectionImpl proj; Earth earth = getEarth(); if (earth.isSpherical()) { proj = new Stereographic(latOrigin, lov, scale); } else { proj = new ucar.unidata.geoloc.projection.proj4.StereographicAzimuthalProjection(latOrigin, lov, scale, lad, 0.0, 0.0, earth); } ProjectionPointImpl start = (ProjectionPointImpl) proj.latLonToProj(new LatLonPointImpl(la1, lo1)); return new GdsHorizCoordSys(getNameShort(), template, 0, scanMode, proj, start.getX(), getDx(), start.getY(), getDy(), getNx(), getNy(), null); }
public GdsHorizCoordSys makeHorizCoordSys() { boolean northPole = (projCenterFlag & 128) == 0; double latOrigin = northPole ? 90.0 : -90.0; // Why the scale factor?. according to GRIB docs: // "Grid lengths are in units of meters, at the 60 degree latitude circle nearest to the pole" // since the scale factor at 60 degrees = k = 2*k0/(1+sin(60)) [Snyder,Working Manual p157] // then to make scale = 1 at 60 degrees, k0 = (1+sin(60))/2 = .933 double scale; if (GribNumbers.isUndefined(lad)) { // LOOK scale = 0.9330127018922193; } else { scale = (1.0 + Math.sin(Math.toRadians(Math.abs(Math.abs(lad))))) / 2; } ProjectionImpl proj; Earth earth = getEarth(); if (earth.isSpherical()) { proj = new Stereographic(latOrigin, lov, scale); } else { proj = new ucar.unidata.geoloc.projection.proj4.StereographicAzimuthalProjection( latOrigin, lov, scale, lad, 0.0, 0.0, earth); } ProjectionPointImpl start = (ProjectionPointImpl) proj.latLonToProj(new LatLonPointImpl(la1, lo1)); return new GdsHorizCoordSys(getNameShort(), template, getOctet4(7), scanMode, proj, start.getX(), dX, start.getY(), dY, getNxRaw(), getNyRaw(), getNptsInLine()); }
public GdsHorizCoordSys makeHorizCoordSys() { ProjectionImpl proj = null; Earth earth = getEarth(); if (earth.isSpherical()) { proj = new ucar.unidata.geoloc.projection.LambertConformal(latin1, lov, latin1, latin2, 0.0, 0.0, earth.getEquatorRadius() * .001); } else { proj = new ucar.unidata.geoloc.projection.proj4.LambertConformalConicEllipse(latin1, lov, latin1, latin2, 0.0, 0.0, earth); } LatLonPointImpl startLL = new LatLonPointImpl(la1, lo1); ProjectionPointImpl start = (ProjectionPointImpl) proj.latLonToProj(startLL); return new GdsHorizCoordSys(getNameShort(), template, 0, scanMode, proj, start.getX(), getDx(), start.getY(), getDy(), getNx(), getNy(), null); }
public GdsHorizCoordSys makeHorizCoordSys() { ProjectionImpl proj; Earth earth = getEarth(); if (earth.isSpherical()) { proj = new ucar.unidata.geoloc.projection.LambertConformal(latin1, lov, latin1, latin2, 0.0, 0.0, earth.getEquatorRadius() * .001); } else { proj = new ucar.unidata.geoloc.projection.proj4.LambertConformalConicEllipse( latin1, lov, latin1, latin2, 0.0, 0.0, earth); } LatLonPointImpl startLL = new LatLonPointImpl(la1, lo1); ProjectionPointImpl start = (ProjectionPointImpl) proj.latLonToProj(startLL); return new GdsHorizCoordSys(getNameShort(), template, getOctet4(7), scanMode, proj, start.getX(), dX, start.getY(), dY, getNxRaw(), getNyRaw(), getNptsInLine()); }
public GdsHorizCoordSys makeHorizCoordSys() { ProjectionImpl proj; Earth earth = getEarth(); if (earth.isSpherical()) { proj = new ucar.unidata.geoloc.projection.AlbersEqualArea(latin1, lov, latin1, latin2, 0.0, 0.0, earth.getEquatorRadius() * .001); } else { proj = new ucar.unidata.geoloc.projection.proj4.AlbersEqualAreaEllipse( latin1, lov, latin1, latin2, 0.0, 0.0, earth); } LatLonPointImpl startLL = new LatLonPointImpl(la1, lo1); ProjectionPointImpl start = (ProjectionPointImpl) proj.latLonToProj(startLL); return new GdsHorizCoordSys(getNameShort(), template, getOctet4(7), scanMode, proj, start.getX(), dX, start.getY(), dY, getNxRaw(), getNyRaw(), getNptsInLine()); }