Skip to content
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

(v0.6.0) Simplify boundary condition construction #175

Merged
merged 10 commits into from
Jul 2, 2024
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"),
navidcy marked this conversation as resolved.
Show resolved Hide resolved
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
Loading