Skip to content

Commit 0cc4463

Browse files
authored
Merge pull request #39 from zsarnoczay/main
Code Quality Improvements and Enhanced Hazus Usability
2 parents 6d557bf + 5f4db65 commit 0cc4463

22 files changed

Lines changed: 1081 additions & 889 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/data_sources/HAZUS_MH_4.2_HU/session.dill
33
/doc/build/
44
*.pyc
5+
*.ipynb
56
/.ropeproject/
67
/doc/cache/
78
/doc/source/dl_doc/

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
---
1111

12+
## [2.1.0] - 2025-09-11
13+
14+
This release focuses on improving code quality and enhancing usability of Hazus assessments. The changes maintain backward compatibility while providing users with more flexibility in input specification and ensuring the codebase adheres to modern Python best practices.
15+
16+
### Changed
17+
- **Input Validation:** Relaxed validation constraints for seismic and flood assessments to improve usability:
18+
- Allow HeightClass attribute for seismic structural systems (W1, W2, S3, PC1, MH) that don't require it in Hazus methodology
19+
- Remove PlanArea field from auto-populated seismic configuration as it's no longer needed
20+
- Allow RES1 occupancy buildings to have more than 3 stories in flood assessments, aligning with FEMA technical manual interpretation
21+
- **Code Quality:** Comprehensive code formatting and linting improvements using Ruff across the entire codebase:
22+
- Applied consistent code formatting across 15 Python files
23+
- Fixed docstring formatting and missing docstring issues
24+
- Cleaned up import statements and unused code
25+
- Standardized quote usage and line spacing
26+
27+
### Fixed
28+
- Resolved spelling issues in comments
29+
30+
---
31+
1232
## [2.0.0] - 2025-08-15
1333

1434
This release marks a major milestone for the Damage and Loss Model Library and the beginning of a more frequent and structured release schedule. After more than two years of continuous development, `v2.0.0` introduces a significantly improved data schema, a host of new models, and a documentation system for model discovery.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A curated, open-source repository of standardized model parameters and metadata
1111

1212
The Damage and Loss Model Library (DLML) is a project from the NHERI SimCenter designed to address a critical gap in natural hazards engineering: the lack of a centralized, standardized, and easy-to-use repository for damage and loss models. This library provides the essential data—model parameters, descriptive metadata, and configuration files—that power natural hazard risk assessment simulations.
1313

14-
This `v2.0.0` release represents a significant evolution of the project, featuring an improved data schema, a host of new and updated models, and a documentation system.
14+
This `v2.1.0` release continues the evolution of the project, building on the improved data schema, extensive model collection, and documentation system introduced in v2.0.0, with enhanced code quality and improved usability for Hazus assessments.
1515

1616
**Key Features:**
1717
* **Standardized Data Schema:** A robust yet flexible schema for organizing models by hazard, asset type, and resolution, making it easy to use data and supporting new contributions.

doc/source/_extensions/visuals.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# # noqa: D100
1+
#
22
# Copyright (c) 2023 Leland Stanford Junior University
33
# Copyright (c) 2023 The Regents of the University of California
44
#
@@ -280,7 +280,7 @@ def plot_fragility(comp_db_path, output_path, create_zip='0'): # noqa: C901, D1
280280
table_vals[1] = np.array(ds_list)
281281

282282
font_size = 16
283-
if ds_i > 8: # noqa: PLR2004
283+
if ds_i > 8:
284284
font_size = 8.5
285285

286286
fig.add_trace(
@@ -317,7 +317,7 @@ def plot_fragility(comp_db_path, output_path, create_zip='0'): # noqa: C901, D1
317317
ds_offset = 0.086
318318
info_font_size = 10
319319

320-
if ds_i > 8: # noqa: PLR2004
320+
if ds_i > 8:
321321
x_loc = 0.4928
322322
y_loc = 0.705 + 0.123
323323
ds_offset = 0.0455
@@ -575,9 +575,9 @@ def plot_repair( # noqa: C901, PLR0912, PLR0915
575575
conseq_val = float(val)
576576
if conseq_val < 1:
577577
table_vals[1][ds_i] = f'{conseq_val:.4g}'
578-
elif conseq_val < 10: # noqa: PLR2004
578+
elif conseq_val < 10:
579579
table_vals[1][ds_i] = f'{conseq_val:.3g}'
580-
elif conseq_val < 1e6: # noqa: PLR2004
580+
elif conseq_val < 1e6:
581581
table_vals[1][ds_i] = f'{conseq_val:.0f}'
582582
else:
583583
table_vals[1][ds_i] = f'{conseq_val:.3g}'
@@ -594,7 +594,7 @@ def plot_repair( # noqa: C901, PLR0912, PLR0915
594594
]
595595

596596
# converted simultaneous damage models might have a lot of DSs
597-
if table_vals.shape[1] > 8: # noqa: PLR2004
597+
if table_vals.shape[1] > 8:
598598
lots_of_ds = True
599599
else:
600600
lots_of_ds = False

doc/source/release_notes/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ Release Notes
77
The following sections document the notable changes of each release.
88
The sequence of all changes is available in the `commit logs <https://github.com/NHERI-SimCenter/DamageAndLossModelLibrary/commits/>`_.
99

10-
Version 1
10+
Version 2
1111
-----------
1212

1313
.. toctree::
1414
:maxdepth: 2
1515

16+
v2.1.0
1617
v2.0.0
1718
v1.0.0

doc/source/release_notes/v1.0.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _changes_v1_0:
22

3-
==========================
3+
============================
44
Version 1.0.0 (May 19, 2023)
5-
==========================
5+
============================
66

77
Initial Release.
88

doc/source/release_notes/v2.0.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _changes_v2_0:
22

3-
=============================
3+
===============================
44
Version 2.0.0 (August 15, 2025)
5-
=============================
5+
===============================
66

77
This release marks a major milestone for the Damage and Loss Model Library and the beginning of a more frequent and structured release schedule. After more than two years of continuous development, ``v2.0.0`` introduces a significantly improved data schema, a host of new models, and a documentation system for model discovery.
88

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _changes_v2_1:
2+
3+
==================================
4+
Version 2.1.0 (September 11, 2025)
5+
==================================
6+
7+
This release focuses on improving code quality and enhancing usability of Hazus assessments. The changes maintain backward compatibility while providing users with more flexibility in input specification and ensuring the codebase adheres to modern Python best practices.
8+
9+
Changed
10+
-------
11+
12+
- **Input Validation:** Relaxed validation constraints for seismic and flood assessments to improve usability:
13+
14+
- Allow HeightClass attribute for seismic structural systems (W1, W2, S3, PC1, MH) that don't require it in Hazus methodology
15+
- Remove PlanArea field from auto-populated seismic configuration as it's no longer needed
16+
- Allow RES1 occupancy buildings to have more than 3 stories in flood assessments, aligning with FEMA technical manual interpretation
17+
18+
- **Code Quality:** Comprehensive code formatting and linting improvements using Ruff across the entire codebase:
19+
20+
- Applied consistent code formatting across 15 Python files
21+
- Fixed docstring formatting and missing docstring issues
22+
- Cleaned up import statements and unused code
23+
- Standardized quote usage and line spacing
24+
25+
Fixed
26+
-----
27+
28+
- Resolved spelling issues in comments

0 commit comments

Comments
 (0)