MuSA
A flexible data assimilation toolbox for experimental and operational snowpack reanalysis development.
https://github.com/ealonsogzl/musa
Category: Cryosphere
Sub Category: Snow and Permafrost
Last synced: about 3 hours ago
JSON representation
Repository metadata
MuSA: The Multiple Snow Assimilation system
- Host: GitHub
- URL: https://github.com/ealonsogzl/musa
- Owner: ealonsogzl
- License: gpl-3.0
- Created: 2021-12-14T09:57:15.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-11-24T18:38:19.000Z (about 1 month ago)
- Last Synced: 2025-12-07T10:07:07.773Z (17 days ago)
- Language: Python
- Homepage:
- Size: 26.2 MB
- Stars: 24
- Watchers: 8
- Forks: 13
- Open Issues: 0
- Releases: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
README.md
MuSA: The Multiple Snow Assimilation system
The Multiple Snow Assimilation System (MuSA), is a flexible data assimilation toolbox for experimental and operational snowpack reanalysis development. MuSA was designed to fuse gridded observations with an ensemble of simulations generated by the Flexible Snow Model (FSM2) by using different Bayesian based data assimilation algorithms.
In its current version, it also offers support for the Snow17 model and a simple temperature index model. Potentially other numerical models could be implemented (not necessarily limited to snow models).

Figure 1: Comparison between open loop and updated simulation after assimilating UAV snow depth retrievals at 5m resolution
Inputs
The inputs of MuSA are composed by meteorological forcing and observations to be assimilated. Both the forcing and observations must share the same geometry, with the same resolution and number of cells in the latitudinal and longitudinal axes, and should be provided in the netCDF format. In this version, the meteorological forcing must be provided in an hourly timestep. Optionally it is possible to provide a mask with the same geometry of the mandatory input files to avoid to run MuSA over certain cells of your domain. The meteorological forcing needed for running MuSA is composed by:
- Incident shortwave radiation (W m-2)
- Incident longwave radiation ( W m-2)
- Precipitation (Kg-2 m-2 s-1)
- Temperature (K)
- Relative Humidity (%)
- Wind speed (m s-1)
- Atmospheric pressure (Pa)
In its current version MuSA provides support for assimilating different variables. Note that it is possible to provide more than one of the following variables at the same time, i.e. MuSA has support for joint assimilation experiments. In its current version, MuSA is able to assimilate:
- SWE (mm)
- Snow depth (m)
- Land/Snow surface temperature (K)
- Fractional snow cover area (-)
- Albedo (-)
- Sensible heat flux to the atmosphere (W m-2)
- Latent heat flux to the atmosphere (W m-2)
The support of other variables like liquid water content, density, ice content etc. could be relatively easily implemented on demand.
Data assimilation algorithms
There are different data assimilation and resampling algorithms implemented in MuSA. Some testing should be done when developing data assimilation experiments, as the performance may be different depending on the problem to solve, and regarding the literature there is not a clear winner. Also, the computational cost will be different, and may be a strong conditioner in some situations.
Filters:
- Particle Filter (PF)
- Ensemble Kalman filter (EnKF)
- Iterative ensemble Kalman filter (IEnKF)
Smoothers:
- Particle batch smoother (PBS)
- Ensemble smoother (ES)
- Iterative ensemble smoother (IES)
- Particle-adjusted iterative ensemble smoother (PIES)
- Robust Adaptive Metropolis initialised by IES (IES-MCMC)
Resampling (for particle filters only):
- Bootstrapping
- Residual resampling
- Stratified resampling
- Systematic resampling
- Redraw from a normal approximation of the posterior
Outputs
The outputs of MuSA are pickles compressed with blosc (the latid_lonid.pkl.bl format). Each file stores a dictionary containing the following dataframes:
- DA_Results: Contains information about the observed variables and posterior parameters (in the normal space).
- OL_Sim: Contains the reference simulation (snow simulation without any assimilation).
- mean_Prior: Contains the prior mean of the ensemble (no assimilation)
- std_Prior: Contains the prior standar deviation of the ensemble (no assimilation)
- mean_Post: Contains the updated simulation after the assimilation, i.e. weighted mean of the ensemble of simulations.
- std_Post: Contains the weighted standard deviation of the ensemble after the assimilation.
You can open these files by your own means, or by using the following function:
from modules.internal_fns.py import io_read
my_cell = io_read(./RESULTS/latid_lonid.pkl.blp)
lonid and latid are the longitude and latitude ids of each cell of the simulation.
Additionally it is possible to store the ensembles generated for each cell. This is an optional feature as it may be a bit memory consuming. However It may be useful in some circumstances specially for advanced users. The ensembles will be stored in the same format, and will containing Ensemble objects.
Usage
MuSA works on GNU/Linux (and therefore Mac) based platforms. MuSA has been tested also in Windows using the Windows Subsystem for Linux (WSL). MuSA relies on python3 with the usual scientific libraries (numpy, pandas, scipy...) and netCDF4 installed. You will also need to have gfortran in the path. The easiest way to do this is to generate a dedicated conda environment. You can use the MuSAenv.yml file of the repository to create the conda environment:
conda env create --name MuSAenv --file=MuSAenv.yml
Then for running MuSA simply:
conda activate MuSAenv
python main.py
Or if MPI is activated in the config.py file:
conda activate MuSAenv
mpiexec -n nprocess python -m mpi4py.futures main.py
Where nprocess is the number of threads to be deployed.
These commands should run the reproducible example included in the repository. This example contains all the information needed by MuSA. It is composed of a few cells containing meteorological forcing and drone SfM derived snowdepth information. To change the configuration of MuSA, you should modify the config.py file. Also it is possible to modify the way MuSA generates the ensemble by modifying the constants.py file.
An example script is also provided to run MuSA in distributed supercomputing facilities using PBS (Portable Batch System, not Particle Batch Smoother 😉) or Slurm arrays. The use of PBS/Slurm arrays is compatible with both MPI and multiprocessing. The use of PBS/Slurm arrays is compatible with both MPI and multiprocessing, allowing many different parallelization schemes depending on the need.
If the spatial propagation is activated, it is necessary to launch the pre-processor that activates the spatial prior sampling before launching the main program.
conda activate MuSAenv
python pre_main_spatial.py
python main.py
How to cite and license
This software is licensed under the GNU General Public License v3.0 (GPL-3.0).
In addition to the terms of the GPL-3.0, we kindly request that any scientific publication, presentation, or derived work using this software includes the following citation:
Alonso-González, E., Aalstad, K., Baba, M. W., Revuelto, J., López-Moreno, J. I., Fiddes, J., Essery, R., and Gascoin, S.: The Multiple Snow Data Assimilation System (MuSA v1.0), Geosci. Model Dev., 15, 9127–9155, https://doi.org/10.5194/gmd-15-9127-2022, 2022.
This citation requirement does not alter or restrict the rights granted under the GPL-3.0 license.
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Alonso-González"
given-names: "Esteban"
orcid: "https://orcid.org/0000-0002-1883-3823"
- family-names: "Aalstad"
given-names: "Kristoffer"
orcid: "https://orcid.org/0000-0002-2475-3731"
title: "MuSA: The Multiple Snow Assimilation system"
version: 2.2
doi: 10.5281/zenodo.14065646
date-released: 2024-11-11
url: "https://github.com/ealonsogzl/MuSA"
preferred-citation:
type: article
authors:
- family-names: "Alonso-González"
given-names: "Esteban"
- family-names: "Aalstad"
given-names: "Kristoffer"
- family-names: "Baba"
given-names: "M. W."
- family-names: "Revuelto"
given-names: "Javier"
- family-names: "López-Moreno"
given-names: "José I."
- family-names: "Fiddes"
given-names: "Joel"
- family-names: "Essery"
given-names: "Richard"
- family-names: "Gascoin"
given-names: "Simon"
doi: "10.5194/gmd-15-9127-2022"
journal: "Geoscientific Model Development"
title: "The Multiple Snow Data Assimilation System (MuSA v1.0)"
volume: 15
start: 9127
end: 9155
year: 2022
Owner metadata
- Name: Esteban Alonso González
- Login: ealonsogzl
- Email:
- Kind: user
- Description:
- Website:
- Location: Spain
- Twitter:
- Company: IPE - CSIC
- Icon url: https://avatars.githubusercontent.com/u/39377932?u=6e84f04f0324acfa6146dd7c822b232dec1b3316&v=4
- Repositories: 2
- Last ynced at: 2025-06-19T16:54:13.817Z
- Profile URL: https://github.com/ealonsogzl
GitHub Events
Total
- Release event: 1
- Watch event: 9
- Issue comment event: 2
- Push event: 27
- Pull request review event: 1
- Pull request event: 4
- Fork event: 2
- Create event: 1
Last Year
- Watch event: 8
- Issue comment event: 2
- Push event: 23
- Pull request review event: 1
- Pull request event: 4
- Fork event: 1
Committers metadata
Last synced: 3 days ago
Total Commits: 251
Total Committers: 6
Avg Commits per committer: 41.833
Development Distribution Score (DDS): 0.127
Commits in past year: 47
Committers in past year: 4
Avg Commits per committer in past year: 11.75
Development Distribution Score (DDS) in past year: 0.106
| Name | Commits | |
|---|---|---|
| Esteban Alonso | e****l@g****m | 219 |
| mmazzolini | m****c@g****m | 17 |
| Esteban Alonso | e****m | 6 |
| krisaalstad | k****d@g****m | 5 |
| geopanda1 | a****t@g****m | 3 |
| cesardb | c****b@h****r | 1 |
Issue and Pull Request metadata
Last synced: 2 months ago
Total issues: 4
Total pull requests: 21
Average time to close issues: 3 days
Average time to close pull requests: 1 day
Total issue authors: 2
Total pull request authors: 5
Average comments per issue: 2.25
Average comments per pull request: 0.95
Merged pull request: 19
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 4
Past year average time to close issues: N/A
Past year average time to close pull requests: about 18 hours
Past year issue authors: 0
Past year pull request authors: 3
Past year average comments per issue: 0
Past year average comments per pull request: 0.75
Past year merged pull request: 4
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- ealonsogzl (3)
- krisaalstad (1)
Top Pull Request Authors
- mmazzolini (9)
- ealonsogzl (5)
- krisaalstad (5)
- geopanda1 (1)
- cesar-db (1)
Top Issue Labels
- bug (1)
- help wanted (1)
Top Pull Request Labels
Score: 4.969813299576001