public NmmScanData(NmmFileName fileNameObject) { MetaData = new ScanMetaData(); MetaData.AddDataFrom(fileNameObject); MetaData.AddDataFrom(new NmmInstrumentCharacteristcs()); // first read the description file so we can check if requested scan index is valid MetaData.AddDataFrom(new NmmDescriptionFileParser(fileNameObject)); // now perform the scan index checks if (MetaData.NumberOfScans > 1) { int scanIndex = fileNameObject.ScanIndex; if (scanIndex == 0) { scanIndex = 1; } if (scanIndex > MetaData.NumberOfScans) { scanIndex = MetaData.NumberOfScans; } fileNameObject.SetScanIndex(scanIndex); MetaData.AddDataFrom(fileNameObject); } // at this stage the scan index of fileNameObject should be ok MetaData.AddDataFrom(new NmmIndFileParser(fileNameObject)); MetaData.AddDataFrom(new NmmEnvironmentData(fileNameObject)); topographyData = new TopographyData(MetaData); nmmDat = new NmmDatFileParser(fileNameObject); LoadTopographyData(); // contrary to similar classes of this library, the dat-files are not closed implicitely nmmDat.Close(); // populate MetaData with absolute origin and center coordinates PopulateFieldOriginAndCenter(); HeydemannCorrectionApplied = false; HeydemannCorrectionSpan = 0.0; }
public TopographyData(ScanMetaData scanMetaData) { this.scanMetaData = scanMetaData; NumberOfColumns = scanMetaData.NumberOfColumnsInFile; NumberOfProfiles = scanMetaData.NumberOfProfiles; NumberOfPointsPerProfile = scanMetaData.NumberOfDataPoints; NumberTotalPoints = NumberOfPointsPerProfile * NumberOfProfiles; columnNumberOfXYvec = GetColumnIndexFor("XYvec"); // magic string! switch (scanMetaData.ScanStatus) { case ScanDirectionStatus.ForwardOnly: fwdMatrix = new double[NumberOfColumns, NumberTotalPoints]; ClearTopographyData(ScanDirection.Forward); bwdMatrix = null; break; case ScanDirectionStatus.ForwardAndBackward: case ScanDirectionStatus.ForwardAndBackwardJustified: fwdMatrix = new double[NumberOfColumns, NumberTotalPoints]; bwdMatrix = new double[NumberOfColumns, NumberTotalPoints]; ClearTopographyData(ScanDirection.Forward); ClearTopographyData(ScanDirection.Backward); break; case ScanDirectionStatus.Unknown: case ScanDirectionStatus.NoData: fwdMatrix = null; bwdMatrix = null; break; } }