t.rast3d.univar.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 raster3d map of a space time raster3d dataset
  9. # COPYRIGHT: (C) 2011 by the GRASS Development Team
  10. #
  11. # This program is free software under the GNU General Public
  12. # License (version 2). Read the file COPYING that comes with GRASS
  13. # for details.
  14. #
  15. #############################################################################
  16. #%module
  17. #% description: Calculates univariate statistics from the non-null cells for each registered raster3d map of a space time raster3d dataset.
  18. #% keywords: temporal
  19. #% keywords: statistics
  20. #% keywords: raster
  21. #%end
  22. #%option G_OPT_STR3DS_INPUT
  23. #%end
  24. #%option G_OPT_T_WHERE
  25. #%end
  26. #%option G_OPT_F_SEP
  27. #% description: Field separator character between the output columns
  28. #%end
  29. #%flag
  30. #% key: e
  31. #% description: Calculate extended statistics
  32. #%end
  33. #%flag
  34. #% key: h
  35. #% description: Print column names
  36. #%end
  37. import grass.script as grass
  38. import grass.temporal as tgis
  39. ############################################################################
  40. def main():
  41. # Get the options
  42. input = options["input"]
  43. where = options["where"]
  44. extended = flags["e"]
  45. header = flags["h"]
  46. fs = options["separator"]
  47. # Make sure the temporal database exists
  48. tgis.init()
  49. tgis.print_gridded_dataset_univar_statistics(
  50. "str3ds", input, where, extended, header, fs)
  51. if __name__ == "__main__":
  52. options, flags = grass.parser()
  53. main()