MPAS-Dev / MPAS-Tools

MPAS Tools Repository
Other
37 stars 63 forks source link

Add post-processing scripts for the ISMIP6 experiment #476

Closed hollyhan closed 1 year ago

hollyhan commented 1 year ago

This PR adds scripts that post-processes MALI state and flux output variables in the format required by the ISMIP6 team. In the previous (first) participation of the MALI team to the ISMIP6-2100 experimental protocol, post-processing MALI outputs involved many steps of manual running of several python scripts and nco commands, which can be tedious and exposed to potential human errors. The scripts here have been written to improve the automation of the workflow and thus reduce the room for making mistakes.

This set of scripts automate the process. There are separate steps for processing 2d state fields, 2d flux fields, and scalar fields. Within each step, there are operations for adjusting the raw MALI output if needed, time-averaging or time-subsetting as appropriate, and remapping to the ISMIP6 grid (as appropriate). It is recommended that post-processing be done on a compute/interactive node, as some of the steps can be time consuming.

hollyhan commented 1 year ago

Hi @matthewhoffman, the PR has been opened now! Note that I've left some lines in the script process_flux_variables.py commented out because I wanted your input on whether to keep them in the script or not, so your input on that would be appreciated!

If it helps (since there are many flags one needs to provide), here is the sample command line I used to run the scripts:

./post_process_mali_to_ismip6.py -i_state output_state.nc -i_flux output_flux_all.nc -i_init AIS_8to30km_r01_20220906.smooth3.basinsFineTuned.nc --mali_mesh_name AIS_8to30km --ismip6_grid_file UKESM1-0-LL_temperature_8km_x_60m.nc  -e ctrl -g globalStats.nc  -p /Users/hollyhan/ISMIP6-PostProcessing/files_states_processed/ 

Note that you might run into errors running the script if the MALI initial and output (state and flux) files that you use to test this PR are missing the variables required by the ISMIP6. There are also some lines that I commented out for now because the output files I was using did not have all of the variables required by the ISMIP6 (e.g., my output flux file was missing dHdt (dlithkdt) and basalHeatFlux (hfgeoubed) variable, so I commented out all of the lines related to the variable for now, but will uncomment them later when we have all of the variables required by the ISMIP6.)

Thanks for reviewing the PR!