@@ -57,6 +57,7 @@ def parse_arguments():
5757
5858 # Return arguments
5959 return args_parsed
60+
6061def validate_arguments (include_list , exclude_list , prognostic ):
6162 """
6263 Checks that the inclusion and exclusion lists are not provided simultaneously
@@ -82,15 +83,13 @@ def validate_arguments(include_list, exclude_list, prognostic):
8283 if prognostic and (include_list or exclude_list ):
8384 raise Exception ("Error: -p incompatible with explicit list of variables" )
8485
85-
8686def void_validation (* args , ** kwargs ):
8787 """
8888 Don't perform the validation, but print a message to inform that validation has been skipped.
8989 """
9090 print ('Skipping mule validation. To enable the validation, run using the "--validate" option.' )
9191 return
9292
93-
9493def initialize_output_file (ff ):
9594 """
9695 Initialize the output UM file by copying the input file and preparing it for output.
@@ -174,7 +173,6 @@ def filter_fields(input_file, prognostic, include_list, exclude_list):
174173
175174 return filtered_fields
176175
177-
178176def check_packed_fields (filtered_fields ):
179177 """
180178 Checks if packed fields in the input file require a land-sea mask and modifies
@@ -243,32 +241,31 @@ def append_fields(outfile, filtered_fields):
243241 # Ad to the outfile fields
244242 outfile .fields .append (field .copy ())
245243
246-
247244def main ():
248245
249- # Parse the inputs and validate that they do not xlist or vlist are given.
246+ # Parse the inputs and validates that either xlist or vlist are given.
250247 args = parse_arguments ()
251248 validate_arguments (args .include_list , args .exclude_list , args .prognostic )
252249
253- # Skip the mule validation if the "--validate" option is provided.
250+ # Skips the mule validation if the "--validate" option is provided.
254251 if args .validate :
255252 mule .DumpFile .validate = void_validation
256253
257254 ff = mule .DumpFile .from_file (args .ifile )
258255
259- # Create the output UM file that will be saved.
256+ # Initializes the output UM file that will be saved.
260257 outfile = initialize_output_file (ff )
261258
262- # Create the output filename.
259+ # Create the new output filename if one isn't already given .
263260 output_filename = create_default_outname (args .ifile ) if args .output_path is None else args .output_path
264261
265- #Create list of fields that meet all the user defined conditions
262+ #Create list of fields that meet all the user defined conditions to either include or exclude
266263 filtered_fields = filter_fields (ff , args .prognostic , args .include_list , args .exclude_list )
267264
268- # Find the fields, if any, that needs a land-sea mask .
265+ # Checks if any of the choosen fields need a land-sea mas and adds it if so .
269266 filtered_fields = check_packed_fields (filtered_fields )
270267
271- # Loop over all the fields.
268+ # Loops over all the fields.
272269 append_fields (outfile , filtered_fields )
273270
274271 outfile .to_file (output_filename )
0 commit comments