Commit 8c64f345 authored by Modellers Operational's avatar Modellers Operational

Add land mask

parent 5561bcf1
......@@ -67,17 +67,16 @@ if rank == 0:
worker.fvcom_grid.select_ll = worker.fvcom_grid.ll
h = worker._Interpolater(worker.fvcom_grid.h)
grid_in_domain = pf.read.FileReader(worker.fvcom_file).in_domain(worker.regular_grid.mesh_lons, worker.regular_grid.mesh_lats)
grid_in_domain = np.reshape(pf.read.FileReader(worker.fvcom_file).in_domain(worker.regular_grid.mesh_lons.ravel(), worker.regular_grid.mesh_lats.ravel()), worker.regular_grid.mesh_lats.shape)
h[~grid_in_domain] = np.nan
h = h.T
land_mask = np.zeros([h.shape[0], h.shape[1], len(depth_layers)])
land_mask = np.zeros([len(depth_layers), h.shape[0], h.shape[1]])
for i, this_depth in enumerate(depth_layers):
if this_depth == 0:
land_mask[~np.isnan(h)] = 1
land_mask[i,~np.isnan(h)] = 1
else:
land_mask[:,:,i][h > this_depth] = 1
land_mask[i,:,:][h > this_depth] = 1
# write to cmems format
fvcom = pf.read.FileReader(fvcom_file)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment