From 8d8005f0c00e70e5af3e21d56e9da177e0df925b Mon Sep 17 00:00:00 2001 From: Fabio Sinibaldi Date: Tue, 2 Mar 2021 14:41:11 +0100 Subject: [PATCH 1/4] Upgrade to apache-sis 1.0 --- CHANGELOG.md | 3 +++ pom.xml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e51a61..d191a63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm # Changelog for org.gcube.data.transfer.sis-geotk-plugin +## [v1.2.0-SNAPSHOT] 2020-09-07 +Upgrade to apache-sis 1.0 + ## [v1.1.3] 2020-09-07 ### Fixes diff --git a/pom.xml b/pom.xml index a67de5f..18560f1 100644 --- a/pom.xml +++ b/pom.xml @@ -8,12 +8,12 @@ org.gcube.data.transfer sis-geotk-plugin - 1.1.3 + 1.2.0-SNAPSHOT Sis/GeoToolkit plugin Apache Sis/Geotk plugin for data-transfer-service - 0.7 + 1.0 ${sis.version} https://code-repo.d4science.org/gCubeSystem From 05ff46dc6f3721be62624af6d424b0a866bd8dad Mon Sep 17 00:00:00 2001 From: Fabio Sinibaldi Date: Wed, 3 Mar 2021 16:14:22 +0100 Subject: [PATCH 2/4] UCAR Library --- .classpath | 36 --------- .settings/org.eclipse.jdt.core.prefs | 5 -- pom.xml | 43 +++++++++- .../transfer/plugins/sis/TestGetMetadata.java | 79 ++++++++++++------- 4 files changed, 92 insertions(+), 71 deletions(-) delete mode 100644 .classpath delete mode 100644 .settings/org.eclipse.jdt.core.prefs diff --git a/.classpath b/.classpath deleted file mode 100644 index fae1a2b..0000000 --- a/.classpath +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 714351a..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/pom.xml b/pom.xml index 18560f1..6594681 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,5 @@ - 4.0.0 @@ -96,6 +97,36 @@ sis-netcdf ${sis.utils.modules} + + org.apache.sis.storage + sis-earth-observation + ${sis.utils.modules} + + + org.apache.sis.storage + sis-geotiff + ${sis.utils.modules} + + + + + + + org.apache.sis.non-free + sis-embedded-data + ${sis.version} + runtime + + + + + + + edu.ucar + netcdf + 4.3.22 + + @@ -117,11 +148,19 @@ test + + org.opengis + geoapi-conformance + 3.0.1 + test + + + - + org.apache.maven.plugins maven-assembly-plugin diff --git a/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java b/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java index 7f2980e..0adb476 100644 --- a/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java +++ b/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java @@ -21,48 +21,71 @@ import org.gcube.data.transfer.plugins.thredds.sis.SisPlugin; public class TestGetMetadata { public static void main(String[] args) throws UnsupportedStorageException, DataStoreException, IOException, NoSuchAlgorithmException { + String[] toCheckFiles=new String[] { + "/Users/FabioISTI/Downloads/Aaptos_aaptos.nc", + "/Users/FabioISTI/Downloads/NASA_Precipitations_1950_2100_rcp45.nc", + }; - File temp=File.createTempFile("temp", ".temp"); - File original=new File("/home/fabio/Downloads/oscar_vel2011_180.nc"); - File copied=File.createTempFile("copied", ".nc"); - transferStream(new FileInputStream(original),new FileOutputStream(temp)); - System.out.println("copied. Moving.."); + for(String f:toCheckFiles) { + System.out.println("checking "+f); + check(false,f); + } + System.out.println("Done"); + } + + private static void check(boolean checkCopy,String src) throws UnsupportedStorageException, DataStoreException, IOException, NoSuchAlgorithmException { + + File original=new File(src); - System.out.println("Checksum original : "+getChecksum(original)); - System.out.println("Checksum temp : "+getChecksum(temp)); + File dataset=original; - - - Files.move(temp.toPath(), copied.toPath(),StandardCopyOption.ATOMIC_MOVE,StandardCopyOption.REPLACE_EXISTING); - if(copied.length() Date: Thu, 11 Mar 2021 16:14:17 +0100 Subject: [PATCH 3/4] Integrated Ucar library --- .settings/.gitignore | 1 + pom.xml | 53 ++++++++++++++----- .../transfer/plugins/sis/TestGetMetadata.java | 29 ++++++++-- 3 files changed, 65 insertions(+), 18 deletions(-) create mode 100644 .settings/.gitignore diff --git a/.settings/.gitignore b/.settings/.gitignore new file mode 100644 index 0000000..3b1537c --- /dev/null +++ b/.settings/.gitignore @@ -0,0 +1 @@ +/org.eclipse.jdt.core.prefs diff --git a/pom.xml b/pom.xml index 6594681..4b5c9b6 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,7 @@ 1.0 ${sis.version} https://code-repo.d4science.org/gCubeSystem + 5.3.3 @@ -31,14 +32,22 @@ org.gcube.distribution gcube-smartgears-bom - 2.0.0 + 2.1.0 pom import org.gcube.distribution gcube-bom - 2.0.0 + 2.0.1 + pom + import + + + + org.apache.sis + storage + 1.0 pom import @@ -49,7 +58,7 @@ org.gcube.data.transfer data-transfer-plugin-framework - [1.0.2,2.0.0-SNAPSHOT) + [1.0.2,2.0.0) @@ -70,7 +79,7 @@ org.gcube.spatial.data sdi-library - [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + [1.0.0,2.0.0) @@ -109,6 +118,20 @@ + + + + com.esri.geometry + esri-geometry-api + + + + + edu.ucar + cdm + + + @@ -118,14 +141,7 @@ runtime - - - - - edu.ucar - netcdf - 4.3.22 - + @@ -138,7 +154,6 @@ junit junit - 4.12 test @@ -151,13 +166,23 @@ org.opengis geoapi-conformance - 3.0.1 test + + + unidata-all + Unidata All + + https://nexus.d4science.org/nexus/content/repositories/unidata/ + + + + + diff --git a/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java b/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java index 0adb476..1f6791b 100644 --- a/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java +++ b/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java @@ -2,12 +2,10 @@ package org.gcube.data.transfer.plugins.sis; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.net.MalformedURLException; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.security.MessageDigest; @@ -15,7 +13,6 @@ import java.security.NoSuchAlgorithmException; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.UnsupportedStorageException; -import org.gcube.data.transfer.model.TransferTicket.Status; import org.gcube.data.transfer.plugins.thredds.sis.SisPlugin; public class TestGetMetadata { @@ -28,11 +25,35 @@ public class TestGetMetadata { for(String f:toCheckFiles) { System.out.println("checking "+f); - check(false,f); + try{ + check(false,f); + }catch(UnsupportedStorageException e) { + System.err.println(e.getMessage()); +// System.out.println("Trying opening "+f+" manually"); +// open(f); + } } System.out.println("Done"); } + +// private static void open(String path) throws IOException, UnsupportedStorageException, DataStoreException { +// System.out.println("Opening "+path); +// NetcdfFile f=NetcdfFiles.open(path); +// System.out.println(f.getFileTypeDescription()+"\t"+f.getFileTypeId()); +// +// +// NetcdfDataset ncDs=NetcdfDatasets.openDataset(path); +//// NcMLReaderNew. +//// +// System.out.println(ncDs.getFileTypeDescription()+"\t"+ncDs.getFileTypeId()); +// +//// NetcdfDatasets.openFile(path,null); +// +// +// } + + private static void check(boolean checkCopy,String src) throws UnsupportedStorageException, DataStoreException, IOException, NoSuchAlgorithmException { File original=new File(src); From d70b7a6347c4f691643b522784e58abf19edf01c Mon Sep 17 00:00:00 2001 From: Fabio Sinibaldi Date: Fri, 12 Mar 2021 18:03:06 +0100 Subject: [PATCH 4/4] release --- CHANGELOG.md | 2 +- pom.xml | 2 +- .../transfer/plugins/sis/TestGetMetadata.java | 24 ++++++++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d191a63..195f775 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm # Changelog for org.gcube.data.transfer.sis-geotk-plugin -## [v1.2.0-SNAPSHOT] 2020-09-07 +## [v1.2.0] 2020-09-07 Upgrade to apache-sis 1.0 ## [v1.1.3] 2020-09-07 diff --git a/pom.xml b/pom.xml index 4b5c9b6..6fc8b0c 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.gcube.data.transfer sis-geotk-plugin - 1.2.0-SNAPSHOT + 1.2.0 Sis/GeoToolkit plugin Apache Sis/Geotk plugin for data-transfer-service diff --git a/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java b/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java index 1f6791b..547b275 100644 --- a/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java +++ b/src/test/java/org/gcube/data/transfer/plugins/sis/TestGetMetadata.java @@ -6,6 +6,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.URL; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.security.MessageDigest; @@ -19,8 +20,21 @@ public class TestGetMetadata { public static void main(String[] args) throws UnsupportedStorageException, DataStoreException, IOException, NoSuchAlgorithmException { String[] toCheckFiles=new String[] { - "/Users/FabioISTI/Downloads/Aaptos_aaptos.nc", + + + // ********** HDF - NETCDF 4 "/Users/FabioISTI/Downloads/NASA_Precipitations_1950_2100_rcp45.nc", + + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/NASA_Precipitations_1950_2100_rcp45.nc", + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/NASA_Precipitations_1950_2100_rcp85.nc", + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/NASA_Surface_Air_Temperature_1950_2100_rcp45.nc", + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/NASA_Surface_Air_Temperature_1950_2100_rcp85.nc", + "https://thredds.d4science.org/thredds/fileServer/public/netcdf/ClimateChange/hcaf_v6_1950_2100.nc", + + + // *********** NETCDF 3 + + "/Users/FabioISTI/Downloads/Aaptos_aaptos.nc" }; for(String f:toCheckFiles) { @@ -79,8 +93,12 @@ public class TestGetMetadata { } - - System.out.println(SisPlugin.getMetaFromFile(dataset)); + if(dataset.exists()) + System.out.println(SisPlugin.getMetaFromFile(dataset)); + else { + System.out.println(SisPlugin.getMetaFromFile(new URL(src))); + } + }