Skip to content

Commit

Permalink
Apply suggestions from code review m_tools_ph3.py
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Paniagua <[email protected]>
  • Loading branch information
kmilo9999 and cpaniaguam authored Mar 11, 2024
1 parent 6014979 commit a8006cb
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions src/icesat2_tracks/local_modules/m_tools_ph3.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def write_variables_log(hist, var_list, locals, verbose=False, date=False):

now = datetime.now().strftime("%Y%m%d")

var_dict = dict((name, locals[name]) for name in var_list)
var_dict = {name: locals[name] for name in var_list}
stringg = "\n".join([f"{name.ljust(5)}{I}" for name, I in var_dict.items()])

if date:
Expand Down Expand Up @@ -344,25 +344,19 @@ def find_O(a, case="round"):


def stats(a):
print("shape", a.shape)
print("Nans", np.sum(np.isnan(a)))
print("max", np.nanmax(a))
print("min", np.nanmin(a))
print("mean", np.nanmean(a))
print(
f"shape: {a.shape}\n"
f"Nans: {np.sum(np.isnan(a))}\n"
f"max: {np.nanmax(a)}\n"
f"min: {np.nanmin(a)}\n"
f"mean: {np.nanmean(a)}"
)


def stats_format(a, name=None):
print(
"Name:",
str(name),
" Shape:",
a.shape,
" NaNs:",
np.sum(np.isnan(a)),
" max:",
np.nanmax(a),
" min",
np.nanmin(a),
" mean:",
np.nanmean(a),
)
print(f"Name: {name}"
f" Shape: {a.shape}"
f" NaNs: {np.sum(np.isnan(a))}"
f" max: {np.nanmax(a)}"
f" min: {np.nanmin(a)}"
f" mean: {np.nanmean(a)}")

0 comments on commit a8006cb

Please sign in to comment.