Skip to content

Commit

Permalink
bug fixes and minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoMattB committed Mar 23, 2024
1 parent 50cfc95 commit e7b96c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions badlands_doe_toolset/csv_to_badlands.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def badlands_encode(row, *args):
if 'Tectonic' in row.keys():
try:
tectonic_structure = tectonic_dict[row['Tectonic']]
except(KeyError): # this is the error returned if the specified xml file is not found.
except(UnboundLocalError): # this is the error returned if the specified xml file is not found.
print('No Tectonic structure files found')
elif 'dstart' in row.keys():
tectonic_structure=f""" <tectonic>
Expand All @@ -119,7 +119,7 @@ def badlands_encode(row, *args):
if '.xml' in str(row['Precipitation']):
try:
precipitation_structure = precipitation_dict[row['Precipitation']]
except(KeyError): # this is the error returned if the specified xml file is not found.
except(UnboundLocalError): # this is the error returned if the specified xml file is not found.
print('No precipitation structure files found using single event climate values')
else:
precipitation_structure = f"""<!-- Precipitation structure -->
Expand Down Expand Up @@ -281,7 +281,7 @@ def badlands_encode(row, *args):
if '.xml' in str(row['Erodibility']):
try:
erodibility_structure = erodability_dict[row['Erodibility']]
except(KeyError): # this is the error returned if the specified xml file is not found.
except(UnboundLocalError): # this is the error returned if the specified xml file is not found.
print('No Erodibility structure files found using single Erodibility values')
else:
erodability_structure = f"""<erodibility>{row['Erodibility']}</erodibility>"""
Expand Down Expand Up @@ -365,7 +365,7 @@ def badlands_encode(row, *args):
if 'Carbonate' in row.keys():
try:
carbonate_structure = carbonate_dict[row['Carbonate']]
except(KeyError): # this is the error returned if the specified xml file is not found.
except(UnboundLocalError): # this is the error returned if the specified xml file is not found.
print('No carbonate structure files found')
elif 'tcarb' in row.keys():
carbonate_structure=f"""<carb>
Expand Down
5 changes: 4 additions & 1 deletion badlands_doe_toolset/postproc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ def tin_write_instdiff(modelfile):
tin_N1=TINfile()
tin_N.loadTIN(modelh5dir+'/tin.time'+str(i)+'.hdf5')
#return(tin_N)
tin_N1.loadTIN(modelh5dir+'/tin.time'+str(i+1)+'.hdf5')
if i != maxSteps:
tin_N1.loadTIN(modelh5dir+'/tin.time'+str(i+1)+'.hdf5')
elif i == maxSteps:
tin_N1.loadTIN(modelh5dir+'/tin.time'+str(i)+'.hdf5')

#this is a bit not-that-useful, it just adds an attribute to the first (zero) layer to keep outputs consistent / tidy.
if i==0:
Expand Down
8 changes: 4 additions & 4 deletions badlands_doe_toolset/postproc_xmf_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def flowfile_xmf(modelfile):
xmf_file=str(modelXmfdir)+'/flow.time'+str(i)+'.xmf'
print ('output will be '+xmf_file)
f=h5py.File(hdf_file, 'r')
tmstep=float(i*model.tDisplay)
tmstep=float(model.tStart+(i*model.tDisplay))
conshp=len(f['connect'])
geom=len(f['coords'])
# row=pd.DataFrame()
Expand Down Expand Up @@ -88,7 +88,7 @@ def tinfile_xmf(modelfile):
xmf_file=str(modelXmfdir)+'/tin.time'+str(i)+'.xmf'
print ('output will be '+xmf_file)
f=h5py.File(hdf_file, 'r')
tmstep=float(i*model.tDisplay)
tmstep=float(model.tStart+(i*model.tDisplay))
cells=len(f['cells'])
geom=len(f['coords'])
row=pd.DataFrame()
Expand Down Expand Up @@ -145,7 +145,7 @@ def tinfile_xmf(modelfile):

# XMF for sed time strat files
# single xmf build write the xmf to view in paraview
def sedfile_xmf(hdf_file,modelinc,tDisplay=100000)
def sedfile_xmf(hdf_file,modelinc,tDisplay=100000):
print ('load '+hdf_file)
strat=ppu.Stratadata()
strat.loadStrat(hdf_file)
Expand Down Expand Up @@ -186,7 +186,7 @@ def sedfile_xmf(hdf_file,modelinc,tDisplay=100000)
</Domain>
</Xdmf>
""")
texfile.close()
texfile.close()


#write all of the xmf files and then the XDMF for a time series.
Expand Down

0 comments on commit e7b96c5

Please sign in to comment.