metadata.py 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. """!@package grass.temporal
  2. @brief GRASS Python scripting module (temporal GIS functions)
  3. Temporal GIS related metadata functions to be used in Python scripts and tgis packages.
  4. Usage:
  5. @code
  6. import grass.temporal as tgis
  7. meta = tgis.raster_metadata()
  8. ...
  9. @endcode
  10. (C) 2008-2011 by the GRASS Development Team
  11. This program is free software under the GNU General Public
  12. License (>=v2). Read the file COPYING that comes with GRASS
  13. for details.
  14. @author Soeren Gebbert
  15. """
  16. from base import *
  17. ###############################################################################
  18. class raster_metadata_base(sql_database_interface):
  19. """!This is the raster metadata base class for raster and raster3d maps"""
  20. def __init__(self, table=None, ident=None, datatype=None, cols=None, rows=None, number_of_cells=None, nsres=None, ewres=None, min=None, max=None):
  21. sql_database_interface.__init__(self, table, ident)
  22. self.set_id(ident)
  23. self.set_datatype(datatype)
  24. self.set_cols(cols)
  25. self.set_rows(rows)
  26. self.set_number_of_cells(number_of_cells)
  27. self.set_nsres(nsres)
  28. self.set_ewres(ewres)
  29. self.set_min(min)
  30. self.set_max(max)
  31. def set_id(self, ident):
  32. """!Convenient method to set the unique identifier (primary key)"""
  33. self.ident = ident
  34. self.D["id"] = ident
  35. def set_datatype(self, datatype):
  36. """!Set the datatype"""
  37. self.D["datatype"] = datatype
  38. def set_cols(self, cols):
  39. """!Set the number of cols"""
  40. self.D["cols"] = cols
  41. def set_rows(self, rows):
  42. """!Set the number of rows"""
  43. self.D["rows"] = rows
  44. def set_number_of_cells(self, number_of_cells):
  45. """!Set the number of cells"""
  46. self.D["number_of_cells"] = number_of_cells
  47. def set_nsres(self, nsres):
  48. """!Set the north-south resolution"""
  49. self.D["nsres"] = nsres
  50. def set_ewres(self, ewres):
  51. """!Set the east-west resolution"""
  52. self.D["ewres"] = ewres
  53. def set_min(self, min):
  54. """!Set the minimum raster value"""
  55. self.D["min"] = min
  56. def set_max(self, max):
  57. """!Set the maximum raster value"""
  58. self.D["max"] = max
  59. def get_id(self):
  60. """!Convenient method to get the unique identifier (primary key)
  61. @return None if not found
  62. """
  63. if self.D.has_key("id"):
  64. return self.D["id"]
  65. else:
  66. return None
  67. def get_datatype(self):
  68. """!Get the map type
  69. @return None if not found"""
  70. if self.D.has_key("datatype"):
  71. return self.D["datatype"]
  72. else:
  73. return None
  74. def get_cols(self):
  75. """!Get number of cols
  76. @return None if not found"""
  77. if self.D.has_key("cols"):
  78. return self.D["cols"]
  79. else:
  80. return None
  81. def get_rows(self):
  82. """!Get number of rows
  83. @return None if not found"""
  84. if self.D.has_key("rows"):
  85. return self.D["rows"]
  86. else:
  87. return None
  88. def get_number_of_cells(self):
  89. """!Get number of cells
  90. @return None if not found"""
  91. if self.D.has_key("number_of_cells"):
  92. return self.D["number_of_cells"]
  93. else:
  94. return None
  95. def get_nsres(self):
  96. """!Get the north-south resolution
  97. @return None if not found"""
  98. if self.D.has_key("nsres"):
  99. return self.D["nsres"]
  100. else:
  101. return None
  102. def get_ewres(self):
  103. """!Get east-west resolution
  104. @return None if not found"""
  105. if self.D.has_key("ewres"):
  106. return self.D["ewres"]
  107. else:
  108. return None
  109. def get_min(self):
  110. """!Get the minimum cell value
  111. @return None if not found"""
  112. if self.D.has_key("min"):
  113. return self.D["min"]
  114. else:
  115. return None
  116. def get_max(self):
  117. """!Get the maximum cell value
  118. @return None if not found"""
  119. if self.D.has_key("max"):
  120. return self.D["max"]
  121. else:
  122. return None
  123. def print_info(self):
  124. """!Print information about this class in human readable style"""
  125. # 0123456789012345678901234567890
  126. print " | Datatype:................... " + str(self.get_datatype())
  127. print " | Number of columns:.......... " + str(self.get_cols())
  128. print " | Number of rows:............. " + str(self.get_rows())
  129. print " | Number of cells:............ " + str(self.get_number_of_cells())
  130. print " | North-South resolution:..... " + str(self.get_nsres())
  131. print " | East-west resolution:....... " + str(self.get_ewres())
  132. print " | Minimum value:.............. " + str(self.get_min())
  133. print " | Maximum value:.............. " + str(self.get_max())
  134. def print_shell_info(self):
  135. """!Print information about this class in shell style"""
  136. print "datatype=" + str(self.get_datatype())
  137. print "cols=" + str(self.get_cols())
  138. print "rows=" + str(self.get_rows())
  139. print "number_of_cells=" + str(self.get_number_of_cells())
  140. print "nsres=" + str(self.get_nsres())
  141. print "ewres=" + str(self.get_ewres())
  142. print "min=" + str(self.get_min())
  143. print "max=" + str(self.get_max())
  144. ###############################################################################
  145. class raster_metadata(raster_metadata_base):
  146. """!This is the raster metadata class"""
  147. def __init__(self, ident=None, strds_register=None, datatype=None, cols=None, rows=None, number_of_cells=None, nsres=None, ewres=None, min=None, max=None):
  148. raster_metadata_base.__init__(self, "raster_metadata", ident, datatype, cols, rows, number_of_cells, nsres, ewres, min, max)
  149. self.set_strds_register(strds_register)
  150. def set_strds_register(self, strds_register):
  151. """!Set the space time raster dataset register table name"""
  152. self.D["strds_register"] = strds_register
  153. def get_strds_register(self):
  154. """!Get the space time raster dataset register table name
  155. @return None if not found"""
  156. if self.D.has_key("strds_register"):
  157. return self.D["strds_register"]
  158. else:
  159. return None
  160. def print_info(self):
  161. """!Print information about this class in human readable style"""
  162. print " +-------------------- Metadata information ----------------------------------+"
  163. # 0123456789012345678901234567890
  164. raster_metadata_base.print_info(self)
  165. print " | STRDS register table ....... " + str(self.get_strds_register())
  166. def print_shell_info(self):
  167. """!Print information about this class in shell style"""
  168. raster_metadata_base.print_shell_info(self)
  169. print "strds_register=" + str(self.get_strds_register())
  170. ###############################################################################
  171. class raster3d_metadata(raster_metadata_base):
  172. """!This is the raster3d metadata class"""
  173. def __init__(self, ident=None, str3ds_register=None, datatype=None, cols=None, rows=None, depths=None, number_of_cells=None, nsres=None, ewres=None, tbres=None, min=None, max=None):
  174. raster_metadata_base.__init__(self, "raster3d_metadata", ident, datatype, cols, rows, number_of_cells, nsres, ewres, min, max)
  175. self.set_str3ds_register(str3ds_register)
  176. self.set_tbres(tbres)
  177. self.set_depths(depths)
  178. def set_str3ds_register(self, str3ds_register):
  179. """!Set the space time raster3d dataset register table name"""
  180. self.D["str3ds_register"] = str3ds_register
  181. def set_depths(self, depths):
  182. """!Set the number of depths"""
  183. self.D["depths"] = depths
  184. def set_tbres(self, tbres):
  185. """!Set the top-bottom resolution"""
  186. self.D["tbres"] = tbres
  187. def get_str3ds_register(self):
  188. """!Get the space time raster3d dataset register table name
  189. @return None if not found"""
  190. if self.D.has_key("str3ds_register"):
  191. return self.D["str3ds_register"]
  192. else:
  193. return None
  194. def get_depths(self):
  195. """!Get number of depths
  196. @return None if not found"""
  197. if self.D.has_key("depths"):
  198. return self.D["depths"]
  199. else:
  200. return None
  201. def get_tbres(self):
  202. """!Get top-bottom resolution
  203. @return None if not found"""
  204. if self.D.has_key("tbres"):
  205. return self.D["tbres"]
  206. else:
  207. return None
  208. def print_info(self):
  209. """!Print information about this class in human readable style"""
  210. print " +-------------------- Metadata information ----------------------------------+"
  211. # 0123456789012345678901234567890
  212. raster_metadata_base.print_info(self)
  213. # 0123456789012345678901234567890
  214. print " | Number of depths:........... " + str(self.get_depths())
  215. print " | Top-Bottom resolution:...... " + str(self.get_tbres())
  216. print " | STR3DS register table ...... " + str(self.get_str3ds_register())
  217. def print_shell_info(self):
  218. """!Print information about this class in shell style"""
  219. print "str3ds_register=" + str(self.get_str3ds_register())
  220. print "depths=" + str(self.get_depths())
  221. print "tbres=" + str(self.get_tbres())
  222. raster_metadata_base.print_shell_info(self)
  223. ###############################################################################
  224. class vector_metadata(sql_database_interface):
  225. """!This is the vector metadata class"""
  226. def __init__(self, ident=None, stvds_register=None, is_3d=False, points=None, lines=None, boundaries=None,\
  227. centroids=None, faces=None, kernels=None, primitives=None, nodes=None, areas=None, \
  228. islands=None, holes=None, volumes=None):
  229. sql_database_interface.__init__(self, "vector_metadata", ident)
  230. self.set_id(ident)
  231. self.set_stvds_register(stvds_register)
  232. self.set_3d_info(is_3d)
  233. self.set_points(points)
  234. self.set_lines(lines)
  235. self.set_boundaries(boundaries)
  236. self.set_centroids(centroids)
  237. self.set_faces(faces)
  238. self.set_kernels(kernels)
  239. self.set_primitives(primitives)
  240. self.set_nodes(nodes)
  241. self.set_areas(areas)
  242. self.set_islands(islands)
  243. self.set_holes(holes)
  244. self.set_volumes(volumes)
  245. def set_id(self, ident):
  246. """!Convenient method to set the unique identifier (primary key)"""
  247. self.ident = ident
  248. self.D["id"] = ident
  249. def set_stvds_register(self, stvds_register):
  250. """!Set the space time vector dataset register table name"""
  251. self.D["stvds_register"] = stvds_register
  252. def set_3d_info(self, is_3d):
  253. """!Set True if the vector map is three dimensional"""
  254. self.D["is_3d"] = is_3d
  255. def set_points(self, points):
  256. """!Set the number of points of the vector map"""
  257. self.D["points"] = points
  258. def set_lines(self, lines):
  259. """!Set the number of lines of the vector map"""
  260. self.D["lines"] = lines
  261. def set_boundaries(self, boundaries):
  262. """!Set the number of boundaries of the vector map"""
  263. self.D["boundaries"] = boundaries
  264. def set_centroids(self, centroids):
  265. """!Set the number of centroids of the vector map"""
  266. self.D["centroids"] = centroids
  267. def set_faces(self, faces):
  268. """!Set the number of faces of the vector map"""
  269. self.D["faces"] = faces
  270. def set_kernels(self, kernels):
  271. """!Set the number of kernels of the vector map"""
  272. self.D["kernels"] = kernels
  273. def set_primitives(self, primitives):
  274. """!Set the number of primitives of the vector map"""
  275. self.D["primitives"] = primitives
  276. def set_nodes(self, nodes):
  277. """!Set the number of nodes of the vector map"""
  278. self.D["nodes"] = nodes
  279. def set_areas(self, areas):
  280. """!Set the number of areas of the vector map"""
  281. self.D["areas"] = areas
  282. def set_islands(self, islands):
  283. """!Set the number of islands of the vector map"""
  284. self.D["islands"] = islands
  285. def set_holes(self, holes):
  286. """!Set the number of holes of the vector map"""
  287. self.D["holes"] = holes
  288. def set_volumes(self, volumes):
  289. """!Set the number of volumes of the vector map"""
  290. self.D["volumes"] = volumes
  291. def get_id(self):
  292. """!Convenient method to get the unique identifier (primary key)
  293. @return None if not found
  294. """
  295. if self.D.has_key("id"):
  296. return self.D["id"]
  297. else:
  298. return None
  299. def get_stvds_register(self):
  300. """!Get the space time vector dataset register table name
  301. @return None if not found"""
  302. if self.D.has_key("stvds_register"):
  303. return self.D["stvds_register"]
  304. else:
  305. return None
  306. def get_3d_info(self):
  307. """!Return True if the map is three dimensional, False if not and None if not info was found"""
  308. if self.D.has_key("is_3d"):
  309. return self.D["is_3d"]
  310. else:
  311. return None
  312. def get_points(self):
  313. """!Get the number of points of the vector map
  314. @return None if not found"""
  315. if self.D.has_key("points"):
  316. return self.D["points"]
  317. else:
  318. return None
  319. def get_lines(self):
  320. """!Get the number of lines of the vector map
  321. @return None if not found"""
  322. if self.D.has_key("lines"):
  323. return self.D["lines"]
  324. else:
  325. return None
  326. def get_boundaries(self):
  327. """!Get the number of boundaries of the vector map
  328. @return None if not found"""
  329. if self.D.has_key("boundaries"):
  330. return self.D["boundaries"]
  331. else:
  332. return None
  333. def get_centroids(self):
  334. """!Get the number of centroids of the vector map
  335. @return None if not found"""
  336. if self.D.has_key("centroids"):
  337. return self.D["centroids"]
  338. else:
  339. return None
  340. def get_faces(self):
  341. """!Get the number of faces of the vector map
  342. @return None if not found"""
  343. if self.D.has_key("faces"):
  344. return self.D["faces"]
  345. else:
  346. return None
  347. def get_kernels(self):
  348. """!Get the number of kernels of the vector map
  349. @return None if not found"""
  350. if self.D.has_key("kernels"):
  351. return self.D["kernels"]
  352. else:
  353. return None
  354. def get_primitives(self):
  355. """!Get the number of primitives of the vector map
  356. @return None if not found"""
  357. if self.D.has_key("primitives"):
  358. return self.D["primitives"]
  359. else:
  360. return None
  361. def get_nodes(self):
  362. """!Get the number of nodes of the vector map
  363. @return None if not found"""
  364. if self.D.has_key("nodes"):
  365. return self.D["nodes"]
  366. else:
  367. return None
  368. def get_areas(self):
  369. """!Get the number of areas of the vector map
  370. @return None if not found"""
  371. if self.D.has_key("areas"):
  372. return self.D["areas"]
  373. else:
  374. return None
  375. def get_islands(self):
  376. """!Get the number of islands of the vector map
  377. @return None if not found"""
  378. if self.D.has_key("islands"):
  379. return self.D["islands"]
  380. else:
  381. return None
  382. def get_holes(self):
  383. """!Get the number of holes of the vector map
  384. @return None if not found"""
  385. if self.D.has_key("holes"):
  386. return self.D["holes"]
  387. else:
  388. return None
  389. def get_volumes(self):
  390. """!Get the number of volumes of the vector map
  391. @return None if not found"""
  392. if self.D.has_key("volumes"):
  393. return self.D["volumes"]
  394. else:
  395. return None
  396. def print_info(self):
  397. """!Print information about this class in human readable style"""
  398. # 0123456789012345678901234567890
  399. print " +-------------------- Metadata information ----------------------------------+"
  400. print " | STVDS register table ....... " + str(self.get_stvds_register())
  401. print " | Is map 3d .................. " + str(self.get_3d_info())
  402. print " | Number of points ........... " + str(self.get_points())
  403. print " | Number of lines ............ " + str(self.get_lines())
  404. print " | Number of boundaries ....... " + str(self.get_boundaries())
  405. print " | Number of centroids ........ " + str(self.get_centroids())
  406. print " | Number of faces ............ " + str(self.get_faces())
  407. print " | Number of kernels .......... " + str(self.get_kernels())
  408. print " | Number of primitives ....... " + str(self.get_primitives())
  409. print " | Number of nodes ............ " + str(self.get_nodes())
  410. print " | Number of areas ............ " + str(self.get_areas())
  411. print " | Number of islands .......... " + str(self.get_islands())
  412. print " | Number of holes ............ " + str(self.get_holes())
  413. print " | Number of volumes .......... " + str(self.get_volumes())
  414. def print_shell_info(self):
  415. """!Print information about this class in shell style"""
  416. print "stvds_register=" + str(self.get_stvds_register())
  417. print "is_3d=" + str(self.get_3d_info())
  418. print "points=" + str(self.get_points())
  419. print "lines=" + str(self.get_lines())
  420. print "boundaries=" + str(self.get_boundaries())
  421. print "centroids=" + str(self.get_centroids())
  422. print "faces=" + str(self.get_faces())
  423. print "kernels=" + str(self.get_kernels())
  424. print "primitives=" + str(self.get_primitives())
  425. print "nodes=" + str(self.get_nodes())
  426. print "areas=" + str(self.get_areas())
  427. print "islands=" + str(self.get_islands())
  428. print "holes=" + str(self.get_holes())
  429. print "volumes=" + str(self.get_volumes())
  430. ###############################################################################
  431. class stds_metadata_base(sql_database_interface):
  432. """!This is the space time dataset metadata base class for strds, stvds and str3ds datasets
  433. setting/getting the id, the title and the description
  434. """
  435. def __init__(self, table=None, ident=None, title=None, description=None):
  436. sql_database_interface.__init__(self, table, ident)
  437. self.set_id(ident)
  438. self.set_title(title)
  439. self.set_description(description)
  440. # No setter for this
  441. self.D["number_of_maps"] = None
  442. def set_id(self, ident):
  443. """!Convenient method to set the unique identifier (primary key)"""
  444. self.ident = ident
  445. self.D["id"] = ident
  446. def set_title(self, title):
  447. """!Set the title"""
  448. self.D["title"] = title
  449. def set_description(self, description):
  450. """!Set the number of cols"""
  451. self.D["description"] = description
  452. def get_id(self):
  453. """!Convenient method to get the unique identifier (primary key)
  454. @return None if not found
  455. """
  456. if self.D.has_key("id"):
  457. return self.D["id"]
  458. else:
  459. return None
  460. def get_title(self):
  461. """!Get the title
  462. @return None if not found"""
  463. if self.D.has_key("title"):
  464. return self.D["title"]
  465. else:
  466. return None
  467. def get_description(self):
  468. """!Get description
  469. @return None if not found"""
  470. if self.D.has_key("description"):
  471. return self.D["description"]
  472. else:
  473. return None
  474. def get_number_of_maps(self):
  475. """!Get the number of registered maps, this value is set in the database
  476. automatically via SQL trigger, so no setter exists
  477. @return None if not found"""
  478. if self.D.has_key("number_of_maps"):
  479. return self.D["number_of_maps"]
  480. else:
  481. return None
  482. def print_info(self):
  483. """!Print information about this class in human readable style"""
  484. # 0123456789012345678901234567890
  485. print " | Number of registered maps:.. " + str(self.get_number_of_maps())
  486. print " | Title:"
  487. print " | " + str(self.get_title())
  488. print " | Description:"
  489. print " | " + str(self.get_description())
  490. def print_shell_info(self):
  491. """!Print information about this class in shell style"""
  492. print "number_of_maps=" + str(self.get_number_of_maps())
  493. ###############################################################################
  494. class stds_raster_metadata_base(stds_metadata_base):
  495. """!This is the space time dataset metadata base class for strds and str3ds datasets
  496. Most of the metadata values are set by triggers in the database when
  497. new raster of voxel maps are added. Therefor only some set- an many get-functions
  498. are available.
  499. """
  500. def __init__(self, table=None, ident=None, title=None, description=None):
  501. stds_metadata_base.__init__(self, table, ident, title, description)
  502. # Initialize the dict to select all values from the db
  503. self.D["min_max"] = None
  504. self.D["max_max"] = None
  505. self.D["min_min"] = None
  506. self.D["max_min"] = None
  507. self.D["nsres_min"] = None
  508. self.D["nsres_max"] = None
  509. self.D["ewres_min"] = None
  510. self.D["ewres_max"] = None
  511. def get_max_min(self):
  512. """!Get the minimal maximum of all registered maps, this value is set in the database
  513. automatically via SQL trigger, so no setter exists
  514. @return None if not found"""
  515. if self.D.has_key("max_min"):
  516. return self.D["max_min"]
  517. else:
  518. return None
  519. def get_min_min(self):
  520. """!Get the minimal minimum of all registered maps, this value is set in the database
  521. automatically via SQL trigger, so no setter exists
  522. @return None if not found"""
  523. if self.D.has_key("min_min"):
  524. return self.D["min_min"]
  525. else:
  526. return None
  527. def get_max_max(self):
  528. """!Get the maximal maximum of all registered maps, this value is set in the database
  529. automatically via SQL trigger, so no setter exists
  530. @return None if not found"""
  531. if self.D.has_key("max_max"):
  532. return self.D["max_max"]
  533. else:
  534. return None
  535. def get_min_max(self):
  536. """!Get the maximal minimum of all registered maps, this value is set in the database
  537. automatically via SQL trigger, so no setter exists
  538. @return None if not found"""
  539. if self.D.has_key("min_max"):
  540. return self.D["min_max"]
  541. else:
  542. return None
  543. def get_nsres_min(self):
  544. """!Get the minimal north-south resolution of all registered maps, this value is set in the database
  545. automatically via SQL trigger, so no setter exists
  546. @return None if not found"""
  547. if self.D.has_key("nsres_min"):
  548. return self.D["nsres_min"]
  549. else:
  550. return None
  551. def get_nsres_max(self):
  552. """!Get the maximal north-south resolution of all registered maps, this value is set in the database
  553. automatically via SQL trigger, so no setter exists
  554. @return None if not found"""
  555. if self.D.has_key("nsres_max"):
  556. return self.D["nsres_max"]
  557. else:
  558. return None
  559. def get_ewres_min(self):
  560. """!Get the minimal east-west resolution of all registered maps, this value is set in the database
  561. automatically via SQL trigger, so no setter exists
  562. @return None if not found"""
  563. if self.D.has_key("ewres_min"):
  564. return self.D["ewres_min"]
  565. else:
  566. return None
  567. def get_ewres_max(self):
  568. """!Get the maximal east-west resolution of all registered maps, this value is set in the database
  569. automatically via SQL trigger, so no setter exists
  570. @return None if not found"""
  571. if self.D.has_key("ewres_max"):
  572. return self.D["ewres_max"]
  573. else:
  574. return None
  575. def print_info(self):
  576. """!Print information about this class in human readable style"""
  577. stds_metadata_base.print_info(self)
  578. # 0123456789012345678901234567890
  579. print " | North-South resolution min:. " + str(self.get_nsres_min())
  580. print " | North-South resolution max:. " + str(self.get_nsres_max())
  581. print " | East-west resolution min:... " + str(self.get_ewres_min())
  582. print " | East-west resolution max:... " + str(self.get_ewres_max())
  583. print " | Minimum value min:.......... " + str(self.get_min_min())
  584. print " | Minimum value max:.......... " + str(self.get_min_max())
  585. print " | Maximum value min:.......... " + str(self.get_max_min())
  586. print " | Maximum value max:.......... " + str(self.get_max_max())
  587. def print_shell_info(self):
  588. """!Print information about this class in shell style"""
  589. stds_metadata_base.print_shell_info(self)
  590. print "nsres_min=" + str(self.get_nsres_min())
  591. print "nsres_max=" + str(self.get_nsres_max())
  592. print "ewres_min=" + str(self.get_ewres_min())
  593. print "ewres_max=" + str(self.get_ewres_max())
  594. print "min_min=" + str(self.get_min_min())
  595. print "min_max=" + str(self.get_min_max())
  596. print "max_min=" + str(self.get_max_min())
  597. print "max_max=" + str(self.get_max_max())
  598. ###############################################################################
  599. class strds_metadata(stds_raster_metadata_base):
  600. """!This is the raster metadata class"""
  601. def __init__(self, ident=None, raster_register=None, title=None, description=None):
  602. stds_raster_metadata_base.__init__(self, "strds_metadata", ident, title, description)
  603. self.set_raster_register(raster_register)
  604. def set_raster_register(self, raster_register):
  605. """!Set the raster map register table name"""
  606. self.D["raster_register"] = raster_register
  607. def get_raster_register(self):
  608. """!Get the raster map register table name
  609. @return None if not found"""
  610. if self.D.has_key("raster_register"):
  611. return self.D["raster_register"]
  612. else:
  613. return None
  614. def print_info(self):
  615. """!Print information about this class in human readable style"""
  616. print " +-------------------- Metadata information ----------------------------------+"
  617. # 0123456789012345678901234567890
  618. stds_raster_metadata_base.print_info(self)
  619. print " | Raster register table:...... " + str(self.get_raster_register())
  620. def print_shell_info(self):
  621. """!Print information about this class in shell style"""
  622. stds_raster_metadata_base.print_shell_info(self)
  623. print "raster_register=" + str(self.get_raster_register())
  624. ###############################################################################
  625. class str3ds_metadata(stds_raster_metadata_base):
  626. """!This is the space time raster3d metadata class"""
  627. def __init__(self, ident=None, raster3d_register=None, title=None, description=None):
  628. stds_raster_metadata_base.__init__(self, "str3ds_metadata", ident, title, description)
  629. self.set_raster3d_register(raster3d_register)
  630. self.D["tbres_min"] = None
  631. self.D["tbres_max"] = None
  632. def set_raster3d_register(self, raster3d_register):
  633. """!Set the raster map register table name"""
  634. self.D["raster3d_register"] = raster3d_register
  635. def get_raster3d_register(self):
  636. """!Get the raster3d map register table name
  637. @return None if not found"""
  638. if self.D.has_key("raster3d_register"):
  639. return self.D["raster3d_register"]
  640. else:
  641. return None
  642. def get_tbres_min(self):
  643. """!Get the minimal top-bottom resolution of all registered maps, this value is set in the database
  644. automatically via SQL trigger, so no setter exists
  645. @return None if not found"""
  646. if self.D.has_key("tbres_min"):
  647. return self.D["tbres_min"]
  648. else:
  649. return None
  650. def get_tbres_max(self):
  651. """!Get the maximal top-bottom resolution of all registered maps, this value is set in the database
  652. automatically via SQL trigger, so no setter exists
  653. @return None if not found"""
  654. if self.D.has_key("tbres_max"):
  655. return self.D["tbres_max"]
  656. else:
  657. return None
  658. def print_info(self):
  659. """!Print information about this class in human readable style"""
  660. print " +-------------------- Metadata information ----------------------------------+"
  661. # 0123456789012345678901234567890
  662. stds_raster_metadata_base.print_info(self)
  663. # 0123456789012345678901234567890
  664. print " | Top-bottom resolution min:.. " + str(self.get_ewres_min())
  665. print " | Top-bottom resolution max:.. " + str(self.get_ewres_max())
  666. print " | Raster3d register table:.... " + str(self.get_raster3d_register())
  667. def print_shell_info(self):
  668. """!Print information about this class in shell style"""
  669. stds_raster_metadata_base.print_shell_info(self)
  670. print "tbres_min=" + str(self.get_tbres_min())
  671. print "tbres_max=" + str(self.get_tbres_max())
  672. print "raster3d_register=" + str(self.get_raster3d_register())
  673. ###############################################################################
  674. class stvds_metadata(stds_metadata_base):
  675. """!This is the raster metadata class"""
  676. def __init__(self, ident=None, vector_register=None, title=None, description=None, \
  677. points=None, lines=None, boundaries=None,\
  678. centroids=None, faces=None, kernels=None, primitives=None, nodes=None, areas=None, \
  679. islands=None, holes=None, volumes=None):
  680. stds_metadata_base.__init__(self, "stvds_metadata", ident, title, description)
  681. self.set_vector_register(vector_register)
  682. self.set_points(points)
  683. self.set_lines(lines)
  684. self.set_boundaries(boundaries)
  685. self.set_centroids(centroids)
  686. self.set_faces(faces)
  687. self.set_kernels(kernels)
  688. self.set_primitives(primitives)
  689. self.set_nodes(nodes)
  690. self.set_areas(areas)
  691. self.set_islands(islands)
  692. self.set_holes(holes)
  693. self.set_volumes(volumes)
  694. def set_vector_register(self, vector_register):
  695. """!Set the vector map register table name"""
  696. self.D["vector_register"] = vector_register
  697. def set_points(self, points):
  698. """!Set the number of points of the vector map"""
  699. self.D["points"] = points
  700. def set_lines(self, lines):
  701. """!Set the number of lines of the vector map"""
  702. self.D["lines"] = lines
  703. def set_boundaries(self, boundaries):
  704. """!Set the number of boundaries of the vector map"""
  705. self.D["boundaries"] = boundaries
  706. def set_centroids(self, centroids):
  707. """!Set the number of centroids of the vector map"""
  708. self.D["centroids"] = centroids
  709. def set_faces(self, faces):
  710. """!Set the number of faces of the vector map"""
  711. self.D["faces"] = faces
  712. def set_kernels(self, kernels):
  713. """!Set the number of kernels of the vector map"""
  714. self.D["kernels"] = kernels
  715. def set_primitives(self, primitives):
  716. """!Set the number of primitives of the vector map"""
  717. self.D["primitives"] = primitives
  718. def set_nodes(self, nodes):
  719. """!Set the number of nodes of the vector map"""
  720. self.D["nodes"] = nodes
  721. def set_areas(self, areas):
  722. """!Set the number of areas of the vector map"""
  723. self.D["areas"] = areas
  724. def set_islands(self, islands):
  725. """!Set the number of islands of the vector map"""
  726. self.D["islands"] = islands
  727. def set_holes(self, holes):
  728. """!Set the number of holes of the vector map"""
  729. self.D["holes"] = holes
  730. def set_volumes(self, volumes):
  731. """!Set the number of volumes of the vector map"""
  732. self.D["volumes"] = volumes
  733. def get_vector_register(self):
  734. """!Get the vector map register table name
  735. @return None if not found"""
  736. if self.D.has_key("vector_register"):
  737. return self.D["vector_register"]
  738. else:
  739. return None
  740. def get_points(self):
  741. """!Get the number of points of the vector map
  742. @return None if not found"""
  743. if self.D.has_key("points"):
  744. return self.D["points"]
  745. else:
  746. return None
  747. def get_lines(self):
  748. """!Get the number of lines of the vector map
  749. @return None if not found"""
  750. if self.D.has_key("lines"):
  751. return self.D["lines"]
  752. else:
  753. return None
  754. def get_boundaries(self):
  755. """!Get the number of boundaries of the vector map
  756. @return None if not found"""
  757. if self.D.has_key("boundaries"):
  758. return self.D["boundaries"]
  759. else:
  760. return None
  761. def get_centroids(self):
  762. """!Get the number of centroids of the vector map
  763. @return None if not found"""
  764. if self.D.has_key("centroids"):
  765. return self.D["centroids"]
  766. else:
  767. return None
  768. def get_faces(self):
  769. """!Get the number of faces of the vector map
  770. @return None if not found"""
  771. if self.D.has_key("faces"):
  772. return self.D["faces"]
  773. else:
  774. return None
  775. def get_kernels(self):
  776. """!Get the number of kernels of the vector map
  777. @return None if not found"""
  778. if self.D.has_key("kernels"):
  779. return self.D["kernels"]
  780. else:
  781. return None
  782. def get_primitives(self):
  783. """!Get the number of primitives of the vector map
  784. @return None if not found"""
  785. if self.D.has_key("primitives"):
  786. return self.D["primitives"]
  787. else:
  788. return None
  789. def get_nodes(self):
  790. """!Get the number of nodes of the vector map
  791. @return None if not found"""
  792. if self.D.has_key("nodes"):
  793. return self.D["nodes"]
  794. else:
  795. return None
  796. def get_areas(self):
  797. """!Get the number of areas of the vector map
  798. @return None if not found"""
  799. if self.D.has_key("areas"):
  800. return self.D["areas"]
  801. else:
  802. return None
  803. def get_islands(self):
  804. """!Get the number of islands of the vector map
  805. @return None if not found"""
  806. if self.D.has_key("islands"):
  807. return self.D["islands"]
  808. else:
  809. return None
  810. def get_holes(self):
  811. """!Get the number of holes of the vector map
  812. @return None if not found"""
  813. if self.D.has_key("holes"):
  814. return self.D["holes"]
  815. else:
  816. return None
  817. def get_volumes(self):
  818. """!Get the number of volumes of the vector map
  819. @return None if not found"""
  820. if self.D.has_key("volumes"):
  821. return self.D["volumes"]
  822. else:
  823. return None
  824. def print_info(self):
  825. """!Print information about this class in human readable style"""
  826. print " +-------------------- Metadata information ----------------------------------+"
  827. # 0123456789012345678901234567890
  828. stds_metadata_base.print_info(self)
  829. print " | Vector register table:...... " + str(self.get_vector_register())
  830. print " | Number of points ........... " + str(self.get_points())
  831. print " | Number of lines ............ " + str(self.get_lines())
  832. print " | Number of boundaries ....... " + str(self.get_boundaries())
  833. print " | Number of centroids ........ " + str(self.get_centroids())
  834. print " | Number of faces ............ " + str(self.get_faces())
  835. print " | Number of kernels .......... " + str(self.get_kernels())
  836. print " | Number of primitives ....... " + str(self.get_primitives())
  837. print " | Number of nodes ............ " + str(self.get_nodes())
  838. print " | Number of areas ............ " + str(self.get_areas())
  839. print " | Number of islands .......... " + str(self.get_islands())
  840. print " | Number of holes ............ " + str(self.get_holes())
  841. print " | Number of volumes .......... " + str(self.get_volumes())
  842. def print_shell_info(self):
  843. """!Print information about this class in shell style"""
  844. stds_metadata_base.print_shell_info(self)
  845. print "vector_register=" + str(self.get_vector_register())
  846. print "points=" + str(self.get_points())
  847. print "lines=" + str(self.get_lines())
  848. print "boundaries=" + str(self.get_boundaries())
  849. print "centroids=" + str(self.get_centroids())
  850. print "faces=" + str(self.get_faces())
  851. print "kernels=" + str(self.get_kernels())
  852. print "primitives=" + str(self.get_primitives())
  853. print "nodes=" + str(self.get_nodes())
  854. print "areas=" + str(self.get_areas())
  855. print "islands=" + str(self.get_islands())
  856. print "holes=" + str(self.get_holes())
  857. print "volumes=" + str(self.get_volumes())