... | ... | @@ -96,7 +96,7 @@ Generate tidal open boundary conditions (from TOPEX/Poseidon TPXO 7.2) |
|
|
|
|
|
In order to include more complicated data structures in SLIM, such as HYCOM model outputs, no easy slim module exists. You need to extract data value for each node (or boundary node). The time steps for data values do not have to be the same as the one for the simulation (a temporal linear interpolation will be done at runtime).
|
|
|
|
|
|
However, other models such as HYCOM might have a coarser resolution than SLIM and therefore have some missing values (near coastlines for instance). Here is thus a pretty useful function to fill the missing entries of scalar field.
|
|
|
However, other models such as HYCOM might have a coarser resolution than SLIM and therefore have some missing values (near coastlines for instance). Here are thus two pretty useful functions to fill the missing entries of scalar field.
|
|
|
|
|
|
```python
|
|
|
def get_nearest(tab,i,j):
|
... | ... | @@ -133,13 +133,13 @@ def fill_mask(tab): |
|
|
return val
|
|
|
```
|
|
|
|
|
|
Here is a (not so) dumb example to get the sea surface height at a single time step from a netCDF file produced by HYCOM.
|
|
|
And here is an example where these functions are applied toget the sea surface height at a single time step from a netCDF file produced by HYCOM.
|
|
|
|
|
|
```python
|
|
|
from netCDF4 import Dataset
|
|
|
f = Dataset("ssh.nc4","r")
|
|
|
ssh = np.array(f.variables["surf_el"][0,:])
|
|
|
ssh[ssh<-20000] = 0 # dumb way to deal with missing values
|
|
|
ssh = np.ma.array(f.variables["surf_el"][[0],:])
|
|
|
ssh = fill_mask(ssh)[0,:]
|
|
|
lon = np.array(f.variables["lon"][:])
|
|
|
lat = np.array(f.variables["lat"][:])
|
|
|
|
... | ... | |