sahitono/geosardine

View on GitHub

Showing 37 of 50 total issues

File raster.py has 866 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import itertools
import warnings
from operator import (
    add,
    floordiv,
Severity: Major
Found in geosardine/raster.py - About 2 days to fix

    Raster has 54 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Raster(np.ndarray):
        """
        Construct Raster from numpy array with spatial information.
        Support calculation between different raster
    
    Severity: Major
    Found in geosardine/raster.py - About 7 hrs to fix

      File _utility.py has 348 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import math
      from functools import singledispatch
      from pathlib import Path
      from typing import List, Optional, Tuple, Union
      
      Severity: Minor
      Found in geosardine/_utility.py - About 4 hrs to fix

        File _geosardine.py has 288 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import warnings
        from collections import OrderedDict
        from math import ceil, floor
        from typing import Callable, Dict, Generator, Iterable, List, Tuple, Union
        
        
        Severity: Minor
        Found in geosardine/_geosardine.py - About 2 hrs to fix

          File idw.py has 280 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import os
          import warnings
          from functools import singledispatch
          from pathlib import Path
          from typing import Callable, List, Optional, Tuple, Union
          Severity: Minor
          Found in geosardine/interpolate/idw.py - About 2 hrs to fix

            Function __init__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(
                    self,
                    array: np.ndarray,
                    resolution: Union[
                        None, Tuple[float, float], List[float], Tuple[float, ...], float
            Severity: Minor
            Found in geosardine/raster.py - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function __nb_raster_calc__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def __nb_raster_calc__(
                raster_a: np.ndarray,
                raster_b: np.ndarray,
                transform_a: Tuple[float, ...],
                inverse_transform_b: Tuple[float, ...],
            Severity: Minor
            Found in geosardine/_raster_numba.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function save_raster has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            def save_raster(
                file_name: Union[str, Path],
                value_array: np.ndarray,
                crs: Union[CRS, int],
                coordinate_array: Optional[np.ndarray] = None,
            Severity: Minor
            Found in geosardine/_utility.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function from_binary has 11 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def from_binary(
            Severity: Major
            Found in geosardine/raster.py - About 1 hr to fix

              Function parse_slicer has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_slicer(key: Union[int, slice, None], length: int) -> int:
                      if key is None:
                          start = 0
                      elif isinstance(key, int):
                          start = key if key > 0 else length + key
              Severity: Minor
              Found in geosardine/raster.py - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Major
              Found in geosardine/raster.py - About 1 hr to fix

                Function __raster_calc_by_pixel__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __raster_calc_by_pixel__(
                        self,
                        raster: "Raster",
                        operator: Callable[[Any, Any], Any],
                    ) -> np.ndarray:
                Severity: Minor
                Found in geosardine/raster.py - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function idw has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def idw(
                Severity: Major
                Found in geosardine/interpolate/idw.py - About 1 hr to fix

                  Function _idw_array has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def _idw_array(
                  Severity: Major
                  Found in geosardine/interpolate/idw.py - About 1 hr to fix

                    Function _idw has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def _idw(
                    Severity: Major
                    Found in geosardine/interpolate/idw.py - About 1 hr to fix

                      Function _idw_file has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def _idw_file(
                          file_name: str,
                          spatial_res: Tuple[float, float],
                          epsg: Optional[int] = None,
                          column_name: Optional[str] = None,
                      Severity: Minor
                      Found in geosardine/interpolate/idw.py - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function _idw_file has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def _idw_file(
                      Severity: Major
                      Found in geosardine/interpolate/idw.py - About 1 hr to fix

                        Function _idw_file_path has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def _idw_file_path(
                        Severity: Major
                        Found in geosardine/interpolate/idw.py - About 1 hr to fix

                          Function split2tiles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def split2tiles(
                                  self, tile_size: Union[int, Tuple[int, int], List[int]]
                              ) -> Generator[Tuple[int, int, "Raster"], None, None]:
                                  """
                                  Split raster into smaller tiles, excessive will be padded and have no data value
                          Severity: Minor
                          Found in geosardine/raster.py - About 55 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function idw_single has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def idw_single(
                          Severity: Major
                          Found in geosardine/interpolate/idw.py - About 50 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language