Next / Previous / Contents / TCC Help System / NM Tech homepage

28.9. CbcHist._addOneEffort()

cbchistlib.py
# - - -   C b c H i s t . _ a d d O n e E f f o r t

    def _addOneEffort(self, effKey):
        '''Add all the filtered census records for one effort key.

          [ effKey is an EffortKey instance ->
              self._rowMap  +:=  census records from db for effort
                  selected by effKey and filtered by self.cenFilter ]
        '''

First we pull the Effort instance from the database and figure out which column will accumulate the data for this effort.

cbchistlib.py
        #-- 1
        # [ effort  :=  the Effort instance from self.db for effort
        #               key (effKey)
        #   colx  :=  the logical column index that displays data
        #       for the effort with key (effKey) ]
        effort = self.db.getEffort(effKey.year_no, effKey.year_key)
        colx = self.findColumn(effKey)

Now pull the related census records and slot them in column colx of the appropriate row for the kind of bird: see Section 28.10, “CbcHist._addOneCensus().

cbchistlib.py
        #-- 2
        # [ self._rowMap  +:=  census records from db for (effort),
        #       filtered by self.cenFilter, in rows appropriate for
        #       the kind of bird, and in column (colx) ]
        for census in effort.censuses:
            #-- 2 body
            # [ if self.cenFilter filters out census ->
            #     I
            #   else ->
            #     self._rowMap  +:=  self.cenFilter(census), in the
            #         row appropriate for the kind of bird, and in
            #         column (colx) ]
            cen1 = self.cenFilter(census)
            if cen1 is not None:
                self._addOneCensus(cen1, colx)