Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mapping/src/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ def __init__(self,config,State):
else:
for name in self.name_var:
State.var[self.name_var[name]] = np.zeros((State.ny,State.nx))
if State.mask is not None:
State.var[self.name_var[name]][State.mask] = np.nan

# Observed variable
self.name_obs_var = self.name_var['SSH'] # SSH
Expand Down
6 changes: 6 additions & 0 deletions mapping/src/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ def ini_mask(self,config):
self.mask = (np.isnan(self.lon) + np.isnan(self.lat)).astype(bool)
return

# Fix hole at Greenwich meridian
ds = ds.assign_coords({name_lon:((name_lon, ds[name_lon].data % 360))})
ds = ds.sortby(ds[name_lon])

dlon = np.nanmax(self.lon[:,1:] - self.lon[:,:-1])
dlat = np.nanmax(self.lat[1:,:] - self.lat[:-1,:])

Expand All @@ -255,6 +259,8 @@ def ini_mask(self,config):

# Interpolate to state grid
if np.any(lon_mask!=self.lon) or np.any(lat_mask!=self.lat):
lon_mask[lon_mask>180] = lon_mask[lon_mask>180] - 360 # Need to convert coordinates back in order to avoid white line error
self.lon[self.lon>180] = self.lon[self.lon>180] - 360
mask_interp = interpolate.griddata(
(lon_mask.ravel(),lat_mask.ravel()), mask.ravel(),
(self.lon.ravel(),self.lat.ravel())).reshape((self.ny,self.nx))
Expand Down