diff --git a/src/main/java/org/gcube/dataanalysis/geo/algorithms/RasterDataPublisher.java b/src/main/java/org/gcube/dataanalysis/geo/algorithms/RasterDataPublisher.java index 06c457b..bcfdc08 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/algorithms/RasterDataPublisher.java +++ b/src/main/java/org/gcube/dataanalysis/geo/algorithms/RasterDataPublisher.java @@ -70,8 +70,8 @@ public class RasterDataPublisher extends StandardLocalExternalAlgorithm{ AnalysisLogger.getLogger().debug("resolution: "+resolution); - if (!(fileName.endsWith(".nc")||fileName.endsWith(".tiff")||fileName.endsWith(".geotiff")||fileName.endsWith(".asc"))) - throw new Exception("Wrong file name: allowed files extensions are .nc, .tiff, .geotiff, .asc"); + if (!(fileName.endsWith(".nc")||fileName.endsWith(".tiff")||fileName.endsWith(".geotiff")||fileName.endsWith(".asc")||fileName.endsWith(".ncml"))) + throw new Exception("Wrong file name: allowed files extensions are .nc, .tiff, .geotiff, .asc, .ncml"); File f = new File(fileAbsolutePath); File newf = new File(f.getParent(),fileName); diff --git a/src/main/java/org/gcube/dataanalysis/geo/utils/ThreddsPublisher.java b/src/main/java/org/gcube/dataanalysis/geo/utils/ThreddsPublisher.java index 00cd097..b372bcb 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/utils/ThreddsPublisher.java +++ b/src/main/java/org/gcube/dataanalysis/geo/utils/ThreddsPublisher.java @@ -73,20 +73,26 @@ public class ThreddsPublisher { if (!found) throw new Exception("Thredds data transfer has not been found in the same scope of the catalog: "+scope); - + boolean gridded=true; if (fileAbsolutePath.endsWith(".nc")){ AnalysisLogger.getLogger().debug("checking NetCDF file coherence"+fileAbsolutePath); - NetCDFDataExplorer.getGrid(layerName, fileAbsolutePath); + //let's publish also if the netCDF is not gridded + try{ + NetCDFDataExplorer.getGrid(layerName, fileAbsolutePath); + }catch(Exception e){ + gridded=false; + AnalysisLogger.getLogger().debug("NetCDF is not gridded"+fileAbsolutePath); + } } AnalysisLogger.getLogger().debug("Transferring via DT to "+threddServiceAddress); DataTransferer.transferFileToService(scope, username, threddsDTService, threddsDTPort, fileAbsolutePath, remoteFolder); AnalysisLogger.getLogger().debug("Adding metadata on GeoNetwork"); - if (fileAbsolutePath.endsWith(".nc")) + if (fileAbsolutePath.endsWith(".nc") && gridded) publishNetCDFMeta(scope, layerTitle, abstractField, new File(fileAbsolutePath).getName(),layerName,threddServiceAddress,username,topics); else{ - if (resolution==-1) + if (resolution==-1 && gridded) throw new Exception ("Specify valid resolution parameter for non-NetCDF raster datasets"); publishOtherFileMeta(scope, layerTitle, resolution, abstractField, new File(fileAbsolutePath).getName(), threddServiceAddress,username,topics); }