示例#1
0
    def _grp_list(self):
        """
        Reads groups from definition file
        """
        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)

            if error == -6028: # no more groups to read
                return self.grplist
            elif not error == 0:  # some other error
                self._print_error(error)
                break
            else:
                ngrp += 1
            self.grplist.append(grp_name)
            # Give the maximum used index of the free dimension of a data group.
            error, ntimes = nefis.inqmxi(self.fp, grp_name)
            self._print_error(error)
            self.grp[grp_name]={}
            self.grp[grp_name]['ntimes'] = ntimes
示例#2
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