From 4dce27ff4ba4eae0a992aea6af3678873b5d0d80 Mon Sep 17 00:00:00 2001 From: Sirkis Date: Thu, 19 Sep 2024 17:15:11 -0600 Subject: [PATCH] Small bathymetry update -- bathymetry input can now be a dictionary with 'x':x vector 'y':y vector 'depth': depth grid --- moorpy/system.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/moorpy/system.py b/moorpy/system.py index 5638c90..a358524 100644 --- a/moorpy/system.py +++ b/moorpy/system.py @@ -93,8 +93,14 @@ def __init__(self, file="", dirname="", rootname="", depth=0, rho=1025, g=9.81, if 'bathymetry' in kwargs: self.seabedMod = 2 - self.bathGrid_Xs, self.bathGrid_Ys, self.bathGrid = readBathymetryFile(kwargs['bathymetry']) - + if isinstance(kwargs['bathymetry'],str): + self.bathGrid_Xs, self.bathGrid_Ys, self.bathGrid = readBathymetryFile(kwargs['bathymetry']) + elif isinstance(kwargs['bathymetry'],dict): + bath_dictionary = kwargs['bathymetry'] + # grid sent in, just assign to properties + self.bathGrid_Xs = bath_dictionary['x'] + self.bathGrid_Ys = bath_dictionary['y'] + self.bathGrid = bath_dictionary['depth'] # initializing variables and lists self.nDOF = 0 # number of (free) degrees of freedom of the mooring system (needs to be set elsewhere)