It is currently not possible to redirect stdout, stderr to files in the model working directory. If workdir doesn't exist when creating the Dales object and a file in workdir is used for redirection the code fails, because the directory doesn't exist when the output files are created.
The DALES interface behaves differently depending on whether workdir exists. If not, it assumes a fresh start and copies files from inputdir. If it exists, it assumes a restart and doesn't copy files. This means the user code cannot create the working directory in advance.
Proposed fix: in the DALES interface.py, move the directory logic before call to model creation, add mkdirs in between:
class Dales(CommonCode, CodeWithNamelistParameters):
...
def __init__(self, **options):
inputdir = None
# Set working directory
self.workdir = "."
if "workdir" in options:
self.workdir = options["workdir"]
if os.path.exists(self.workdir): # This is a restart
inputdir = self.workdir
else:
os.makedirs(self.workdir)
# create work directory so that output files can be placed there
CodeWithNamelistParameters.__init__(self, namelist_parameters)
CommonCode.__init__(self, DalesInterface(**options), **options)
self.stopping_conditions = StoppingConditions(self)
It is currently not possible to redirect stdout, stderr to files in the model working directory. If workdir doesn't exist when creating the Dales object and a file in workdir is used for redirection the code fails, because the directory doesn't exist when the output files are created.
The DALES interface behaves differently depending on whether workdir exists. If not, it assumes a fresh start and copies files from inputdir. If it exists, it assumes a restart and doesn't copy files. This means the user code cannot create the working directory in advance.
Proposed fix: in the DALES interface.py, move the directory logic before call to model creation, add mkdirs in between: