-
Notifications
You must be signed in to change notification settings - Fork 10
Preparing boundary conditions for CCS1
Open boundary conditions for CCS1 are generated using the brushcutter Python package. Follow the link for installation instructions.
The preprocessing script is contained in createOBCsegments.py
For this example, OBC data are generated using output from a global MOM6 simulation. The following outlines the full script using sea surface height as an example
-
Download input data
-
Start a Python session and import required modules
from brushcutter import lib_obc_variable as lov
from brushcutter import lib_obc_segments as los
from brushcutter import lib_ioncdf as ncdf
-
Define the boundary using the
los.obc_segment
methodsouth = los.obc_segment('segment_001',momgrd,istart=0,iend=360,jstart=0,jend=0)
The label attached to this segment is
segment_001
, it can be anything you choose.momgrd
is the path to the regional model FMS supergrid file. In this example, the model supergrid size equals 360x960 (a reminder that the supergrid has double the refinement of the tracer grid) and the boundary is defined along the south edge of the domain. -
Define the sea surface height (zeta) field to be interpolated to the boundary
zeta_south = lov.obc_variable(south,'zeta',geometry='line',obctype='flather',use_locstream=True)
zeta will be the name given to the interpolated field in the file
-
Load the source grid using the source supergrid file
xsrc=nc.Dataset(srcgrd).variables['x'][1::2,1::2]
ysrc=nc.Dataset(srcgrd).variables['y'][1::2,1::2]
-
Now interpolate sea surface heights from the source model
zeta_south.interpolate_from(ssh_data,'ssh',frame=kt,from_global=True,x_coords=xsrc,y_coords=ysrc, drown='ncl')
-
And save the data to a file for use by MOM6
ncdf.write_obc_file([south],[zeta_south],[],time,output='obc_CCS1.nc')
Here is an visualization of the resulting surface heights at the CCS1 domain boundaries.