Skip to content

Commit bebf1b6

Browse files
committed
Fixing FFarmCompatible MD to give bathymetry data under option with the name depth
1 parent f80b9c0 commit bebf1b6

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

famodel/project.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4226,26 +4226,31 @@ def FFarmCompatibleMDOutput(self, filename, unrotateTurbines=True, renameBody=Tr
42264226
newLines = []
42274227

42284228
for i, line in enumerate(lines):
4229-
newLines.append(line)
4229+
if 'DEPTH' not in line.upper():
4230+
newLines.append(line)
42304231
if '---' in line and 'OPTIONS' in line.upper():
4231-
newLines.append(f" {bathymetryFile} Seafloor File\n")
4232+
newLines.append(f"{bathymetryFile} depth\n")
42324233

4234+
with open(filename, 'w') as f:
4235+
f.writelines(newLines)
4236+
42334237

42344238
with open(filename, 'w') as f:
42354239
f.writelines(newLines)
42364240

42374241
def resetArrayCenter(self, FOWTOnly=True):
42384242
'''
4239-
Function to reset array center such that the farm origin is the mid-point between all FOWT platforms:
4243+
Function to reset array center such that the farm origin is the mid-point
4244+
between all FOWT platforms in y and the minimum_x turbine location in x:
42404245
42414246
Parameters
42424247
----------
42434248
FOWTOnly : bool
42444249
find the center between only FOWT-entity platforms if True.
42454250
'''
4246-
xCenter = np.mean([p.r[0] for p in self.platformList.values() if p.entity=='FOWT' or not FOWTOnly])
4251+
x = np.min([p.r[0] for p in self.platformList.values() if p.entity=='FOWT' or not FOWTOnly])
42474252
yCenter = np.mean([p.r[1] for p in self.platformList.values() if p.entity=='FOWT' or not FOWTOnly])
4248-
delta = np.array([xCenter, yCenter])
4253+
delta = np.array([x, yCenter])
42494254

42504255
# Change boundaries
42514256
self.boundary -= delta

famodel/seabed/seabed_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def writeBathymetryFile(filename, grid_x, grid_y, grid_depth):
5454
"""
5555
with open(filename, 'w') as f:
5656
# Write a placeholder header
57-
f.write("Bathymetry Data File\n")
57+
f.write("--- MoorPy Bathymetry Input File ---\n")
5858

5959
# Write the number of grid values in the x and y directions
6060
f.write(f"nGridX {len(grid_x)}\n")

0 commit comments

Comments
 (0)