parameters: (separator, output_files, output_time_list,
                                   output, write_header, site_input)
docstring: Use the original layout of the r.what output and print instead of
         the raster names, the time stamps as header
  
         One point per line for all time stamps:
          x|y|1991-01-01 00:00:00;1991-01-02 00:00:00|1991-01-02 00:00:00;1991-01-03 00:00:00|1991-01-03 00:00:00;1991-01-04 00:00:00|1991-01-04 00:00:00;1991-01-05 00:00:00
          3730731.49590371|5642483.51236521|6|8|7|7
          3581249.04638104|5634411.97526282|5|8|7|7
docstring_summary: Use the original layout of the r.what output and print instead of
         the raster names, the time stamps as header
docstring_tokens: Use the original layout of the r . what output and print instead of the raster names the time stamps as header
function: def one_point_per_timerow_output(separator, output_files, output_time_list,
                                   output, write_header, site_input):
      """Use the original layout of the r.what output and print instead of
         the raster names, the time stamps as header
  
         One point per line for all time stamps:
          x|y|1991-01-01 00:00:00;1991-01-02 00:00:00|1991-01-02 00:00:00;1991-01-03 00:00:00|1991-01-03 00:00:00;1991-01-04 00:00:00|1991-01-04 00:00:00;1991-01-05 00:00:00
          3730731.49590371|5642483.51236521|6|8|7|7
          3581249.04638104|5634411.97526282|5|8|7|7
      """
      out_file = open(output, 'w') if output != "-" else sys.stdout
  
      matrix = []
      header = ""
  
      first = True
      for count in range(len(output_files)):
          file_name = output_files[count]
          gscript.verbose("Transforming r.what output file %s" % (file_name))
          map_list = output_time_list[count]
          in_file = open(file_name, "r")
  
          if write_header:
              if first is True:
                  if site_input:
                      header = "x%(sep)sy%(sep)ssite" % ({"sep": separator})
                  else:
                      header = "x%(sep)sy" % ({"sep": separator})
              for map in map_list:
                  start, end = map.get_temporal_extent_as_tuple()
                  time_string = "%(sep)s%(start)s;%(end)s"\
                                % ({"start": str(start), "end": str(end),
                                    "sep": separator})
                  header += time_string
  
          lines = in_file.readlines()
  
          for i in range(len(lines)):
              cols = lines[i].split(separator)
  
              if first is True:
                  if site_input:
                      matrix.append(cols[:3])
                  else:
                      matrix.append(cols[:2])
  
              matrix[i] = matrix[i] + cols[3:]
  
          first = False
  
          in_file.close()
  
      out_file.write(header + "\n")
  
      gscript.verbose(_("Writing the output file <%s>" % (output)))
      for row in matrix:
          first = True
          for col in row:
              value = col.strip()
  
              if first is False:
                  out_file.write("%s" % (separator))
              out_file.write(value)
  
              first = False
  
          out_file.write("\n")
      if out_file is not sys.stdout:
          out_file.close()
function_tokens: def one_point_per_timerow_output ( separator , output_files , output_time_list , output , write_header , site_input ) : out_file = open ( output , 'w' ) if output != "-" else sys . stdout matrix = [ ] header = "" first = True for count in range ( len ( output_files ) ) : file_name = output_files [ count ] gscript . verbose ( "Transforming r.what output file %s" % ( file_name ) ) map_list = output_time_list [ count ] in_file = open ( file_name , "r" ) if write_header : if first is True : if site_input : header = "x%(sep)sy%(sep)ssite" % ( { "sep" : separator } ) else : header = "x%(sep)sy" % ( { "sep" : separator } ) for map in map_list : start , end = map . get_temporal_extent_as_tuple ( ) time_string = "%(sep)s%(start)s;%(end)s" % ( { "start" : str ( start ) , "end" : str ( end ) , "sep" : separator } ) header += time_string lines = in_file . readlines ( ) for i in range ( len ( lines ) ) : cols = lines [ i ] . split ( separator ) if first is True : if site_input : matrix . append ( cols [ : 3 ] ) else : matrix . append ( cols [ : 2 ] ) matrix [ i ] = matrix [ i ] + cols [ 3 : ] first = False in_file . close ( ) out_file . write ( header + "\n" ) gscript . verbose ( _ ( "Writing the output file <%s>" % ( output ) ) ) for row in matrix : first = True for col in row : value = col . strip ( ) if first is False : out_file . write ( "%s" % ( separator ) ) out_file . write ( value ) first = False out_file . write ( "\n" ) if out_file is not sys . stdout : out_file . close ( )