Skip to content

Commit 655fa3e

Browse files
update envvar capacity
1 parent 63524f4 commit 655fa3e

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

schimpy/schism_hotstart.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
from schimpy.schism_mesh import read_mesh, write_mesh, SchismMeshGr3Reader, compare_mesh
4949
from schimpy import geo_tools
50-
from schimpy import schism_yaml
50+
from schimpy.util.yaml_load import yaml_from_file
5151

5252

5353
class SCHISMHotstart(object):
@@ -67,7 +67,7 @@ class hotstart(object):
6767
"""
6868

6969
# will change these into yaml file on
70-
def __init__(self, input=None, modules=None, crs=None):
70+
def __init__(self, input=None, modules=None, crs=None, envvar=None):
7171
# read input from yaml files;
7272
# create elev.ic if it does not exist or not used as an input
7373
self.input = input
@@ -76,19 +76,24 @@ def __init__(self, input=None, modules=None, crs=None):
7676
self.crs = crs
7777
self._hotstart_cache = {}
7878
self._mesh_cache = {} # hgrid_fn -> mesh object
79+
if envvar is None:
80+
self.envvar = {}
81+
else:
82+
if not isinstance(envvar, dict):
83+
raise ValueError("envvar must be a dictionary if provided.")
84+
self.envvar = envvar
7985

8086
def read_yaml(self):
8187
"""
8288
read yaml and load mesh grid
8389
"""
8490
print(self.input)
85-
with open(self.input, "r") as f:
86-
info = schism_yaml.load(f)
91+
info = yaml_from_file(self.input, envvar=self.envvar)
8792
hotstart_info = info["hotstart"]
8893
self.info = hotstart_info
8994
self.date = hotstart_info["date"]
9095
self.run_start = hotstart_info["run_start"]
91-
self.time_step = hotstart_info["time_step"]
96+
self.time_step = int(hotstart_info["time_step"])
9297
self.hgrid_fn = hotstart_info["hgrid_input_file"]
9398
self.vgrid_fn = hotstart_info["vgrid_input_file"]
9499
variables = list(hotstart_info.keys())

0 commit comments

Comments
 (0)