Skip to content

Commit

Permalink
Save field to file
Browse files Browse the repository at this point in the history
  • Loading branch information
MassimoCimmino committed Nov 28, 2024
1 parent 6027e42 commit f999eac
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pygfunction/borefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,31 @@ def to_boreholes(self) -> List[Borehole]:
"""
return [borehole for borehole in self]

def to_file(self, filename: str) -> List[Borehole]:
"""
Save the bore field into a text file.
Parameters
----------
filename : str
The filename in which to save the bore field.
"""
data = np.stack(
(self.x,
self.y,
self.H,
self.D,
self.r_b,
self.tilt,
self.orientation),
axis=-1)
np.savetxt(
filename,
data,
delimiter='\t',
header='x\ty\tH\tD\tr_b\ttilt\torientation')

@classmethod
def rectangle_field(
cls, N_1: int, N_2:int, B_1: float, B_2: float, H: float, D: float,
Expand Down

0 comments on commit f999eac

Please sign in to comment.