Python library for the implementation of MuSt3Net (Multiple Steps 3D Convolutional Neural Network for data integration (or model data fusion)). This project developes a convolutional neural network (CNN) to perform model data fusion through an innovative 2-step training pocedure.
pip install -r requirements.txt The code is organized as follows:
--MuSt3Netcontains the functions for the implementation of the CNN architecture and for the 2-step training procedure--plotscontains the functions to generate the plots--data_preprocessingcontains the functions to generate the input data (3D tensors for the CNN trainings)--RMSE_computationcontain the funtions to compute the RMSE to assess the model results--utilscontains all the auxiliary functions for models' training and validation
To train the MuSt3Net model, it is sufficient to run the 2_step_train_ensemble.py script:
sbatch ./2_step_train_ensemble.sh The .sh script run the .py script, which is organized as follows:
- it downloads the data from the dataset_training directory and it uses the function training_1p (
--MuSt3Net/training_testing_function.training_1p) to emulate the BFM model - it uses the function testing_1p (
--MuSt3Net/training_testing_function.testing_1p) to test the quality of the BFM emulation on the test dataset - it downloads the data from the dataset_training directory and the model_1p results and it uses the function training_2p (
--MuSt3Net/training_testing_function.training_2p) to integrate Argo-floats - it uses the function testing_2p_ensemble (
--MuSt3Net/training_testing_function.testing_2p_ensemble) to test the quality of the integration on the test dataset
To manage the runtime, which could exceed 24 hours, the code flow is ruled by 3 binary parameters
--first_run_idis the parameter which identifies the first run of the job; it is useful to correctly download data.--end_train_1pis the parameter which identifies if the 1st training step is ended or not.--end_1pis the parameter which identifies if the 1st step (training and testing) is ended or not. if is true, the code passes to execute the 2nd step.
The input data are concatenation od 3D tensors, representing the 3D distribution of physical variables and chlorophyll.
To obtain these tensors starting from netCDF files (.nc), it is sufficient to run the data_preprocessing/run_data_preprocessing.py script, in which, for each single variable:
--make_dataset_single_varcreates the .npy file in which the 3D distribution of a single variable is saved. The file--make_dataset_floatdoes the same for the float measures.--plot_save_tensortransforms the .npy in a .pt file--interpolationinterpolates the .pt file in order to reach an higher spatial resolution; different interpolation functions are implemented for numerical model data and float data. The final tensors are stored infinal_tensorfolder, inside thedatasetfolder, and they are simply a copy of theinterp_tensorfolder. Due to high dimensionality of data and lower computational resources, the tensor data for the 1st training step can be generated through the scriptgeneration_training_datasetand therefore stored indataset_trainingfolder.
The results, along with the trained models, will be automatically saved in the directory referred to the current job; the plots directory contain all the plots used to see and evaluate the prediction quality.
Different plots are used for this purpose, in particular:
--maps 1pare the maps which compares the 1st training step results with the BFM predictions--maps 2pare the maps which shows the chlorophyll 3D maps after the data integration with ARGO floats--profiles 1pare the plots which compares the same profiles computed by the MuSt3Net after the 1st training step and the BFM one--profiles 2pare the plots which compares the same profiles computed by the MuSt3Net after the 2nd training step and the real BGC-Argo float measure--hovmollerare the plots which show the temporal behavior of the predicted chlorophyll--hovmoller_externalare the plots which show the temporal behavior of the predicted chlorophyll on unseen float data
To asses the result quality, the plots are coupled with the computation of the root mean square error (RMSE).
The RMSE_computation/rmse_function_test.sh runs the RMSE_computation/rmse_function_test.pyscript, which computes the RMSE with respect to different geographical areas (RMSE_compiutation/rmse_functions.RMSE_ensemble_ga) and the RMSE with respect to different seasons (RMSE_computation/rmse_functions.RMSE_ensemble_season).
To apply the same architecture for the prediction of other biogeochemical variables, it could be useful to modify the model architecture, for example, adding or removing some convolutional layers. The default architectures are located in:
MuSt3Net/convolutional_network.py.
The dimension of the training dataset exceeds the available memory space of github. A portion of the dataset is available in Zenodo (https://zenodo.org/records/17580239); for the whole training dataset, ask the codeowner and it will be sent.
We acknowledge this study does not include any direct comparison with DA methods, as a meaningful comparison would necessitate new experiments performed under strictly controlled and comparable conditions, such as the same dataset. This remains an important direction for future developments.