Example #1
0
    def onMouseMotion(self, event):
        # Show row,col,lat,lon,image value of pixel in status bar
        # and a small zoom in other preview image
        if (0 <= event.xdata <= self.XSize) and (0 <= event.ydata <=
                                                 self.YSize):

            # Mouse over the image
            col, row = int(event.xdata), int(event.ydata)
            # Warning! if row-5 or col-5 is negative => out of bounds
            lat, lon = m.getLatLon(row, col, self.lat0, self.lon0, self.dlat,
                                   self.dlon)

            # Status bar sms
            sms = "Row,Col = [" + str(row) + "," + str(
                col) + "]     |     Lat,Lon =  [" + str(lat) + "," + str(
                    lon) + "]"
            sms += "    |    Value = " + str(self.data[row, col])
            self.m_statusBar.SetStatusText(sms)

            # Load small zoom
            self.m_figure_preview.clear()
            self.ax2 = self.m_figure_preview.add_subplot(111)
            eval(
                "self.ax2.imshow(self.data[row-5:row+5,col-5:col+5], cmap = cm."
                + self.m_cmb_colormap.GetValue() + ")")
            self.m_canvas_preview.draw()
Example #2
0
    def onExtractClicked( self, event ):
        # Get the value from image
        choice = self.m_rBox_extract_input_type.GetStringSelection()
        if choice == "Row/Col":
            row = float(self.m_txt_lat.GetValue())
            col = float(self.m_txt_lon.GetValue())

            # Only to be logged
            lat,lon = m.getLatLon(row,col,self.lat0, self.lon0, self.dlat, self.dlon)
        else:
            lat = float(self.m_txt_lat.GetValue())
            lon = float(self.m_txt_lon.GetValue())

            # Image indexes
            row,col = m.getRowCol(lat,lon,self.lat0, self.lon0, self.dlat, self.dlon)

        # Format the info to be logged
        sms = "\n+ Extract operation \n"
        sms += "     Lat = "+ str(lat) + "\n"
        sms += "     Lon = "+ str(lon) + "\n"
        sms += "     Row = "+ str(row) + "\n"
        sms += "     Col = "+ str(col) + "\n"
        self.m_txt_log.AppendText(sms)

        if ( self.YSize < row or row < 0 ) or (self.XSize < col or col < 0 ):
            # if row or col are out of bounds
            self.m_txt_log.AppendText("\n Error: Row or column out of bouds")
        else:
            self.m_txt_extracted_value.SetValue(str(self.data[row][col]))
            self.m_txt_log.AppendText("     Extracted value = "+str(self.data[row][col]))

        # Scroll to show the las log added
        self.m_txt_log.ShowPosition( self.m_txt_log.GetLastPosition())
Example #3
0
    def onMouseMotion( self, event ):
        # Show row,col,lat,lon,image value of pixel in status bar
        # and a small zoom in other preview image
        if (0 <= event.xdata <= self.XSize) and (0 <= event.ydata <= self.YSize):

            # Mouse over the image
            col,row = int(event.xdata), int(event.ydata)
            # Warning! if row-5 or col-5 is negative => out of bounds
            lat,lon = m.getLatLon(row,col,self.lat0, self.lon0, self.dlat, self.dlon)

            # Status bar sms
            sms = "Row,Col = ["+str(row) + "," + str(col) + "]     |     Lat,Lon =  [" + str(lat) + "," + str(lon) + "]"
            sms += "    |    Value = " + str(self.data[row,col])
            self.m_statusBar.SetStatusText(sms)

            # Load small zoom
            self.m_figure_preview.clear()
            self.ax2 = self.m_figure_preview.add_subplot(111)
            eval("self.ax2.imshow(self.data[row-5:row+5,col-5:col+5], cmap = cm." + self.m_cmb_colormap.GetValue() + ")")
            self.m_canvas_preview.draw()
Example #4
0
    def onExtractClicked(self, event):
        # Get the value from image
        choice = self.m_rBox_extract_input_type.GetStringSelection()
        if choice == "Row/Col":
            row = float(self.m_txt_lat.GetValue())
            col = float(self.m_txt_lon.GetValue())

            # Only to be logged
            lat, lon = m.getLatLon(row, col, self.lat0, self.lon0, self.dlat,
                                   self.dlon)
        else:
            lat = float(self.m_txt_lat.GetValue())
            lon = float(self.m_txt_lon.GetValue())

            # Image indexes
            row, col = m.getRowCol(lat, lon, self.lat0, self.lon0, self.dlat,
                                   self.dlon)

        # Format the info to be logged
        sms = "\n+ Extract operation \n"
        sms += "     Lat = " + str(lat) + "\n"
        sms += "     Lon = " + str(lon) + "\n"
        sms += "     Row = " + str(row) + "\n"
        sms += "     Col = " + str(col) + "\n"
        self.m_txt_log.AppendText(sms)

        if (self.YSize < row or row < 0) or (self.XSize < col or col < 0):
            # if row or col are out of bounds
            self.m_txt_log.AppendText("\n Error: Row or column out of bouds")
        else:
            self.m_txt_extracted_value.SetValue(str(self.data[row][col]))
            self.m_txt_log.AppendText("     Extracted value = " +
                                      str(self.data[row][col]))

        # Scroll to show the las log added
        self.m_txt_log.ShowPosition(self.m_txt_log.GetLastPosition())