-
Notifications
You must be signed in to change notification settings - Fork 0
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
CICE grid generation from MOM supergrid #6
Closed
Closed
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
39277fe
Added Gen_CICE_grid.py to generate CICE grid from mom supergrid
ezhilsabareesh8 b7d84fa
Use np.deg2rad instead of constants
ezhilsabareesh8 0213e6e
x index shifted to NE corner from cell centre
ezhilsabareesh8 b902158
Updated ULAT and ULON indices
ezhilsabareesh8 47a0014
Update attributes to match grid.nc
ezhilsabareesh8 092d995
update attributes to match grid.nc
ezhilsabareesh8 8cd8480
Updated script filenames
ezhilsabareesh8 09be9fb
Added TAREA and UAREA variables
ezhilsabareesh8 f7434b2
Added versioning information
ezhilsabareesh8 90f1e35
Amended versioning information
ezhilsabareesh8 d3b4360
UAREA wrapping changed similar to esmgrids
ezhilsabareesh8 aa89836
dx and dy are defined on the edges in mom, and include the bottom/lef…
anton-seaice 4b85704
turn on compression
anton-seaice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,32 +60,27 @@ def generate_cice_grid(in_superGridPath, output_file): | |
TLAT = np.deg2rad(in_superGridFile['y'][1::2, 1::2]) | ||
TLON = np.deg2rad(in_superGridFile['x'][1::2, 1::2]) | ||
|
||
# MPI | ||
HTN = in_superGridFile['dx'] * 100.0 # convert to cm | ||
HTN = HTN[1::2, ::2] + HTN[1::2, 1::2] | ||
HTE = in_superGridFile['dy'] * 100.0 # convert to cm | ||
HTE = HTE[::2, 1::2] + HTE[1::2, 1::2] | ||
|
||
# The angle of rotation is a corner cell centres and applies to both t and u cells. | ||
ANGLE = np.deg2rad(in_superGridFile['angle_dx'][2::2, 2::2]) | ||
ANGLET= np.deg2rad(in_superGridFile['angle_dx'][1::2, 1::2]) | ||
|
||
# Area | ||
AREA = (in_superGridFile['area']) | ||
TAREA = AREA[::2,::2] + AREA[1::2,1::2] + AREA[::2,1::2] + AREA[1::2,::2] | ||
|
||
array_to_roll = AREA[2::2,2::2] | ||
|
||
# Roll the array along axis 0 and concatenate the last row as the first row | ||
rolled_array_axis0 = np.concatenate(( | ||
np.roll(array_to_roll, -1, axis=0), | ||
array_to_roll[-1:, :]), axis=0) | ||
|
||
# Roll the rolled array along axis 1 and concatenate the last column as the first column | ||
rolled_array = np.concatenate(( | ||
np.roll(rolled_array_axis0, -1, axis=1), | ||
rolled_array_axis0[:, -1:]), axis=1) | ||
|
||
UAREA = AREA[1::2,1::2] + np.concatenate((np.roll(AREA[1::2, 2::2], -1, axis=1), AREA[1::2, 2::2][:, :1]), axis=1) + np.concatenate((np.roll(AREA[2::2, 1::2], -1, axis=0), AREA[2::2, 1::2][:1, :]), axis=0) + rolled_array | ||
# UAREA need to wrap around the globe. Copy ocn_area and | ||
# add an extra column at the end. Also u-cells cross the | ||
# tri-polar fold so add an extra row at the top. | ||
area_ext = np.append(AREA[:], AREA[:, 0:1], axis=1) | ||
area_ext = np.append(area_ext[:], area_ext[-1:, :], axis=0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this line only works because the top row is symmetrical? It doesn't actual seem to fold it... ? |
||
|
||
UAREA = area_ext[1::2, 1::2] + area_ext[2::2, 1::2] + \ | ||
area_ext[2::2, 2::2] + area_ext[1::2, 2::2] | ||
|
||
# Close input files | ||
in_superGridFile.close() | ||
|
@@ -156,7 +151,6 @@ def generate_cice_grid(in_superGridPath, output_file): | |
angleT[:] = ANGLET | ||
tarea[:] = TAREA | ||
uarea[:] = UAREA | ||
|
||
# Close the file | ||
nc.close() | ||
|
||
|
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.
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.
In the mom_grid, dx has units ('nyp','nx'). These correspond to the edges in y and the middle in x. So, the y coordinate (i.e. rows) should be 2::2