Exemplo n.º 1
0
        } /* LocateImageDepthStats */

        private void  WriteDepthSummary(System.IO.StreamWriter o,
                                        InstrumentDataList cast,
                                        List <ImagesDepthStats> imageStats,
                                        float scanRate
                                        )
        {
            int zed = 0;

            cast.SortByDepth();

            InstrumentData id = (InstrumentData)(cast[0]);

            while ((id != null) && (!cancelBackGround))
            {
                id = (InstrumentData)cast[zed];
                int lastDepth = (int)Math.Round(id.Depth());

                uint scanLinesThisDepth = 0;

                List <float> flowRate             = new List <float> ();
                List <float> temperature          = new List <float> ();
                List <float> oxygen               = new List <float> ();
                List <float> oxygenSensor         = new List <float> ();
                List <float> salinity             = new List <float> ();
                List <float> density              = new List <float> ();
                List <float> fluorensce           = new List <float> ();
                List <float> fluorensceSensor     = new List <float> ();
                List <float> transmissivity       = new List <float> ();
                List <float> transmissivitySensor = new List <float> ();
                List <float> turbidity            = new List <float> ();
                List <float> turbiditySensor      = new List <float> ();
                List <float> recordRate           = new List <float> ();

                while ((lastDepth == (int)Math.Round(id.Depth())) && (id != null))
                {
                    if ((id.Temperature() > 0.0f) && (id.Temperature() <= 40.0f) &&
                        (id.Salinity() > 20.0f) && (id.Salinity() <= 40.0f) &&
                        (id.Density() > 18.0f) && (id.Density() <= 40.0f) &&
                        (id.Fluorescence() > -2.0f)
                        )
                    {
                        flowRate.Add(id.FlowRate1);
                        temperature.Add(id.Temperature());
                        salinity.Add(id.Salinity());
                        density.Add(id.Density());
                        fluorensce.Add(id.Fluorescence());
                        fluorensceSensor.Add(id.FluorescenceSensor());
                        transmissivity.Add(id.Transmissivity());
                        transmissivitySensor.Add(id.TransmissivitySensor());
                        turbidity.Add(id.Turbidity());
                        turbiditySensor.Add(id.TurbiditySensor());
                        recordRate.Add(id.RecordingRate);
                        oxygen.Add(id.Oxygen());
                        oxygenSensor.Add(id.OxygenSensor());
                        scanLinesThisDepth += 4096;
                    }

                    zed++;
                    if (zed < cast.Count)
                    {
                        id = (InstrumentData)cast[zed];
                    }
                    else
                    {
                        id = null;
                        break;
                    }
                }

                float timeAtThisDepth = 0.0f;
                if (scanRate > 0.0f)
                {
                    timeAtThisDepth = scanLinesThisDepth / scanRate;
                }

                int imageCount       = 0;
                int totalPixelCount  = 0;
                ImagesDepthStats ids = LocateImageDepthStats(imageStats, lastDepth);
                if (ids != null)
                {
                    if (ids.counted)
                    {
                        RunLogAddMsg("WriteDepthSummary   Duplicate Use of Cast[" + (ids.upCast ? "Up":"Down") + "]  Depth[" + ids.bucketDepth + "]   Count[" + ids.imageCount + "]");
                    }
                    else
                    {
                        imageCount      = ids.imageCount;
                        totalPixelCount = ids.totalPixelCount;
                        ids.counted     = true;
                    }
                }

                o.WriteLine(lastDepth.ToString() + "\t" +
                            scanLinesThisDepth.ToString() + "\t" +
                            timeAtThisDepth.ToString() + "\t" +
                            imageCount.ToString() + "\t" +
                            totalPixelCount.ToString() + "\t" +
                            Mean(flowRate).ToString() + "\t" + StdDev(flowRate).ToString() + "\t" +
                            Mean(temperature).ToString() + "\t" + StdDev(temperature).ToString() + "\t" +
                            Mean(oxygen).ToString() + "\t" + StdDev(oxygen).ToString() + "\t" +
                            Mean(oxygenSensor).ToString() + "\t" + StdDev(oxygenSensor).ToString() + "\t" +
                            Mean(salinity).ToString() + "\t" + StdDev(salinity).ToString() + "\t" +
                            Mean(density).ToString() + "\t" + StdDev(density).ToString() + "\t" +
                            Mean(fluorensce).ToString() + "\t" + StdDev(fluorensce).ToString() + "\t" +
                            Mean(fluorensceSensor).ToString() + "\t" + StdDev(fluorensceSensor).ToString() + "\t" +
                            Mean(transmissivity).ToString() + "\t" + StdDev(transmissivity).ToString() + "\t" +
                            Mean(transmissivitySensor).ToString() + "\t" + StdDev(transmissivitySensor).ToString() + "\t" +
                            Mean(turbidity).ToString() + "\t" + StdDev(turbidity).ToString() + "\t" +
                            Mean(turbiditySensor).ToString() + "\t" + StdDev(turbiditySensor).ToString() + "\t" +
                            Mean(recordRate).ToString() + "\t" + StdDev(recordRate).ToString()
                            );
            }

            foreach (ImagesDepthStats ids in imageStats)
            {
                if (!ids.counted)
                {
                    RunLogAddMsg("WriteDepthSummary   UnCounted [" + (ids.upCast ? "Up":"Down") + "]  Depth[" + ids.bucketDepth + "]   Count[" + ids.imageCount + "]");
                    o.WriteLine(ids.bucketDepth.ToString() + "\t" +
                                "---" + "\t" +
                                "---" + "\t" +
                                ids.imageCount.ToString() + "\t" +
                                ids.totalPixelCount.ToString() + "\t"
                                );
                }
            }
        } /* WriteDepthSummary */