git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@126776 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
757fd11202
commit
55810c7099
|
@ -70,8 +70,8 @@ public class RasterDataPublisher extends StandardLocalExternalAlgorithm{
|
||||||
AnalysisLogger.getLogger().debug("resolution: "+resolution);
|
AnalysisLogger.getLogger().debug("resolution: "+resolution);
|
||||||
|
|
||||||
|
|
||||||
if (!(fileName.endsWith(".nc")||fileName.endsWith(".tiff")||fileName.endsWith(".geotiff")||fileName.endsWith(".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");
|
throw new Exception("Wrong file name: allowed files extensions are .nc, .tiff, .geotiff, .asc, .ncml");
|
||||||
|
|
||||||
File f = new File(fileAbsolutePath);
|
File f = new File(fileAbsolutePath);
|
||||||
File newf = new File(f.getParent(),fileName);
|
File newf = new File(f.getParent(),fileName);
|
||||||
|
|
|
@ -73,20 +73,26 @@ public class ThreddsPublisher {
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
throw new Exception("Thredds data transfer has not been found in the same scope of the catalog: "+scope);
|
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")){
|
if (fileAbsolutePath.endsWith(".nc")){
|
||||||
AnalysisLogger.getLogger().debug("checking NetCDF file coherence"+fileAbsolutePath);
|
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);
|
AnalysisLogger.getLogger().debug("Transferring via DT to "+threddServiceAddress);
|
||||||
DataTransferer.transferFileToService(scope, username, threddsDTService, threddsDTPort, fileAbsolutePath, remoteFolder);
|
DataTransferer.transferFileToService(scope, username, threddsDTService, threddsDTPort, fileAbsolutePath, remoteFolder);
|
||||||
|
|
||||||
AnalysisLogger.getLogger().debug("Adding metadata on GeoNetwork");
|
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);
|
publishNetCDFMeta(scope, layerTitle, abstractField, new File(fileAbsolutePath).getName(),layerName,threddServiceAddress,username,topics);
|
||||||
else{
|
else{
|
||||||
if (resolution==-1)
|
if (resolution==-1 && gridded)
|
||||||
throw new Exception ("Specify valid resolution parameter for non-NetCDF raster datasets");
|
throw new Exception ("Specify valid resolution parameter for non-NetCDF raster datasets");
|
||||||
publishOtherFileMeta(scope, layerTitle, resolution, abstractField, new File(fileAbsolutePath).getName(), threddServiceAddress,username,topics);
|
publishOtherFileMeta(scope, layerTitle, resolution, abstractField, new File(fileAbsolutePath).getName(), threddServiceAddress,username,topics);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue