Changelog¶
v0.3.0 - 2025-11-07¶
Critical Bug Fixes for Multi-Basin Flood Event Data:
- Fixed Time Array Misalignment in Evaluation:
- Fixed critical issue where multi-basin flood events used incorrect time arrays in NetCDF output
- Previous behavior: Used longest basin's time array for all basins, causing time misalignment for shorter basins
- Example issue: Basin 21100150's Event 26 showed "2020-08-31 to 2022-08-02" (spanning 2 years) when actual data ended at 2020-09-05
- New behavior: Creates unified time array from all basins' unique timestamps, then remaps each basin's data to correct time positions
- Modified
_save_all_results()inunified_evaluate.py(lines 403-470) -
Each basin now has accurate event timestamps in evaluation results
-
Fixed Data Access Issues in Calibration:
- Fixed
AttributeErrorwhen calibrating multi-basin flood event data - Previous behavior:
UnifiedCalibratortried to accessp_and_e.shape[1]whenp_and_e=Nonefor separate basin data - Added proper detection of
basin_data_separatemode inUnifiedCalibrator.__init__() - Modified
set_basin_index()to extract basin-specific data frombasin_data_separatewhen available - Each basin now uses its own time series without padding during calibration
-
Modified
unified_calibrate.py(lines 116-253, 377-386) -
Code Quality Improvements:
- Removed debug print statements from data loading pipeline
- Cleaned up verbose event statistics output in
unified_data_loader.py - Removed redundant basin information prints in
floodevent.py -
Fixed
SyntaxWarninginrun_xaj_calibration.pyby using raw string for file path -
Visualization Enhancements:
- Fixed metrics text overlap with legend in flood event plots
- Moved metrics display position from (0.98, 0.97) to (0.98, 0.70) to avoid overlap
- Metrics (NSE/RMSE/PBIAS) now display cleanly below legend on right side
- Modified
data_visualize.py(line 255)
Impact:
- Evaluation: Multi-basin flood event evaluations now produce correct NetCDF files with accurate timestamps for each basin
- Calibration: Multi-basin flood event calibrations now work correctly without data access errors
- Visualization: Event plots are cleaner with better layout and no overlapping text
Files Changed:
hydromodel/trainers/unified_evaluate.py: Time array unification and remapping logichydromodel/trainers/unified_calibrate.py: Basin data separation support and basin_ids detectionhydromodel/datasets/unified_data_loader.py: Removed debug print statementshydromodel/datasets/data_visualize.py: Adjusted metrics text positionscripts/run_xaj_calibration.py: Fixed path string syntax warning
Testing:
- Verified multi-basin flood event evaluation produces correct timestamps
- Verified multi-basin flood event calibration accesses correct basin data
- Confirmed clean console output without excessive debug information
v0.3.0 - 2025-11-06¶
Flood Event Data Support:
- Event ID System:
- Added
event_idtracking to group multi-peak flood events together - Modified
floodevent.pyto extract and passevent_idandevent_namefrom original data - Modified
_convert_events_to_arrays()to includeevent_idas 4th feature in p_and_e array - p_and_e shape changed from
[time, features=3]to[time, features=4]where features =[prcp, pet, marker, event_id] -
Prevents original flood events with multiple peaks from being split into separate visualizations
-
Simulation Code Fixes:
- Fixed
_simulate_event_data()inunified_simulate.pyto handle 4-feature input - Changed flood_event_marker extraction from index
-1to index2(to account for event_id as 4th feature) - Only passes first 3 features
[:3]to model function, excluding event_id -
Updated validation error message to reflect 3+ features format
-
Visualization Improvements:
- Modified
_identify_flood_events()to support grouping byevent_idwhen available - Only plots flood period data (
marker==1), excluding warmup (marker==NaN) and gaps (marker==0) - Filters time and data arrays to only include flood period timesteps
- Fixes issue where plots would span entire year or show overlapping x-axis ticks
-
Event count now correctly reflects original flood events (e.g., 26 events instead of 39 peaks)
-
Time Handling Fixes:
- Fixed time array padding for multi-basin flood event data
- Extends time arrays with regular intervals using
pd.date_range()when padding data - Fixed pandas FutureWarning by replacing
'H'with'h'and'D'with'd'in frequency strings -
Extracts real event timestamps from original flood event data instead of generating dummy times
-
Evaluation Results:
- Modified
_save_evaluation_results()to saveevent_idas additional variable in NetCDF output - Enables visualization to group multi-peak events by original event_id
Files Changed:
hydrodatasource/reader/floodevent.py: Event ID and time extractionhydromodel/datasets/unified_data_loader.py: 4-feature p_and_e array, time paddinghydromodel/trainers/unified_simulate.py: 4-feature input handlinghydromodel/trainers/unified_evaluate.py: Event ID saving to NetCDFhydromodel/datasets/data_visualize.py: Event grouping and flood period filtering
Known Issues:
- Visualization still shows some x-axis overlap issues for certain events (pending further investigation)
v0.3.0 - 2025-11-05¶
Multi-Basin Support:
- Fixed Multi-Basin Unit Conversion:
- Fixed broadcasting error in
streamflow_unit_convfor multi-basin data - Modified
UnifiedDataLoader._check_and_convert_units()to process basins individually - Modified
_save_evaluation_results()to convert units basin-by-basin - Now properly handles dimension order (
["basin", "time"]or["time", "basin"]) - Successfully tested calibration and evaluation on CAMELS-US multi-basin datasets
Calibration Improvements:
- Parameter Display Enhancement:
- All three algorithms (SCE-UA, GA, scipy) now display denormalized parameters (actual physical ranges)
- Changed console output from normalized values (0-1) to actual parameter ranges
- Uses the same denormalization formula as
process_parameters()inparam_utils.py - Format: "Best parameters (actual ranges)" with physical values
Files Changed:
hydromodel/trainers/unified_calibrate.py: Parameter display for all three algorithmshydromodel/datasets/unified_data_loader.py: Multi-basin unit conversionhydromodel/trainers/unified_evaluate.py: Multi-basin evaluation results saving
Testing:
- Verified multi-basin calibration on CAMELS-US dataset
- Verified multi-basin evaluation on CAMELS-US dataset
- All three calibration algorithms tested with multi-basin data
v0.3.0 - 2025-11-04¶
Major Improvements:
- Configurable File Saving:
- Added
save_configoption intraining_cfgs(default:True) - Controls saving of
calibration_config.yamlandparam_range.yaml param_range.yamlnow only contains the current model's parameters (not all models)calibration_config.yamlrecords actualparam_range_filepath instead ofnull- Command-line flag
--no-save-configto disable saving
Bug Fixes:
- Fixed
param_range.yamlcontaining all models instead of only the current model - Fixed
calibration_config.yamlnot recording the actualparam_range_filepath
Documentation:
- Updated README.md and README_zh.md with
save_configusage - Documented
param_range.yamlbehavior (only saves current model) - Updated example_config.yaml with save_config option
Testing:
- Verified all three calibration algorithms (SCE-UA, GA, scipy) work correctly
- Tested configuration file saving functionality
v0.3.0 - 2025-11-04¶
Major Improvements:
- Unified Calibration Interface: All three algorithms (SCE-UA, GA, scipy) now use a consistent API
- Standardized Results Format:
- All algorithms save best parameters to
calibration_results.json(unified format) - All algorithms save detailed iteration history to CSV with parameter values
- CSV format unified across GA and scipy (
objective_value+param_{name}columns) - Enhanced Progress Tracking:
- Real-time progress display for all algorithms
- Progress bars for GA using tqdm
- Iteration-by-iteration output for scipy
- Generation-by-generation statistics for GA
- Improved Parameter Loading:
- Automatic fallback: JSON → GA CSV → scipy CSV → SCE-UA CSV → legacy TXT
- Clear error messages showing all attempted file paths
- Support for all algorithm result formats in evaluation
New Features:
- Genetic Algorithm (GA) Enhancements:
- Saves detailed generation history with all parameter values
- Custom bounded mutation operator
- Generation statistics (min, mean, max, best fitness)
- Compatible CSV format with scipy results
- scipy Optimizer Enhancements:
- Iteration history tracking with parameter values
- Progress display every N iterations
- Detailed convergence information
- Support for multiple scipy methods (SLSQP, L-BFGS-B, TNC, etc.)
- Unified Configuration:
- All algorithm parameters configurable via YAML
- Example config includes all three algorithms with defaults
- Algorithm aliases:
SCE_UA/sceua,GA/genetic_algorithm,scipy/scipy_minimize
Bug Fixes:
- Fixed GA evaluation function returning tuple of list instead of tuple of float
- Fixed scipy/GA algorithm name matching using
inoperator instead ofor - Fixed parameter loading failure when
calibration_results.jsonnot found - Added error handling for all parameter loading methods
Documentation:
- Updated README.md with complete algorithm parameter documentation
- Updated README_zh.md with Chinese documentation
- Updated quickstart.md with algorithm comparison guide
- Added convergence analysis examples
- Added results format explanation
- Updated configuration examples with all algorithm parameters
v0.2.11 - 2025-11-02¶
Improvement:
- Refactored visualization and cleanup codebase
- Updated GitHub workflows
New Features:
- Added unified simulate interface
- Added parameter file support for simulation
v0.0.1 - 2024-XX-XX¶
Initial Release:
- Basic XAJ model implementation
- SCE-UA calibration support
- CAMELS dataset integration