MPAS-Dev / MPAS-Tools

MPAS Tools Repository
Other
37 stars 63 forks source link

Add a general script for plotting 2D output #481

Closed trhille closed 1 year ago

trhille commented 1 year ago

Add a generalized script for plotting 2D output for arbitrary numbers of output files, variables, and time levels. The purposes of this script are:

  1. to serve as a quick-view tool so that we don't have to scp large output files for simple visualization.
  2. to serve as a template for more customized plotting scripts for presentations and publications.
trhille commented 1 year ago

Usage example:

python plot_maps.py -r /global/cscratch1/sd/trhille/Thwaites_1to8km_r02_20220427/climatology/uncoupled/remove_shear_zone/VM250/output_2015.nc,/global/cscratch1/sd/trhille/Thwaites_1to8km_r02_20220427/climatology/coupled/remove_shear_zone/VM250_enhancement_factor/output_2015.nc -t 0,-1 -v thickness,surfaceSpeed -c Blues,plasma

image

trhille commented 1 year ago

This is also flexible enough to plot results from different meshes in separate figures with a single command:

python plot_maps.py -r /global/cscratch1/sd/trhille/Thwaites_1to8km_r02_20220427/climatology/uncoupled/remove_shear_zone/VM250/output_2015.nc,/global/cscratch1/sd/trhille/Humboldt_1to10km_r04_20210615/m5/HadGEM2/VM160_shelfMelt20myr/output.nc -t 0,-1 -v thickness,surfaceSpeed -c Blues,plasma

image

trhille commented 1 year ago

Updated usage example with new standardized color ranges and log-scale option for surfaceSpeed:

python plot_maps.py -r /global/cscratch1/sd/trhille/Thwaites_1to8km_r02_20220427/climatology/uncoupled/remove_shear_zone/VM250/output_2015.nc,/global/cscratch1/sd/trhille/Humboldt_1to10km_r04_20210615/m5/HadGEM2/VM160_shelfMelt20myr/output.nc -t 0,40,-1 -v thickness,surfaceSpeed,bedTopography -c Blues,plasma,BrBG -l False,True,False

image

trhille commented 1 year ago

@hollyhan, I just wanted to make you aware of this new tool for plotting MALI output.

hollyhan commented 1 year ago

@hollyhan, I just wanted to make you aware of this new tool for plotting MALI output.

Thanks a lot @trhille ! This is extremely useful!!

trhille commented 1 year ago

@matthewhoffman, thanks for those helpful suggestions. I implemented all three of them. The choices for colormaps are currently either to define colormaps for all variables or to use the default colormaps added in https://github.com/MPAS-Dev/MPAS-Tools/pull/481/commits/50c4b7a75b34dc09a5d81060ddc8eafce29ff281. I thought about being able to mix and match, but that would lead to clunky syntax like -c Blues,default,plasma when executing, so I decided to go with one or the other. Let me know if you think we should go with the other option.