From 9b71518fdff319f90b251564eeed49b99f5acb5e Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 2 Dec 2024 12:16:41 -0700 Subject: [PATCH] Satisfy black and pylint. --- python/ctsm/crop_calendars/cropcal_figs_module.py | 1 + python/ctsm/crop_calendars/cropcal_module.py | 8 ++------ python/ctsm/crop_calendars/generate_gdds_functions.py | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/python/ctsm/crop_calendars/cropcal_figs_module.py b/python/ctsm/crop_calendars/cropcal_figs_module.py index d820460175..599b29f169 100644 --- a/python/ctsm/crop_calendars/cropcal_figs_module.py +++ b/python/ctsm/crop_calendars/cropcal_figs_module.py @@ -12,6 +12,7 @@ from matplotlib import cm import matplotlib.collections as mplcol +# pylint: disable=abstract-class-instantiated # Colormaps (maps) cropcal_colors = { diff --git a/python/ctsm/crop_calendars/cropcal_module.py b/python/ctsm/crop_calendars/cropcal_module.py index 1993225a9c..44f2ca0293 100644 --- a/python/ctsm/crop_calendars/cropcal_module.py +++ b/python/ctsm/crop_calendars/cropcal_module.py @@ -25,15 +25,11 @@ def check_and_trim_years(year_1, year_n, ds_in): year = utils.get_timestep_year(ds_in, ds_in.time.values[0]) if year > year_1: raise RuntimeError( - f"Requested year_1 is {year_1} but first year in outputs is " - + f"{year}" + f"Requested year_1 is {year_1} but first year in outputs is {year}" ) year = utils.get_timestep_year(ds_in, ds_in.time.values[-1]) if year < year_1: - raise RuntimeError( - f"Requested year_n is {year_n} but last year in outputs is " - + f"{year}" - ) + raise RuntimeError(f"Requested year_n is {year_n} but last year in outputs is {year}") # Remove years outside range of interest ### Include an extra year at the end to finish out final seasons. diff --git a/python/ctsm/crop_calendars/generate_gdds_functions.py b/python/ctsm/crop_calendars/generate_gdds_functions.py index 988edf6d89..299f1e4225 100644 --- a/python/ctsm/crop_calendars/generate_gdds_functions.py +++ b/python/ctsm/crop_calendars/generate_gdds_functions.py @@ -1,7 +1,7 @@ """ Functions to support generate_gdds.py """ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines,too-many-statements,abstract-class-instantiated import warnings import os import glob @@ -553,8 +553,8 @@ def import_and_process_1yr( clm_gdd_var = "GDDACCUM" my_vars = [clm_gdd_var, "GDDHARV"] patterns = [f"*h2.{this_year-1}-01*.nc", f"*h2.{this_year-1}-01*.nc.base"] - for p in patterns: - pattern = os.path.join(indir, p) + for pat in patterns: + pattern = os.path.join(indir, pat) h2_files = glob.glob(pattern) if h2_files: break