diff --git a/SalishSeaTools/envs/requirements.txt b/SalishSeaTools/envs/requirements.txt index b770e093..4ff3bdcc 100644 --- a/SalishSeaTools/envs/requirements.txt +++ b/SalishSeaTools/envs/requirements.txt @@ -105,7 +105,7 @@ MarkupSafe==3.0.3 matplotlib==3.10.8 matplotlib-inline==0.2.1 mdurl==0.1.2 -mistune==3.2.1 +mistune==3.3.0 more-itertools==10.8.0 munkres==1.1.4 mypy_extensions==1.1.0 diff --git a/SalishSeaTools/salishsea_tools/evaltools.py b/SalishSeaTools/salishsea_tools/evaltools.py index df114eec..84658d84 100644 --- a/SalishSeaTools/salishsea_tools/evaltools.py +++ b/SalishSeaTools/salishsea_tools/evaltools.py @@ -35,7 +35,7 @@ import pandas as pd import pytz import xarray as xr -import cftime #Added for noleap exeption. +import cftime # Added for noleap exeption. from salishsea_tools import geo_tools, places @@ -232,7 +232,7 @@ def matchData( ) for file_type in file_types } - + # Call a function to match model field values to the observation data using the specified method data = _match_model_to_data( method, @@ -247,7 +247,7 @@ def matchData( model_file_hours_res, n_spatial_dims, pre_indexed=pre_indexed, - nam_fmt = mod_nam_fmt + nam_fmt=mod_nam_fmt, ) data.reset_index(drop=True, inplace=True) return data @@ -473,7 +473,7 @@ def _match_model_to_data( model_file_hours_res, n_spatial_dims, pre_indexed=False, - nam_fmt = "nowcast" + nam_fmt="nowcast", ): """ Match model field values to the provided observational data using the specified method. @@ -1012,12 +1012,11 @@ def _getTimeInd_bin(idt, ifid, torig, hpf=None): if "time_centered_bounds" in ifid.variables.keys(): tlist = ifid.variables["time_centered_bounds"][:, :] tc = ifid["time_counter"] - target_num = cftime.date2num(idt, units=tc.units, calendar=tc.calendar) #This way noleap runs also work - ih = [ - iii - for iii, hhh in enumerate(tlist) - if hhh[1] > target_num][0] - + target_num = cftime.date2num( + idt, units=tc.units, calendar=tc.calendar + ) # This way noleap runs also work + ih = [iii for iii, hhh in enumerate(tlist) if hhh[1] > target_num][0] + else: # hacky fix because time_centered_bounds missing from post-processed daily files nt = len(ifid.variables["time_counter"][:]) if "hours" in ifid.variables["time_counter"].units: @@ -1237,7 +1236,7 @@ def index_model_files_flex( t_0 = list() t_n = list() for ifl in paths: - if nam_fmt in ["nowcast","SHEM"]: + if nam_fmt in ["nowcast", "SHEM"]: dates = re.findall(r"\d{8}", re.search(r"\d{8}_\d{8}", ifl)[0]) elif nam_fmt == "long": dates = re.findall(r"\d{8}", re.search(r"\d{8}-\d{8}", ifl)[0]) @@ -3315,7 +3314,7 @@ def getChlNRatio( "nmlfile must contain full namelist path or basedir and nam_fmt must be defined" ) if basedir: - if nam_fmt in ["nowcast","SHEM"]: + if nam_fmt in ["nowcast", "SHEM"]: nmlfile = os.path.join(basedir, idt.strftime("%d%b%y").lower(), nmlfile) elif nam_fmt == "long": nmlfile = os.path.join(basedir, nmlfile)