r_neighbors.py 1.3 KB

1234567891011121314151617181920212223242526272829
  1. """
  2. ***************************************************************************
  3. r_neighbors.py
  4. --------
  5. Date : June 2021
  6. Copyright : (C) 2021 by Nicolas Godet
  7. Email : nicolas dot godet at outlook dot fr
  8. ***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************
  16. """
  17. __author__ = 'Nicolas Godet'
  18. __date__ = 'June 2021'
  19. __copyright__ = '(C) 2021, Nicolas Godet'
  20. def checkParameterValuesBeforeExecuting(alg, parameters, context):
  21. """ Verify if we have the right parameters """
  22. # Verifiy that neighborhood size is odd
  23. if (alg.parameterAsInt(parameters, 'size', context) % 2) == 0:
  24. return False, alg.tr("The neighborhood size must be odd!")
  25. return True, None