Exemplo n.º 1
0
    def __str__(self):
        tt = TextTable([("epoch", "%5i"), ("date","%10s"), ("time","%8s")])
        str = [tt.make_table_head()]
        str.extend([tt.make_table_row(i, dt.date(), dt.time())\
                    for dt,i in zip(self.dateTimeList,
                                    xrange(len(self.dateTimeList)))])
        str.append(tt.make_table_foot())
        str.append("\n")
        str.append(self.epochPointList.__str__())

        return "".join(str)
Exemplo n.º 2
0
 def __init__(self, id, textTable=None):
     """id - point identification 
     textTable - describes format of output text table
     """
     self.id = id
     if textTable == None:
         self.textTable = TextTable([("id","%12s")])
     else:
         self.textTable = textTable
     self.lindex = None # index in PointList
Exemplo n.º 3
0
    def make_table(self):
        """makes text table of epochs"""
        
        if not self.list:
            return "Empty EpochPointList"

        #ids
        from gizela.text.TextTable import TextTable
        textTable = TextTable([("id","%12s")] + \
                              [("ep %i" % i, "%5s")\
                               for i in xrange(len(self.list))])
        
        ids = [id for id in self.index]
        if self.sortOutput:
            ids.sort()
        return  textTable.make_table_head() +\
                "".join([textTable.make_table_row(\
                            [id] + [i==None and " " or "*" \
                                       for i in self.index[id]])\
                         for id in ids]) +\
                textTable.make_table_foot()
Exemplo n.º 4
0
    def str_summary(self):
        tt = TextTable([("", "%10s"),
                        ("ep 0", "%4i"),
                        ("ep 1", "%4i")])
        str = [tt.make_table_head()]
        
        sum1 = sum([len(cl) for cl in self.obsToComp1])
        sum2 = sum([len(cl) for cl in self.obsToComp2])
        sumComp = sum([len(cl) for cl in self.compObsClList])
        sumu1 = sum([len(cl) for cl in self.uncompObsClList1])
        sumu2 = sum([len(cl) for cl in self.uncompObsClList2])
    

        str.append(tt.make_table_row("sum obs", sum1, sum2))
        str.append(tt.make_table_row("obs comp", sumComp, sumComp))
        str.append(tt.make_table_row("obs uncomp", sumu1, sumu2))

        str.append(tt.make_table_foot())

        return "".join(str)
Exemplo n.º 5
0
class PointBase(object):
    '''base class for geodetic coordinates
    '''
    
    __slots__ = ["id", "textTable", "lindex"]
    
    def __init__(self, id, textTable=None):
        """id - point identification 
        textTable - describes format of output text table
        """
        self.id = id
        if textTable == None:
            self.textTable = TextTable([("id","%12s")])
        else:
            self.textTable = textTable
        self.lindex = None # index in PointList

    def with_text_table(self, textTable):
        """
        returns text table output with textTable without changing of
        self.textTable
        """
        tt = self.textTable
        self.textTable = textTable
        str = self.__str__()
        self.textTable = tt

        return str


    def set_row_data_function(self, rowDataFun): 
        """set list of functions for making row of data"""
        self.textTable.set_row_data_function(rowDataFun)

    def set_text_table_type(self, type):
        self.textTable.type = type

    def make_header(self): 
        """returns header of table"""
        return self.textTable.make_table_head()
    
    def make_table_row(self): 
        """returns row of table"""
        return self.textTable.make_table_row(self.id)
    
    def make_footer(self): 
        """returns footer of table"""
        return self.textTable.make_table_foot()

    def __str__(self): 
        return self.make_header() +\
               self.make_table_row()    +\
               self.make_footer()

    def __eq__(self,other):
        """operator equal =="""
        if isinstance(other, PointBase):
            return self.id == other.id
        else:
            return self.id == other

    def make_gama_xml(self):
        "returns xml tag for gama-local"
        return '<point id="%s"/>' % self.id

    def change_id(self, idDict):
        if self.id in idDict:
            self.id = idDict[self.id]