Skip to content

Commit

Permalink
Update STEBBS configuration loading and test conditions
Browse files Browse the repository at this point in the history
- Modify STEBBS file path selection based on 'stebbsmethod' parameter
- Add support for different input file paths in _load.py
- Update test configuration to use 'any' instead of 'all' for test flag conditions
- Minor code cleanup and path handling improvements
  • Loading branch information
sunt05 committed Jan 29, 2025
2 parents 02938ae + 63f2dcf commit caf18c8
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/suews/src/suews_phys_stebbs.f95
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,7 @@ SUBROUTINE tstep( &
IF (Awater_vessel > 0.0) THEN
VARatio_water_vessel = Vwater_vessel/Awater_vessel
END IF

IF (MOD(timestep, resolution) == 0) THEN
looptime: DO i = 1, INT(timestep/resolution), 1
Qsw_transmitted_window = windowInsolation(Qsw_dn_extwall, winT, Awindow)
Expand Down
52 changes: 39 additions & 13 deletions src/supy/_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,24 +1378,50 @@ def load_SUEWS_dict_ModConfig(path_runcontrol, dict_default=dict_RunControl_defa
/ "SUEWS_SPARTACUS.nml"
)


# load STEBBS-specific variables:
path_stebbs_typologies = (
path_runcontrol.parent
/ dict_RunControl["fileinputpath"]
/ "test_stebbs_building_typologies.nml"
)
path_stebbs_general = (
path_runcontrol.parent
/ dict_RunControl["fileinputpath"]
/ "test_stebbs_general_params.nml"
)
if dict_RunControl["stebbsmethod"] == 2:
path_stebbs_typologies = (
path_runcontrol.parent
/ dict_RunControl["fileinputpath"]
/ "stebbs_building_typologies.nml"
)
path_stebbs_general = (
path_runcontrol.parent
/ dict_RunControl["fileinputpath"]
/ "stebbs_general_params.nml"
)
else:
path_stebbs_typologies = (
trv_supy_module / "sample_run" / "Input"
/ "test_stebbs_building_typologies.nml"
)
path_stebbs_general = (
trv_supy_module / "sample_run" / "Input"
/ "test_stebbs_general_params.nml"
)

dict_RunControl_x = {k[0]: v for k, v in load_SUEWS_nml(path_spartacus).items()}
dict_RunControl.update(dict_RunControl_x)

dict_RunControl_y = {
k[0]: v for k, v in load_SUEWS_nml(path_stebbs_typologies).items()
}
# load STEBBS-specific variables:
if dict_RunControl["stebbsmethod"] == 1:
path_stebbs_typologies = (
path_runcontrol.parent
/ dict_RunControl["fileinputpath"]
/ "test_stebbs_building_typologies.nml"
)
path_stebbs_general = (
path_runcontrol.parent
/ dict_RunControl["fileinputpath"]
/ "test_stebbs_general_params.nml"
)
else:
trv_SampleData = trv_supy_module / "sample_run"
path_stebbs_general = trv_SampleData / "Input/test_stebbs_general_params.nml"
path_stebbs_typologies = trv_SampleData / "Input/test_stebbs_building_typologies.nml"

dict_RunControl_y = {k[0]: v for k, v in load_SUEWS_nml(path_stebbs_typologies).items()}
dict_RunControl.update(dict_RunControl_y)

dict_RunControl_z = {
Expand Down
22 changes: 17 additions & 5 deletions test/test_supy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@
p_df_sample = Path(test_data_dir) / "sample_output.pkl"

# if platform is macOS and python version is 3.12, set flag_full_test to True
flag_full_test = all(
flag_full_test = any(
[
sys.version_info[0] == 3,
sys.version_info[1] == 12,
platform.system() == "Darwin",
platform.machine() == "arm64",
all(
[
sys.version_info[0] == 3,
sys.version_info[1] == 12,
platform.system() == "Darwin",
platform.machine() == "arm64",
]
),
all(
[
sys.version_info[0] == 3,
sys.version_info[1] == 13,
platform.system() == "Linux",
platform.machine() == "x86_64",
]
),
]
)

Expand Down

0 comments on commit caf18c8

Please sign in to comment.