Skip to content

Instantly share code, notes, and snippets.

@chrisb13
Created May 29, 2018 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisb13/ba91f6e2b112bec057a1d10cce5994ad to your computer and use it in GitHub Desktop.
Save chrisb13/ba91f6e2b112bec057a1d10cce5994ad to your computer and use it in GitHub Desktop.
lg.info("")
lg.info("Running check to see if changes found in "+cfgf+" are now in: "+ofile)
#run quick check to make sure all diff'd parameters were inserted
#(still uses f90nml, so not exactly independent)
with open(ofile) as nml_file:
new_nml = f90nml.read(nml_file)
for top_key in diff[cfgf].keys():
for bot_key in diff[cfgf][top_key].keys():
# assert(new_nml[top_key][bot_key]==diff[cfgf][top_key][bot_key]),ofile + " did not get created correctly"
# print(top_key,bot_key,new_nml[top_key][bot_key],diff[cfgf][top_key][bot_key])
if new_nml[top_key][bot_key]!=diff[cfgf][top_key][bot_key]: #chk: how does this work elementwise?
# print(top_key,bot_key,new_nml[top_key][bot_key],diff[cfgf][top_key][bot_key])
lg.error("")
lg.error("For "+top_key + " "+ bot_key)
lg.error("New namelist has: "+str(new_nml[top_key][bot_key] ))
lg.error("but old namelist has: "+str(diff[cfgf][top_key][bot_key]))
lg.error("")
# __import__('pdb').set_trace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment