Пример #1
0
        public override void Project(AbstractWarpDataset srcRaster, FilePrjSettings prjSettings,
                                     SpatialReference dstSpatialRef, Action <int, string> progressCallback)
        {
            _setting = prjSettings as FY4A_AGRIPrjSetting;
            progressCallback?.Invoke(0, "读取位置参数");
            InitLocationArgs(srcRaster);
            CreateDstRaster(srcRaster, prjSettings, dstSpatialRef, progressCallback);
            WriteMetaData(srcRaster, _prdWriter, prjSettings);
            ReadySession(srcRaster, prjSettings, dstSpatialRef, progressCallback);
            var calChannel = ReadDataSetToSingle(srcRaster, _setting.OutBandNos);

            for (int i = 0; i < calChannel.Count; i++)
            {
                ushort[] buffer = new ushort[calChannel[i].Length];
                for (int j = 0; j < calChannel[i].Length; j++)
                {
                    if (calChannel[i][j] > 2)
                    {
                        buffer[j] = Convert.ToUInt16(calChannel[i][j] * 10);
                    }
                    else
                    {
                        buffer[j] = Convert.ToUInt16(calChannel[i][j] * 1000);
                    }
                }

                _calChannel.Add(buffer);
            }

            base.Project(srcRaster, prjSettings, dstSpatialRef, progressCallback);
        }
Пример #2
0
        public override AbstractWarpDataset Project(AbstractWarpDataset srcRaster, FilePrjSettings prjSettings,
                                                    AbstractWarpDataset dstRaster, int beginBandIndex, Action <int, string> progressCallback)
        {
            try
            {
                _setting = prjSettings as FY4A_AGRIPrjSetting;
                progressCallback?.Invoke(0, "读取位置参数");
                InitLocationArgs(srcRaster);
                var calChannel = ReadDataSetToSingle(srcRaster, _setting.OutBandNos);
                for (int i = 0; i < calChannel.Count; i++)
                {
                    ushort[] buffer = new ushort[calChannel[i].Length];
                    for (int j = 0; j < calChannel[i].Length; j++)
                    {
                        if (calChannel[i][j] > 2)
                        {
                            buffer[j] = Convert.ToUInt16(calChannel[i][j] * 10);
                        }
                        else
                        {
                            buffer[j] = Convert.ToUInt16(calChannel[i][j] * 1000);
                        }
                    }

                    _calChannel.Add(buffer);
                }

                ReadySession(srcRaster, prjSettings, dstRaster.SpatialRef, progressCallback);
                SetPrdwritterNodata(dstRaster, NODATA_VALUE);
                return(base.Project(srcRaster, prjSettings, dstRaster, beginBandIndex, progressCallback));
            }
            finally
            {
                EndSession();
            }
        }