t.create.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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-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(name, type, temporaltype, title, descr,
  74. semantic, None, grass.overwrite())
  75. if __name__ == "__main__":
  76. options, flags = grass.parser()
  77. main()