示例#1
0
    def _find_elm(self, search_elm_name):
        """
        Finds group name and associated element's number

        :param search_elm_name: element's name, string
        :return: group name (string) and element's number (int)
        """
        ngrp=0
        while True:
            if ngrp == 0:
                error, grp_name, cel_name, grp_count_dimensions, grp_dimensions, grp_order = nefis.inqfgr(self.fp)
            else:
                error, grp_name, cel_name, grp_count_dimensions, grp_dimensions, grp_order = nefis.inqngr(self.fp)

            ngrp += 1
            if error == -6028: # no more groups to read
                return '', -1   # element not found

            # Read a cell definition from the definition file
            error, count, elm_names = nefis.inqcel(self.fp, cel_name)
            self._print_error(error)

            for i in range(count):
                if search_elm_name.strip() == elm_names[17*i:17*(i+1)].strip():
                    return grp_name, i    # return group and element number
示例#2
0
    def cell_info(self, cel_name, print_out=True):
        """
        Read a cell definition from the definition file

        :param cel_name: cell's name, string
        :param print_out: print-out flag, boolean
        :return: element's count, elements' names
        """
        error, count, elm_names = nefis.inqcel(self.fp, cel_name)
        self._print_error(error)
        if print_out:
            print('  Element Count: "%d"' % count)
            print('  Element names: "%s"' % elm_names)

        return count, elm_names