t.create.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. ############################################################################
  4. #
  5. # MODULE: t.create
  6. # AUTHOR(S): Soeren Gebbert
  7. #
  8. # PURPOSE: Create a space time dataset
  9. # COPYRIGHT: (C) 2011-2014 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: Creates a space time dataset.
  18. #% keyword: temporal
  19. #% keyword: map management
  20. #% keyword: create
  21. #%end
  22. #%option G_OPT_STDS_OUTPUT
  23. #%end
  24. #%option G_OPT_STDS_TYPE
  25. #% description: Type of the output space time dataset
  26. #%end
  27. #%option G_OPT_T_TYPE
  28. #%end
  29. #%option
  30. #% key: semantictype
  31. #% type: string
  32. #% description: Semantic type of the space time dataset
  33. #% required: yes
  34. #% multiple: no
  35. #% options: min,max,sum,mean
  36. #% answer: mean
  37. #%end
  38. #%option
  39. #% key: title
  40. #% type: string
  41. #% description: Title of the new space time dataset
  42. #% required: yes
  43. #% multiple: no
  44. #%end
  45. #%option
  46. #% key: description
  47. #% type: string
  48. #% description: Description of the new space time dataset
  49. #% required: yes
  50. #% multiple: no
  51. #%end
  52. import grass.script as grass
  53. import grass.temporal as tgis
  54. ############################################################################
  55. def main():
  56. # Get the options
  57. name = options["output"]
  58. type = options["type"]
  59. temporaltype = options["temporaltype"]
  60. title = options["title"]
  61. descr = options["description"]
  62. semantic = options["semantictype"]
  63. # Make sure the temporal database exists
  64. tgis.init()
  65. tgis.open_new_stds(name, type, temporaltype, title, descr,
  66. semantic, None, grass.overwrite())
  67. if __name__ == "__main__":
  68. options, flags = grass.parser()
  69. main()