@@ -35,26 +35,26 @@ class and write out the SCHISM boundary condition btdides input file.
3535 mesh_in = main_yaml_dict ["mesh" ]["mesh_inputfile" ]
3636 sr = SchismMeshGr3Reader ()
3737 hgrid = sr .read (mesh_in )
38- open_boundary = None
38+ open_boundary_grd = None
3939 if "open_boundaries" in main_yaml_dict ["mesh" ].keys ():
40- open_boundary = main_yaml_dict ["mesh" ]["open_boundaries" ]
40+ open_boundary_grd = main_yaml_dict ["mesh" ]["open_boundaries" ]
4141
4242 bctides_dic = main_yaml_dict ["bctides" ]
4343 for bctides_key in bctides_dic .keys ():
4444 bctides_yaml = bctides_dic [bctides_key ]
45- by = load_boundary (bctides_yaml ,hgrid )
45+ by = load_boundary (hgrid , bctides_yaml ,open_boundary_grd )
4646 by .write_bctides (bctides_key )
4747
48- def load_boundary (hgrid ,fn ):
49- return boundary (fn )
48+ def load_boundary (hgrid ,fn , open_boundary_grid ):
49+ return boundary (hgrid , fn , open_boundary_grid )
5050
5151
5252class boundary (object ):
5353 """
5454 A class to generate boundary condition input file for SCHISM
5555 """
5656
57- def __init__ (self , hgrid ,bc_yaml = None ):
57+ def __init__ (self , hgrid ,bc_yaml = None , boundary_grid = None ):
5858 """ initialize the boundary condition from yaml file"""
5959
6060 main_id = "bctides"
@@ -69,7 +69,11 @@ def __init__(self, hgrid,bc_yaml=None):
6969 self .boundary_tidals = None
7070
7171 self .open_boundaries = bc_yaml [main_id ]["open_boundaries" ]
72- self .hgrid = hgrid
72+ self .hgrid = hgrid
73+
74+ ## if boundary grid is provided, use it to override the hgrid boundary
75+ ## grid
76+ self .boundary_grid = boundary_grid
7377
7478 self .elev_type = {
7579 "elev.th" : 1 ,
@@ -126,7 +130,7 @@ def __init__(self, hgrid,bc_yaml=None):
126130 }
127131
128132 def write_bctides (self , bctides_file ):
129-
133+
130134 with open (bctides_file , "w" ) as outf :
131135 tt = self .date .strftime ("%Y-%m-%d %H:%M" )
132136 outf .write (tt )
@@ -515,10 +519,9 @@ def write_bctides(self, bctides_file):
515519
516520
517521if __name__ == "__main__" :
518- bcyaml = "G:\\ schism\\ bctides\\ bctides.yaml"
519- bctides = "G:\\ schism\\ bctides\\ bctides.in"
520- by = load_boundary (bcyaml )
521- by .write_bctides (bctides )
522+ bcyaml = "bctides_main.yaml"
523+ by = load_main_input (bcyaml )
524+
522525
523526
524527##################### YAML EXMAPLE #####################################################
0 commit comments