-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add files_for_e3sm
steps for ocean and sea-ice meshes
#570
Add files_for_e3sm
steps for ocean and sea-ice meshes
#570
Conversation
files_for_e3sm
steps for ocean and sea-ice meshes
7d4382c
to
bd4a58c
Compare
TestingI tested this on the following 6 meshes:
which I have created and placed in:
|
bd4a58c
to
2f4de52
Compare
Based off of #563, so in draft mode until that gets merged. |
Can't build docs locally until I fix #567 |
2f4de52
to
4053000
Compare
@mark-petersen, I could use your review on this. I'll point out specific things I'd appreciate your feedback on. |
self.mesh_vars = [ | ||
'areaCell', 'cellsOnCell', 'edgesOnCell', 'indexToCellID', | ||
'latCell', 'lonCell', 'meshDensity', 'nEdgesOnCell', | ||
'verticesOnCell', 'xCell', 'yCell', 'zCell', 'angleEdge', | ||
'cellsOnEdge', 'dcEdge', 'dvEdge', 'edgesOnEdge', | ||
'indexToEdgeID', 'latEdge', 'lonEdge', 'nEdgesOnCell', | ||
'nEdgesOnEdge', 'verticesOnEdge', 'weightsOnEdge', 'xEdge', | ||
'yEdge', 'zEdge', 'areaTriangle', 'cellsOnVertex', 'edgesOnVertex', | ||
'indexToVertexID', 'kiteAreasOnVertex', 'latVertex', | ||
'lonVertex', 'xVertex', 'yVertex', 'zVertex'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mark-petersen, could you sanity check that I didn't miss any variables that are necessary for defining the horizontal mesh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, these are my notes on how to add a mesh for a paraview visualiztion from a netcdf file without a mesh:
set GridVars=latCell,lonCell,maxLevelCell,nEdgesOnCell,xCell,yCell,zCell,dcEdge,dvEdge,indexToEdgeID,latEdge,lonEdge,nEdgesOnEdge,xEdge,yEdge,zEdge,areaTriangle,indexToVertexID,latVertex,lonVertex,xVertex,yVertex,zVertex,edgesOnVertex,cellsOnVertex,indexToCellID,indexToEdgeID,indexToVertexID,cellsOnEdge,edgesOnCell,edgesOnEdge,cellsOnCell,refBottomDepth,verticesOnCell
ncks -d Time,0 -v ${GridVars},temperature file1.nc file2.nc
Yes, your list includes all the horizontal variables from my notes. I agree that you have them all.
'refBottomDepth', 'vertCoordMovementWeights', | ||
'bottomDepth', 'maxLevelCell', | ||
'layerThickness', 'restingThickness' | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mark-petersen, in addition to the horizontal mesh variables, these seem to be the minimum set available for defining the vertical grid. Does that seem right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
if 'minLevelCell' not in ds: | ||
ds['minLevelCell'] = xr.ones_like(ds.maxLevelCell) | ||
ds.minLevelCell.attrs['long_name'] = \ | ||
'Index to the first active ocean cell in each column.' | ||
|
||
ds['refTopDepth'] = ('nVertLevels', interfaces[0:-1]) | ||
ds.refTopDepth.attrs['units'] = 'm' | ||
ds.refTopDepth.attrs['long_name'] = \ | ||
"Reference depth of ocean for each vertical level. Used in " \ | ||
"'z-level' type runs." | ||
ds['refZMid'] = ('nVertLevels', | ||
-0.5 * (interfaces[1:] + interfaces[0:-1])) | ||
ds.refZMid.attrs['units'] = 'm' | ||
ds.refZMid.attrs['long_name'] = \ | ||
'Reference mid z-coordinate of ocean for each vertical ' \ | ||
'level. This has a negative value.' | ||
ds['refLayerThickness'] = ('nVertLevels', | ||
interfaces[1:] - interfaces[0:-1]) | ||
ds.refLayerThickness.attrs['units'] = 'm' | ||
ds.refLayerThickness.attrs['long_name'] = \ | ||
'Reference layer thickness of ocean for each vertical level.' | ||
|
||
ds['cellMask'] = compute_cell_mask( | ||
ds.minLevelCell - 1, ds.maxLevelCell - 1, | ||
ds.sizes['nVertLevels']) | ||
ds.cellMask.attrs['long_name'] = \ | ||
'Mask on cells that determines if computations should be ' \ | ||
'done on cells.' | ||
ds['ssh'] = compute_ssh_from_layer_thickness( | ||
ds.layerThickness, ds.bottomDepth, ds.cellMask) | ||
ds.ssh.attrs['units'] = 'm' | ||
ds.ssh.attrs['long_name'] = 'sea surface height' | ||
ds['zMid'] = compute_zmid_from_layer_thickness( | ||
ds.layerThickness, ds.ssh, ds.cellMask) | ||
ds.zMid.attrs['units'] = 'm' | ||
ds.zMid.attrs['long_name'] = \ | ||
'z-coordinate of the mid-depth of the layer' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mark-petersen, in addition to the "required" vertical grid variables above, I'm also adding these (using the layerThickness
variable from the initial condition):
- minLevelCell
- refTopDepth
- refZMid
- refLayerThickness
- cellMask
- ssh
- zMid
Anything in that list seem out of place? Anything important I'm missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that looks good. The variables edgeMask and vertexMask would match your cellMask, but we probably don't need them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that, too. I don't currently have compass routines for computing those (and I needed cellMask
for computing ssh
and zMid
) so I decided to let them be.
Thanks for taking a look!
These also need to be added to `inputdata` in `shared/meshes/mpas`
4053000
to
213f44c
Compare
@mark-petersen, this has been rebased. You are also welcome to look at the meshes it generated:
Here are the QU240 tests as well, to show it within compass:
In particular, look at:
|
@mark-petersen, could you let me know if you want to take some more time to look at the results from this PR? If not, could you approve so I can merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please merge. Looks good, thank you!
These also need to be added to
inputdata
inshared/meshes/mpas
This merge also makes public some functions from the
compass.ocean.vertical
module that are used to addcellMask
andzMid
variables to the MPAS-Ocean mesh.Checklist
api.rst
) has any new or modified class, method and/or functions listedTesting
in this PR) any testing that was used to verify the changescloses #569