From 8360a2765a6fdee68b85438e32759c1266ec9967 Mon Sep 17 00:00:00 2001 From: manishvenu Date: Thu, 9 Jan 2025 10:38:45 -0700 Subject: [PATCH] Formatting --- regional_mom6/regional_mom6.py | 13 ++++++++++--- regional_mom6/rotation.py | 3 ++- regional_mom6/utils.py | 8 ++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/regional_mom6/regional_mom6.py b/regional_mom6/regional_mom6.py index 0d295033..bef03274 100644 --- a/regional_mom6/regional_mom6.py +++ b/regional_mom6/regional_mom6.py @@ -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") @@ -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*"): @@ -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... " ) @@ -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( diff --git a/regional_mom6/rotation.py b/regional_mom6/rotation.py index a8151e46..979d0cd6 100644 --- a/regional_mom6/rotation.py +++ b/regional_mom6/rotation.py @@ -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 diff --git a/regional_mom6/utils.py b/regional_mom6/utils.py index 966bf966..f4602f04 100644 --- a/regional_mom6/utils.py +++ b/regional_mom6/utils.py @@ -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. """ @@ -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