t.rast3d.list.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. ############################################################################
  4. #
  5. # MODULE: t.rast3d.list
  6. # AUTHOR(S): Soeren Gebbert
  7. #
  8. # PURPOSE: List registered maps of a space time raster3d dataset
  9. # COPYRIGHT: (C) 2011-2017, Soeren Gebbert and 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: Lists registered maps of a space time raster3d dataset.
  24. #% keyword: temporal
  25. #% keyword: map management
  26. #% keyword: list
  27. #% keyword: raster3d
  28. #% keyword: voxel
  29. #% keyword: time
  30. #%end
  31. #%option G_OPT_STR3DS_INPUT
  32. #%end
  33. #%option
  34. #% key: order
  35. #% type: string
  36. #% description: Order the space time dataset by category
  37. #% required: no
  38. #% multiple: yes
  39. #% options: id,name,creator,mapset,temporal_type,creation_time,start_time,end_time,north,south,west,east,nsres,tbres,ewres,cols,rows,depths,number_of_cells,min,max
  40. #% answer: start_time
  41. #%end
  42. #%option
  43. #% key: columns
  44. #% type: string
  45. #% description: Columns to be printed to stdout
  46. #% guisection: Selection
  47. #% required: no
  48. #% multiple: yes
  49. #% options: id,name,creator,mapset,temporal_type,creation_time,start_time,end_time,north,south,west,east,nsres,tbres,ewres,cols,rows,depths,number_of_cells,min,max
  50. #% answer: name,mapset,start_time,end_time
  51. #%end
  52. #%option G_OPT_T_WHERE
  53. #% guisection: Selection
  54. #%end
  55. #%option
  56. #% key: method
  57. #% type: string
  58. #% description: Method used for data listing
  59. #% required: no
  60. #% multiple: no
  61. #% options: cols,comma,delta,deltagaps,gran
  62. #% answer: cols
  63. #%end
  64. #%option G_OPT_F_SEP
  65. #% label: Field separator character between the output columns
  66. #% guisection: Formatting
  67. #%end
  68. #%option G_OPT_F_OUTPUT
  69. #% required: no
  70. #%end
  71. #%flag
  72. #% key: s
  73. #% description: Suppress printing of column names
  74. #% guisection: Formatting
  75. #%end
  76. import grass.script as grass
  77. ############################################################################
  78. def main():
  79. # lazy imports
  80. import grass.temporal as tgis
  81. # Get the options
  82. input = options["input"]
  83. columns = options["columns"]
  84. order = options["order"]
  85. where = options["where"]
  86. separator = grass.separator(options["separator"])
  87. method = options["method"]
  88. header = flags["s"]
  89. output = options["output"]
  90. # Make sure the temporal database exists
  91. tgis.init()
  92. tgis.list_maps_of_stds("str3ds", input, columns, order, where, separator,
  93. method, header, outpath=output)
  94. if __name__ == "__main__":
  95. options, flags = grass.parser()
  96. main()