예제 #1
0
    def __makeResponse(self):
        from com.raytheon.edex.uengine.tasks.decode import FileIn
        from gov.noaa.nws.ncep.edex.uengine.output import GridOut
        response = ArrayList()
        size = self.queryResults.size()
        for i in range(size):
            currentQuery = self.queryResults.get(i)

            #
            # grid coverage
            #
            if self.pluginName == 'grib':
                gridNavInfo = GempakConvert.getGridNavigationContent(
                    currentQuery.getSpatialObject()).split(";")
            elif self.pluginName == 'ncgrib':
                gridNavInfo = GempakConvert.getNcgridNavigationContent(
                    currentQuery.getSpatialObject()).split(";")

            nx = gridNavInfo[1]
            ny = gridNavInfo[2]

            #
            # Call FileIn constructor
            #
            fileIn = FileIn(self.plugin, currentQuery)

            #
            # Call the execute method, getting back the data record
            #
            record = fileIn.execute()
            self.nxStr = "%s" % nx
            self.nyStr = "%s" % ny
            fileOut = GridOut(record.getDataObject(), self.format, self.nxStr,
                              self.nyStr)

            #
            # Execute method of FileOut class stores the data
            # in a file in uEngineProducts directory with the extension
            # contained in the string self.format
            #
            writeFile = fileOut.execute()

            #
            # Separate the file name from the complete path and store in content
            #
            content = (
                "%s" %
                writeFile).split("/")[len(("%s" % writeFile).split("/")) - 1]

            #
            #
            #
            import socket
            hostname = socket.gethostbyaddr(socket.gethostname())[2][0]
            #
            # Return content wrapped in a generic XML message
            #
            response.add(ResponseMessageGeneric(hostname + "|" + content))

        return response
예제 #2
0
	def __makeImageResponse(self):
		from com.raytheon.edex.uengine.tasks.decode import FileIn
		from com.raytheon.edex.uengine.tasks.process import ColorMapImage, ReprojectImage, ImageOut
		from com.raytheon.edex.uengine.tasks.output import FileOut
		from com.raytheon.edex.uengine.tasks.response import MakeResponseUri
		from com.raytheon.uf.common.geospatial import MapUtil
		response = ArrayList()
		size = self.queryResults.size()
		for i in range(size):
			currentQuery = self.queryResults.get(i)
			geom = MapUtil.getGridGeometry(currentQuery.getSpatialObject())
			crs = geom.getCoordinateReferenceSystem()
			fileIn = FileIn(self.plugin, currentQuery)
			record = fileIn.execute()
			colorMap = ColorMapImage(self.__colormap, record.getDataObject(), geom)
			imageOut = None
			if self.__reproject:
				reproject = ReprojectImage(colorMap.execute(), geom, crs)
				reprojectedImage = reproject.execute()
				imageOut = ImageOut(reprojectedImage, self.__format, reproject.getGridGeometry())
			else:
				imageOut = ImageOut(colorMap.execute(), self.__format, geom)
			fileOut = FileOut(imageOut.execute(), self.__format)
			writeFile = fileOut.execute()
			makeResponse = MakeResponseUri(writeFile, None, currentQuery.getIdentifier(), self.__format)
			response.add(makeResponse.execute())
			if self.__kml:
				from com.raytheon.edex.uengine.tasks.output import KmlImage
				kmlImage = KmlImage(writeFile, geom)
				kmlFile = kmlImage.execute()
				kmlResponse = MakeResponseUri(kmlFile, None, None, "kml")
				response.add(kmlResponse.execute())
			
		return response
				
예제 #3
0
    def __makeResponse(self):
        from com.raytheon.edex.uengine.tasks.decode import FileIn
        from gov.noaa.nws.ncep.edex.uengine.output import GridOut        
        response = ArrayList()
        size = self.queryResults.size() 
        for i in range(size):
            currentQuery = self.queryResults.get(i)
            
            #
            # grid coverage
            #
            if self.pluginName == 'grib':
                gridNavInfo = GempakConvert.getGridNavigationContent(currentQuery.getSpatialObject()).split(";")
            elif self.pluginName == 'ncgrib':
                gridNavInfo = GempakConvert.getNcgridNavigationContent(currentQuery.getSpatialObject()).split(";")
            
            nx = gridNavInfo[1]
            ny = gridNavInfo[2]

            #
            # Call FileIn constructor
            #
            fileIn = FileIn(self.plugin, currentQuery)

            #
            # Call the execute method, getting back the data record
            #
            record = fileIn.execute()
            self.nxStr = "%s" % nx
            self.nyStr = "%s" % ny
            fileOut = GridOut(record.getDataObject(), self.format, self.nxStr, self.nyStr)
            
            #
            # Execute method of FileOut class stores the data 
            # in a file in uEngineProducts directory with the extension
            # contained in the string self.format 
            #
            writeFile = fileOut.execute()
            
            #
            # Separate the file name from the complete path and store in content
            #
            content = ("%s" % writeFile).split("/")[len(("%s" % writeFile).split("/") ) - 1]
            
            #
            #
            # 
            import socket
            hostname = socket.gethostbyaddr(socket.gethostname())[2][0]
            #
            # Return content wrapped in a generic XML message
            #
            response.add(ResponseMessageGeneric(hostname+"|"+content))
            
        return response
예제 #4
0
    def __makeResponse(self):
        from com.raytheon.edex.uengine.tasks.decode import FileIn
        from com.raytheon.edex.uengine.tasks.output import FileOut
        response = ArrayList()
        size = self.queryResults.size()
        for i in range(size):
            currentQuery = self.queryResults.get(i)
            #
            # Call FileIn constructor
            #
            fileIn = FileIn(self.plugin, currentQuery)

            #
            # Call the execute method, getting back the data record
            #
            record = fileIn.execute()

            fileOut = FileOut(record.getDataObject(), self.format)

            #
            # Execute method of FileOut class stores the data
            # in a file in uEngineProducts directory with the extension
            # contained in the string self.format
            #
            writeFile = fileOut.execute()

            #
            # Separate the file name from the complete path and store in content
            #
            content = (
                "%s" %
                writeFile).split("/")[len(("%s" % writeFile).split("/")) - 1]

            #
            # Return content wrapped in a generic XML message
            #
            response.add(ResponseMessageGeneric(content))

        return response
 def __makeResponse(self):
     from com.raytheon.edex.uengine.tasks.decode import FileIn
     from com.raytheon.edex.uengine.tasks.output import FileOut        
     response = ArrayList()
     size = self.queryResults.size() 
     for i in range(size):
         currentQuery = self.queryResults.get(i)
         #
         # Call FileIn constructor
         #
         fileIn = FileIn(self.plugin, currentQuery)
         
         #
         # Call the execute method, getting back the data record
         #
         record = fileIn.execute()
         
         fileOut = FileOut(record.getDataObject(), self.format)
         
         #
         # Execute method of FileOut class stores the data 
         # in a file in uEngineProducts directory with the extension
         # contained in the string self.format 
         #
         writeFile = fileOut.execute()
         
         #
         # Separate the file name from the complete path and store in content
         #
         content = ("%s" % writeFile).split("/")[len(("%s" % writeFile).split("/") ) - 1]
         
         #
         # Return content wrapped in a generic XML message
         #
         response.add(ResponseMessageGeneric(content))
         
     return response