DOI: 10.5281/zenodo.17434459
title: Nudging-based data assimilation method for error correction coupled with Huber loss functions and BiLSTM-GRU hybrids

description: Nudging-Based Data Assimilation for Error Correction Using Huber Loss Coupled with BiLSTM-GRU Hybrid Networks



Code Architecture and Workflow In this study, we employ multiple Python scripts to implement, demonstrate, and evaluate various stages of the proposed data assimilation framework. The structure and purpose of the key scripts are summarized as follows:


1.1 Core Scripts da_bilstm-gru-1_sparse.py (Code Example 1): Demonstrates the generation of Lorenz-96 simulation data and applies a hybrid neural network composed of BiLSTM and GRU layers for model training and data assimilation. This script includes the implementation of a custom Huber loss function and provides the fundamental assimilation workflow.

da_bilstm-gru-2_sparse.py to da_bilstm-gru-5_sparse.py (Code Examples 2–5): These scripts extend and test the assimilation procedure from various perspectives, including network depth, the number of neurons, training epochs, and observation configurations. While the general architecture remains consistent, these scripts explore different hyperparameter settings and experimental scenarios.

lorenz96_bilstm-gru_sparse.py: Serves as a reference script for generating synthetic data based on the Lorenz-96 system. It includes implementations of the Lorenz-96 right-hand side function (rhs) and a fourth-order Runge-Kutta (RK4) integrator. The script also simulates observational noise and prior trajectory perturbations.

1.2 Key Functional Components rhs(ne, u, forcing): Computes the right-hand side terms of the Lorenz-96 differential equations.

rk4(ne, dt, u, forcing): Integrates the Lorenz-96 system using a single step of the fourth-order Runge-Kutta method.

create_training_data_lstm(...) / create_training_data(...): Converts raw data into 3D tensor structures suitable for training recurrent neural networks.

Neural Network Module: Constructs, trains, and applies a BiLSTM-GRU hybrid neural network utilizing the Keras/TensorFlow framework.

1.3 Data Files The file lstm_data_sparse.npz contains the Lorenz-96 ground truth states, observations, and prior trajectories with initial errors. The data structure is as follows:

python 复制 data = np.load('lstm_data_sparse.npz') utrue = data['utrue'] # Ground truth states (ne, nt+1) uobs = data['uobs'] # Observations (ne, nb+1) uwe = data['uwe'] # Prior trajectories with errors (ne, npe, nt+1) Detailed usage examples are provided within the corresponding scripts.

1.4 Software Dependencies and Computing Environment Python Version: 3.7 or higher recommended.

TensorFlow / Keras: For neural network modeling and training (tensorflow==2.x or tensorflow-gpu==2.x).

NumPy, SciPy: For numerical operations and integration schemes.

scikit-learn: For data preprocessing (MinMaxScaler), dataset partitioning (train_test_split), and performance evaluation (MSE, MAE, R² metrics).

GPU Support: For GPU acceleration, appropriate TensorFlow GPU versions along with CUDA and cuDNN libraries must be properly installed and configured.



Code Usage Instructions 2.1 Execution Sequence Data Generation (Optional) To generate new synthetic datasets, the script lorenz96_bilstm-gru_sparse.py may be executed to create ground truth state trajectories and corresponding observational datasets. The outputs will be stored as lstm_data_sparse.npz.


Model Training and Assimilation The assimilation process can be initiated by running da_bilstm-gru-1_sparse.py (or any of the alternative versions provided). The script will:

Load data from lstm_data_sparse.npz.

Construct the BiLSTM-GRU hybrid neural network.

Train the model using the specified training data.

Save the trained model weights in HDF5 format (e.g., model_bilstm_gru.h5).

Perform data assimilation by sequentially correcting state estimates at observation time steps based on the trained model.

Evaluation and Visualization The scripts automatically compute standard evaluation metrics including MAE, MSE, RMSE, and R². Visualization routines are included to plot differences between the assimilated states and the true states for qualitative analysis.

2.2 Configurable Parameters ne: Number of state variables in the Lorenz-96 system (default: 40).

dt: Time step size (default: 0.005).

tmax: Total integration time (default: 10.0).

nf: Observation interval (i.e., frequency of available observations).

me: Number of observed variables; together with freq = ne / me determines spatial observation locations.

npe: Ensemble size, indicating the number of prior trajectories generated for training.

Neural Network Hyperparameters: Specified within each script, including the number of LSTM/GRU units, number of training epochs, batch size, etc.

2.3 Model Architecture and Output Neural Network Structure The model architecture integrates:

Bidirectional LSTM layers (Bidirectional(LSTM(...))),

GRU layers (GRU(...)),

Fully-connected Dense layers (Dense(...)).

Output Files Trained neural network weights saved in HDF5 format (e.g., model_bilstm_gru.h5).

Assimilation results exported as CSV files (e.g., t.csv, utrue.csv, uobs.csv, ulstm.csv) for downstream analysis and visualization.

Diagnostic plots illustrating assimilation performance and reconstruction accuracy.

This framework provides a flexible and extensible platform for investigating machine learning-based data assimilation using hybrid recurrent neural networks within chaotic dynamical systems such as Lorenz-96.

Changelog - Revision Summary for Nudging-based Data Assimilation Method for Error Correction Coupled with Huber Loss and BiLSTM-GRU Hybrids

This document summarizes all major revisions and additions made to the manuscript (blue text) during the current revision cycle.

🔧 Key Modifications 1️⃣ Title Refinement Clarified and standardized the paper title for better scientific rigor:

Before: Nudging-based data assimilation method for error correction...

After: Nudging-based Data Assimilation Method for Error Correction Coupled with Huber Loss and BiLSTM-GRU Hybrids

2️⃣ Key Points Enhanced Added clear bullet-point highlights to better emphasize key technical contributions:

The BiLSTM-GRU hybrid model’s superior performance.

The robustness benefits of Huber Loss.

Enhanced feature extraction via ReLU activation and dense layers.

3️⃣ Abstract Expanded Revised to emphasize:

Training via EnKF residuals.

Integration of Huber loss for improved error robustness.

Nudging mechanism for progressive correction.

Superior performance under strong forcing, sparse observations, and noisy conditions.

4️⃣ Plain Language Summary Added Added a non-technical summary emphasizing:

The hybrid BiLSTM-GRU + nudging approach.

Successful performance under noisy Lorenz-96 scenarios.

Comparison against EnKF.

5️⃣ Extended Background and Literature Review Added several recent studies to enrich the context:

Integration of ML with DA (Bocquet et al. 2019, Brajard et al. 2020, Farchi et al. 2021, etc.).

Recent advances in nudging combined with ML (Barthélemy et al. 2022, Peyron et al. 2021, Bora 2023).

Motivations for adopting Huber Loss (Saad et al. 2025, Trung et al. 2025).

6️⃣ Expanded Research Gap Section More detailed analysis on:

Limitations of prior LSTM-only models.

Need for better long- and short-term sequence modeling.

Advantages of combining BiLSTM + GRU + Huber loss for robust DA under noise and sparsity.

7️⃣ New Contribution Section Reformulated Clearly itemized 3 main technical innovations:

Multimodel ensemble design (BiLSTM-GRU hybrid).

Robust loss function integration (Huber Loss).

Deep feature extraction (ReLU activations + dense layers).

8️⃣ Detailed Model Framework (Section 2 Updated) New Figure 1 added to visualize full DA workflow.

Enhanced pseudocode for the BiLSTM-GRU nudging procedure.

Tables 1-3 updated to present both EnKF and BiLSTM-GRU configurations side-by-side.

Added Table 3 (Algorithm 1) to provide full nudging pseudocode.

9️⃣ Hyperparameter Sensitivity Analysis (New Section 4.2) Introduced new hyperparameter search results:

Optimal configuration: BiLSTM (128 units), GRU (256 units), dropout (0.1).

Presented via new Figure 2 heatmap series.

🔟 Extensive Numerical Experiments Enhanced Lorenz-96 sensitivity tests expanded to include: Loss function comparison (Huber vs MAE vs MSE).

RNN architecture comparison (RNN, LSTM, GRU, BiLSTM, BiLSTM-GRU).

Forcing parameter sensitivity (F = 6, 8, 10, 12).

Ensemble size sensitivity (N = 5, 20, 40, 80, 400).

Observation vector sensitivity (M = 2, 4, 8, 20).

Noise sensitivity (both observation and process noise levels).

Added new comparative visualizations: Figures 3–17: High-quality experimental plots with enhanced interpretability.

Cross-regime generalization analysis included (generalization matrix).

Comparison against stronger baseline LPF models (particle filters).

BiLSTM-V1 vs V2 model evolution performance comparisons.

🔢 New Section: Model Scalability and Discussion Thorough discussion on:

Model’s robustness under high noise.

Tradeoffs between accuracy and computational cost.

Potential extension to hybrid particle filters in future work.

Domain-adaptive limitations and need for transfer learning.

🔬 Updated Conclusion and Future Work Summary strengthened to:

Emphasize BiLSTM-GRU’s scalability for high-dimensional DA.

Position method as a strong candidate for real-world nonlinear chaotic systems.

Propose further extension via ensemble or domain-adaptive training strategies.

📊 New Supplementary Data for Reproducibility New datasets, hyperparameter details, and pseudocode for BiLSTM-GRU nudging made available in the supplementary GitHub repository:

github.com/mcvnbhfbrfgeht/huber-bilstm-gru-DA 🧮 Reference List Substantially Expanded Dozens of newly cited high-quality references (2021-2025) added to improve context and demonstrate literature coverage.