Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mpas_analysis/ocean/ocean_regional_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ def run_task(self):
dsMesh = xr.open_dataset(meshFilename)
dsMesh = dsMesh.isel(Time=0)
areaCell = dsMesh.areaCell
landIceFraction = dsMesh.landIceFraction
landIceFraction = xr.where(landIceFraction > 0, 1, landIceFraction)
landIceFraction = -1*(landIceFraction-1)

@xylar xylar Aug 25, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
landIceFraction = dsMesh.landIceFraction
landIceFraction = xr.where(landIceFraction > 0, 1, landIceFraction)
landIceFraction = -1*(landIceFraction-1)
openOceanMask = xr.where(dsMesh.landIceMask > 0, 0, 1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this would be simpler and make more sense (at least to me). (And then openOceanMask gets used below.)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we want to use landIceMask rather than landIceFraction > 0 but that could be a point of discussion.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sure, if the variable is available that is fine - I had tried first with landIceFloatingMask but that variable wasn't available for some reason, so I went with landIceFraction following the melt rate example

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

cellMask = numpy.logical_and(cellMask, landIceMask == 0)

It seems like either landIceFraction or landIceMask would work so it doesn't matter too much. landIceFloatingFraction should also work but I don't think that would be the right thing if it differs from landIceFraction -- if grounded ice is present, we want to exclude it, too.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

landIceMask seems like the right choice to me


nVertLevels = dsMesh.sizes['nVertLevels']

Expand Down Expand Up @@ -407,7 +410,9 @@ def run_task(self):
prefix = field['prefix']
self.logger.info(' {}'.format(field['titleName']))

var = dsLocal[variableName].where(vertDepthMask)
var_mpas = dsLocal[variableName]
var_mpas_masked = var_mpas*landIceFraction

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
var_mpas_masked = var_mpas*landIceFraction
var_mpas_masked = var_mpas*openOceanMask

var = var_mpas_masked.where(vertDepthMask)

meanName = '{}_mean'.format(prefix)
dsLocal[meanName] = \
Expand Down
10 changes: 6 additions & 4 deletions mpas_analysis/ocean/time_series_antarctic_melt.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def run_task(self):

dsOut = xarray.concat(objs=datasets, dim='Time')
dsOut['regionNames'] = dsRegionMask.regionNames
dsOut.integratedMeltFlux.attrs['units'] = 'GT a$^{-1}$'
dsOut.integratedMeltFlux.attrs['units'] = 'Gt a$^{-1}$'
dsOut.integratedMeltFlux.attrs['description'] = \
'Integrated melt flux summed over each ice shelf or region'
dsOut.meltRates.attrs['units'] = 'm a$^{-1}$'
Expand Down Expand Up @@ -662,7 +662,7 @@ def run_task(self):
suffix = self.iceShelf.replace(' ', '_')

xLabel = 'Time (yr)'
yLabel = 'Melt Flux (GT/yr)'
yLabel = 'Melt Flux (Gt/yr)'

timeSeries = integratedMeltFlux.isel(nRegions=self.regionIndex)

Expand Down Expand Up @@ -723,7 +723,8 @@ def run_task(self):
# and cartopy doesn't play too well with tight_layout anyway
plt.tight_layout()

add_inset(fig, fc, width=2.0, height=2.0)
#add_inset(fig, fc, width=2.0, height=2.0)
Comment thread
irenavankova marked this conversation as resolved.
Outdated
add_inset(fig, fc, width=1.0, height=1.0, lowerleft=[0.0, 0.0], xbuffer=0.01, ybuffer=0.01)

savefig(outFileName, config)

Expand Down Expand Up @@ -788,7 +789,8 @@ def run_task(self):
# and cartopy doesn't play too well with tight_layout anyway
plt.tight_layout()

add_inset(fig, fc, width=2.0, height=2.0)
#add_inset(fig, fc, width=2.0, height=2.0)
Comment thread
irenavankova marked this conversation as resolved.
Outdated
add_inset(fig, fc, width=1.0, height=1.0, lowerleft=[0.0, 0.0], xbuffer=0.01, ybuffer=0.01)

savefig(outFileName, config)

Expand Down
3 changes: 2 additions & 1 deletion mpas_analysis/ocean/time_series_ocean_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,8 @@ def run_task(self):
# and cartopy doesn't play too well with tight_layout anyway
plt.tight_layout()

add_inset(fig, fc, width=2.0, height=2.0)
#add_inset(fig, fc, width=2.0, height=2.0)
Comment thread
irenavankova marked this conversation as resolved.
Outdated
add_inset(fig, fc, width=1.0, height=1.0, lowerleft=[0.0, 0.0], xbuffer=0.01, ybuffer=0.01)

savefig(outFileName, config, tight=False)

Expand Down