Skip to content

Commit

Permalink
Auto-format with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Mar 25, 2023
1 parent 9b3426d commit 8afa5a2
Show file tree
Hide file tree
Showing 8 changed files with 574 additions and 227 deletions.
149 changes: 102 additions & 47 deletions HyAn/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,87 +4,142 @@
import os


class PDF( FPDF ):
def __init__ (self):
class PDF(FPDF):
def __init__(self):
super().__init__()

def header(self):
#Page border
# Page border
self.rect(5.0, 5.0, self.w - 10.0, self.h - 10.0)

#File Header
self.set_font('Arial', 'B', 12 )
self.cell(0, 20, 'Hydro Analyzer Report', 1, 1, 'C')
# File Header
self.set_font("Arial", "B", 12)
self.cell(0, 20, "Hydro Analyzer Report", 1, 1, "C")


class Report():
class Report:
"""
Generates report for the pumping test analysis.
Generates report for the pumping test analysis.
"""


def __init__(self, data):
self.pdf = PDF()
self.pdf.add_page()
self.pdf.set_font('Arial', '', 12)
self.pdf.set_font("Arial", "", 12)

self.m = 10
self.pw = 210 - 2*self.m
self.pw = 210 - 2 * self.m
self.ch = 10
self.cw = self.pw/6
self.cw = self.pw / 6

self.data = data
print("Time in report" , list(data[:,0]))
print("Time in report", list(data[:, 0]))

# time and drawdown data frame
self.df = pd.DataFrame(
{"Time" : list(data[:,0]),
"Drawdown" : list(data[:,1])
})

def project_data(self,project_name, project_number, client, location, pumping_test, pumping_well, test_conducted_by, test_date, discharge_rate):
self.df = pd.DataFrame({"Time": list(data[:, 0]), "Drawdown": list(data[:, 1])})

def project_data(
self,
project_name,
project_number,
client,
location,
pumping_test,
pumping_well,
test_conducted_by,
test_date,
discharge_rate,
):
# datas of the project and analyst
self.pdf.cell(w=(self.pw/3), h= self.ch, txt= f"Project : {project_name} ", border =1 , ln =0 )
self.pdf.cell(w=(self.pw/3), h= self.ch, txt= f"Project Number : {project_number} ", border =1 , ln =0)
self.pdf.cell(w=(self.pw/3), h= self.ch, txt= f"Client : {client} ", border =1 , ln =1 )

self.pdf.cell(w=(self.pw/3), h= self.ch, txt= f"Location : {location}", border =1 , ln =0 )
self.pdf.cell(w=(self.pw/3), h= self.ch, txt= f"Pumping Test: {pumping_test}", border =1 , ln =0)
self.pdf.cell(w=(self.pw/3), h= self.ch, txt= f"Pumping well: {pumping_well}", border =1 , ln =1 )


self.pdf.cell(w=(self.pw/3), h= self.ch, txt= f"Test Conducted By : {test_conducted_by}", border =1 , ln =0 )
self.pdf.cell(w=(self.pw/3), h= self.ch, txt= f"Test Date : {test_date}", border =1 , ln =0)
self.pdf.cell(w=(self.pw/3), h= self.ch, txt= f"Discharge rate : {discharge_rate} ", border =1 , ln =1 )
self.pdf.cell(
w=(self.pw / 3), h=self.ch, txt=f"Project : {project_name} ", border=1, ln=0
)
self.pdf.cell(
w=(self.pw / 3),
h=self.ch,
txt=f"Project Number : {project_number} ",
border=1,
ln=0,
)
self.pdf.cell(
w=(self.pw / 3), h=self.ch, txt=f"Client : {client} ", border=1, ln=1
)

self.pdf.cell(
w=(self.pw / 3), h=self.ch, txt=f"Location : {location}", border=1, ln=0
)
self.pdf.cell(
w=(self.pw / 3),
h=self.ch,
txt=f"Pumping Test: {pumping_test}",
border=1,
ln=0,
)
self.pdf.cell(
w=(self.pw / 3),
h=self.ch,
txt=f"Pumping well: {pumping_well}",
border=1,
ln=1,
)

self.pdf.cell(
w=(self.pw / 3),
h=self.ch,
txt=f"Test Conducted By : {test_conducted_by}",
border=1,
ln=0,
)
self.pdf.cell(
w=(self.pw / 3), h=self.ch, txt=f"Test Date : {test_date}", border=1, ln=0
)
self.pdf.cell(
w=(self.pw / 3),
h=self.ch,
txt=f"Discharge rate : {discharge_rate} ",
border=1,
ln=1,
)

def print_table(self):
# Table Header
self.pdf.set_font('Arial', 'B', 16)
self.pdf.cell(w=self.cw, h=10, txt='Time', border=1, ln=0, align='C')
self.pdf.cell(w=self.cw, h=10, txt='Drawdown', border=1, ln=1, align='C')
self.pdf.set_font("Arial", "B", 16)
self.pdf.cell(w=self.cw, h=10, txt="Time", border=1, ln=0, align="C")
self.pdf.cell(w=self.cw, h=10, txt="Drawdown", border=1, ln=1, align="C")

# Table Data
self.pdf.set_font('Arial', '', 14)
self.pdf.set_font("Arial", "", 14)
for i in range(0, len(self.df)):
self.pdf.cell(w=self.cw, h=6,
txt=self.df['Time'].iloc[i].astype(str),
border=1, ln=0, align='C')
self.pdf.cell(w=self.cw, h=6,
txt=self.df['Drawdown'].iloc[i].astype(str),
border=1, ln=1, align='C')

self.pdf.cell(
w=self.cw,
h=6,
txt=self.df["Time"].iloc[i].astype(str),
border=1,
ln=0,
align="C",
)
self.pdf.cell(
w=self.cw,
h=6,
txt=self.df["Drawdown"].iloc[i].astype(str),
border=1,
ln=1,
align="C",
)

def display_graph(self):
# embedding graph on report
output_path = os.path.join("HyAn/img", "analysis.png")
self.pdf.image(output_path, x = 72, y = 65, w = 130, h = 125, type = 'PNG')
self.pdf.image(output_path, x=72, y=65, w=130, h=125, type="PNG")

def result(self, t, s):
#Transmissivity and storativity Cell
# Transmissivity and storativity Cell
self.pdf.ln(10)
self.pdf.cell(w=self.pw, h=self.ch, txt=f"Transmissivity : {t} ", border=1, ln=1 )
self.pdf.cell(
w=self.pw, h=self.ch, txt=f"Transmissivity : {t} ", border=1, ln=1
)
self.pdf.cell(w=self.pw, h=self.ch, txt=f"Storativity : {s}", border=1, ln=1)

def generate_report(self, output_path):
# generates report pdf
self.pdf.output(f"{output_path}", 'F')

self.pdf.output(f"{output_path}", "F")
55 changes: 51 additions & 4 deletions HyAn/solution/theis.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def calculate_well_function(self, r, S, T, t):
Returns:
- float or numpy array, value(s) of the well function at the specified time(s)
"""

u = (r**2) * S / (4 * T * t)
Wu = -0.5772 - np.log(u) + u
n_terms = 30
Expand Down Expand Up @@ -77,10 +77,57 @@ def fit(self):
print(f"fit : {[self.T, self.S, self.model]}")
return [self.T, self.S, self.model]

time = [3, 5, 8, 12, 20, 24, 30, 38, 47, 50, 60, 70, 80, 90, 100, 130, 160, 200, 260, 320, 380, 500]
drawdown = [0.3, 0.7, 1.3, 2.1, 3.2, 3.6, 4.1, 4.7, 5.1, 5.3, 5.7, 6.1, 6.3, 6.7, 7.0, 7.5, 8.3, 8.5, 9.2, 9.7, 10.2, 10.9]

time = [
3,
5,
8,
12,
20,
24,
30,
38,
47,
50,
60,
70,
80,
90,
100,
130,
160,
200,
260,
320,
380,
500,
]
drawdown = [
0.3,
0.7,
1.3,
2.1,
3.2,
3.6,
4.1,
4.7,
5.1,
5.3,
5.7,
6.1,
6.3,
6.7,
7.0,
7.5,
8.3,
8.5,
9.2,
9.7,
10.2,
10.9,
]
Q = 220
r = 40

theis = Theis(time=time, drawdown=drawdown, Q=Q, r=r)
theis.fit()
theis.fit()
Loading

0 comments on commit 8afa5a2

Please sign in to comment.