plans.project#

Project-related classes and routines

Overview#

# todo [major docstring improvement] – overview Mauris gravida ex quam, in porttitor lacus lobortis vitae. In a lacinia nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

Functions

handle_input_file(file_path[, msg])

load_project(project_folder)

Loads a Project from folder

new_project(specs)

Create a new Project from a specification dictionary.

Classes

Project(name[, alias])

plans.project.new_project(specs)[source]#

Create a new Project from a specification dictionary.

Danger

This method overwrites all existing default files.

Parameters:

specs (dict) –

Dictionary containing project specifications.

Required keys:

  • folder_base (str): Path where the project folder will be created.

  • name (str): Name of the project.

Optional keys:

  • alias (str): Alternative identifier. Defaults to None.

  • source (str): Source reference. Defaults to empty string.

  • description (str): Project description. Defaults to empty string.

Raises:

ValueError – If any required key is missing.

Returns:

A new :class:`plans.Project instance initialized with the given specifications.

Return type:

plans.Project

Examples

Import plans

import plans

Create a new plans.Project. First setup details.

# [CHANGE THIS] setup specs dictionary
project_specs = {
    "folder_base": "C:/plans", # change this path
    "name": "newProject",
    "alias": "NPrj",
    "source": "Me",
    "description": "Just a test"
}

Then call new_project()

plans.new_project(specs=project_specs)

Create and get the project instance:

prj = plans.new_project(specs=project_specs)
plans.project.load_project(project_folder)[source]#

Loads a Project from folder

Parameters:

project_folder (str or Path) – path to project root folder

Returns:

A new :class:`plans.Project instance.

Return type:

plans.Project

Notes

Warning

load_project() will overwrite the name attribute in project_info.csv file to match current folder name.

Examples

Import plans

import plans

Load an existing plans.Project

# get project instance
pj = plans.load_project(project_folder="path/to/project/folder")
plans.project.handle_input_file(file_path, msg='')[source]#
class plans.project.Project(name, alias=None)[source]#

Bases: FileSys

__init__(name, alias=None)[source]#

Initialize the FileSys object.

Parameters:
  • folder_base (str) – path to File System folder location

  • name (str) – unique class name

  • alias (str) – unique object alias. If None, it takes the first and last characters from name

get_metadata()[source]#

Get a dictionary with object metadata.

Returns:

dictionary with all metadata

Return type:

dict

Warning

Metadata does not necessarily include all object attributes.

setter(dict_setter, load_data=False)[source]#

Set selected attributes based on an incoming dictionary.

Parameters:

dict_setter (dict) – incoming dictionary with attribute values

load_data()[source]#

Load data from file. Expected to overwrite superior methods.

Parameters:

file_data (str) – file path to data.

Returns:

None

Return type:

None

setup()[source]#

This method sets up all the FileSys structure (default folders and files)

Danger

This method overwrites all existing default files.

update()[source]#

Refresh all mutable attributes based on data (including paths).

list_basins()[source]#
list_scenarios_climate()[source]#
list_scenarios_lulc()[source]#
make_run_folder(run_name)[source]#
run_demo()[source]#
run_analysis_dto(include_views=True, use_basin=None)[source]#
run_analysis_lulc_series(lulc_scenario, include_views=True, use_basin=None)[source]#
run_analysis_climate_series_lulc(climate_scenario, lulc_scenario, include_views=True)[source]#
get_dto()[source]#
get_climate_lulc_series(climate_scenario=None, lulc_scenario=None, skip_climate_scenario=None, skip_lulc_scenario=None)[source]#
get_lulc_series(lulc_scenario=None, skip_lulc_scenario=None)[source]#
static get_timestamp()[source]#