Skip to content

Commit 69bd8e2

Browse files
committed
variable names and keyword editing
1 parent b95594e commit 69bd8e2

1 file changed

Lines changed: 34 additions & 34 deletions

File tree

schimpy/bctide.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -131,37 +131,37 @@ def __init__(self, hgrid,bc_yaml=None,boundary_segments=None):
131131
)
132132
update_mesh_open_boundaries(self.hgrid, self.boundary_segments)
133133

134-
self.elev_type = {
135-
"elev.th": 1,
134+
self.elev_source = {
135+
"elev history": 1,
136136
"constant": 2,
137137
"tidal": 3,
138-
"elev2D.th.nc": 4,
139-
"tidal elev2D.th.nc": 5,
138+
"2D elev history": 4,
139+
"tidal and 2D elev history": 5,
140140
"none": 0,
141141
}
142-
self.vel_type = {
143-
"flux.th": 1,
142+
self.vel_source = {
143+
"flux history": 1,
144144
"constant": 2,
145145
"tidal": 3,
146-
"uv3D.th.nc": 4,
147-
"tidal uv3D.th.nc": 5,
146+
"3D uv history": 4,
147+
"tidal and 3D uv history": 5,
148148
"flather 1": -1,
149149
"none": 0,
150150
}
151151

152-
self.temp_type = {
153-
"TEM_1.th": 1,
152+
self.temp_source = {
153+
"temperature history": 1,
154154
"constant": 2,
155155
"initial profile": 3,
156-
"TEM_3D.th.nc": 4,
156+
"3D temperature history": 4,
157157
"none": 0,
158158
}
159159

160-
self.salt_type = {
161-
"SAL_1.th": 1,
160+
self.salt_source = {
161+
"salinity history": 1,
162162
"constant": 2,
163163
"initial profile": 3,
164-
"SAL_3D.th.nc": 4,
164+
"3D salinity history": 4,
165165
"none": 0,
166166
}
167167

@@ -178,7 +178,7 @@ def __init__(self, hgrid,bc_yaml=None,boundary_segments=None):
178178
"FABM": 9,
179179
"DVD": 10,
180180
}
181-
self.tracer_type = {
181+
self.tracer_source = {
182182
"time history": 1,
183183
"constant": 2,
184184
"initial profile": 3,
@@ -315,15 +315,15 @@ def write_bctides(self, bctides_file):
315315
elev_boundary = None
316316
if "elevation_boundary" in self.open_boundaries[i].keys():
317317
elev_boundary = self.open_boundaries[i]["elevation_boundary"]
318-
elev_source = elev_boundary["type"]
318+
elev_source = elev_boundary["source"]
319319
elev_key = elev_source
320320
if isinstance(elev_source, numbers.Number):
321321
elev_key = "constant"
322322
if ("tidal" in elev_key) and ("elev2D.th.nc" in elev_key):
323323
elev_key = "tidal elev2D.th.nc"
324324

325325
try:
326-
elev_id = self.elev_type[elev_key]
326+
elev_id = self.elev_source[elev_key]
327327
except:
328328
raise ValueError(
329329
elev_key + " elevation boundary is not supported"
@@ -333,7 +333,7 @@ def write_bctides(self, bctides_file):
333333
vel_boundary = None
334334
if "velocity_boundary" in self.open_boundaries[i].keys():
335335
vel_boundary = self.open_boundaries[i]["velocity_boundary"]
336-
vel_source = vel_boundary["type"]
336+
vel_source = vel_boundary["source"]
337337
vel_key = vel_source
338338

339339
if isinstance(vel_source, numbers.Number):
@@ -345,7 +345,7 @@ def write_bctides(self, bctides_file):
345345
vel_key = "flather 1"
346346

347347
try:
348-
vel_id = self.vel_type[vel_key]
348+
vel_id = self.vel_source[vel_key]
349349
except:
350350
raise ValueError(
351351
vel_key + " velocity boundary is not supported"
@@ -356,13 +356,13 @@ def write_bctides(self, bctides_file):
356356
temp_boundary = None
357357
if "temperature_boundary" in self.open_boundaries[i].keys():
358358
temp_boundary = self.open_boundaries[i]["temperature_boundary"]
359-
temp_source = temp_boundary["type"]
359+
temp_source = temp_boundary["source"]
360360
temp_key = temp_source
361361
if isinstance(temp_source, numbers.Number):
362362
temp_key = "constant"
363363

364364
try:
365-
temp_id = self.vel_type[vel_key]
365+
temp_id = self.vel_source[vel_key]
366366
except:
367367
raise ValueError(
368368
temp_key + " temperature boundary is not supported"
@@ -371,28 +371,28 @@ def write_bctides(self, bctides_file):
371371
salt_boundary = None
372372
if "salinity_boundary" in self.open_boundaries[i].keys():
373373
salt_boundary = self.open_boundaries[i]["salinity_boundary"]
374-
salt_source = salt_boundary["type"]
374+
salt_source = salt_boundary["source"]
375375
salt_key = salt_source
376376
if isinstance(salt_source, numbers.Number):
377377
salt_key = "constant"
378378

379379
try:
380-
salt_id = self.salt_type[salt_key]
380+
salt_id = self.salt_source[salt_key]
381381
except:
382382
raise ValueError(
383383
salt_key + " temperature boundary is not supported"
384384
)
385385

386386
## output tracer boundary
387-
tracer_boundary_types = [0] * num_tracer_mod
387+
tracer_boundary_sources = [0] * num_tracer_mod
388388
## this list save sorted tracer boundary index according to SCHISM code order
389389
tracer_boundary_lst_sorted = []
390390
if "tracers" in self.open_boundaries[i].keys():
391391
boundary_tracer_mod_num = len(
392392
self.open_boundaries[i]["tracers"]
393393
)
394394
for j in range(boundary_tracer_mod_num):
395-
tracer_boundary = self.open_boundaries[i]["tracers"][j]["type"]
395+
tracer_boundary = self.open_boundaries[i]["tracers"][j]["source"]
396396
tracer_mod = self.open_boundaries[i]["tracers"][j]["tracer"]
397397
tracer_boundary_key = tracer_boundary
398398
if isinstance(tracer_boundary, numbers.Number):
@@ -410,9 +410,9 @@ def write_bctides(self, bctides_file):
410410
+ str(tracer_boundary)
411411
+ " boundary is not supported"
412412
)
413-
tracer_boundary_type = self.tracer_type[tracer_boundary_key]
413+
tracer_boundary_source = self.tracer_source[tracer_boundary_key]
414414
pos = tracer_mod_pos[tracer_mod]
415-
tracer_boundary_types[pos] = tracer_boundary_type
415+
tracer_boundary_sources[pos] = tracer_boundary_source
416416
tracer_boundary_lst_sorted.append(j)
417417

418418
tracer_boundary_lst_sorted.sort(
@@ -426,7 +426,7 @@ def write_bctides(self, bctides_file):
426426
outf.write(str(temp_id) + " ")
427427
outf.write(str(salt_id) + " ")
428428
for ii in range(num_tracer_mod):
429-
outf.write(str(tracer_boundary_types[ii]) + " ")
429+
outf.write(str(tracer_boundary_sources[ii]) + " ")
430430
outf.write("\n")
431431

432432
## output all the boundary parameters
@@ -566,15 +566,15 @@ def write_bctides(self, bctides_file):
566566

567567
## temperature bc parameters
568568
if temp_id == 2:
569-
temp_bc = temp_boundary["type"]
569+
temp_bc = temp_boundary["source"]
570570
outf.write(str(temp_bc) + "\n")
571571
if temp_id > 0:
572572
nudge = temp_boundary["nudge"]
573573
outf.write(str(nudge) + "\n")
574574

575575
## salt bc parameters
576576
if salt_id == 2:
577-
salt_bc = salt_boundary["type"]
577+
salt_bc = salt_boundary["source"]
578578
outf.write(str(salt_bc) + "\n")
579579
if salt_id > 0:
580580
nudge = salt_boundary["nudge"]
@@ -584,16 +584,16 @@ def write_bctides(self, bctides_file):
584584
for ii in range(len(tracer_boundary_lst_sorted)):
585585
tracer_index = tracer_boundary_lst_sorted[ii]
586586
tracer = self.open_boundaries[i]["tracers"][tracer_index]
587-
tracer_bc_type = tracer_boundary_types[ii]
588-
if tracer_bc_type == 2:
589-
tracer_bc_const = tracer["type"]
587+
tracer_bc_source = tracer_boundary_sources[ii]
588+
if tracer_bc_source == 2:
589+
tracer_bc_const = tracer["source"]
590590
if isinstance(tracer_bc_const, list):
591591
for val in tracer_bc_const:
592592
outf.write(str(val) + " ")
593593
else:
594594
outf.write(str(tracer_bc_const))
595595
outf.write("\n")
596-
if tracer_bc_type > 0:
596+
if tracer_bc_source > 0:
597597
relax = tracer["relax"]
598598
outf.write(str(relax) + "\n ")
599599

0 commit comments

Comments
 (0)