t.create.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/usr/bin/env python3
  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-2017 by the GRASS Development Team
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version.
  15. #
  16. # This program is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. # GNU General Public License for more details.
  20. #
  21. #############################################################################
  22. # %module
  23. # % description: Creates a space time dataset.
  24. # % keyword: temporal
  25. # % keyword: map management
  26. # % keyword: create
  27. # % keyword: time
  28. # %end
  29. # %option G_OPT_STDS_OUTPUT
  30. # %end
  31. # %option G_OPT_STDS_TYPE
  32. # % description: Type of the output space time dataset
  33. # %end
  34. # %option G_OPT_T_TYPE
  35. # %end
  36. # %option
  37. # % key: semantictype
  38. # % type: string
  39. # % description: Semantic type of the space time dataset
  40. # % required: yes
  41. # % multiple: no
  42. # % options: min,max,sum,mean
  43. # % answer: mean
  44. # %end
  45. # %option
  46. # % key: title
  47. # % type: string
  48. # % description: Title of the new space time dataset
  49. # % required: yes
  50. # % multiple: no
  51. # %end
  52. # %option
  53. # % key: description
  54. # % type: string
  55. # % description: Description of the new space time dataset
  56. # % required: yes
  57. # % multiple: no
  58. # %end
  59. import grass.script as grass
  60. ############################################################################
  61. def main():
  62. # lazy imports
  63. import grass.temporal as tgis
  64. # Get the options
  65. name = options["output"]
  66. type = options["type"]
  67. temporaltype = options["temporaltype"]
  68. title = options["title"]
  69. descr = options["description"]
  70. semantic = options["semantictype"]
  71. # Make sure the temporal database exists
  72. tgis.init()
  73. tgis.open_new_stds(
  74. name, type, temporaltype, title, descr, semantic, None, grass.overwrite()
  75. )
  76. if __name__ == "__main__":
  77. options, flags = grass.parser()
  78. main()