Skip to content

Commit

Permalink
Start adding list of files to rof.input_data_list file dealing with E…
Browse files Browse the repository at this point in the history
  • Loading branch information
ekluzek committed Mar 18, 2022
1 parent 7bea959 commit 3b7eef6
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile,
logger.debug(" mizuRoute lnd grid is %s ", config['lnd_grid'])
logger.debug(" mizuRoute rof grid is %s ", config['rof_grid'])
#----------------------------------------------------
# Create dictionary of files that will be read in
#----------------------------------------------------
files = {}
#----------------------------------------------------
# Settings that depend on the resolution
#----------------------------------------------------
if ( config['rof_grid'] == "HDMAmz" ):
Expand Down Expand Up @@ -175,6 +179,8 @@ def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile,
ctl.set( "varname_downSegId", varname_downSegId )
ctl.set( "varname_pfafCode", varname_pfafCode )

files['fname_ntopold'] = os.path.join( ctl.get('ancil_dir'), ctl.get('fname_ntopOld') )

#----------------------------------------------------
# Set the restart file depending on start type
#----------------------------------------------------
Expand All @@ -189,6 +195,7 @@ def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile,
filename = "%s.mizuRoute.r.%s-%s.nc" %(run_refcase, run_refdate, run_tod)

ctl.set( "fname_state_in", filename )
files['fname_state_in'] = ctl.get('fname_state_in')

elif fname_state_in.strip() == '':
fname_state_in = "empty"
Expand All @@ -215,15 +222,23 @@ def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile,
#----------------------------------------------------
control_file = os.path.join(confdir, "mizuRoute.control")
nml_file = os.path.join(confdir, "mizuRoute_in")
write_nml_in_file(case, nmlgen, confdir, nml_file)
write_nml_in_file(case, nmlgen, confdir, nml_file, data_list_path)
ctl.write( control_file )
#----------------------------------------------------
# Append list of files needed to file list file
#----------------------------------------------------
print( data_list_path )
fileslist = open( data_list_path, "a" )
print( files )
for datafile in files:
print( datafile )
fileslist.write( datafile + " = " + files[datafile] + "\n" )

fileslist.close()

###############################################################################
def write_nml_in_file(case, nmlgen, confdir, nml_file):
def write_nml_in_file(case, nmlgen, confdir, nml_file, data_list_path):
###############################################################################
data_list_path = os.path.join(case.get_case_root(), "Buildconf", "rof.input_data_list")
if os.path.exists(data_list_path):
os.remove(data_list_path)
namelist_file = os.path.join(confdir, nml_file)
nmlgen.write_output_file(namelist_file, data_list_path )

Expand Down

0 comments on commit 3b7eef6

Please sign in to comment.