示例#1
0
 private void InitLutList(AbstractWarpDataset srcRaster)
 {
     PrjBand[] prjBands = PrjBandTable.GetPrjBands(srcRaster);
     for (int i = 0; i < _setting.OutBandNos.Length; i++)
     {
         int     bandNo  = _setting.OutBandNos[i];
         PrjBand b       = prjBands[bandNo - 1];
         string  calName = b.DataSetName.Replace("NOMChannel", "CALChannel");
         Band[]  bands   = srcRaster.GetBands(calName);
         if (bands == null || bands.Length == 0)
         {
             throw new ArgumentNullException(string.Format("FY2X辐射定标,未找到名称为{0}的数据.", calName));
         }
         var     band   = bands[0];
         float[] buffer = new float[band.XSize * band.YSize];
         band.ReadRaster(0, 0, band.XSize, band.YSize, buffer, band.XSize, band.YSize, 0, 0);
         UInt16[] ubuffer = new ushort[band.XSize * band.YSize];
         for (int j = 0; j < buffer.Length; j++)
         {
             if (buffer[j] > 1)
             {
                 ubuffer[j] = (UInt16)(buffer[j] * 10 + 0.5);
             }
             else
             {
                 ubuffer[j] = (UInt16)(buffer[j] * 1000 + 0.5);
             }
         }
         _lutList.Add(ubuffer);
     }
 }
示例#2
0
        private Band[] TryCreateRasterDataBands(AbstractWarpDataset srcRaster, NPP_PrjSetting prjSettings,
                                                Action <int, string> progressCallback)
        {
            List <Band> rasterBands = new List <Band>();

            _factors = new float[_prjBands.Length * 2];
            for (int i = 0; i < _prjBands.Length; i++)
            {
                progressCallback?.Invoke(_readyProgress++, "准备第" + i + "个输入数据通道");
                PrjBand bandMap = _prjBands[i];
                int     index   = Convert.ToInt32(bandMap.BandName);
                float[] factor  = new float[] { 1, 0 };
                if (prjSettings.IsRad || prjSettings.IsRadRef)
                {
                    Band[] latBands = bandDatasetList[index].GetBands("BrightnessTemperature");
                    if (latBands == null || latBands.Length == 0)
                    {
                        latBands = bandDatasetList[index].GetBands("Reflectance");
                        var     factorDic = bandDatasetList[index].GetDatasetAttributes("ReflectanceFactors");
                        float[] temp      = TryReadFactor(bandDatasetList[index], "ReflectanceFactors");
                        if (temp != null)
                        {
                            factor[0] = temp[0];
                            factor[1] = temp[1];
                        }
                        Console.WriteLine("Reflectance");
                    }
                    else
                    {
                        Console.WriteLine("BrightnessTemperature");
                        float[] temp = TryReadFactor(bandDatasetList[index], "BrightnessTemperatureFactors");
                        if (temp != null)
                        {
                            factor[0] = temp[0];
                            factor[1] = temp[1];
                        }
                    }

                    Band band = latBands[0];
                    rasterBands.Add(band);
                }
                else
                {
                    Band[] latBands = bandDatasetList[index].GetBands("Radiance");
                    bandDatasetList[index].GetBands("RadianceFactors")?.FirstOrDefault()
                    ?.ReadRaster(0, 0, 1, 2, factor, 1, 2, 0, 0);
                    Band band = latBands[0];
                    rasterBands.Add(band);
                }

                Array.Copy(factor, 0, _factors, i * 2, 2);
            }

            return(rasterBands.ToArray());
        }
        private Band[] TryCreateRasterDataBands(AbstractWarpDataset srcRaster, FY3_MERSI_PrjSettings fy3prjSettings, Action <int, string> progressCallback)
        {
            List <Band> rasterBands = new List <Band>();

            for (int i = 0; i < _prjBands.Length; i++)
            {
                if (progressCallback != null)
                {
                    progressCallback(_readyProgress++, "准备第" + i + "个输入数据通道");
                }
                PrjBand bandMap  = _prjBands[i];
                Band[]  latBands = srcRaster.GetBands(bandMap.DataSetName);
                Band    band     = latBands[bandMap.DataSetIndex];
                rasterBands.Add(band);
            }
            return(rasterBands.ToArray());
        }
示例#4
0
        protected Band[] TryCreateRasterDataBands(AbstractWarpDataset srcRaster, FilePrjSettings prjSettings,
                                                  Action <int, string> progressCallback)
        {
            PrjBand[]   bands       = PrjBandTable.GetPrjBands(srcRaster);
            List <Band> rasterBands = new List <Band>();

            for (int i = 0; i < prjSettings.OutBandNos.Length; i++)
            {
                if (progressCallback != null)
                {
                    progressCallback(_readyProgress++, "投影准备");
                }
                int     bandNo = prjSettings.OutBandNos[i];
                PrjBand b      = bands[bandNo - 1];
                Band    band   = srcRaster.GetBands(b.DataSetName)[0];
                rasterBands.Add(band);
            }

            return(rasterBands.ToArray());
        }