MPAS-Dev / MPAS-Tools

MPAS Tools Repository
Other
36 stars 63 forks source link

Add script to plot transects from MALI output #540

Closed trhille closed 7 months ago

trhille commented 7 months ago

This merge adds a script to plot ice surfaces, bed topography, speed and optionally temperature along a transect. The transect can either be defined using -x and -y options from the command line, or using -c to point to a csv file containing x and y coordinates in the first and second columns, respectively, with no header row. Use --temperature if you wish to plot temperature along the transect. Note that this uses the 3D temperature field and ignores surfaceAirTemperature and basalTemperature, but these could be added in the future. You can plot more than one time index, specified using the -t option; however, plotting temperature at multiple times is not supported. The script increases the number of specified sample points to match the highest resolution in the mesh, based on dcEdge, and uses linear interpolation to produce high-resolution transects from a minimal number of specified points (minimum is 2). Temperature is interpolated in x and y, but not in the vertical dimension.

trhille commented 7 months ago

Testing

A transect (including temperature) down the middle of Thwaites Glacier from an ISMIP6 run in 2175: python plot_transect.py -d /pscratch/sd/t/trhille/ISMIP6/archive/expAE03/rst.2175-01-01.nc -x -1589311.171,-1208886.353 -y -473916.7182,-357411.6176 --temperature

image

Transects down the middle of Thwaites Glacier from an ISMIP6 run from 2175 to 2179: python plot_transect.py -d /pscratch/sd/t/trhille/ISMIP6/archive/expAE03/output/output_state_2175.nc -t 0,1,2,3,4 -x -1589311.171,-1208886.353 -y -473916.7182,-357411.6176

image
trhille commented 7 months ago

Thanks for the review @matthewhoffman! I'll get on these changes.

I would have suggested seeing what's being done for transects in MPAS-Analysis to avoid reinventing the wheel.

I already had most of this lying around in a branch from a few years ago, so really the new thing was the temperature plotting.

trhille commented 7 months ago

@matthewhoffman, I've addressed all your comments in one form or another. The change to argparse rather than optparse is clunky enough that I'd rather leave it using optparse, even though it's deprecated.