Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
manishvenu committed Jan 9, 2025
1 parent 1048b70 commit 8360a27
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
13 changes: 10 additions & 3 deletions regional_mom6/regional_mom6.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from . import rotation as rot
from .utils import quadrilateral_areas, ap2ep, ep2ap, is_rectilinear_hgrid, setup_logger
import logging

rm6_logger = setup_logger(__name__, set_handler=True)

warnings.filterwarnings("ignore")
Expand Down Expand Up @@ -2214,7 +2215,9 @@ def run_FRE_tools(self, layout=None):
"Running GFDL's FRE Tools. The following information is all printed by the FRE tools themselves"
)
if not (self.mom_input_dir / "bathymetry.nc").exists():
rm6_logger.error("No bathymetry file! Need to run setup_bathymetry method first")
rm6_logger.error(
"No bathymetry file! Need to run setup_bathymetry method first"
)
return

for p in self.mom_input_dir.glob("mask_table*"):
Expand Down Expand Up @@ -2293,7 +2296,9 @@ def setup_run_directory(
)

if not premade_rundir_path.exists():
rm6_logger.info("Could not find premade run directories at ", premade_rundir_path)
rm6_logger.info(
"Could not find premade run directories at ", premade_rundir_path
)
rm6_logger.info(
"Perhaps the package was imported directly rather than installed with conda. Checking if this is the case... "
)
Expand Down Expand Up @@ -2642,7 +2647,9 @@ def change_MOM_parameter(
else:
if param_name in MOM_override_dict.keys():
original_val = MOM_override_dict[param_name]["value"]
rm6_logger.info("Deleting parameter {} from MOM_override".format(param_name))
rm6_logger.info(
"Deleting parameter {} from MOM_override".format(param_name)
)
del MOM_override_dict[param_name]
else:
rm6_logger.info(
Expand Down
3 changes: 2 additions & 1 deletion regional_mom6/rotation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .utils import setup_logger
import logging
rotation_logger = setup_logger(__name__, set_handler = False)

rotation_logger = setup_logger(__name__, set_handler=False)
# An Enum is like a dropdown selection for a menu, it essentially limits the type of input parameters. It comes with additional complexity, which of course is always a challenge.
from enum import Enum
import xarray as xr
Expand Down
8 changes: 4 additions & 4 deletions regional_mom6/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ def ep2ap(SEMA, ECC, INC, PHA):
return ua, va, up, vp


def setup_logger(name: str, set_handler = False, log_level = logging.INFO) -> logging.Logger:
def setup_logger(
name: str, set_handler=False, log_level=logging.INFO
) -> logging.Logger:
"""
Setup general config for a logger.
"""
Expand All @@ -311,9 +313,7 @@ def setup_logger(name: str, set_handler = False, log_level = logging.INFO) -> lo
handler.setLevel(log_level)

# Create a formatter (optional)
formatter = logging.Formatter(
"%(name)s.%(funcName)s:%(levelname)s:%(message)s"
)
formatter = logging.Formatter("%(name)s.%(funcName)s:%(levelname)s:%(message)s")
handler.setFormatter(formatter)

# Add the handler to the logger
Expand Down

0 comments on commit 8360a27

Please sign in to comment.