diff --git a/pyproject.toml b/pyproject.toml index 6e84cb588..5427f5ca5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -161,10 +161,10 @@ markers = [ ignore_directives = ["argparse", "automodule"] [tool.ruff] -ignore = [ +lint.ignore = [ "C901", ] -select = [ +lint.select = [ "C", "E", "F", diff --git a/src/subscript/sector2fluxnum/datafile_obj.py b/src/subscript/sector2fluxnum/datafile_obj.py index f6420deb8..ebfe0349f 100644 --- a/src/subscript/sector2fluxnum/datafile_obj.py +++ b/src/subscript/sector2fluxnum/datafile_obj.py @@ -328,10 +328,8 @@ def set_USEFLUX_header(self, args): with open(self.USEFLUX_name, "r", encoding="utf8") as fin: lines = fin.readlines() - idx = 0 - for line in insert_lines: - idx += 1 - lines.insert(idx, line) + for idx, line in enumerate(insert_lines): + lines.insert(idx + 1, line) with open(self.USEFLUX_name, "w", encoding="utf8") as fout: fout.writelines(lines) diff --git a/src/subscript/sector2fluxnum/fluxfile_obj.py b/src/subscript/sector2fluxnum/fluxfile_obj.py index f00a27c68..9af3e8721 100644 --- a/src/subscript/sector2fluxnum/fluxfile_obj.py +++ b/src/subscript/sector2fluxnum/fluxfile_obj.py @@ -83,10 +83,9 @@ def create_map_rst( """ mapping = [] - counter = 0 print("Creating map...") - for index in dest_flux.flux[6][0 : dest_flux.number_flux_cells]: + for counter, index in enumerate(dest_flux.flux[6][0 : dest_flux.number_flux_cells]): # Find global coordinates in the fine grid (i_f, j_f, k_f) = dest_flux.grid.get_ijk(global_index=index - 1) @@ -123,10 +122,8 @@ def create_map_rst( # Identify map of coarse grid to collect values to fine grid mapping.append(min_pos_index) - counter += 1 - - if counter % 100 == 0: - print(f"Map progress: {counter:d}") + if (counter + 1) % 100 == 0: + print(f"Map progress: {counter+1:d}") return mapping