OpenTemp.WriteCellStationResults()

        /// <summary>
        /// Write the cell-station restuls to a data file in CSV format (stations that can affect each cell).
        /// </summary>
        /// <returns>0 if successful; -ve for error code</returns>
        protected int WriteCellStationResults()
        {
            OpenTemp.WriteLine(string.Format("Writing the cell-station results file '{0}'...", _outputCellStationsFile));
            // Open the file
            StreamWriter sw;
            try
            {
                sw = new StreamWriter(_outputCellStationsFile, false);      // Overwrite (do not append)
                OpenTemp.WriteLine("  File opened for writing");
            }
            catch (Exception ex)
            {
                OpenTemp.WriteLine(string.Format("  Exception thrown when opening file:  {0}", ex.ToString()));
                return -1;
            }
            if (sw == null)
            {
                OpenTemp.WriteLine("  Failed to open file (check that it exists and the path is correct)");
                return -2;
            }
            // Write header
            sw.Write("CELL_LAT, CELL_LONG");
            foreach (Station station in _stations.Values)
            {
                sw.Write(string.Format(", {0}{1}_LAT, {0}{1}_LONG, {0}{1}_WEIGHT", station.Country, station.StationID));
            }
            sw.WriteLine();

            // Write station locations
            sw.Write(", ");
            foreach (Station station in _stations.Values)
            {
                sw.Write(string.Format(", {0:F2}, {1:F2}, ", station.Latitude, station.Longitude));
            }
            sw.WriteLine();

            // Write cell location and cell-station weights
            foreach (Cell cell in _cells)
            {
                sw.Write(string.Format("{0:F2}, {1:F2}", cell.Latitude, cell.Longitude));
                foreach (Station station in _stations.Values)
                {
                    sw.Write(", , ");
                    float weight = -1.0f;
                    foreach (CellStation cs in cell.Stations)
                    {
                        if (cs.station.Equals(station))
                        {
                            weight = cs.weight;
                            break;
                        }
                    }
                    if (weight >= 0.0f)
                    {
                        sw.Write(string.Format(", {0:F3}", weight));
                    }
                    else
                    {
                        sw.Write(", ");
                    }
                }
                sw.WriteLine();
            }

            // Done
            sw.Close();

            // Done
            OpenTemp.WriteLine(string.Format("  Writing finished: {0} cells written", _cells.Count));
            return 0;
        }