private void DoSession(AbstractWarpDataset srcRaster, AbstractWarpDataset locationRaster, SpatialReference dstSpatialRef, FY3_MERSI_PrjSettings prjSettings, Action <int, string> progressCallback) { if (_curSession == null || _curSession != srcRaster || _isBeginSession) { Size srcImgSize = new Size(srcRaster.Width, srcRaster.Height); ReadyLocations(srcRaster, dstSpatialRef, prjSettings, out _srcLocationSize, out _maxPrjEnvelope, progressCallback); if (progressCallback != null) { progressCallback(4, "准备其他参数"); } if (prjSettings.IsRadRef || prjSettings.IsRad) { ReadyRadiationArgs(srcRaster); } if (prjSettings.IsSolarZenith) //&& prjSettings.IsRadiation { _szDataFilename = GetSolarZenithCacheFilename(locationRaster.fileName); if (!File.Exists(_szDataFilename)) { ReadySolarZenithArgsToFile(locationRaster); } else { _solarZenithCacheRaster = WarpDataset.Open(_szDataFilename); } if (prjSettings.IsSensorZenith) { ReadySensorZenith(locationRaster); } } _rasterDataBands = TryCreateRasterDataBands(srcRaster, prjSettings, progressCallback);//待投影的波段 _isBeginSession = false; } }
/// <summary> /// 初始化输入数据集 /// </summary> /// <param name="srcRaster"></param> /// <param name="prjSettings"></param> private void InitInputDataset(AbstractWarpDataset srcRaster, FilePrjSettings prjSettings) { if (iBandGeoDataset == null) { if ((new int[] { 1, 2, 3, 4, 5 }).Any(t => prjSettings.OutBandNos.Contains(t))) { iBandGeoDataset = WarpDataset.Open(FileFinder.TryFindNppIbandGeoFile(srcRaster)); } } if (mBandGeoDataset == null) { mBandGeoDataset = WarpDataset.Open(FileFinder.TryFindNppMbandGeoFile(srcRaster)); } foreach (var item in prjSettings.OutBandNos) { if (!bandDatasetList.ContainsKey(item)) { if (item <= 5) { bandDatasetList.Add(item, WarpDataset.Open(FileFinder.TryFindNppIbandFile(srcRaster, item))); } else { bandDatasetList.Add(item, WarpDataset.Open(FileFinder.TryFindNppMbandFile(srcRaster, item - 5))); } } } }
public static AbstractWarpDataset Open(string filename) { var ds = WarpDataset.Open(filename); if (ds != null && ds.ds == null) { ds = null; } return(ds); }
internal static AbstractWarpDataset TryFindFY4A_DKM_FromFKM(AbstractWarpDataset srcRaster) { AbstractWarpDataset result = null; string dir = Path.GetDirectoryName(srcRaster.fileName); string fileName = Path.GetFileName(srcRaster.fileName); string newFileName = fileName.Replace("_4000M_", "_2000M_"); string newPath = Path.Combine(dir, newFileName); if (File.Exists(newPath)) { result = WarpDataset.Open(newPath); } return(result); }
public string GetFileType(string file) { WarpDataset rad = GetSrcRaster(file); try { return(GetFileType(rad)); } finally { if (rad != null) { rad.Dispose(); } } }
public override AbstractWarpDataset GetDataset(string name) { WarpDataset rds = null; if (isMultiDs) { var subDsDic = ds.GetSubDatasets(); if (!subDsDic.ContainsKey(name)) { throw new Exception(string.Format("不存在名称为{0}的数据集", name)); } rds = WarpDataset.Open(subDsDic[name]); } return(rds); }
private void DoSession(AbstractWarpDataset srcRaster, SpatialReference dstSpatialRef, FY3_VIRR_PrjSettings prjSettings, Action <int, string> progressCallback) { if (_curSession == null || _curSession != srcRaster || _isBeginSession) { _srcLocationSize = new Size(srcRaster.Width, srcRaster.Height); if (progressCallback != null) { progressCallback(_readyProgress++, "VIRR读取及预处理经纬度数据集"); } ReadyLocations(srcRaster, dstSpatialRef, _srcLocationSize, out _xs, out _ys, out _maxPrjEnvelope, progressCallback); if (progressCallback != null) { progressCallback(_readyProgress++, "准备其他参数"); } if (prjSettings.IsRadRef || prjSettings.IsRad) { ReadyRadiationArgs(srcRaster); } if (prjSettings.IsSolarZenith && prjSettings.IsRadRef) { _solarZenithCacheFilename = GetSolarZenithCacheFilename(srcRaster.fileName); //太阳天顶角数据 if (!File.Exists(_solarZenithCacheFilename)) { ReadySolarZenithArgsToFile(srcRaster); } else { _solarZenithCacheRaster = WarpDataset.Open(_solarZenithCacheFilename); } if (prjSettings.IsSensorZenith) { ReadySensorZenith(srcRaster); } } _rasterDataBands = TryCreateRasterDataBands(srcRaster, prjSettings, progressCallback); _isBeginSession = false; } }
private void DoSession(AbstractWarpDataset srcRaster, AbstractWarpDataset geoRaster, SpatialReference dstSpatialRef, FY3_VIRR_PrjSettings prjSettings, Action <int, string> progressCallback) { if (_curSession == null || _curSession != srcRaster || _isBeginSession) { if (progressCallback != null) { progressCallback(_readyProgress++, "读取及预处理经纬度数据集"); } ReadyLocations(_geoDataProvider, SpatialReferenceFactory.CreateSpatialReference(4326), dstSpatialRef, out _srcLocationSize, out _xs, out _ys, out _maxPrjEnvelope, progressCallback); if (progressCallback != null) { progressCallback(_readyProgress++, "准备其他参数"); } if (prjSettings.IsRadRef || prjSettings.IsRad) { ReadyRadiationArgs(srcRaster); } if (prjSettings.IsSolarZenith && prjSettings.IsRadRef) { _solarZenithCacheFilename = GetSolarZenithCacheFilename(geoRaster.fileName); //太阳天顶角数据 if (!File.Exists(_solarZenithCacheFilename)) { ReadySolarZenithArgsToFile(geoRaster); } else { var ds = Gdal.OpenShared(_solarZenithCacheFilename, Access.GA_ReadOnly); _solarZenithCacheRaster = new WarpDataset(ds, _solarZenithCacheFilename); } if (prjSettings.IsSensorZenith) { ReadySensorZenith(geoRaster); } } _rasterDataBands = TryCreateRasterDataBands(srcRaster, prjSettings, progressCallback); _isBeginSession = false; } }
private WarpDataset GetSrcRaster(string filename) { return(WarpDataset.Open(filename)); }