Skip to content

Commit

Permalink
Merge branch 'feat-logger/5-replace-print-logger-local_modules' into …
Browse files Browse the repository at this point in the history
…feat-logger/6-reformat-everything

# Conflicts:
#	src/icesat2waves/local_modules/m_general_ph3.py
#	src/icesat2waves/local_modules/m_tools_ph3.py
  • Loading branch information
hollandjg committed Mar 15, 2024
2 parents b1b6119 + 5501bfc commit 22c1ff3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/icesat2waves/local_modules/jonswap_gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ def reg_func(p0, pi, p_err_unit):
vd[k] = I * np.random.rand()

Jm = Jm_regulizer(vd, priors)
_logger.debug(Jm)
_logger.debug("Jm from regulizer: %s", Jm)


def cost(value_dict, time, f, data=None, weight=None, prior=False, eps=None):
Expand Down
19 changes: 9 additions & 10 deletions src/icesat2waves/local_modules/m_general_ph3.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ def cut_nparray(var, low, high, verbose=False):
return np.unravel_index(np.abs(a).argmin(), np.transpose(a.shape))

else:
_logger.debug("error")
_logger.warning("error in cut_nparray()")
return


Expand Down Expand Up @@ -972,7 +972,7 @@ def boxmean(data, lon, lat, xlim, ylim):
case (2, 1):
datan = data[:, :, xbool][:, ybool, :]
case _:
_logger.debug("arrays have not the same shape")
_logger.debug("arrays do not have the same shape")

_logger.debug("new shape %s", datan.shape)

Expand Down Expand Up @@ -1606,14 +1606,16 @@ def find_max_along_line(

if mode is None:
mode = "free_limits"

_logger.debug("find_max_along_line with %s", mode)

if mode in ["free_limits", "upper_limit"]:
_logger.debug("line_left[0]: %s, time_lin[0]: %s", line_left[0], time_lin[0])
if line_left[0] > time_lin[0]:
f_start = 0
_logger.debug(" left line > time0")
_logger.debug("%s %s", line_left[0], time_lin[0])
f_start = 0
else:
_logger.debug(" left line < time")
_logger.debug("%s %s", line_left[0], time_lin[0])
_logger.debug(" left line < time0")
a = line_left - time_lin[0]
f_start = np.unravel_index(np.abs(a).argmin(), np.transpose(a.shape))[0] + 1
else:
Expand All @@ -1622,16 +1624,13 @@ def find_max_along_line(
f_start = np.unravel_index(np.abs(a).argmin(), np.transpose(a.shape))[0]

if mode == "free_limits" or mode == "lower_limit":
_logger.debug("line_right[-1]: %s, time_lin[-1]: %s", line_right[-1], time_lin[-1])
if line_right[-1] > time_lin[-1]:
_logger.debug(" right line > time window")
_logger.debug(
"line_right[-1]: %s, time_lin[-1]: %s", line_right[-1], time_lin[-1]
)
a = line_right - time_lin[-1]
f_end = np.unravel_index(np.abs(a).argmin(), np.transpose(a.shape))[0] - 1
else:
_logger.debug(" right line < time window")
_logger.debug("%s %s", line_right[-1], time_lin[-1])
f_end = time_lin.size - 2
else:
a = f - f2
Expand Down
2 changes: 1 addition & 1 deletion src/icesat2waves/local_modules/m_tools_ph3.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def write_variables_log(hist, var_list, locals, verbose=False, date=False):
message = f"\n{now} {stringg}" if date else f"\n{' '.ljust(5)} {stringg}"

if verbose in [True, "all"]:
_logger.debug("%s", hist + message if verbose == "all" else message)
_logger.debug("write_variables_log: %s", hist + message if verbose == "all" else message)


def save_log_txt(name, path, hist, verbose=False):
Expand Down

0 comments on commit 22c1ff3

Please sign in to comment.