-
Notifications
You must be signed in to change notification settings - Fork 0
MOM6 hgrids
hgrid file include all the rho, psi, u, v, dx, dy, area information.
The relationship is described here https://gist.github.com/adcroft/c1e207024fe1189b43dddc5f1fe7dd6c
Mosaic grid specification A mosaic grid specification makes use of a "supergrid" which is a simple grid which is an integer refinement of the target model grid. The grid specification provides the bare minimum metrics for the supergrid cells which can be combined by aggregation to obtain the appropriate metrics for the model grid. A logically rectangular grid (LRG) mosaic specification will contain
ni - Number of columns in x-direction
nj - Number of rows in y-direction
x[nj+1,ni+1] - x-coordinate of the grid vertices
y[nj+1,ni+1] - y-coordinate of the grid vertices
area[nj,ni] - area of each cell
dx[nj+1,ni] - length of the edges of constant j-index
dy[nj,ni+1] - length of the edges of constant -index
Notes:
The data has different shapes depending on location which means that an indexing convention is not needed.
The is no redundant data, except:
For an x-periodic domain, the x,y and
The x,y location of h[j,i] is at x[2j+1,2i+1],y[2j+1,2i+1]
so that h[0,0] is at x[1,1],y[1,1], h[0,1] is at x[1,3],y[1,3], etc.
The x,y location of q[j,i] is at x[2j,2i],y[2j,2i]
so that q[0,0] is at x[0,0],y[0,0], q[0,1] is at x[0,2],y[0,2], etc.
The x,y location of u[j,i] is at x[2j+1,2i],y[2j+1,2i]
so that u[0,0] is at x[1,0],y[1,0], u[0,1] is at x[1,2],y[1,2], etc.
The x,y location of v[j,i] is at x[2j,2i+1],y[2j,2i+1]
so that v[0,0] is at x[0,1],y[0,1], v[0,1] is at x[0,3],y[0,3], etc.
The distance between u-points, centered at h[j,i] is dxh[j,i] = dx[2j+1,2i] + dx[2j+1,2i+1]
The distance between v-points, centered at h[j,i] is dxh[j,i] = dy[2j,2i+1] + dy[2j+1,2i+1]
The distance between q-points, centered at v[j,i] is dxCv[j,i] = dx[2j,2i] + dx[2j,2i+1]
The distance between q-points, centered at u[j,i] is dyCu[j,i] = dy[2j,2i] + dy[2j+1,2i]
The distance between h-points, centered at u[j,i] is dxCu[j,i] = dx[2j+1,2i-1] + dx[2j+1,2i]
(note periodic wrapping of i-index is needed)
The distance between h-points, centered at v[j,i] is dyCv[j,i] = dy[2j-1,2i+1] + dx[2j,2i+1]
(note periodic wrapping of j-index is needed)
The distance between v-points, centered at q[j,i] is dxBu[j,i] = dx[2j,2i-1] + dx[2j,2i]
(note periodic wrapping of i-index is needed)
The distance between u-points, centered at q[j,i] is dyBu[j,i] = dy[2j-1,2i] + dx[2j,2i]
(note periodic wrapping of j-index is needed)
The area of an h-cell, centered at h[j,i] is areah[j,i] = area[2j,2i] + area[2j,2i+1] + area[2j+1,2i] + area[2j+1,2i+1]
The area of a q-cell, centered at q[j,i] is areaBu[j,i] = area[2j-1,2i-1] + area[2j-1,2i] + area[2j,2i-1] + area[2j,2i]
(note periodic wrapping of i- and j-index is needed)
The area of a u-cell, centered at u[j,i] is areaCu[j,i] = area[2j,2i-1] + area[2j,2i] + area[2j+1,2i-1] + area[2j+1,2i]
(note periodic wrapping of i-index is needed)
The area of a v-cell, centered at v[j,i] is areaCv[j,i] = area[2j-1,2i] + area[2j-1,2i+1] + area[2j,2i] + area[2j,2i+1]
(note periodic wrapping of j-index is needed)
Another one is here. This change ROMS grid to MOM6 hgrid
lon[::2,::2] = nc.variables['lon_psi'][:,:] # Cell corners
lon[1::2,1::2] = nc.variables['lon_rho'][1:-1,1:-1] # Cell centers (drop outside row and column)
lon[1::2,::2] = nc.variables['lon_u'][1:-1,:] # U-points (drop outside row)
lon[::2,1::2] = nc.variables['lon_v'][:,1:-1] # V-points (drop outside column)
lat[::2,::2] = nc.variables['lat_psi'][:,:] # Cell corners
lat[1::2,1::2] = nc.variables['lat_rho'][1:-1,1:-1] # Cell centers (drop outside row and column)
lat[1::2,::2] = nc.variables['lat_u'][1:-1,:] # U-points (drop outside row)
lat[::2,1::2] = nc.variables['lat_v'][:,1:-1] # V-points (drop outside column)
https://github.com/ESMG/ESMG-configs/blob/dev/esmg/CCS1/preprocessing/CreateFMSgridTopo.py