Skip to content

Commit

Permalink
attempt to simplify IC
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy committed May 9, 2024
1 parent a0c1fb4 commit d8b3197
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
12 changes: 1 addition & 11 deletions demos/reanalysis-forced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,7 @@
" glorys_path / \"ic_unprocessed.nc\", # directory where the unprocessed initial condition is stored, as defined earlier\n",
" ocean_varnames,\n",
" arakawa_grid=\"A\"\n",
" )\n",
"\n",
"# Now iterate through our four boundaries \n",
"for i, orientation in enumerate([\"south\", \"north\", \"west\", \"east\"]):\n",
" expt.rectangular_boundary(\n",
" glorys_path / (orientation + \"_unprocessed.nc\"),\n",
" ocean_varnames,\n",
" orientation, # Needs to know the cardinal direction of the boundary\n",
" i + 1, # Just a number to identify the boundary. Indexes from 1 \n",
" arakawa_grid=\"A\"\n",
" )"
" ) "
]
},
{
Expand Down
21 changes: 19 additions & 2 deletions regional_mom6/regional_mom6.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,12 @@ def _make_vgrid(self):
return vcoord

def initial_condition(
self, ic_path, varnames, arakawa_grid="A", vcoord_type="height"
self,
ic_path,
varnames,
arakawa_grid="A",
vcoord_type="height",
boundaries=["south", "north", "west", "east"],
):
"""
Reads the initial condition from files in ``ic_path``, interpolates to the
Expand Down Expand Up @@ -874,11 +879,23 @@ def initial_condition(
"eta_t": {"_FillValue": None},
},
)
print("done setting up initial condition.")

self.ic_eta = eta_out
self.ic_tracers = tracers_out
self.ic_vels = vel_out

# Now iterate through our four boundaries
for i, orientation in enumerate(boundaries, start=1):
self.rectangular_boundary(
glorys_path / (orientation + "_unprocessed.nc"),
ocean_varnames,
orientation, # The cardinal direction of the boundary
i, # A number to identify the boundary; indexes from 1
arakawa_grid=arakawa_grid,
)

print("done setting up initial condition.")

return

def rectangular_boundary(
Expand Down

0 comments on commit d8b3197

Please sign in to comment.