Add script to plot spatial distribution of subglacial discharge and ice shelf melt#581
Open
alexolinhager wants to merge 2 commits intoMPAS-Dev:masterfrom
Open
Conversation
Add script to plot spatial distribution of subglacial discharge and ice shelf melt around Antarctica. Script at this point is not complete.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new (work-in-progress) post-processing script under landice/output_processing_li/ intended to visualize the spatial distribution of MPAS-Ocean land-ice freshwater flux (ice-shelf melt / discharge proxy) around Antarctica by projecting mesh cells into polar stereographic coordinates, gridding the data, and plotting a map.
Changes:
- Add
plot_qsg_shelf_melt.pyto read MPAS-Ocean mesh/output via xarray and extract Antarctic cells. - Project lon/lat to a polar stereographic coordinate system and subset by named regions.
- Bin/average values onto a regular grid and plot with
matplotlib.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+31
to
+34
| ind = np.where(latCellDeg <= -65) | ||
| latCellAnt = latCellDeg[ind] | ||
| lonCellAnt = lonCellDeg[ind] | ||
| meltAnt = melt[0,ind] |
Comment on lines
+74
to
+86
| ind = np.array(np.where((xCellAnt >= np.min(xlimit)) & (xCellAnt <= np.max(xlimit)) & (yCellAnt >= np.min(ylimit)) & (yCellAnt <= np.max(ylimit)))) | ||
| #set up grid to interpolate onto - better for visualization purposes | ||
| res = 15*1000 #15 km grid resolution | ||
| Xvec = np.arange(np.min(xCellAnt[ind]), np.max(xCellAnt[ind]) + res, res) | ||
| Yvec = np.arange(np.min(yCellAnt[ind]), np.max(yCellAnt[ind]) + res, res) | ||
|
|
||
| Xgrd, Ygrd = np.meshgrid(Xvec,Yvec) | ||
| Xgrd = np.transpose(Xgrd) | ||
| Ygrd = np.transpose(Ygrd) | ||
|
|
||
| xp = np.array(xCellAnt[ind]) | ||
| yp = np.array(yCellAnt[ind]) | ||
|
|
Comment on lines
+92
to
+97
| for i in range(len(Xvec)-1): | ||
| for ii in range(len(Yvec)-1): | ||
| ind = np.array(np.where((xp >= Xvec[i]) & (xp <= Xvec[i+1]) & (yp >= Yvec[ii]) & (yp <= Yvec[ii+1]))) | ||
| if ind.size != 0: | ||
| Mgrd[i,ii] = np.mean(values[0,ind]) | ||
| else: |
Comment on lines
+91
to
+96
| #bin average onto grid | ||
| for i in range(len(Xvec)-1): | ||
| for ii in range(len(Yvec)-1): | ||
| ind = np.array(np.where((xp >= Xvec[i]) & (xp <= Xvec[i+1]) & (yp >= Yvec[ii]) & (yp <= Yvec[ii+1]))) | ||
| if ind.size != 0: | ||
| Mgrd[i,ii] = np.mean(values[0,ind]) |
Minor cleanup and ease of life improvements from copilot code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add script to plot spatial distribution of subglacial discharge and ice shelf melt around Antarctica. Script at this point is not complete and is a work in progress.