Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright (c) 1998-2020 John Caron and University Corporation for Atmospheric Research/Unidata
* Copyright (c) 1998-2025 John Caron and University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package ucar.unidata.geoloc;

import java.util.Formatter;
Expand Down Expand Up @@ -77,7 +78,7 @@ public static double lonNormalFrom(double lon, double start) {
/**
* Normalize the longitude to lie between +/-180
*
* @param lon east latitude in degrees
* @param lon east longitude in degrees
* @return normalized lon
*/
public static double lonNormal(double lon) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
/*
* Copyright (c) 1998-2018 University Corporation for Atmospheric Research/Unidata
* Copyright (c) 1998-2025 University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

package ucar.unidata.geoloc;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ucar.unidata.geoloc.projection.*;
import junit.framework.*;
import java.lang.invoke.MethodHandles;

/**
*
* @author John Caron
*/
public class TestLatLonProjection extends TestCase {
public class TestLatLonProjection {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private LatLonProjection p;

public TestLatLonProjection(String name) {
super(name);
}

@Before
public void setUp() {
p = new LatLonProjection();
}
Expand Down Expand Up @@ -66,6 +65,7 @@ void runCenter(double center) {
}
}

@Test
public void testLatLonToProjBB() {
runCenter();
runCenter(110.45454545454547);
Expand All @@ -82,6 +82,7 @@ public LatLonRect testIntersection(LatLonRect bbox, LatLonRect bbox2) {
return result;
}

@Test
public void testIntersection() {
LatLonRect bbox = new LatLonRect(LatLonPoint.create(40.0, -100.0), 10.0, 20.0);
LatLonRect bbox2 = new LatLonRect(LatLonPoint.create(-40.0, -180.0), 120.0, 300.0);
Expand All @@ -108,6 +109,7 @@ private LatLonRect testExtend(LatLonRect bbox, LatLonRect bbox2) {
return bbox;
}

@Test
public void testExtend() {
LatLonRect bbox;

Expand Down
5 changes: 4 additions & 1 deletion grib/src/main/java/ucar/nc2/grib/grib1/Grib1Gds.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2018 John Caron and University Corporation for Atmospheric Research/Unidata
* Copyright (c) 1998-2025 John Caron and University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

Expand Down Expand Up @@ -556,6 +556,9 @@ public String toString() {
@Override
public GdsHorizCoordSys makeHorizCoordSys() {
LatLonProjection proj = new LatLonProjection(getEarth());
double centerLon = ((int) ((lo2 - lo1 + deltaLon) / 2 / scale3)) * scale3;
proj.setCenterLon(centerLon);

// ProjectionPoint startP = proj.latLonToProj(LatLonPoint.create(la1, lo1));
double startx = lo1; // startP.getX();
double starty = la1; // startP.getY();
Expand Down
4 changes: 3 additions & 1 deletion grib/src/main/java/ucar/nc2/grib/grib2/Grib2Gds.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2018 John Caron and University Corporation for Atmospheric Research/Unidata
* Copyright (c) 1998-2025 John Caron and University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/

Expand Down Expand Up @@ -518,6 +518,8 @@ public int[] getOptionalPoints() {

public GdsHorizCoordSys makeHorizCoordSys() {
LatLonProjection proj = new LatLonProjection(getEarth());
double centerLon = ((int) ((lo2 - lo1 + deltaLon) / 2 / getScale())) * getScale();
proj.setCenterLon(centerLon);
// ProjectionPoint startP = proj.latLonToProj(LatLonPoint.create(la1, lo1));
double startx = lo1; // startP.getX();
double starty = la1; // startP.getY();
Expand Down