Skip to content

Commit 1396740

Browse files
authored
Implement conditional output format for exports
Add export format option for output files. The user can now specify in the runtime.txt file if they want model output files to be in NetCDF (default) or CSV format.
1 parent 086224d commit 1396740

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/dementpy.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def main():
4545
pulse = int(runtime.loc['pulse',1]) # number of pulses
4646
cycle = int(runtime.loc['end_time',1]) # number of time steps in each pulse
4747
interval = int(runtime.loc['interval',1]) # interval of time step to record outputs
48+
Export_format = int(runtime.loc['output_CSV',1]) # interval of time step to record outputs
4849
mode = int(runtime.loc['dispersal',1]) # 0:'default' or 1:'dispersal'
4950

5051
#...Initialize data by calling the Function: Initialize_Data()
@@ -101,6 +102,9 @@ def main():
101102

102103
#...export the Output_init object to the output_folder using the export() funtion in the utility module
103104
os.chdir('../'+output_folder)
104-
Output_init.export(outname)
105+
if Export_format == 1:
106+
Output_init.export_to_csv(outname)
107+
else:
108+
Output_init.export_to_netcdf(outname)
105109

106-
main()
110+
main()

0 commit comments

Comments
 (0)