Skip to content

Conversation

cshafer
Copy link
Contributor

@cshafer cshafer commented Jan 24, 2025

This pull request updates the existing plot_transect.py script to add the option of plotting ocean thermal forcing along an ice-shelf transect.

The code plots the extrapolated TFocean field for a single time index along a user defined transect. Invalid (1.0e36) TF values are set to np.nan before interpolation happens for each ocean layer. Ice and bedrock are filled in with solid colors if --thermal_forcing option is set.

image

Copy link
Collaborator

@trhille trhille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @cshafer! I have two small changes to request.

Copy link
Collaborator

@trhille trhille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cshafer, this is great and runs really fast! I have a few minor changes to request. It looks like a lot, but you can just accept all the changes I made to spacing and lump that into one commit.

thickAx.fill_between(distance, upper_surf_nan, lower_surf_nan, color='xkcd:ice blue')
thickAx.fill_between(distance, bed_transect, thickAx.get_ylim()[0], color='xkcd:greyish brown')
thickAx.grid(False)
thickAx.set_ylim([None, 750])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The axis limits should not be hard-coded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1027fad

Comment on lines 248 to 249
thickAx.fill_between(distance, upper_surf_nan, lower_surf_nan, color='xkcd:ice blue')
thickAx.fill_between(distance, bed_transect, thickAx.get_ylim()[0], color='xkcd:greyish brown')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be applied generally, not just for the thermal forcing case. However, the ice color will need to be skipped if options.temperature.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1027fad

y = np.array([float(i) for i in options.y_coords.split(',')])

# Determine bounding box using max and min of user-provided coordinates
pad = 5000
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to make the padding size a function of dcEdge. @matthewhoffman , what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1027fad

cshafer and others added 3 commits February 4, 2025 10:23
* add option to disable fill of glacier and topo, and disable fill for
  modes where it would obscure information * make padding a function of dcEdge
* Use ismip6shelfMelt_3dThermalForcing variable instead of TFocean
* if ismip6shelfMelt_zOcean variable is not present, use standard values with a warning
* minor cosmetic adjustments to figure and font size
* dynamically set y-axis range when plotting TF
@matthewhoffman
Copy link
Member

I updated the PR based on the remaining code review items. Here is the current behavior for a TF plot:

python ~/mpas/MPAS-Tools/landice/output_processing_li/plot_transect.py --tf -d ~/gis1km_tf_issue_t15.nc -x -489974.405,-474805.9 -y -1250463.8,-1254941.27


Using padding around region of interest of 8162.936082704757 m
WARNING: ismip6shelfMelt_zOcean not found in file. Assuming values:
[  -30.   -90.  -150.  -210.  -270.  -330.  -390.  -450.  -510.  -570.
  -630.  -690.  -750.  -810.  -870.  -930.  -990. -1050. -1110. -1170.
 -1230. -1290. -1350. -1410. -1470. -1530. -1590. -1650. -1710. -1770.]
Reading bedTopography from the first time level only. If multiple times are needed, plot_transects.py will need to be updated.
Interpolating ocean thermal forcing for ocean level 0
Interpolating ocean thermal forcing for ocean level 1
Interpolating ocean thermal forcing for ocean level 2
Interpolating ocean thermal forcing for ocean level 3
Interpolating ocean thermal forcing for ocean level 4
Interpolating ocean thermal forcing for ocean level 5
Interpolating ocean thermal forcing for ocean level 6
Interpolating ocean thermal forcing for ocean level 7
Interpolating ocean thermal forcing for ocean level 8
Interpolating ocean thermal forcing for ocean level 9
Interpolating ocean thermal forcing for ocean level 10
Interpolating ocean thermal forcing for ocean level 11
Interpolating ocean thermal forcing for ocean level 12
Interpolating ocean thermal forcing for ocean level 13
Interpolating ocean thermal forcing for ocean level 14
Interpolating ocean thermal forcing for ocean level 15
Interpolating ocean thermal forcing for ocean level 16
Interpolating ocean thermal forcing for ocean level 17
Interpolating ocean thermal forcing for ocean level 18
Interpolating ocean thermal forcing for ocean level 19
Interpolating ocean thermal forcing for ocean level 20
Interpolating ocean thermal forcing for ocean level 21
Interpolating ocean thermal forcing for ocean level 22
Interpolating ocean thermal forcing for ocean level 23
Interpolating ocean thermal forcing for ocean level 24
Interpolating ocean thermal forcing for ocean level 25
Interpolating ocean thermal forcing for ocean level 26
Interpolating ocean thermal forcing for ocean level 27
Interpolating ocean thermal forcing for ocean level 28
Interpolating ocean thermal forcing for ocean level 29
image

Copy link
Collaborator

@trhille trhille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved based on inspection and @matthewhoffman's testing.

@trhille trhille merged commit 7b99a66 into MPAS-Dev:master Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants