Tip
Need help? Please let us know in the SUEWS Community.
Please report issues with the manual on GitHub Issues (or use Report Issue for This Page for page-specific feedback).
Please cite SUEWS with proper information from our Zenodo page.
6.2. Core Functions#
Deprecated since version 2025.11.20: The functional API is deprecated and will be removed in a future release.
Please migrate to the object-oriented SUEWSSimulation interface.
See SUEWSSimulation Class for the modern interface.
The core functions provide the primary interface for running SUEWS simulations using the legacy functional API.
6.2.1. Main Functions (Deprecated)#
|
Initialise supy by loading initial model states. |
|
Perform supy simulation. |
|
Save SuPy run results to files. |
|
Load forcing data for a specific grid included in the index of |
Load sample data for quickly starting a demo run. |
|
|
Display SUEWS version and system dependency information. |
Note
All functions except show_version() are deprecated.
Use SUEWSSimulation for new code.
6.2.2. Legacy Workflow Reference#
Warning
This workflow is deprecated. For new projects, use SUEWSSimulation instead.
The legacy functional API workflow consists of:
Load initial conditions:
init_supy()to set up model state (deprecated)Load forcing data:
load_forcing_grid()to load meteorological inputs (deprecated)Run simulation:
run_supy()to execute the model (deprecated)Save results:
save_supy()to write outputs to disk (deprecated)
Recommended: See SUEWSSimulation Class for the modern object-oriented interface.
6.2.3. Logging Controls#
These functions are not deprecated; they control where SuPy writes its logs.
|
Write SuPy log messages to a file (opt-in). |
Detach and close the opt-in file handler, if one is active. |
By default SuPy logs only to the console; no SuPy.log file is created.
Call enable_file_logging() to also write a log file (lazily created on
the first message, so an unused logger leaves no stray file) and
disable_file_logging() to stop it again:
import supy
supy.enable_file_logging() # writes SuPy.log in the current directory
supy.enable_file_logging("~/logs/run.log") # a specific file (~ is expanded)
supy.disable_file_logging() # stop writing to the file
To log into a directory (created if needed), use the SUPY_LOG_DIR
environment variable, which always writes SuPy.log inside it. File logging
can be enabled entirely without code by setting an environment variable before
importing supy:
export SUPY_LOGFILE=~/logs/run.log # explicit file path
export SUPY_LOG_DIR=~/logs # directory; file is SuPy.log inside it