space_time_datasets_tools.py 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. """!@package grass.temporal
  2. @brief GRASS Python scripting module (temporal GIS functions)
  3. Temporal GIS related functions to be used in Python scripts.
  4. Usage:
  5. @code
  6. import grass.temporal as tgis
  7. tgis.register_maps_in_space_time_dataset(type, name, maps)
  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 space_time_datasets import *
  17. ###############################################################################
  18. def register_maps_in_space_time_dataset(
  19. type, name, maps=None, file=None, start=None,
  20. end=None, unit=None, increment=None, dbif=None,
  21. interval=False, fs="|"):
  22. """!Use this method to register maps in space time datasets.
  23. Additionally a start time string and an increment string can be specified
  24. to assign a time interval automatically to the maps.
  25. It takes care of the correct update of the space time datasets from all
  26. registered maps.
  27. @param type: The type of the maps rast, rast3d or vect
  28. @param name: The name of the space time dataset
  29. @param maps: A comma separated list of map names
  30. @param file: Input file one map with start and optional end time,
  31. one per line
  32. @param start: The start date and time of the first raster map
  33. (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd",
  34. format relative is integer 5)
  35. @param end: The end date and time of the first raster map
  36. (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd",
  37. format relative is integer 5)
  38. @param unit: The unit of the relative time: years, months, days,
  39. hours, minutes, seconds
  40. @param increment: Time increment between maps for time stamp creation
  41. (format absolute: NNN seconds, minutes, hours, days,
  42. weeks, months, years; format relative: 1.0)
  43. @param dbif: The database interface to be used
  44. @param interval: If True, time intervals are created in case the start
  45. time and an increment is provided
  46. @param fs: Field separator used in input file
  47. """
  48. start_time_in_file = False
  49. end_time_in_file = False
  50. if maps and file:
  51. core.fatal(_("%s= and %s= are mutually exclusive") % ("input", "file"))
  52. if end and increment:
  53. core.fatal(_("%s= and %s= are mutually exclusive") % (
  54. "end", "increment"))
  55. if end and not start:
  56. core.fatal(_("Please specify %s= and %s=") % ("start_time",
  57. "end_time"))
  58. if not maps and not file:
  59. core.fatal(_("Please specify %s= or %s=") % ("input", "file"))
  60. # We may need the mapset
  61. mapset = core.gisenv()["MAPSET"]
  62. # The name of the space time dataset is optional
  63. if name:
  64. # Check if the dataset name contains the mapset as well
  65. if name.find("@") < 0:
  66. id = name + "@" + mapset
  67. else:
  68. id = name
  69. if type == "rast" or type == "raster":
  70. sp = dataset_factory("strds", id)
  71. elif type == "rast3d":
  72. sp = dataset_factory("str3ds", id)
  73. elif type == "vect" or type == "vector":
  74. sp = dataset_factory("stvds", id)
  75. else:
  76. core.fatal(_("Unkown map type: %s") % (type))
  77. dbif, connect = init_dbif(None)
  78. if name:
  79. # Read content from temporal database
  80. sp.select(dbif)
  81. if not sp.is_in_db(dbif):
  82. dbif.close()
  83. core.fatal(_("Space time %s dataset <%s> no found") %
  84. (sp.get_new_map_instance(None).get_type(), name))
  85. if sp.is_time_relative() and not unit:
  86. dbif.close()
  87. core.fatal(_("Space time %s dataset <%s> with relative time found, "
  88. "but no relative unit set for %s maps") %
  89. (sp.get_new_map_instance(None).get_type(),
  90. name, sp.get_new_map_instance(None).get_type()))
  91. # We need a dummy map object to build the map ids
  92. dummy = dataset_factory(type, None)
  93. maplist = []
  94. # Map names as comma separated string
  95. if maps:
  96. if maps.find(",") < 0:
  97. maplist = [maps, ]
  98. else:
  99. maplist = maps.split(",")
  100. # Build the map list again with the ids
  101. for count in range(len(maplist)):
  102. row = {}
  103. mapid = dummy.build_id(maplist[count], mapset, None)
  104. row["id"] = mapid
  105. maplist[count] = row
  106. # Read the map list from file
  107. if file:
  108. fd = open(file, "r")
  109. line = True
  110. while True:
  111. line = fd.readline()
  112. if not line:
  113. break
  114. line_list = line.split(fs)
  115. # Detect start and end time
  116. if len(line_list) == 2:
  117. start_time_in_file = True
  118. end_time_in_file = False
  119. elif len(line_list) == 3:
  120. start_time_in_file = True
  121. end_time_in_file = True
  122. else:
  123. start_time_in_file = False
  124. end_time_in_file = False
  125. mapname = line_list[0].strip()
  126. row = {}
  127. if start_time_in_file and end_time_in_file:
  128. row["start"] = line_list[1].strip()
  129. row["end"] = line_list[2].strip()
  130. if start_time_in_file and not end_time_in_file:
  131. row["start"] = line_list[1].strip()
  132. row["id"] = dummy.build_id(mapname, mapset)
  133. maplist.append(row)
  134. num_maps = len(maplist)
  135. map_object_list = []
  136. statement = ""
  137. # Store the ids of datasets that must be updated
  138. datatsets_to_modify = {}
  139. core.message(_("Gathering map informations"))
  140. for count in range(len(maplist)):
  141. core.percent(count, num_maps, 1)
  142. # Get a new instance of the map type
  143. map = dataset_factory(type, maplist[count]["id"])
  144. # Use the time data from file
  145. if "start" in maplist[count]:
  146. start = maplist[count]["start"]
  147. if "end" in maplist[count]:
  148. end = maplist[count]["end"]
  149. is_in_db = False
  150. # Put the map into the database
  151. if not map.is_in_db(dbif):
  152. is_in_db = False
  153. # Break in case no valid time is provided
  154. if start == "" or start is None:
  155. dbif.close()
  156. if map.get_layer():
  157. core.fatal(_("Unable to register %s map <%s> with layer %s. "
  158. "The map has no valid time and the start time is not set.") %
  159. (map.get_type(), map.get_map_id(), map.get_layer()))
  160. else:
  161. core.fatal(_("Unable to register %s map <%s>. The map has no valid"
  162. " time and the start time is not set.") %
  163. (map.get_type(), map.get_map_id()))
  164. if unit:
  165. map.set_time_to_relative()
  166. else:
  167. map.set_time_to_absolute()
  168. else:
  169. is_in_db = True
  170. # Check the overwrite flag
  171. if not core.overwrite():
  172. if map.get_layer():
  173. core.warning(_("Map is already registered in temporal database. "
  174. "Unable to update %s map <%s> with layer %i. "
  175. "Overwrite flag is not set.") %
  176. (map.get_type(), map.get_map_id(), map.get_layer()))
  177. else:
  178. core.warning(_("Map is already registered in temporal database. "
  179. "Unable to update %s map <%s>. "
  180. "Overwrite flag is not set.") %
  181. (map.get_type(), map.get_map_id()))
  182. # Jump to next map
  183. continue
  184. # Select information from temporal database
  185. map.select(dbif)
  186. # Safe the datasets that must be updated
  187. datasets = map.get_registered_datasets(dbif)
  188. if datasets:
  189. for dataset in datasets:
  190. datatsets_to_modify[dataset["id"]] = dataset["id"]
  191. if name and map.get_temporal_type() != sp.get_temporal_type():
  192. dbif.close()
  193. if map.get_layer():
  194. core.fatal(_("Unable to update %s map <%s> with layer. "
  195. "The temporal types are different.") %
  196. (map.get_type(), map.get_map_id(), map.get_layer()))
  197. else:
  198. core.fatal(_("Unable to update %s map <%s>. "
  199. "The temporal types are different.") %
  200. (map.get_type(), map.get_map_id()))
  201. # Load the data from the grass file database
  202. map.load()
  203. # Set the valid time
  204. if start:
  205. # In case the time is in the input file we ignore the increment counter
  206. if start_time_in_file:
  207. count = 1
  208. assign_valid_time_to_map(ttype=map.get_temporal_type(),
  209. map=map, start=start, end=end, unit=unit,
  210. increment=increment, mult=count,
  211. interval=interval)
  212. if is_in_db:
  213. # Gather the SQL update statement
  214. statement += map.update_all(dbif=dbif, execute=False)
  215. else:
  216. # Gather the SQL insert statement
  217. statement += map.insert(dbif=dbif, execute=False)
  218. # Sqlite3 performace better for huge datasets when committing in small chunks
  219. if dbmi.__name__ == "sqlite3":
  220. if count % 100 == 0:
  221. if statement is not None and statement != "":
  222. core.message(_("Registering maps in the temporal database")
  223. )
  224. dbif.execute_transaction(statement)
  225. statement = ""
  226. # Store the maps in a list to register in a space time dataset
  227. if name:
  228. map_object_list.append(map)
  229. core.percent(num_maps, num_maps, 1)
  230. if statement is not None and statement != "":
  231. core.message(_("Register maps in the temporal database"))
  232. dbif.execute_transaction(statement)
  233. # Finally Register the maps in the space time dataset
  234. if name:
  235. statement = ""
  236. count = 0
  237. num_maps = len(map_object_list)
  238. core.message(_("Register maps in the space time raster dataset"))
  239. for map in map_object_list:
  240. core.percent(count, num_maps, 1)
  241. sp.register_map(map=map, dbif=dbif)
  242. count += 1
  243. # Update the space time tables
  244. if name:
  245. core.message(_("Update space time raster dataset"))
  246. sp.update_from_registered_maps(dbif)
  247. # Update affected datasets
  248. if datatsets_to_modify:
  249. for dataset in datatsets_to_modify:
  250. if type == "rast" or type == "raster":
  251. ds = dataset_factory("strds", dataset)
  252. elif type == "rast3d":
  253. ds = dataset_factory("str3ds", dataset)
  254. elif type == "vect" or type == "vector":
  255. ds = dataset_factory("stvds", dataset)
  256. ds.select(dbif)
  257. ds.update_from_registered_maps(dbif)
  258. if connect == True:
  259. dbif.close()
  260. core.percent(num_maps, num_maps, 1)
  261. ###############################################################################
  262. def assign_valid_time_to_map(ttype, map, start, end, unit, increment=None, mult=1, interval=False):
  263. """!Assign the valid time to a map dataset
  264. @param ttype: The temporal type which should be assigned
  265. and which the time format is of
  266. @param map: A map dataset object derived from abstract_map_dataset
  267. @param start: The start date and time of the first raster map
  268. (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd",
  269. format relative is integer 5)
  270. @param end: The end date and time of the first raster map
  271. (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd",
  272. format relative is integer 5)
  273. @param unit: The unit of the relative time: years, months,
  274. days, hours, minutes, seconds
  275. @param increment: Time increment between maps for time stamp creation
  276. (format absolute: NNN seconds, minutes, hours, days,
  277. weeks, months, years; format relative is integer 1)
  278. @param multi: A multiplier for the increment
  279. @param interval: If True, time intervals are created in case the start
  280. time and an increment is provided
  281. """
  282. if ttype == "absolute":
  283. start_time = string_to_datetime(start)
  284. if start_time is None:
  285. dbif.close()
  286. core.fatal(_("Unable to convert string \"%s\"into a "
  287. "datetime object") % (start))
  288. end_time = None
  289. if end:
  290. end_time = string_to_datetime(end)
  291. if end_time is None:
  292. dbif.close()
  293. core.fatal(_("Unable to convert string \"%s\"into a "
  294. "datetime object") % (end))
  295. # Add the increment
  296. if increment:
  297. start_time = increment_datetime_by_string(
  298. start_time, increment, mult)
  299. if start_time is None:
  300. core.fatal(_("Error in increment computation"))
  301. if interval:
  302. end_time = increment_datetime_by_string(
  303. start_time, increment, 1)
  304. if end_time is None:
  305. core.fatal(_("Error in increment computation"))
  306. if map.get_layer():
  307. core.verbose(_("Set absolute valid time for map <%(id)s> with "
  308. "layer %(layer)s to %(start)s - %(end)s") %
  309. {'id': map.get_map_id(), 'layer': map.get_layer(),
  310. 'start': str(start_time), 'end': str(end_time)})
  311. else:
  312. core.verbose(_("Set absolute valid time for map <%s> to %s - %s") %
  313. (map.get_map_id(), str(start_time), str(end_time)))
  314. map.set_absolute_time(start_time, end_time, None)
  315. else:
  316. start_time = int(start)
  317. end_time = None
  318. if end:
  319. end_time = int(end)
  320. if increment:
  321. start_time = start_time + mult * int(increment)
  322. if interval:
  323. end_time = start_time + int(increment)
  324. if map.get_layer():
  325. core.verbose(_("Set relative valid time for map <%s> with layer %s "
  326. "to %i - %s with unit %s") %
  327. (map.get_map_id(), map.get_layer(), start_time,
  328. str(end_time), unit))
  329. else:
  330. core.verbose(_("Set relative valid time for map <%s> to %i - %s "
  331. "with unit %s") % (map.get_map_id(), start_time,
  332. str(end_time), unit))
  333. map.set_relative_time(start_time, end_time, unit)
  334. ###############################################################################
  335. def dataset_factory(type, id):
  336. """!A factory functions to create space time or map datasets
  337. @param type: the dataset type: rast or raster, rast3d,
  338. vect or vector, strds, str3ds, stvds
  339. @param id: The id of the dataset ("name@mapset")
  340. """
  341. if type == "strds":
  342. sp = SpaceTimeRasterDataset(id)
  343. elif type == "str3ds":
  344. sp = SpaceTimeRaster3DDataset(id)
  345. elif type == "stvds":
  346. sp = SpaceTimeVectorDataset(id)
  347. elif type == "rast" or type == "raster":
  348. sp = RasterDataset(id)
  349. elif type == "rast3d":
  350. sp = Raster3DDataset(id)
  351. elif type == "vect" or type == "vector":
  352. sp = VectorDataset(id)
  353. else:
  354. core.error(_("Unknown dataset type: %s") % type)
  355. return None
  356. return sp
  357. ###############################################################################
  358. def list_maps_of_stds(type, input, columns, order, where, separator, method, header):
  359. """! List the maps of a space time dataset using diffetent methods
  360. @param type: The type of the maps raster, raster3d or vector
  361. @param input: Name of a space time raster dataset
  362. @param columns: A comma separated list of columns to be printed to stdout
  363. @param order: A comma separated list of columns to order the
  364. space time dataset by category
  365. @param where: A where statement for selected listing without "WHERE"
  366. e.g: start_time < "2001-01-01" and end_time > "2001-01-01"
  367. @param separator: The field separator character between the columns
  368. @param method: String identifier to select a method out of cols,
  369. comma,delta or deltagaps
  370. - "cols": Print preselected columns specified by columns
  371. - "comma": Print the map ids (name@mapset) as comma separated string
  372. - "delta": Print the map ids (name@mapset) with start time,
  373. end time, relative length of intervals and the relative
  374. distance to the begin
  375. - "deltagaps": Same as "delta" with additional listing of gaps.
  376. Gaps can be simply identified as the id is "None"
  377. - "gran": List map using the granularity of the space time dataset,
  378. columns are identical to deltagaps
  379. @param header: Set True to print column names
  380. """
  381. mapset = core.gisenv()["MAPSET"]
  382. if input.find("@") >= 0:
  383. id = input
  384. else:
  385. id = input + "@" + mapset
  386. sp = dataset_factory(type, id)
  387. if not sp.is_in_db():
  388. core.fatal(_("Dataset <%s> not found in temporal database") % (id))
  389. sp.select()
  390. if separator is None or separator == "":
  391. separator = "\t"
  392. # This method expects a list of objects for gap detection
  393. if method == "delta" or method == "deltagaps" or method == "gran":
  394. if type == "stvds":
  395. columns = "id,name,layer,mapset,start_time,end_time"
  396. else:
  397. columns = "id,name,mapset,start_time,end_time"
  398. if method == "deltagaps":
  399. maps = sp.get_registered_maps_as_objects_with_gaps(where, None)
  400. elif method == "delta":
  401. maps = sp.get_registered_maps_as_objects(where, "start_time", None)
  402. elif method == "gran":
  403. maps = sp.get_registered_maps_as_objects_by_granularity(None)
  404. if header:
  405. string = ""
  406. string += "%s%s" % ("id", separator)
  407. string += "%s%s" % ("name", separator)
  408. if type == "stvds":
  409. string += "%s%s" % ("layer", separator)
  410. string += "%s%s" % ("mapset", separator)
  411. string += "%s%s" % ("start_time", separator)
  412. string += "%s%s" % ("end_time", separator)
  413. string += "%s%s" % ("interval_length", separator)
  414. string += "%s" % ("distance_from_begin")
  415. print string
  416. if maps and len(maps) > 0:
  417. if isinstance(maps[0], list):
  418. if len(maps[0]) > 0:
  419. first_time, dummy = maps[0][0].get_valid_time()
  420. else:
  421. core.warning(_("Empty map list."))
  422. return
  423. else:
  424. first_time, dummy = maps[0].get_valid_time()
  425. for mymap in maps:
  426. if isinstance(mymap, list):
  427. if len(mymap) > 0:
  428. map = mymap[0]
  429. else:
  430. core.fatal(_("Empty entry in map list, this should not happen."))
  431. else:
  432. map = mymap
  433. start, end = map.get_valid_time()
  434. if end:
  435. delta = end - start
  436. else:
  437. delta = None
  438. delta_first = start - first_time
  439. if map.is_time_absolute():
  440. if end:
  441. delta = time_delta_to_relative_time(delta)
  442. delta_first = time_delta_to_relative_time(delta_first)
  443. string = ""
  444. string += "%s%s" % (map.get_id(), separator)
  445. string += "%s%s" % (map.get_name(), separator)
  446. if type == "stvds":
  447. string += "%s%s" % (map.get_layer(), separator)
  448. string += "%s%s" % (map.get_mapset(), separator)
  449. string += "%s%s" % (start, separator)
  450. string += "%s%s" % (end, separator)
  451. string += "%s%s" % (delta, separator)
  452. string += "%s" % (delta_first)
  453. print string
  454. else:
  455. # In comma separated mode only map ids are needed
  456. if method == "comma":
  457. columns = "id"
  458. rows = sp.get_registered_maps(columns, where, order, None)
  459. if rows:
  460. if method == "comma":
  461. string = ""
  462. count = 0
  463. for row in rows:
  464. if count == 0:
  465. string += row["id"]
  466. else:
  467. string += ",%s" % row["id"]
  468. count += 1
  469. print string
  470. elif method == "cols":
  471. # Print the column names if requested
  472. if header:
  473. output = ""
  474. count = 0
  475. collist = columns.split(",")
  476. for key in collist:
  477. if count > 0:
  478. output += separator + str(key)
  479. else:
  480. output += str(key)
  481. count += 1
  482. print output
  483. for row in rows:
  484. output = ""
  485. count = 0
  486. for col in row:
  487. if count > 0:
  488. output += separator + str(col)
  489. else:
  490. output += str(col)
  491. count += 1
  492. print output
  493. ###############################################################################
  494. def sample_stds_by_stds_topology(intype, sampletype, inputs, sampler, header, separator, method, spatial=False):
  495. """!Sample the input space time datasets with a sample
  496. space time dataset and print the result to stdout
  497. In case multiple maps are located in the current granule,
  498. the map names are separated by comma.
  499. In case a layer is present, the names map ids are extended
  500. in this form: name:layer@mapset
  501. Attention: Do not use the comma as separator
  502. @param intype: Type of the input space time dataset (strds, stvds or str3ds)
  503. @param samtype: Type of the sample space time dataset (strds, stvds or str3ds)
  504. @param input: Name of a space time dataset
  505. @param sampler: Name of a space time dataset used for temporal sampling
  506. @param header: Set True to print column names
  507. @param separator: The field separator character between the columns
  508. @param method: The method to be used for temporal sampling
  509. (start,during,contain,overlap,equal)
  510. @param spatial: Perform spatial overlapping check
  511. """
  512. mapset = core.gisenv()["MAPSET"]
  513. input_list = inputs.split(",")
  514. sts = []
  515. for input in input_list:
  516. if input.find("@") >= 0:
  517. id = input
  518. else:
  519. id = input + "@" + mapset
  520. st = dataset_factory(intype, id)
  521. sts.append(st)
  522. if sampler.find("@") >= 0:
  523. sid = sampler
  524. else:
  525. sid = sampler + "@" + mapset
  526. sst = dataset_factory(sampletype, sid)
  527. dbif = SQLDatabaseInterfaceConnection()
  528. dbif.connect()
  529. for st in sts:
  530. if st.is_in_db(dbif) == False:
  531. core.fatal(_("Dataset <%s> not found in temporal database") % (id))
  532. st.select(dbif)
  533. if sst.is_in_db(dbif) == False:
  534. core.fatal(_("Dataset <%s> not found in temporal database") % (sid))
  535. sst.select(dbif)
  536. if separator is None or separator == "" or separator.find(",") >= 0:
  537. separator = " | "
  538. mapmatrizes = []
  539. for st in sts:
  540. mapmatrix = st.sample_by_dataset(sst, method, spatial, dbif)
  541. if mapmatrix and len(mapmatrix) > 0:
  542. mapmatrizes.append(mapmatrix)
  543. if len(mapmatrizes) > 0:
  544. if header:
  545. string = ""
  546. string += "%s%s" % (sst.get_id(), separator)
  547. for st in sts:
  548. string += "%s%s" % (st.get_id(), separator)
  549. string += "%s%s" % ("start_time", separator)
  550. string += "%s%s" % ("end_time", separator)
  551. string += "%s%s" % ("interval_length", separator)
  552. string += "%s" % ("distance_from_begin")
  553. print string
  554. first_time, dummy = mapmatrizes[0][0]["granule"].get_valid_time()
  555. for i in range(len(mapmatrizes[0])):
  556. mapname_list = []
  557. for mapmatrix in mapmatrizes:
  558. mapnames = ""
  559. count = 0
  560. entry = mapmatrix[i]
  561. for sample in entry["samples"]:
  562. if count == 0:
  563. mapnames += str(sample.get_id())
  564. else:
  565. mapnames += ",%s" % str(sample.get_id())
  566. count += 1
  567. mapname_list.append(mapnames)
  568. entry = mapmatrizes[0][i]
  569. map = entry["granule"]
  570. start, end = map.get_valid_time()
  571. if end:
  572. delta = end - start
  573. else:
  574. delta = None
  575. delta_first = start - first_time
  576. if map.is_time_absolute():
  577. if end:
  578. delta = time_delta_to_relative_time(delta)
  579. delta_first = time_delta_to_relative_time(delta_first)
  580. string = ""
  581. string += "%s%s" % (map.get_id(), separator)
  582. for mapnames in mapname_list:
  583. string += "%s%s" % (mapnames, separator)
  584. string += "%s%s" % (start, separator)
  585. string += "%s%s" % (end, separator)
  586. string += "%s%s" % (delta, separator)
  587. string += "%s" % (delta_first)
  588. print string
  589. dbif.close()