t.rast3d.univar.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. ############################################################################
  4. #
  5. # MODULE: t.rast3d.univar
  6. # AUTHOR(S): Soeren Gebbert
  7. #
  8. # PURPOSE: Calculates univariate statistics from the non-null cells for each registered 3D
  9. # raster map of a space time 3D raster dataset
  10. # COPYRIGHT: (C) 2011-2014, Soeren Gebbert and the GRASS Development Team
  11. #
  12. # This program is free software under the GNU General Public
  13. # License (version 2). Read the file COPYING that comes with GRASS
  14. # for details.
  15. #
  16. #############################################################################
  17. #%module
  18. #% description: Calculates univariate statistics from the non-null cells for each registered 3D raster map of a space time 3D raster dataset.
  19. #% keyword: temporal
  20. #% keyword: statistics
  21. #% keyword: raster3d
  22. #% keyword: voxel
  23. #%end
  24. #%option G_OPT_STR3DS_INPUT
  25. #%end
  26. #%option G_OPT_T_WHERE
  27. #% guisection: Selection
  28. #%end
  29. #%option G_OPT_F_SEP
  30. #% label: Field separator character between the output columns
  31. #% guisection: Formatting
  32. #%end
  33. #%flag
  34. #% key: e
  35. #% description: Calculate extended statistics
  36. #%end
  37. #%flag
  38. #% key: s
  39. #% description: Suppress printing of column names
  40. #% guisection: Formatting
  41. #%end
  42. import grass.script as grass
  43. import grass.temporal as tgis
  44. ############################################################################
  45. def main():
  46. # Get the options
  47. input = options["input"]
  48. where = options["where"]
  49. extended = flags["e"]
  50. no_header = flags["s"]
  51. separator = grass.separator(options["separator"])
  52. # Make sure the temporal database exists
  53. tgis.init()
  54. tgis.print_gridded_dataset_univar_statistics(
  55. "str3ds", input, where, extended, no_header, separator)
  56. if __name__ == "__main__":
  57. options, flags = grass.parser()
  58. main()