t.rast.import.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. ############################################################################
  4. #
  5. # MODULE: t.rast.import
  6. # AUTHOR(S): Soeren Gebbert
  7. #
  8. # PURPOSE: Import a space time raster 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: Imports space time raster dataset.
  18. #% keywords: temporal
  19. #% keywords: import
  20. #%end
  21. #%option G_OPT_F_INPUT
  22. #%end
  23. #%option G_OPT_STRDS_OUTPUT
  24. #%end
  25. #%option G_OPT_M_DIR
  26. #% key: extrdir
  27. #% description: Path to the extraction directory
  28. #%end
  29. #%option
  30. #% key: title
  31. #% type: string
  32. #% description: Title of the new space time dataset
  33. #% required: no
  34. #% multiple: no
  35. #%end
  36. #%option
  37. #% key: description
  38. #% type: string
  39. #% description: Description of the new space time dataset
  40. #% required: no
  41. #% multiple: no
  42. #%end
  43. #%option
  44. #% key: location
  45. #% type: string
  46. #% description: Create a new location and import the data into it. Please do not run this module in parallel or interrupt it when a new location should be created.
  47. #% required: no
  48. #% multiple: no
  49. #%end
  50. #%flag
  51. #% key: l
  52. #% description: Link the raster files using r.external
  53. #%end
  54. #%flag
  55. #% key: e
  56. #% description: Extend location extents based on new dataset
  57. #%end
  58. #%flag
  59. #% key: o
  60. #% description: Override projection (use location's projection)
  61. #%end
  62. #%option G_OPT_R_BASE
  63. #% required: no
  64. #%end
  65. #%flag
  66. #% key: c
  67. #% description: Create the location specified by the "location" parameter and exit. Do not import the space time raster datasets.
  68. #%end
  69. import grass.script as grass
  70. import grass.temporal as tgis
  71. def main():
  72. # Get the options
  73. input = options["input"]
  74. output = options["output"]
  75. extrdir = options["extrdir"]
  76. title = options["title"]
  77. descr = options["description"]
  78. location = options["location"]
  79. base = options["base"]
  80. link = flags["l"]
  81. exp = flags["e"]
  82. overr = flags["o"]
  83. create = flags["c"]
  84. tgis.init()
  85. tgis.import_stds(input, output, extrdir, title, descr, location,
  86. link, exp, overr, create, "strds", base)
  87. if __name__ == "__main__":
  88. options, flags = grass.parser()
  89. main()