private FileExtractResult CalcMPDI(string pviFile, float ndviCalcMin, float ndviCalcMax, IRasterDataProvider currPrd, bool normalizationSuccess, Action <int, string> progressTracker) { IBandNameRaster bandNameRaster = _argumentProvider.DataProvider as IBandNameRaster;// int VisibleCH = TryGetBandNo(bandNameRaster, "RedBand"); int NearInfraredCH = TryGetBandNo(bandNameRaster, "NirBand"); double VisibleZoom = (double)_argumentProvider.GetArg("RedBand_Zoom"); double NearInfraredZoom = (double)_argumentProvider.GetArg("NirBand_Zoom"); if (VisibleCH == -1 || NearInfraredCH == -1) { PrintInfo("获取波段序号失败,可能是波段映射表配置错误或判识算法波段参数配置错误。"); return(null); } float mpdiZoom = (float)_argumentProvider.GetArg("MPDIZoom"); Int16 defCloudy = (Int16)_argumentProvider.GetArg("defCloudy"); Int16 defWater = (Int16)_argumentProvider.GetArg("defWater"); Int16 InvaildValue = (Int16)_argumentProvider.GetArg("InvaildValue"); DRTExpCoefficientCollection ExpCoefficient = _argumentProvider.GetArg("ExpCoefficient") as DRTExpCoefficientCollection; string EdgesFile = ExpCoefficient.EgdesFilename; DRTExpCoefficientCollection LandExpCoefficient = _argumentProvider.GetArg("LandExpCoefficient") as DRTExpCoefficientCollection; string LandFile = LandExpCoefficient.EgdesFilename; int bandNo = TryGetBandNo(bandNameRaster, "DemBand"); int LandbandNo = TryGetBandNo(bandNameRaster, "LandBand"); float ndviExp = (float)_argumentProvider.GetArg("NDVIExp"); bool isSetMinMax = (bool)_argumentProvider.GetArg("isSetMinMax"); float ndviMax = (float)_argumentProvider.GetArg("NDVIMax"); float ndviMin = (float)_argumentProvider.GetArg("NDVIMin"); float RegionExp1 = (float)_argumentProvider.GetArg("RegionExp1"); float RegionExp2 = (float)_argumentProvider.GetArg("RegionExp2"); float LandExp1 = (float)_argumentProvider.GetArg("LandExp1"); float LandExp2 = (float)_argumentProvider.GetArg("LandExp2"); string[] aois = _argumentProvider.GetArg("AOITemplate") as string[]; string aoiTemplate = (aois == null || aois.Length == 0) ? null : aois[0]; if (isSetMinMax) { ndviCalcMin = ndviMin; ndviCalcMax = ndviMax; } //输入文件准备 List <RasterMaper> rms = new List <RasterMaper>(); IRasterDataProvider currRaster = null; IRasterDataProvider pviPrd = null; IRasterDataProvider edgeRaster = null; IRasterDataProvider edgeLand = null; FileExtractResult mpdiRes = null; float PNVIZoom = (float)_argumentProvider.GetArg("PNVIZoom"); try { currRaster = currPrd; if (!normalizationSuccess && (currRaster.BandCount < VisibleCH || currRaster.BandCount < NearInfraredCH)) { PrintInfo("请选择正确的数据进行垂直干旱指数计算。"); return(null); } RasterMaper rmCurr = normalizationSuccess ? new RasterMaper(currRaster, new int[] { 1, 2 }) : new RasterMaper(currRaster, new int[] { VisibleCH, NearInfraredCH }); rms.Add(rmCurr); pviPrd = GeoDataDriver.Open(pviFile) as IRasterDataProvider; RasterMaper clmRm = new RasterMaper(pviPrd, new int[] { 1 }); rms.Add(clmRm); bool isContainEdges = false; if (!string.IsNullOrEmpty(EdgesFile) && File.Exists(EdgesFile)) { edgeRaster = RasterDataDriver.Open(EdgesFile) as IRasterDataProvider; if (edgeRaster.BandCount < bandNo) { PrintInfo("请正确选择经验系数中的边界文件,波段数不足!"); return(null); } RasterMaper rmEdge = new RasterMaper(edgeRaster, new int[] { bandNo }); rms.Add(rmEdge); isContainEdges = true; } bool isContainEdgesLand = false; if (!string.IsNullOrEmpty(LandFile) && File.Exists(LandFile)) { edgeLand = RasterDataDriver.Open(LandFile) as IRasterDataProvider; if (edgeLand.BandCount < LandbandNo) { PrintInfo("请正确选择土地参数中的边界文件,波段数不足!"); return(null); } RasterMaper rmLand = new RasterMaper(edgeLand, new int[] { LandbandNo }); rms.Add(rmLand); isContainEdgesLand = true; } //输出文件准备(作为输入栅格并集处理) string outFileName = GetFileName(new string[] { currRaster.fileName }, _subProductDef.ProductDef.Identify, _identify, ".dat", null); using (IRasterDataProvider outRaster = CreateOutRaster(outFileName, rms.ToArray())) { //栅格数据映射 RasterMaper[] fileIns = rms.ToArray(); RasterMaper[] fileOuts = new RasterMaper[] { new RasterMaper(outRaster, new int[] { 1 }) }; //创建处理模型 RasterProcessModel <Int16, Int16> rfr = null; rfr = new RasterProcessModel <Int16, Int16>(progressTracker); rfr.SetRaster(fileIns, fileOuts); rfr.SetTemplateAOI(aoiTemplate); DRTExpCoefficientItem item = null; DRTExpCoefficientItem landitem = null; int demCode = -1; int landCode = -1; Int16 curNDVI = 0; float tempNDVIExp = 0f; float argsM = 0f; float argsM2 = 0f; float argsLand = 0f; float argsLand2 = 0f; rfr.RegisterCalcModel(new RasterCalcHandler <Int16, Int16>((rvInVistor, rvOutVistor, aoi) => { if (rvInVistor[0] == null || rvInVistor[0].RasterBandsData[0] == null || rvInVistor[1] == null || rvInVistor[1].RasterBandsData[0] == null || (isContainEdges && (rvInVistor[2] == null || rvInVistor[2].RasterBandsData[0] == null)) || (isContainEdgesLand && (rvInVistor[3 - (isContainEdges ? 0 : 1)] == null || rvInVistor[3 - (isContainEdges ? 0 : 1)].RasterBandsData[0] == null))) { return; } int dataLength = aoi == null || aoi.Length == 0 ? rvOutVistor[0].SizeY * rvOutVistor[0].SizeX : aoi.Length; for (int i = 0; i < dataLength; i++) { int index = aoi == null || aoi.Length == 0 ? i : aoi[i]; Int16 visiableValue = rvInVistor[0].RasterBandsData[0][index]; Int16 nearInfraredValue = rvInVistor[0].RasterBandsData[1][index]; if (isContainEdges && rvInVistor[2].RasterBandsData[0] != null) { demCode = (int)rvInVistor[2].RasterBandsData[0][index]; } else { demCode = -1; } if (isContainEdgesLand && rvInVistor[3 - (isContainEdges ? 0 : 1)].RasterBandsData[0] != null) { landCode = (int)rvInVistor[3 - (isContainEdges ? 0 : 1)].RasterBandsData[0][index]; } else { landCode = -1; } curNDVI = rvInVistor[1].RasterBandsData[0][index]; if (visiableValue == 0 && nearInfraredValue == 0) { rvOutVistor[0].RasterBandsData[0][index] = InvaildValue; } else if (curNDVI == defCloudy) { rvOutVistor[0].RasterBandsData[0][index] = defCloudy; } else if (curNDVI == defWater) { rvOutVistor[0].RasterBandsData[0][index] = defWater; } else { if (ndviCalcMax - ndviCalcMin == 0) { rvOutVistor[0].RasterBandsData[0][index] = 0; } tempNDVIExp = (float)(1 - Math.Pow(((ndviCalcMax - curNDVI / PNVIZoom) / (ndviCalcMax - ndviCalcMin)), ndviExp)); if (1 - tempNDVIExp == 0) { rvOutVistor[0].RasterBandsData[0][index] = 0; } item = ExpCoefficient.GetExpItemByNum(demCode); landitem = LandExpCoefficient.GetExpItemByNum(landCode); argsM = item == null ? RegionExp1 : (float)item.APara; argsM2 = item == null ? RegionExp2 : (float)item.BPara; argsLand = landitem == null ? LandExp1 : (float)landitem.APara; argsLand2 = landitem == null ? LandExp2 : (float)landitem.BPara; rvOutVistor[0].RasterBandsData[0][index] = (Int16)((visiableValue / VisibleZoom + (argsM * nearInfraredValue / NearInfraredZoom) - tempNDVIExp * (argsLand + argsM * argsLand2)) / ((1 - tempNDVIExp) * (Math.Sqrt(argsM2 * argsM2 + 1))) * mpdiZoom); } } })); //执行 rfr.Excute(InvaildValue); mpdiRes = new FileExtractResult(_subProductDef.Identify, outFileName, true); mpdiRes.SetDispaly(false); _argumentProvider.SetArg("CursorInfo:MPDI-NDVIMax", ndviCalcMax); _argumentProvider.SetArg("CursorInfo:MPDI-NDVIMin", ndviCalcMin); return(mpdiRes); } } finally { if (edgeLand != null) { edgeLand.Dispose(); } if (pviPrd != null) { pviPrd.Dispose(); } if (normalizationSuccess && currPrd != null) { currPrd.Dispose(); } if (edgeRaster != null) { edgeRaster.Dispose(); } } }
private IExtractResult DemAlgorithm(Action <int, string> progressTracker) { int DNTBandCH = (int)_argumentProvider.GetArg("DNTBand"); float DNTZoom = float.Parse(_argumentProvider.GetArg("DNTZoom").ToString()); float DNTVaildMin = float.Parse(_argumentProvider.GetArg("DNTVaildMin").ToString()); float DNTVaildMax = float.Parse(_argumentProvider.GetArg("DNTVaildMax").ToString()); Int16 DemMin = (Int16)_argumentProvider.GetArg("DemMin"); float DemCorrect = (float)_argumentProvider.GetArg("DemCorrect"); double SWIZoom = (float)_argumentProvider.GetArg("SWIZoom"); DRTExpCoefficientCollection ExpCoefficient = _argumentProvider.GetArg("ExpCoefficient") as DRTExpCoefficientCollection; if (DNTBandCH == -1 || _argumentProvider.GetArg("DNTFile") == null || _argumentProvider.GetArg("DemFile") == null || ExpCoefficient == null) { PrintInfo("热惯量干旱指数生产所用文件或通道未设置完全,请检查!"); return(null); } string DNTFile = _argumentProvider.GetArg("DNTFile").ToString(); string DemFile = _argumentProvider.GetArg("DemFile").ToString(); if (string.IsNullOrEmpty(ExpCoefficient.EgdesFilename) || !File.Exists(ExpCoefficient.EgdesFilename)) { string fileanme = AppDomain.CurrentDomain.BaseDirectory + @"\SystemData\RasterTemplate\\China_Province.dat"; if (File.Exists(fileanme)) { ExpCoefficient.EgdesFilename = fileanme; } else { PrintInfo("热惯量干旱指数生产所用的经验系数边界文件不存在,请检查!"); return(null); } } Int16 defCloudy = (Int16)_argumentProvider.GetArg("defCloudy"); string EdgesFile = ExpCoefficient.EgdesFilename; int bandNo = 1; //输入文件准备 List <RasterMaper> rms = new List <RasterMaper>(); IRasterDataProvider dntRaster = null; IRasterDataProvider demRaster = null; IRasterDataProvider edgeRaster = null; try { dntRaster = RasterDataDriver.Open(DNTFile) as IRasterDataProvider; if (dntRaster.BandCount < DNTBandCH) { PrintInfo("请选择正确的数据进行热惯量干旱指数计算。"); return(null); } RasterMaper rmDnt = new RasterMaper(dntRaster, new int[] { DNTBandCH }); rms.Add(rmDnt); demRaster = RasterDataDriver.Open(DemFile) as IRasterDataProvider; if (demRaster.BandCount < bandNo) { PrintInfo("请选择正确的数据进行热惯量干旱指数计算。"); return(null); } RasterMaper rmDem = new RasterMaper(demRaster, new int[] { bandNo }); rms.Add(rmDem); edgeRaster = RasterDataDriver.Open(EdgesFile) as IRasterDataProvider; if (edgeRaster.BandCount < bandNo) { PrintInfo("请选择正确的数据进行热惯量干旱指数计算。"); return(null); } RasterMaper rmEdge = new RasterMaper(edgeRaster, new int[] { bandNo }); rms.Add(rmEdge); //输出文件准备(作为输入栅格并集处理) string outFileName = GetFileName(new string[] { DNTFile }, _subProductDef.ProductDef.Identify, _identify, ".dat", null); using (IRasterDataProvider outRaster = CreateOutRaster(outFileName, rms.ToArray())) { //栅格数据映射 RasterMaper[] fileIns = rms.ToArray(); RasterMaper[] fileOuts = new RasterMaper[] { new RasterMaper(outRaster, new int[] { 1 }) }; //创建处理模型 RasterProcessModel <short, short> rfr = null; rfr = new RasterProcessModel <short, short>(progressTracker); rfr.SetRaster(fileIns, fileOuts); DRTExpCoefficientItem item = null; double swiTemp = 0f; float value = 0f; rfr.RegisterCalcModel(new RasterCalcHandler <short, short>((rvInVistor, rvOutVistor, aoi) => { int dataLength = rvOutVistor[0].SizeY * rvOutVistor[0].SizeX; if (rvInVistor[0].RasterBandsData == null || rvInVistor[1].RasterBandsData == null || rvInVistor[2].RasterBandsData == null || rvInVistor[0].RasterBandsData[0] == null || rvInVistor[1].RasterBandsData[0] == null || rvInVistor[2].RasterBandsData[0] == null) { return; } for (int index = 0; index < dataLength; index++) { short dataValue = rvInVistor[0].RasterBandsData[0][index]; if (dataValue == 0 || dataValue == defCloudy) { rvOutVistor[0].RasterBandsData[0][index] = dataValue; } else { value = (float)rvInVistor[0].RasterBandsData[0][index] / DNTZoom; if (value < DNTVaildMin || value > DNTVaildMax) { rvOutVistor[0].RasterBandsData[0][index] = 0; } else { item = ExpCoefficient.GetExpItemByNum((int)rvInVistor[2].RasterBandsData[0][index]); if (item == null) { rvOutVistor[0].RasterBandsData[0][index] = 0; } else { //计算SWI swiTemp = item.APara * value + item.BPara + item.CPara; if (rvInVistor[1].RasterBandsData[0][index] > DemMin) { swiTemp += DemCorrect; } rvOutVistor[0].RasterBandsData[0][index] = (Int16)(swiTemp * SWIZoom); } } } } })); //执行 rfr.Excute(); FileExtractResult res = new FileExtractResult(_subProductDef.Identify, outFileName, true); res.SetDispaly(false); return(res); } } finally { if (dntRaster != null) { dntRaster.Dispose(); } if (demRaster != null) { demRaster.Dispose(); } if (edgeRaster != null) { edgeRaster.Dispose(); } } }
private IExtractResult DemAlgorithm() { int DNTBandCH = (int)_curArguments.GetArg("DNTBand"); double DNTZoom = (float)_curArguments.GetArg("DNTZoom"); float DNTVaildMin = (float)_curArguments.GetArg("DNTVaildMin"); float DNTVaildMax = (float)_curArguments.GetArg("DNTVaildMax"); Int16 DemMin = (Int16)_curArguments.GetArg("DemMin"); float DemCorrect = (float)_curArguments.GetArg("DemCorrect"); double SWIZoom = (float)_curArguments.GetArg("SWIZoom"); DRTExpCoefficientCollection ExpCoefficient = _curArguments.GetArg("ExpCoefficient") as DRTExpCoefficientCollection; string errorStr = null; if (DNTBandCH == -1 || _curArguments.GetArg("DNTFile") == null || _curArguments.GetArg("DemFile") == null || ExpCoefficient == null) { errorStr = "SWI生产所用文件或通道未设置完全,请检查!"; return(null); } string DNTFile = _curArguments.GetArg("DNTFile").ToString(); string DemFile = _curArguments.GetArg("DemFile").ToString(); if (string.IsNullOrEmpty(ExpCoefficient.EgdesFilename) || !File.Exists(ExpCoefficient.EgdesFilename)) { string fileanme = AppDomain.CurrentDomain.BaseDirectory + @"\SystemData\RasterTemplate\\China_Province.dat"; if (File.Exists(fileanme)) { ExpCoefficient.EgdesFilename = fileanme; } else { errorStr = "SWI生产所用的经验系数边界文件不存在,请检查!"; return(null); } } ; string EdgesFile = ExpCoefficient.EgdesFilename; Dictionary <string, FilePrdMap> filePrdMap = new Dictionary <string, FilePrdMap>(); filePrdMap.Add("DNTFile", new FilePrdMap(DNTFile, DNTZoom, new VaildPra(DNTVaildMin, DNTVaildMax), new int[] { DNTBandCH })); filePrdMap.Add("DemFile", new FilePrdMap(DemFile, 1, new VaildPra(DemMin, float.MaxValue), new int[] { 1 })); filePrdMap.Add("EdgesFile", new FilePrdMap(EdgesFile, 1, new VaildPra(float.MinValue, float.MaxValue), new int[] { 1 })); ITryCreateVirtualPrd tryVPrd = new TryCreateVirtualPrdByMultiFile(); DRTExpCoefficientItem item = null; IVirtualRasterDataProvider vrd = null; try { vrd = tryVPrd.CreateVirtualRasterPRD(ref filePrdMap); if (vrd == null) { throw new Exception("数据间无相交部分,无法创建虚拟数据提供者!"); } ArgumentProvider ap = new ArgumentProvider(vrd, null); RasterPixelsVisitor <float> rpVisitor = new RasterPixelsVisitor <float>(ap); IPixelFeatureMapper <Int16> result = new MemPixelFeatureMapper <Int16>("0SWI", 1000, new Size(vrd.Width, vrd.Height), vrd.CoordEnvelope, vrd.SpatialRef); double swiTemp = 0f; rpVisitor.VisitPixel(new int[] { filePrdMap["DNTFile"].StartBand, filePrdMap["DemFile"].StartBand, filePrdMap["EdgesFile"].StartBand }, (index, values) => { if (values[0] < filePrdMap["DNTFile"].VaildValue.Min || values[0] > filePrdMap["DNTFile"].VaildValue.Max) { result.Put(index, 0); } else { item = ExpCoefficient.GetExpItemByNum((int)values[2]); if (item == null) { result.Put(index, 0); } else { //计算SWI swiTemp = item.APara * values[0] + item.BPara + item.CPara; if (values[1] > filePrdMap["DemFile"].VaildValue.Min) { swiTemp += DemCorrect; } result.Put(index, (Int16)(swiTemp * SWIZoom)); } } }); return(result); } finally { if (vrd != null) { vrd.Dispose(); } } }
private IExtractResult ComputeByCurrentRaster(IRasterDataProvider currPrd, Action <int, string> progressTracker) { currPrd = currPrd != null ? currPrd : _argumentProvider.DataProvider; if (currPrd == null) { return(null); } IBandNameRaster bandNameRaster = _argumentProvider.DataProvider as IBandNameRaster;// int VisibleCH = TryGetBandNo(bandNameRaster, "RedBand"); int NearInfraredCH = TryGetBandNo(bandNameRaster, "NirBand"); int FarInfrared11CH = TryGetBandNo(bandNameRaster, "FarBand"); double VisibleZoom = (double)_argumentProvider.GetArg("RedBand_Zoom"); double NearInfraredZoom = (double)_argumentProvider.GetArg("NirBand_Zoom"); double FarInfrared11Zoom = (double)_argumentProvider.GetArg("FarBand_Zoom"); bool isAutoCloud = (bool)_argumentProvider.GetArg("isAutoCloud"); bool isAppCloud = (bool)_argumentProvider.GetArg("isAppCloud"); if (VisibleCH == -1 || NearInfraredCH == -1 || (isAutoCloud && FarInfrared11CH == -1)) { PrintInfo("获取波段序号失败,可能是波段映射表配置错误或判识算法波段参数配置错误。"); return(null); } float pdiZoom = (float)_argumentProvider.GetArg("PDIZoom"); Int16 defCloudy = (Int16)_argumentProvider.GetArg("defCloudy"); Int16 defWater = (Int16)_argumentProvider.GetArg("defWater"); Int16 InvaildValue = (Int16)_argumentProvider.GetArg("InvaildValue"); float NearInfraredCLMMin = float.Parse(_argumentProvider.GetArg("NearInfraredCLMMin").ToString()); float FarInfrared11CLMMax = float.Parse(_argumentProvider.GetArg("FarInfrared11CLMMax").ToString()); float FarInfrared11WaterMin = float.Parse(_argumentProvider.GetArg("FarInfrared11WaterMin").ToString()); float NDVIWaterMax = float.Parse(_argumentProvider.GetArg("NDVIWaterMax").ToString()); int cloudCH = (int)_argumentProvider.GetArg("CLMBand"); string clmFile = GetClmFile(currPrd); float RegionExp1 = (float)_argumentProvider.GetArg("RegionExp1"); float RegionExp2 = (float)_argumentProvider.GetArg("RegionExp2"); DRTExpCoefficientCollection ExpCoefficient = _argumentProvider.GetArg("ExpCoefficient") as DRTExpCoefficientCollection; string EdgesFile = ExpCoefficient.EgdesFilename; int bandNo = TryGetBandNo(bandNameRaster, "DemBand"); string[] aois = _argumentProvider.GetArg("AOITemplate") as string[]; string aoiTemplate = (aois == null || aois.Length == 0) ? null : aois[0]; //输入文件准备 List <RasterMaper> rms = new List <RasterMaper>(); IRasterDataProvider currRaster = null; IRasterDataProvider edgeRaster = null; IRasterDataProvider clmPrd = null; try { currRaster = currPrd; if (currRaster.BandCount < VisibleCH || currRaster.BandCount < NearInfraredCH || (isAutoCloud && currRaster.BandCount < FarInfrared11CH)) { PrintInfo("请选择正确的数据进行垂直干旱指数计算。"); return(null); } RasterMaper rmCurr = new RasterMaper(currRaster, new int[] { VisibleCH, NearInfraredCH, FarInfrared11CH }); rms.Add(rmCurr); bool isContainEdgesFile = false; if (!string.IsNullOrEmpty(EdgesFile) && File.Exists(EdgesFile)) { edgeRaster = RasterDataDriver.Open(EdgesFile) as IRasterDataProvider; if (edgeRaster.BandCount < bandNo) { PrintInfo("请正确选择经验系数中的边界文件,波段数不足!"); return(null); } RasterMaper rmEdge = new RasterMaper(edgeRaster, new int[] { bandNo }); rms.Add(rmEdge); isContainEdgesFile = true; } bool isContainClm = false; if (isAppCloud && !string.IsNullOrEmpty(clmFile) && File.Exists(clmFile)) { clmPrd = GeoDataDriver.Open(clmFile) as IRasterDataProvider; if (clmPrd.BandCount < cloudCH) { PrintInfo("请选择正确的云数据进行计算,波段数不足!"); return(null); } RasterMaper clmRm = new RasterMaper(clmPrd, new int[] { cloudCH }); rms.Add(clmRm); isContainClm = true; } float curNDVI = 0f; //输出文件准备(作为输入栅格并集处理) string outFileName = GetFileName(new string[] { currRaster.fileName }, _subProductDef.ProductDef.Identify, _identify, ".dat", null); using (IRasterDataProvider outRaster = CreateOutRaster(outFileName, rms.ToArray())) { //栅格数据映射 RasterMaper[] fileIns = rms.ToArray(); RasterMaper[] fileOuts = new RasterMaper[] { new RasterMaper(outRaster, new int[] { 1 }) }; //创建处理模型 RasterProcessModel <Int16, Int16> rfr = null; rfr = new RasterProcessModel <Int16, Int16>(progressTracker); rfr.SetRaster(fileIns, fileOuts); rfr.SetTemplateAOI(aoiTemplate); DRTExpCoefficientItem item = null; int demCode = -1; rfr.RegisterCalcModel(new RasterCalcHandler <Int16, Int16>((rvInVistor, rvOutVistor, aoi) => { if (rvInVistor[0] == null || rvInVistor[0].RasterBandsData[0] == null || (isContainEdgesFile && (rvInVistor[1] == null || rvInVistor[1].RasterBandsData[0] == null)) || (isContainClm && (rvInVistor[2 - (isContainEdgesFile ? 0 : 1)] == null || rvInVistor[2 - (isContainEdgesFile ? 0 : 1)].RasterBandsData[0] == null))) { return; } int dataLength = aoi == null || aoi.Length == 0 ? rvOutVistor[0].SizeY * rvOutVistor[0].SizeX : aoi.Length; for (int i = 0; i < dataLength; i++) { int index = aoi == null || aoi.Length == 0 ? i : aoi[i]; Int16 visiableValue = rvInVistor[0].RasterBandsData[0][index]; Int16 nearInfraredValue = rvInVistor[0].RasterBandsData[1][index]; Int16 farInfraredVale = rvInVistor[0].RasterBandsData[2][index]; if (isContainEdgesFile && rvInVistor[1].RasterBandsData[0] != null) { demCode = (int)rvInVistor[1].RasterBandsData[0][index]; } else { demCode = -1; } curNDVI = GetNDVI(nearInfraredValue, visiableValue); if (visiableValue == 0 && nearInfraredValue == 0) { rvOutVistor[0].RasterBandsData[0][index] = InvaildValue; } else if (isContainClm && rvInVistor[2 - (isContainEdgesFile ? 0 : 1)].RasterBandsData[0][index] != 0) { rvOutVistor[0].RasterBandsData[0][index] = defCloudy; } else if (isAutoCloud && (nearInfraredValue / NearInfraredZoom > NearInfraredCLMMin && farInfraredVale / FarInfrared11Zoom < FarInfrared11CLMMax)) { rvOutVistor[0].RasterBandsData[0][index] = defCloudy; } else { if (farInfraredVale / FarInfrared11Zoom > FarInfrared11WaterMin && curNDVI < NDVIWaterMax) { rvOutVistor[0].RasterBandsData[0][index] = defWater; } else { item = ExpCoefficient.GetExpItemByNum(demCode); if (item == null) { rvOutVistor[0].RasterBandsData[0][index] = (Int16)((visiableValue / VisibleZoom + RegionExp1 * nearInfraredValue / NearInfraredZoom) / Math.Sqrt(RegionExp2 * RegionExp2 + 1) * pdiZoom); } else { rvOutVistor[0].RasterBandsData[0][index] = (Int16)((visiableValue / VisibleZoom + item.APara * nearInfraredValue / NearInfraredZoom) / Math.Sqrt(item.BPara * item.BPara + 1) * pdiZoom); } } } } })); //执行 rfr.Excute(); IFileExtractResult pdiFile = new FileExtractResult(_subProductDef.Identify, outFileName, true); pdiFile.SetDispaly(false); return(pdiFile); } } finally { if (clmPrd != null) { clmPrd.Dispose(); } if (edgeRaster != null) { edgeRaster.Dispose(); } } }