Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tb snap11 #16

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### Updates from version 1.5.8 to 1.6.0
* Migrated to SNAP 11, several refactorings and library updates
* The VariableCache now uses an LRU cache with a listener to automatically free the oldest cached, no longer
needed variables and file handles when the maximum cache size is reached.* fix wrong corner point order of
era5 interpolation in SatelliteFields
Expand Down
22 changes: 9 additions & 13 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
</dependency>

<dependency>
<groupId>org.esa.s3tbx</groupId>
<artifactId>s3tbx-avhrr-reader</artifactId>
<groupId>eu.esa.opt</groupId>
<artifactId>opttbx-avhrr-reader</artifactId>
</dependency>

<dependency>
<groupId>org.esa.s3tbx</groupId>
<artifactId>s3tbx-sentinel3-reader</artifactId>
<groupId>eu.esa.opt</groupId>
<artifactId>opttbx-sentinel3-reader</artifactId>
</dependency>

<dependency>
Expand Down Expand Up @@ -89,14 +89,10 @@
<artifactId>netcdfAll</artifactId>
</dependency>

<!--<dependency>-->
<!--<groupId>edu.ucar</groupId>-->
<!--<artifactId>netcdf4</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>edu.ucar</groupId>-->
<!--<artifactId>cdm</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
Expand All @@ -110,7 +106,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/com/bc/fiduceo/archive/ArchiveConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@


import com.bc.fiduceo.util.JDomUtils;
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom2.Attribute;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;

import java.io.ByteArrayInputStream;
import java.io.IOException;
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/com/bc/fiduceo/core/SystemConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

import com.bc.fiduceo.archive.ArchiveConfig;
import com.bc.fiduceo.util.JDomUtils;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;

import java.io.File;
import java.io.FileInputStream;
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/java/com/bc/fiduceo/core/UseCaseConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
package com.bc.fiduceo.core;

import org.esa.snap.core.util.StringUtils;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.IOException;
import java.io.OutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.bc.fiduceo.reader.snap.SNAP_Reader;
import com.bc.fiduceo.reader.time.TimeLocator;
import com.bc.fiduceo.util.NetCDFUtils;
import org.esa.s3tbx.dataio.avhrr.AvhrrConstants;
import eu.esa.opt.dataio.avhrr.AvhrrConstants;
import org.esa.snap.core.datamodel.ProductData;
import org.esa.snap.core.datamodel.RasterDataNode;
import org.esa.snap.core.datamodel.VirtualBand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import com.bc.fiduceo.core.SystemConfig;
import com.bc.fiduceo.log.FiduceoLogger;
import com.bc.fiduceo.util.JDomUtils;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;

import java.io.File;
import java.io.FileInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import com.bc.fiduceo.store.ZipStore;
import com.bc.fiduceo.util.NetCDFUtils;
import com.bc.fiduceo.util.TimeUtils;
import org.esa.s3tbx.dataio.s3.Manifest;
import org.esa.s3tbx.dataio.s3.XfduManifest;
import eu.esa.opt.dataio.s3.Manifest;
import eu.esa.opt.dataio.s3.XfduManifest;
import org.esa.snap.core.dataio.geocoding.*;
import org.esa.snap.core.dataio.geocoding.forward.PixelForward;
import org.esa.snap.core.dataio.geocoding.inverse.PixelQuadTreeInverse;
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/com/bc/fiduceo/util/JDomUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package com.bc.fiduceo.util;

import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom2.Attribute;
import org.jdom2.Document;
import org.jdom2.Element;

import java.util.List;

Expand Down
8 changes: 4 additions & 4 deletions core/src/test/java/com/bc/fiduceo/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;

import java.io.*;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package com.bc.fiduceo.core;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.output.XMLOutputter;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

package com.bc.fiduceo.core;

import org.jdom.JDOMException;
import org.jdom2.JDOMException;
import org.junit.Before;
import org.junit.Test;

Expand Down
16 changes: 16 additions & 0 deletions core/src/test/java/com/bc/fiduceo/geometry/GeometryTestUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.bc.fiduceo.geometry;

import static org.junit.Assert.assertEquals;

public class GeometryTestUtils {

public static void assertSameGeometry(Geometry expected, Geometry geoBounds) {
Point[] expectedCoords = expected.getCoordinates();
Point[] actualCoords = geoBounds.getCoordinates();
assertEquals(expectedCoords.length, actualCoords.length);
for(int i = 0; i < expectedCoords.length; i++) {
assertEquals(expectedCoords[i].getLon(), actualCoords[i].getLon(), 1e-8);
assertEquals(expectedCoords[i].getLat(), actualCoords[i].getLat(), 1e-8);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testFormat_point() {
final Point point = factory.createPoint(34.8, -72.44);

final String wkt = factory.format(point);
assertEquals("POINT(34.8,-72.44)", wkt);
assertEquals("POINT(34.8 -72.44)", wkt);
}

@Test
Expand Down Expand Up @@ -267,7 +267,7 @@ public void testToStorageFormat_point() {
final Geometry point = factory.parse("POINT(-22.5 67.23)");

final byte[] storageFormat = factory.toStorageFormat(point);
assertEquals("POINT(-22.500000000000004,67.23)", new String(storageFormat));
assertEquals("POINT(-22.500000000000004 67.23)", new String(storageFormat));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import com.bc.fiduceo.util.NetCDFUtils;
import org.junit.Before;
import org.junit.Test;
import sun.nio.ch.Net;
import ucar.ma2.Array;
import ucar.ma2.DataType;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public void testGetPixelLocator() throws IOException {
Point2D[] pixelLocation = pixelLocator.getPixelLocation(-51.034195, 52.659184);
assertEquals(1, pixelLocation.length);
assertEquals(132.51219668358698, pixelLocation[0].getX(), 1e-8);
assertEquals(411.4166814102514, pixelLocation[0].getY(), 1e-8);
assertEquals(411.4166814102514, pixelLocation[0].getY(), 1e-6);

pixelLocation = pixelLocator.getPixelLocation(-4, 1176);
assertEquals(0, pixelLocation.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ public void testGetPixelLocator() throws IOException {
assertNotNull(pixelLocation);
assertEquals(1, pixelLocation.length);

assertEquals(38.317269513397704, pixelLocation[0].getX(), 1e-8);
assertEquals(38.317269513397704, pixelLocation[0].getX(), 1e-6);
assertEquals(781.666865947429, pixelLocation[0].getY(), 1e-8);
} finally {
reader.close();
Expand All @@ -540,7 +540,7 @@ public void testGetPixelLocator_N09() throws IOException {
assertNotNull(pixelLocation);
assertEquals(1, pixelLocation.length);

assertEquals(38.50497313441438, pixelLocation[0].getX(), 1e-8);
assertEquals(38.50497313441438, pixelLocation[0].getX(), 1e-6);
assertEquals(783.6241097278424, pixelLocation[0].getY(), 1e-8);
} finally {
reader.close();
Expand All @@ -567,7 +567,7 @@ public void testGetSubScenePixelLocator() throws IOException {
assertNotNull(pixelLocation);
assertEquals(1, pixelLocation.length);

assertEquals(33.59545482099081, pixelLocation[0].getX(), 1e-8);
assertEquals(33.59545482099081, pixelLocation[0].getX(), 1e-6);
assertEquals(416.5860033509568, pixelLocation[0].getY(), 1e-8);

} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import com.bc.fiduceo.reader.Reader;
import com.bc.fiduceo.reader.ReaderContext;
import org.esa.s3tbx.dataio.s3.Manifest;
import org.esa.s3tbx.dataio.s3.XfduManifest;
import eu.esa.opt.dataio.s3.Manifest;
import eu.esa.opt.dataio.s3.XfduManifest;
import org.junit.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
Expand Down
6 changes: 3 additions & 3 deletions core/src/test/java/com/bc/fiduceo/util/JDomUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
package com.bc.fiduceo.util;

import com.bc.fiduceo.core.UseCaseConfig;
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom2.Attribute;
import org.jdom2.Document;
import org.jdom2.Element;
import org.junit.Test;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import sun.net.www.protocol.file.FileURLConnection;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private static String writePointWkt(S2LatLng geometry) {
final StringBuilder builder = new StringBuilder();
builder.append("POINT(");
builder.append(geometry.lngDegrees());
builder.append(",");
builder.append(" ");
builder.append(geometry.latDegrees());
builder.append(")");
return builder.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testWritePoint() {
final S2Point s2Point = createS2Point(-18.7, 45.9);

final String wkt = S2WKTWriter.write(s2Point);
assertEquals("POINT(-18.7,45.9)", wkt);
assertEquals("POINT(-18.7 45.9)", wkt);
}

@Test
Expand All @@ -71,7 +71,7 @@ public void testWritePoint_S2LatLong() {
final S2LatLng s2LatLng = new S2LatLng(s2Point);

final String wkt = S2WKTWriter.write(s2LatLng);
assertEquals("POINT(-19.800000000000004,46.0)", wkt);
assertEquals("POINT(-19.800000000000004 45.99999999999999)", wkt);
}

@Test
Expand Down
Loading