Skip to content

Commit

Permalink
Fix interpolation of SSH to transects
Browse files Browse the repository at this point in the history
This merge fixes masking of the SSH to ignore cells where
maxLevelCell=0
  • Loading branch information
xylar committed Oct 28, 2023
1 parent 6e1ccbe commit 525e376
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions conda_package/mpas_tools/ocean/transects.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,14 @@ def _get_vertical_coordinate(dsTransect, layerThickness, bottomDepth,
layerThicknessTransect = (layerThicknessTransect*interpCellWeights).sum(
dim='nHorizWeights')

interpMask = maxLevelCell.isel(nCells=interpCellIndices) >= 0
interpHorizCellWeights = interpMask*dsTransect.interpHorizCellWeights
weightSum = interpHorizCellWeights.sum(dim='nHorizWeights')
interpHorizCellWeights = \
(interpHorizCellWeights/weightSum).where(interpMask)

sshTransect = ssh.isel(nCells=interpCellIndices)
sshTransect = (sshTransect*dsTransect.interpHorizCellWeights).sum(
dim='nHorizWeights')
sshTransect = (sshTransect*interpHorizCellWeights).sum(dim='nHorizWeights')

zBot = sshTransect - layerThicknessTransect.cumsum(dim='nVertLevels')
zTop = zBot + layerThicknessTransect
Expand Down

0 comments on commit 525e376

Please sign in to comment.