MorphFiles#

class mhm_tools.pre.create_mhm_restart_file.MorphFiles(filepath=None, land_cover=None, bulk_density=None, sand_content=None, clay_content=None, slope=None, slope_emp=None, lai=None, aspect=None, geology=None)[source]#

Bases: object

A class representing a collection of morphological files.

Variables:
  • (Path) (geology)

  • (Path)

  • (Path)

  • (Path)

  • (Path)

  • (Path)

  • (Path)

  • (Path)

  • (Path)

Methods

get_file(key)

Retrieve the file path associated with the given name of the member variable.

get_files_as_dict()

Return a dictionary of all files in the object's attributes.

get_files_as_list()

Return a list of all files in the object's attributes.

read_files(filepath[, overwrite])

Read morph files and assign them to attributes.

get_file(key)[source]#

Retrieve the file path associated with the given name of the member variable.

Parameters:

key (str) (The member-variable name to retrieve the filepath for.)

Returns:

object

Return type:

The filepath or list of filepaths associated with the given key, or None if the key is not found.

get_files_as_dict()[source]#

Return a dictionary of all files in the object’s attributes.

Returns:

dict

Return type:

A dictionary containing all files in the object’s attributes.

get_files_as_list()[source]#

Return a list of all files in the object’s attributes.

This method iterates over all attributes of the object and checks if they are lists. If an attribute is a list, its elements are added to the file_list. If an attribute is not a list, it is directly appended to the file_list.

Returns:

list

Return type:

A list of all files in the object’s attributes.

read_files(filepath: Path, overwrite=False)[source]#

Read morph files and assign them to attributes.

Scans filepath for known variables and sets the corresponding instance attributes. Existing values are preserved unless overwrite=True.

Parameters:
  • filepath (Path) – Directory containing the files.

  • overwrite (bool, default False) – If False, existing attribute values will not be overwritten.