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 @@ -315,14 +315,30 @@ def create_stream_xml(
315
315
),
316
316
)
317
317
if var_key in valid_values :
318
+
319
+ # # Handle, e.g., 'bilinear' in namelist instead of bilinear (no quotes)
320
+ mod_dict_var_key = mod_dict [var_key ]
321
+
322
+ # Check that key is valid
323
+ is_valid = mod_dict_var_key in valid_values [var_key ]
324
+ msg = "{} can only have values of {} for stream {} in file {}, not {}" .format (
325
+ var_key ,
326
+ valid_values [var_key ],
327
+ stream_name ,
328
+ user_mods_file ,
329
+ mod_dict [var_key ],
330
+ )
331
+ if not is_valid :
332
+ # Check for surrounding quote marks
333
+ has_surrounding_quotes = (
334
+ (mod_dict_var_key [0 ] == mod_dict_var_key [- 1 ] == "'" ) or
335
+ (mod_dict_var_key [0 ] == mod_dict_var_key [- 1 ] == '"' )
336
+ )
337
+ if has_surrounding_quotes and mod_dict_var_key [1 :- 1 ] in valid_values [var_key ]:
338
+ msg += " (try removing surrounding quotes)"
318
339
expect (
319
- mod_dict [var_key ] in valid_values [var_key ],
320
- "{} can only have values of {} for stream {} in file {}" .format (
321
- var_key ,
322
- valid_values [var_key ],
323
- stream_name ,
324
- user_mods_file ,
325
- ),
340
+ is_valid ,
341
+ msg ,
326
342
)
327
343
stream_vars ["stream_" + var_key ] = mod_dict [var_key ]
328
344
if var_key == "datafiles" :
You can’t perform that action at this time.
0 commit comments