} /* DatePicesInstrumentComparer */ private void FindScanRates(PicesDataBase threadConn, String cruiseName, String stationName, String deploymentNum, ref float scanRateMin, ref float scanRateMax ) { // Because Scan Rates are stored with each individual SIPPER File we will need to // peruse though all of them for this deployment. Ideally they will all have the // same scan rate. scanRateMin = scanRateMax = 24950.0f; PicesSipperFileList sipperFiles = threadConn.SipperFileLoad(cruiseName, stationName, deploymentNum); if (sipperFiles == null) { return; } scanRateMin = float.MaxValue; scanRateMax = float.MinValue; foreach (PicesSipperFile sf in sipperFiles) { scanRateMin = Math.Min(scanRateMin, sf.ScanRate); scanRateMax = Math.Max(scanRateMax, sf.ScanRate); } } /* FindScanRates */
} /* PerformUpdate */ private void UpdateProcess() { PicesDataBase.ThreadInit(); updateRunning = true; PicesRunLog updRunLog = new PicesRunLog(); PicesDataBase updDbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(updRunLog); sipperFilesTotal = 0; sipperFilesUpdated = 0; if (addingNewClass || deletingExistingClass || (mergeClass != null)) { sipperFiles = updDbConn.SipperFileLoad("", "", ""); if (sipperFiles == null) { RunLogAddMsg("Could not retrieve list of SIPPER files update failed." + "\n"); updateRunning = false; return; } sipperFilesTotal = sipperFiles.Count; } if (addingNewClass) { UpdateProcessAdd(updDbConn); } else if (deletingExistingClass) { UpdateProcessDelete(updDbConn); } else if (mergeClass != null) { UpdateProcessMerge(updDbConn); } else if (nameChangeHasOccured) { UpdateProcessNameChange(updDbConn); } else { UpdateDataFields(updDbConn); } updDbConn.Close(); updDbConn = null; GC.Collect(); PicesDataBase.ThreadEnd(); updateRunning = false; } /* UpdateProcess */
private void LoadSipperFileDetails() { PicesSipperFileList sipperFiles = dbConn.SipperFileLoad(deployment.CruiseName, deployment.StationName, deployment.DeploymentNum); if (sipperFiles != null) { foreach (PicesSipperFile sf in sipperFiles) { this.Nodes.Add(new TreeNodeSipperFile(dbConn, sf)); } } }
private float[] CountsByDepth(PicesClass c, char classKeyToUse ) { String predOrValStr = "Validated"; if (classKeyToUse != 'V') { predOrValStr = "Predicted"; } String msg = "Extracting Counts for \"" + c.Name + "\"" + " " + predOrValStr; statusMsgs.AddMsg(msg); msgQueue.AddMsg(msg); uint[] counts = null; PicesSipperFileList sipperFiles = threadConn.SipperFileLoad(cruise, station, deployment); foreach (PicesSipperFile sf in sipperFiles) { if (cancelRequested) { break; } msg = "Retrieving counts for Class[" + c.Name + "] SipperFile[" + sf.SipperFileName + "]" + predOrValStr; statusMsgs.AddMsg("Retrieving counts for Class[" + c.Name + "] SipperFile[" + sf.SipperFileName + "]"); uint[] countsThisSipperFile = threadConn.ImageGetDepthStatistics(group, // PicesDataBaseImageGroup^ imageGroup, sf.SipperFileName, depthIncrement, // depthIncrements, c, // mlClass, classKeyToUse, // classKeyToUse, probMin, probMax, sizeMin, sizeMax ); counts = MergeTwoLists(counts, countsThisSipperFile); } if (cancelRequested) { return(null); } if (counts == null) { counts = new uint[1]; counts[0] = 0; } float[] countsFloat = new float[counts.Length]; for (int idx = 0; idx < counts.Length; ++idx) { countsFloat[idx] = counts[idx]; } if (!includeSubClasses) { return(countsFloat); } List <PicesClass> children = c.Children; if (children != null) { foreach (PicesClass pc in children) { if (cancelRequested) { break; } float[] countsForChild = CountsByDepth(pc, classKeyToUse); if (countsForChild != null) { countsFloat = MergeTwoLists(countsFloat, countsForChild); } } } return(countsFloat); } /* CountsByDepth */
} /* SaveGivenImageList */ private void SaveImagesBySipperFiles() { bool includeStationAndDeploymentInDirName = false; bool firstSipperFile = true; PicesSipperFileList sipperFiles = null; if (String.IsNullOrEmpty(sipperFileName)) { sipperFiles = dbConn.SipperFileLoad(cruise, station, deployment); } else { PicesSipperFile sf = dbConn.SipperFileRecLoad(sipperFileName); if (sf != null) { sipperFiles = new PicesSipperFileList(); sipperFiles.Add(sf); } } if (sipperFiles != null) { String lastCruise = ""; String lastStation = ""; String lastDeployment = ""; String dirPath = ""; Dictionary <String, int> imagesPerClass = new Dictionary <string, int> (); foreach (PicesSipperFile sf in sipperFiles) { bool startANewDir = false; if (firstSipperFile) { startANewDir = true; } //else if (sf.CruiseName != lastCruise) // startANewDir = true; else if ((includeStationAndDeploymentInDirName) && ((sf.StationName != lastStation) || (sf.DeploymentNum != lastDeployment)) ) { startANewDir = true; } if (startANewDir) { lastCruise = sf.CruiseName; lastStation = sf.StationName; lastDeployment = sf.DeploymentNum; dirPath = OSservices.AddSlash(DestinationDirectory.Text); if (includeStationAndDeploymentInDirName) { if (!String.IsNullOrEmpty(lastCruise)) { dirPath = OSservices.AddSlash(dirPath) + lastCruise; } if (!String.IsNullOrEmpty(lastStation)) { dirPath = OSservices.AddSlash(dirPath) + lastStation; } if (!String.IsNullOrEmpty(lastDeployment)) { dirPath = OSservices.AddSlash(dirPath) + lastDeployment; } } OSservices.CreateDirectoryPath(dirPath); imagesPerClass = new Dictionary <string, int> (); } SaveImagesForOneSipperFile(dirPath, sf, imagesPerClass); firstSipperFile = false; } } } /* SaveImagesBySipperFiles */