def extract(self, variable_idx):
        """
        Extract a specific varaible
        """
        branch = self._define_branch(variable_idx)
        label = self.profiles[variable_idx].replace("\n", "")
        self.label[variable_idx] = label
        self.data[variable_idx] = [[], []]
        with open(self.abspath) as fobj:
            for line in fobj.readlines()[
                    variable_idx+1+self._attributes['data_idx']::
                    self._attributes['nvar']+1]:
                points = []
                for point in line.split(' '):
                    try:
                        points.append(float(point))
                    except ValueError:
                        pass
                self.data[variable_idx][1].append(np.array(points))
        x_st = self.geometries[branch][0]
        x_no_st = [(x0+x1)/2 for x0, x1 in zip(x_st[:-1], x_st[1:])]
        if len(self.data[variable_idx][1][0]) == len(x_st):
            self.data[variable_idx][0] = np.array(x_st)
        else:
            self.data[variable_idx][0] = np.array(x_no_st)
def extract ( self , variable_idx ) : branch = self . _define_branch ( variable_idx ) label = self . profiles [ variable_idx ] . replace ( "\n" , "" ) self . label [ variable_idx ] = label self . data [ variable_idx ] = [ [ ] , [ ] ] with open ( self . abspath ) as fobj : for line in fobj . readlines ( ) [ variable_idx + 1 + self . _attributes [ 'data_idx' ] : : self . _attributes [ 'nvar' ] + 1 ] : points = [ ] for point in line . split ( ' ' ) : try : points . append ( float ( point ) ) except ValueError : pass self . data [ variable_idx ] [ 1 ] . append ( np . array ( points ) ) x_st = self . geometries [ branch ] [ 0 ] x_no_st = [ ( x0 + x1 ) / 2 for x0 , x1 in zip ( x_st [ : - 1 ] , x_st [ 1 : ] ) ] if len ( self . data [ variable_idx ] [ 1 ] [ 0 ] ) == len ( x_st ) : self . data [ variable_idx ] [ 0 ] = np . array ( x_st ) else : self . data [ variable_idx ] [ 0 ] = np . array ( x_no_st )
Extract a specific varaible