This script loads and preprocesses meteorological data from multiple stations, computes weighted averages based on spatial distances, merges sub-basin precipitation records, and engineers features (lag, cumulative, seasonal) for use in runoff prediction models (e.g., XGBoost). It includes PACF-based lag selection, feature importance filtering, and prepares a dataset aligned with runoff records for model training.
Inputs: Meteorological station CSVs, sub-basin precipitation CSVs, flow records, station info, and subbasin metadata.
Outputs: Cleaned and engineered feature matrix ready for ML training.
Main Features: Distance-weighted averaging, lag/cumulative features, seasonal encoding, PACF analysis, optional clustering.
To tackle the challenge of extreme runoff simulation in data-limited hydrological regions, this study introduces a novel approach to enhance runoff simulation accuracy in the typical humid basin in China by integrating the Soil and Water Assessment Tool (SWAT) sub-basin delineation into the XGBoost model. We optimized sub-basin precipitation extraction and basin-scale aggregation methods to improve accuracy of extreme runoff simulation. The Fengyun Quantitative Precipitation Estimation (FY QPE) was validated for its potential in hydrological modeling, and SHAP analysis was employed to quantify the contributions of driving factors, revealing the underlying mechanisms of hydrological elements. Representative precipitation sequences were extracted using mean values (FYm) and hybrid maximum-mean strategies (FYmm70, FYmm75, FYmm80, FYmm85, FYmm90, FYmm95) tailored to extreme runoff thresholds. Five aggregation methods—Mean, Area-weighted (A), Distance-to-Center (D2C), Distance-to-Outlet (D2O), and Cluster—were explored to derive basin-scale precipitation inputs, bridging distributed and lumped modeling for enhanced stability and interpretability. Results show FY QPE correlates highly with in-situ data (CC > 0.87, NSE > 0.74), despite underestimating extremes. XGBoost outperforms SWAT with an 8% NSE improvement and reduced PBIAS. FYmm85 and FYmm90 excel in extreme high runoff simulation (PBIAS improvement >20%), while D2C and D2O aggregation methods yield the best overall performance (NSE 0.84–0.85, KGE 0.86–0.89). Cumulative precipitation (7-day and 15-day) as the dominant driver, with seasonal variations influenced by humidity and sunshine duration. This framework advances satellite-driven hydrological modeling by improving precipitation spatial representativeness, reducing biases in extremes, and enhancing model explainability. If you have any further questions, please feel free to contact me at heklong666@gmail.com.