Skip to content

Add code to plot ocean TF within transect #600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

cshafer
Copy link

@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.

if options.interp_temp and (len(times) > 1):
print('Cannot plot temperature for more than one time index.' +
' Skipping temperature interpolation and plotting.')
options.interp_temp = False

if options.interp_thermal_forcing and (len(times) > 1):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Combine this with if-statement used for temperature above.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks Trevor, I'll fix this!

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.

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.

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?

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.

2 participants