def set_dict(self, gli_dict): """ Set a gli dict as returned by tools methods or generators. Gli will be checked for validity. Parameters ---------- gli_dict : :class:`dict` dictionary containing the gli file Includes the following information (sorted by keys): points : ndarray Array with all point postions point_names : ndarray (of strings) Array with all point names point_md : ndarray Array with all Material-densities at the points if point_md should be undefined it takes the value -np.inf polylines : list of dict each containing information about - ``ID`` (int or None) - ``NAME`` (str) - ``POINTS`` (ndarray) - ``EPSILON`` (float or None) - ``TYPE`` (int or None) - ``MAT_GROUP`` (int or None) - ``POINT_VECTOR`` (str or None) surfaces : list of dict each containing information about - ``ID`` (int or None) - ``NAME`` (str) - ``POLYLINES`` (list of str) - ``EPSILON`` (float or None) - ``TYPE`` (int or None) - ``MAT_GROUP`` (int or None) - ``TIN`` (str or None) volumes : list of dict each containing information about - ``NAME`` (str) - ``SURFACES`` (list of str) - ``TYPE`` (int or None) - ``MAT_GROUP`` (int or None) - ``LAYER`` (int or None) """ if check_gli_dict(gli_dict): self.__dict = gli_dict else: print("given gli_dict is not valid")
def __init__(self, gli_dict=None, **OGS_Config): super(GLI, self).__init__(**OGS_Config) self.file_ext = ".gli" self.force_writing = True if gli_dict is None: self.__dict = dcp(EMPTY_GLI) elif check_gli_dict(gli_dict): self.__dict = gli_dict else: print("given gli_dict is not valid.. will set default") self.__dict = dcp(EMPTY_GLI)
def check(self, verbose=True): """ Check if the gli is valid in the sence, that the contained data is consistent. Parameters ---------- verbose : bool, optional Print information for the executed checks. Default: True Returns ------- result : bool Validity of the given gli. """ return check_gli_dict(self.__dict, verbose=verbose)
def load(self, filepath, verbose=False, encoding=None, **kwargs): """ Load an OGS5 gli from file. kwargs will be forwarded to "tools.load_ogs5gli" Parameters ---------- filepath : string path to the '\*.gli' OGS5 gli file to load verbose : bool, optional Print information of the reading process. Default: True """ tmp = load_ogs5gli(filepath, verbose=verbose, encoding=encoding, **kwargs) if check_gli_dict(tmp, verbose=verbose): self.__dict = tmp else: raise ValueError("GLI.load: " + filepath + ": given gli is not valid")