Skip to content

Commit b4238c7

Browse files
Apply suggestions from code review
Minor comments Co-authored-by: Davide Marchegiani <[email protected]>
1 parent 3693bc4 commit b4238c7

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/perturbIC.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def create_random_generator(value=None):
5151
raise ValueError('Seed value must be non-negative.')
5252
return Generator(PCG64(value))
5353

54-
def get_rid_of_timeseries(ff):
54+
def remove_timeseries(ff):
5555
"""
5656
Remove any timeseries from a fields file.
5757
@@ -62,7 +62,8 @@ def get_rid_of_timeseries(ff):
6262
6363
Returns
6464
----------
65-
ff/ff_out : Returns a mule fields object with no timeseries
65+
ff_out : mule.dump.DumpFile
66+
The mule DumpFile with no timeseries.
6667
"""
6768
ff_out = ff.copy()
6869
num_ts = 0
@@ -211,9 +212,11 @@ def transform(self, source_field, new_field):
211212
return data + self.perturbation
212213

213214

214-
def void(*args, **kwargs):
215-
print('skipping validation')
216-
pass
215+
def void_validation(*args, **kwargs):
216+
"""
217+
Don't perform the validation, but print a message to inform that validation has been skipped.
218+
"""
219+
print('Skipping mule validation. To enable the validation, run using the "--validate" option.')
217220

218221

219222
def set_validation(validate):
@@ -239,17 +242,16 @@ def main():
239242
"""
240243

241244
# Define all the variables
242-
data_limit = -99
243-
surface_temp_stash = 4
245+
STASH_THETA = 4
244246

245247
# Parse the command line arguments
246248
args = parse_args()
247249

248250
# Create the output filename
249251
output_file = create_default_outname(args.ifile)
250252

251-
# Set the seed if one is given else proced without one.
252-
random_obj = set_seed(args)
253+
# Create the random generator.
254+
random_generator = create_random_generator(args.seed)
253255

254256
# Skips the validation entirely for use on ESM15 due to river fields error
255257
# Creates the mule field object
@@ -261,7 +263,7 @@ def main():
261263
nlat = 145
262264

263265
# Remove the time series from the data to ensure mule will work
264-
ff = get_rid_of_timeseries(ff_raw)
266+
ff = remove_timeseries(ff_raw)
265267

266268
# Creates a random perturbation array
267269
perturbation = create_perturbation(args, random_obj, nlon, nlat)

0 commit comments

Comments
 (0)