コード例 #1
0
 public static bool IsCompatible(string fileName, byte[] header1024)
 {
     if (header1024 == null)
     {
         header1024 = new byte[1024];
         using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
         {
             fs.Read(header1024, 0, 1024);
             fs.Close();
         }
     }
     if (!HDF5Helper.IsHdf5(header1024) && !HDF4Helper.IsHdf4(header1024))
     {
         return(false);
     }
     L2ProductDefind[] l2Pros = L2ProductDefindParser.GetL2ProductDefs(fileName);
     if (l2Pros == null || l2Pros.Length == 0)
     {
         return(false);
     }
     return(true);
 }
コード例 #2
0
        public FY3HDFL2ProductProvider(string fileName, byte[] header1024, IGeoDataDriver driver, params object[] args)
            : base(fileName, driver)
        {
            L2ProductDefind[] l2Pros = L2ProductDefindParser.GetL2ProductDefs(Path.GetFileName(_fileName));
            if (l2Pros == null)
            {
                return;
            }
            _fileName = fileName;
            _args     = args;
            L2ProductDefind verifyL2Pro = l2Pros.Length == 1 ? l2Pros[0] : VerifyL2ProDef(l2Pros);

            if (verifyL2Pro == null)
            {
                return;
            }
            using (Dataset dataset = Gdal.Open(fileName, Access.GA_ReadOnly))
            {
                GDALHelper.GetDatasetAttributes(dataset, _attributes);
            }
            Dictionary <string, string> allGdalSubDatasets = this.Attributes.GetAttributeDomain("SUBDATASETS");

            _allGdalSubDatasets = RecordAllSubDatasetNames(allGdalSubDatasets);
            _coordEnvelope      = TrySetGeoInfo(verifyL2Pro);
            _selectedsets       = TryGetSelectedSets(verifyL2Pro);
            TryCreateBandProvider();
            _bandCount   = _rasterBands.Count;
            _dataType    = _rasterBands[0].DataType;
            _width       = _rasterBands[0].Width;
            _height      = _rasterBands[0].Height;
            _coordType   = _spatialRef.ProjectionCoordSystem != null ? enumCoordType.PrjCoord : enumCoordType.GeoCoord;
            _resolutionX = (float)(_coordEnvelope.Width / (_width));
            _resolutionY = (float)(_coordEnvelope.Height / (_height));
            if (_dataIdentify != null && _dataIdentify.OrbitDateTime == DateTime.MinValue)
            {
                _dataIdentify.OrbitDateTime = IceConDataProvider.TryGetFileDate(Path.GetFileName(fileName));
            }
        }