Skip to content

Commit

Permalink
output file error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kthyng committed Nov 14, 2024
1 parent 4ac521c commit 71d36e6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions particle_tracking_manager/the_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class ParticleTrackingManager:
seed_seafloor: bool
output_file: str
output_format: str
output_file_initial: Optional[str]

def __init__(
self,
Expand Down Expand Up @@ -223,6 +224,8 @@ def __init__(
self.__dict__["has_run_seeding"] = False
self.__dict__["has_run"] = False

self.output_file_initial = None

# Set all attributes which will trigger some checks and changes in __setattr__
# these will also update "value" in the config dict
for key in sig.parameters.keys():
Expand Down Expand Up @@ -383,9 +386,10 @@ def __setattr__(self, name: str, value) -> None:
)

# make new attribute for initial output file
self.output_file_initial = str(
pathlib.Path(f"{output_file}_initial").with_suffix(".nc")
)
if self.output_file_initial is None:
self.output_file_initial = str(
pathlib.Path(f"{output_file}_initial").with_suffix(".nc")
)

if self.output_format is not None:
if self.output_format == "netcdf":
Expand Down

0 comments on commit 71d36e6

Please sign in to comment.