File tree 1 file changed +23
-7
lines changed
1 file changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -333,14 +333,30 @@ def create_stream_xml(
333
333
),
334
334
)
335
335
if var_key in valid_values :
336
+
337
+ # # Handle, e.g., 'bilinear' in namelist instead of bilinear (no quotes)
338
+ mod_dict_var_key = mod_dict [var_key ]
339
+
340
+ # Check that key is valid
341
+ is_valid = mod_dict_var_key in valid_values [var_key ]
342
+ msg = "{} can only have values of {} for stream {} in file {}, not {}" .format (
343
+ var_key ,
344
+ valid_values [var_key ],
345
+ stream_name ,
346
+ user_mods_file ,
347
+ mod_dict [var_key ],
348
+ )
349
+ if not is_valid :
350
+ # Check for surrounding quote marks
351
+ has_surrounding_quotes = (
352
+ (mod_dict_var_key [0 ] == mod_dict_var_key [- 1 ] == "'" ) or
353
+ (mod_dict_var_key [0 ] == mod_dict_var_key [- 1 ] == '"' )
354
+ )
355
+ if has_surrounding_quotes and mod_dict_var_key [1 :- 1 ] in valid_values [var_key ]:
356
+ msg += " (try removing surrounding quotes)"
336
357
expect (
337
- mod_dict [var_key ] in valid_values [var_key ],
338
- "{} can only have values of {} for stream {} in file {}" .format (
339
- var_key ,
340
- valid_values [var_key ],
341
- stream_name ,
342
- user_mods_file ,
343
- ),
358
+ is_valid ,
359
+ msg ,
344
360
)
345
361
stream_vars ["stream_" + var_key ] = mod_dict [var_key ]
346
362
if var_key == "datafiles" :
You can’t perform that action at this time.
0 commit comments