コード例 #1
0
    def OnQuery(self, event):
        if self._check_time_itv_input() == False or\
           self._check_space_input() == False:
            return
        self.current_selected = range(self.dbf.n_records)
        self._filter_by_query_field()
        self.query_date = None
        self._filter_by_date_interval()
        self._filter_by_tod()
        self.query_data = self.gen_date_by_step()
        if self.query_data == None or len(self.query_data) <= 1:
            self.ShowMsgBox(
                "LISA Trend Graph requires at least 2 time intervals, please reselect step-by parameters."
            )
            return

        title = ""
        if self.query_field.lower() != "all fields":
            title = "(%s:%s)" % (self.query_field, self.query_range)

        # LISA layer (only one)
        lisa_layer = self.background_shps[self.background_shp_idx]
        gi_widget = PlotWidget(
            self.parent,
            lisa_layer,
            None,  #data
            SigTrendGraphLISA,
            query_data=self.query_data,
            size=(800, 650),
            start=self._wxdate2pydate(self.itv_start_date.GetValue()),
            end=self._wxdate2pydate(self.itv_end_date.GetValue()),
            step_by=self.step_by,
            step=self.step,
            title=title)
        gi_widget.Show()
コード例 #2
0
def ShowSigTrendGraphLISA(self):
    # self is Main.py
    if not self.shapefiles or len(self.shapefiles) < 1:
        return
    shp_list = [shp.name for shp in self.shapefiles]
    dlg = wx.SingleChoiceDialog(
        self, 'Select a POINT or Polygon(with time field) shape file:',
        'LISA Trend Graph', shp_list, wx.CHOICEDLG_STYLE)
    if dlg.ShowModal() == wx.ID_OK:
        idx = dlg.GetSelection()
        shp = self.shapefiles[idx]
        background_shapes = FilterShapeList(self.shapefiles, stars.SHP_POLYGON)
        if shp.shape_type == stars.SHP_POINT:
            # create Markov LISA from points
            gi_dlg = SigTrendGraphLISAQueryDialog(
                self,
                "LISA Trend Graph:" + shp.name,
                shp,
                background_shps=background_shapes,
                size=stars.DIALOG_SIZE_QUERY_MARKOV_LISA)
            gi_dlg.Show()
        elif shp.shape_type == stars.SHP_POLYGON:
            # bring up a dialog and let user select
            # the time field in POLYGON shape file
            dbf_field_list = shp.dbf.header
            timedlg = wx.MultiChoiceDialog(
                self, 'Select TIME fields to generate LISA Trend Graph:',
                'DBF fields view', dbf_field_list)
            if timedlg.ShowModal() == wx.ID_OK:
                selections = timedlg.GetSelections()
                # compose lisa_data_dict
                dbf = shp.dbf
                lisa_data_dict = {}
                count = 0
                lbls = []
                for idx in selections:
                    lisa_data_dict[count] = np.array(
                        dbf.by_col(dbf.header[idx]))
                    lbls.append(dbf.header[idx])
                    count += 1
                gi_spacetime_widget = PlotWidget(self,
                                                 shp,
                                                 None,
                                                 SigTrendGraphLISA,
                                                 query_data=lisa_data_dict,
                                                 lbls=lbls,
                                                 size=(800, 650),
                                                 start=1,
                                                 end=count - 1,
                                                 step_by='',
                                                 step=1)
                gi_spacetime_widget.Show()
            timedlg.Destroy()
        else:
            self.ShowMsgBox(
                "File type error. Should be a POINT or POLYGON shapefile.")
            dlg.Destroy()
            return
    dlg.Destroy()
コード例 #3
0
   def OnQuery(self,event):
       if self._check_space_input() == False or\
          self._check_time_itv_input() == False:
           return
       
       self.current_selected = range(self.dbf.n_records)
       self._filter_by_query_field()
       # query_date is not available in Trend Graph case
       self.query_date = None         
       self._filter_by_date_interval()
       self._filter_by_tod()
 
       self.query_data = self.gen_date_by_step()
       
       if self.query_data== None:
           self.ShowMsgBox("Querying dynamic data by time step could not be completed. Please respecify input parameters.")
           return
       
       background_shp, trend_data_dict  = self.query_data
      
       queryfield = "" if self.query_field_idx < 0 else self.query_field
       queryrange = "" if self.query_range == None else ""
       
       title = ""
       if self.query_field.lower() != "all fields":
           title = "(%s:%s)"%(self.query_field,self.query_range)
           
       trendgraph_widget= PlotWidget(
           self.parent,
           background_shp,
           trend_data_dict,
           TrendGraph,
           queryfield=queryfield,
           queryrange=queryrange,
           start=self.start_date,
           end=self.end_date,
           step_by=self.step_by,
           step=self.step,
           title=title
           )
       trendgraph_widget.Show()
       
       self.btn_save.Enable(True)