Skip to content

Commit

Permalink
destroy cached copy of mesh before it is submitted to the pickler
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Sep 20, 2021
1 parent f0b12a6 commit 6f7d76d
Show file tree
Hide file tree
Showing 28 changed files with 34 additions and 39 deletions.
1 change: 0 additions & 1 deletion coupledmodeldriver/generate/adcirc/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from datetime import datetime, timedelta
import os
from os import PathLike
from pathlib import Path
from typing import Any, Union
Expand Down
9 changes: 0 additions & 9 deletions coupledmodeldriver/generate/adcirc/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,6 @@ def __init__(
for forcing in forcings:
self.add_forcing(forcing)

def perturb(self, relative_to: PathLike = None) -> {str: 'ADCIRCRunConfiguration'}:
perturbations = super().perturb(relative_to=relative_to)

for run_name, perturbation in perturbations.items():
if self.adcircpy_mesh == perturbation.adcircpy_mesh:
perturbation.adcircpy_mesh = self.adcircpy_mesh

return perturbations

def add_forcing(self, forcing: ForcingJSON):
if forcing not in self:
forcing = self[self.add(forcing)]
Expand Down
13 changes: 9 additions & 4 deletions coupledmodeldriver/generate/adcirc/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ def generate_adcirc_configuration(
'duration': spinup_duration,
'local_fort13_filename': local_fort13_filename,
'local_fort14_filename': local_fort14_filename,
'link_mesh': use_original_mesh
or spinup_configuration.adcircpy_mesh == base_configuration.adcircpy_mesh,
'link_mesh': True,
'relative_paths': relative_paths,
'overwrite': overwrite,
'platform': platform,
Expand All @@ -218,15 +217,19 @@ def generate_adcirc_configuration(
for run_name, run_configuration in perturbations.items():
run_directory = runs_directory / run_name

link_mesh = (
use_original_mesh
or run_configuration.adcircpy_mesh == base_configuration.adcircpy_mesh
)

run_kwargs = {
'directory': run_directory,
'name': run_name,
'phase': run_phase,
'configuration': run_configuration,
'local_fort13_filename': local_fort13_filename,
'local_fort14_filename': local_fort14_filename,
'link_mesh': use_original_mesh
or run_configuration.adcircpy_mesh == base_configuration.adcircpy_mesh,
'link_mesh': link_mesh,
'relative_paths': relative_paths,
'overwrite': overwrite,
'platform': platform,
Expand All @@ -243,6 +246,8 @@ def generate_adcirc_configuration(
}

if parallel:
# destroy stored copy of adcircpy mesh, because it cannot be pickled across processes
run_configuration.adcircpy_mesh = None
futures.append(process_pool.submit(write_run_directory, **run_kwargs))
else:
write_run_directory(**run_kwargs)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:16 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:16 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:16 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
2 changes: 1 addition & 1 deletion tests/data/reference/test_hera_adcirc_tidal/spinup/fort.15
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:16 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ AL, 09, 2008091418, , BEST, 324, 403N, 872W, 50, 988, EX, 34, NEQ, 0,
AL, 09, 2008091418, , BEST, 324, 403N, 872W, 50, 988, EX, 50, NEQ, 0, 160, 0, 0, 1007, 300, 50, , , , , , 53, 27, IKE , 59
AL, 09, 2008091500, , BEST, 330, 433N, 815W, 50, 988, EX, 34, NEQ, 0, 180, 150, 0, 1007, 300, 50, , , , , , 58, 26, IKE , 60
AL, 09, 2008091500, , BEST, 330, 433N, 815W, 50, 988, EX, 50, NEQ, 0, 160, 0, 0, 1007, 300, 50, , , , , , 58, 26, IKE , 60
AL, 09, 2008091506, , BEST, 336, 458N, 753W, 40, 986, EX, 34, NEQ, 0, 180, 150, 0, 1007, 300, 50, , , , , , 63, 17, IKE , 61
AL, 09, 2008091506, , BEST, 336, 458N, 753W, 40, 986, EX, 34, NEQ, 0, 180, 150, 0, 1007, 300, 50, , , , , ,243, 26, IKE , 61
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ AL, 09, 2008091418, , BEST, 324, 403N, 872W, 50, 988, EX, 34, NEQ, 0,
AL, 09, 2008091418, , BEST, 324, 403N, 872W, 50, 988, EX, 50, NEQ, 0, 160, 0, 0, 1007, 300, 50, , , , , , 53, 27, IKE , 59
AL, 09, 2008091500, , BEST, 330, 433N, 815W, 50, 988, EX, 34, NEQ, 0, 180, 150, 0, 1007, 300, 50, , , , , , 58, 26, IKE , 60
AL, 09, 2008091500, , BEST, 330, 433N, 815W, 50, 988, EX, 50, NEQ, 0, 160, 0, 0, 1007, 300, 50, , , , , , 58, 26, IKE , 60
AL, 09, 2008091506, , BEST, 336, 458N, 753W, 40, 986, EX, 34, NEQ, 0, 180, 150, 0, 1007, 300, 50, , , , , , 63, 17, IKE , 61
AL, 09, 2008091506, , BEST, 336, 458N, 753W, 40, 986, EX, 34, NEQ, 0, 180, 150, 0, 1007, 300, 50, , , , , ,243, 26, IKE , 61
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:16 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:16 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:16 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:16 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:16 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:22 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:22 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:22 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:22 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:17 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:18 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2021-09-07 12:21 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2021-09-07 14:18 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Loading

0 comments on commit 6f7d76d

Please sign in to comment.