Gianpaolo Coro 2016-04-05 14:00:10 +00:00
parent 757fd11202
commit 55810c7099
2 changed files with 12 additions and 6 deletions

View File

@ -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);

View File

@ -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);
}