Example #1
0
    def __call__(self):
        """
        Return a metaArray when called
        """
        metainfo = self.metainfo
        index = array(self.getcolumn(3), dtype=float)
        data = array(self.getcolumn(4), dtype=float)

        if linearChk(index, debug=self.debug) is not True:
            raise ValueError("The index array is not linear")

        # Write the data array as metaArray
        ary = metaArray(data)

        # Update the basic metaArray info
        ary['name'] = self.name
        ary['unit'] = metainfo['Vertical Units']

        # Update the scaling info
        ary['range']['begin'][0] = index[0]
        ary['range']['end'][0] = index[-1]
        ary['range']['unit'][0] = metainfo['Horizontal Units']
        ary['range']['label'][0] = metainfo['Source']

        # Include the rest of the metainfo into metaArray
        for field, value in metainfo.items():
            ary["TDS2.csv." + field] = value

        ary.update_range()
        return ary
Example #2
0
    def __call__(self):
        """
        Return a metaArray when called
        """
        metainfo = self.metainfo
        index = array(self.getcolumn(3), dtype=float)
        data = array(self.getcolumn(4), dtype=float)

        if linearChk(index, debug=self.debug) is not True:
            raise ValueError("The index array is not linear")

        # Write the data array as metaArray
        ary = metaArray(data)

        # Update the basic metaArray info
        ary['name'] = self.name
        ary['unit'] = metainfo['Vertical Units']

        # Update the scaling info
        ary['range']['begin'][0] = index[0]
        ary['range']['end'][0] = index[-1]
        ary['range']['unit'][0] = metainfo['Horizontal Units']
        ary['range']['label'][0] = metainfo['Source']

        # Include the rest of the metainfo into metaArray
        for field, value in metainfo.items():
            ary["TDS2.csv."+field] = value

        ary.update_range()
        return ary
Example #3
0
    def __call__(self):
        """
        Return a metaArray when called
        """
        metainfo = self.metainfo
        rcd_len = metainfo['Record Length']

        index = csv_file.getcolumn(self, 0)[self.label_row:]
        index_name = index[0]
        index = array(index[1:rcd_len+1], dtype=float)

        try:
            data = csv_file.getcolumn(self, self.data_col)[self.label_row:]
            metainfo['Source'] = data[0]
            data = array(data[1:rcd_len+1], dtype=float)
        except IndexError as err:
            print("Data column doesn't exist:", err)
            print("Defaulting to first data column")
            data = csv_file.getcolumn(self, 1)[self.label_row:]
            metainfo['Source'] = data[0]
            data = array(data[1:rcd_len+1], dtype=float)

        if linearChk(index, debug=self.debug) is not True:
            raise ValueError("The index array is not linear")

        # Write the data array as metaArray
        ary = metaArray(data)

        # Update the basic metaArray info
        ary['unit'] = metainfo['Vertical Units']
        if metainfo['Label'] is '':
            ary['name'] = self.name
        else:
            ary['name'] = metainfo['Label']

        # Update the scaling info
        ary['range']['begin'][0] = index[0]
        ary['range']['end'][0] = index[-1]
        ary['range']['unit'][0] = metainfo['Horizontal Units']
        ary['range']['label'][0] = index_name

        # Include the rest of the metainfo into metaArray
        for field, value in metainfo.items():
            ary["DPO2.csv."+field] = value

        ary.update_range()
        return ary
Example #4
0
    def __call__(self):
        """
        Return a metaArray when called
        """
        metainfo = self.metainfo
        rcd_len = metainfo['Record Length']

        index = csv_file.getcolumn(self, 0)[self.label_row:]
        index_name = index[0]
        index = array(index[1:rcd_len + 1], dtype=float)

        try:
            data = csv_file.getcolumn(self, self.data_col)[self.label_row:]
            metainfo['Source'] = data[0]
            data = array(data[1:rcd_len + 1], dtype=float)
        except IndexError as err:
            print("Data column doesn't exist:", err)
            print("Defaulting to first data column")
            data = csv_file.getcolumn(self, 1)[self.label_row:]
            metainfo['Source'] = data[0]
            data = array(data[1:rcd_len + 1], dtype=float)

        if linearChk(index, debug=self.debug) is not True:
            raise ValueError("The index array is not linear")

        # Write the data array as metaArray
        ary = metaArray(data)

        # Update the basic metaArray info
        ary['unit'] = metainfo['Vertical Units']
        if metainfo['Label'] is '':
            ary['name'] = self.name
        else:
            ary['name'] = metainfo['Label']

        # Update the scaling info
        ary['range']['begin'][0] = index[0]
        ary['range']['end'][0] = index[-1]
        ary['range']['unit'][0] = metainfo['Horizontal Units']
        ary['range']['label'][0] = index_name

        # Include the rest of the metainfo into metaArray
        for field, value in metainfo.items():
            ary["DPO2.csv." + field] = value

        ary.update_range()
        return ary