Skip to content

Commit d2fd74f

Browse files
committed
Updates based on Eriks comments
1 parent f210718 commit d2fd74f

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

docs/examples/idealised_flow.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,19 @@ def add_uniform_temp_salt_field(fieldset, times):
121121
""" Add a uniform temperature and salinity field to the fieldset.
122122
The temperature/salinity field is time-invariant and has a linear decay with depth.
123123
Of course, this makes no sense in reality, but it is a simple example."""
124-
lon = fieldset.U.grid.lon #TODO Given the Bickley Jet above is C-Grid, is this the right approach to create the other velocity fields??
124+
lon = fieldset.U.grid.lon
125125
lat = fieldset.U.grid.lat
126126
depth = fieldset.U.grid.depth
127127

128128
T = np.zeros((times.size, depth.size, lat.size, lon.size), dtype=np.float32)
129129
S = np.zeros((times.size, depth.size, lat.size, lon.size), dtype=np.float32)
130130

131-
T[:, 0, :, :] = 25.0 # TODO: make sure the units are correct!
131+
T[:, 0, :, :] = 25.0
132132
S[:, 0, :, :] = 35.0
133133

134134
for d in range(1, depth.size):
135-
T[:, d, :, :] = T[:, 0, :, :] #* ( (depth.size - 0.5 * d) / depth.size)
136-
S[:, d, :, :] = S[:, 0, :, :] #* ( (depth.size - 0.5 * d) / depth.size)
135+
T[:, d, :, :] = T[:, 0, :, :]
136+
S[:, d, :, :] = S[:, 0, :, :]
137137

138138
data = {"conservative_temperature": T, "absolute_salinity": S}
139139

@@ -183,7 +183,6 @@ def add_biogeochemistry_field(fieldset, times):
183183
data, dimensions, mesh="flat", allow_time_extrapolation=allow_time_extrapolation
184184
)
185185

186-
#fieldsetbgc.add_periodic_halo(zonal=True)
187186
fieldset.add_field(fieldsetbgc.pp_phyto)
188187
fieldset.add_field(fieldsetbgc.bio_nanophy)
189188
fieldset.add_field(fieldsetbgc.bio_diatom)
@@ -193,7 +192,7 @@ def add_biogeochemistry_field(fieldset, times):
193192

194193
def add_wind_field(fieldset, times):
195194
""" Horizontal wind field with a sinusoidal variation in time."""
196-
lon = fieldset.U.grid.lon # Is this right?
195+
lon = fieldset.U.grid.lon
197196
lat = fieldset.U.grid.lat
198197

199198
wind_U = np.zeros((times.size, lat.size, lon.size), dtype=np.float32)
@@ -206,7 +205,7 @@ def add_wind_field(fieldset, times):
206205

207206
wind_U[0, :, :] = 10. * f_wind
208207

209-
# vary the wind speed with time
208+
# Vary the wind speed with time
210209
for time in range(1, times.size):
211210
wind_U[time, :, :] = wind_U[0, :, :] * np.sin(2. * np.pi * time / times.size)
212211

@@ -218,15 +217,14 @@ def add_wind_field(fieldset, times):
218217
data, dimensions, mesh="flat", allow_time_extrapolation=allow_time_extrapolation
219218
)
220219

221-
#fieldsetwind.add_periodic_halo(zonal=True)
222220
fieldset.add_field(fieldsetwind.Wind_U)
223221
fieldset.add_field(fieldsetwind.Wind_V)
224222

225223
return fieldset
226224

227225
def add_stokes_field(fieldset, times):
228226
""" Horizontal wave field that varies in time."""
229-
lon = fieldset.U.grid.lon # Is this right?
227+
lon = fieldset.U.grid.lon
230228
lat = fieldset.U.grid.lat
231229

232230
stokes_U = np.zeros((times.size, lat.size, lon.size), dtype=np.float32)
@@ -253,7 +251,6 @@ def add_stokes_field(fieldset, times):
253251
data, dimensions, mesh="flat", allow_time_extrapolation=allow_time_extrapolation
254252
)
255253

256-
#fieldsetStokes.add_periodic_halo(zonal=True)
257254
fieldset.add_field(fieldsetStokes.Stokes_U)
258255
fieldset.add_field(fieldsetStokes.Stokes_V)
259256
fieldset.add_field(fieldsetStokes.wave_Tp)

0 commit comments

Comments
 (0)