예제 #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))
            {
                return(false);
            }
            Hdf5Operator oper = new Hdf5Operator(fileName);

            string[] datasets    = oper.GetDatasetNames;
            string[] alldatasets = new string[16] {
                "SD_Flags_NorthernDaily_A", "SD_Flags_NorthernDaily_D", "SD_Flags_SouthernDaily_A", "SD_Flags_SouthernDaily_D",
                "SD_NorthernDaily_A", "SD_NorthernDaily_D", "SD_SouthernDaily_A", "SD_SouthernDaily_D",
                "SWE_Flags_NorthernDaily_A", "SWE_Flags_NorthernDaily_D", "SWE_Flags_SouthernDaily_A", "SWE_Flags_SouthernDaily_D",
                "SWE_NorthernDaily_A", "SWE_NorthernDaily_D", "SWE_SouthernDaily_A", "SWE_SouthernDaily_D"
            };
            foreach (object set in alldatasets)
            {
                if (!datasets.Contains(set))
                {
                    return(false);
                }
            }
            return(false);
        }
예제 #2
0
        public override bool IsSupport(string fname, byte[] header1024, Dictionary <string, string> datasetNames)
        {
            string ext = Path.GetExtension(fname).ToUpper();

            if (ext != ".HDF" || !HDF5Helper.IsHdf5(header1024))
            {
                return(false);
            }
            using (Hdf5Operator hdf5 = new Hdf5Operator(fname))
            {
                if (hdf5 == null)
                {
                    return(false);
                }
                string[] dss = hdf5.GetDatasetNames;
                if (dss == null)
                {
                    return(false);
                }
                foreach (string bandname in defaultBandnames)
                {
                    if (!dss.Contains(bandname))
                    {
                        return(false);
                    }
                }
            }
            TryGetDef();
            return(true);
        }
예제 #3
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))
            {
                return(false);
            }
            Hdf5Operator hdfic = new Hdf5Operator(fileName);

            string[] HDFdatasets = hdfic.GetDatasetNames;
            string[] alldatasets = new string[6] {
                "icecon_north_asc", "icecon_north_avg", "icecon_north_des", "icecon_south_asc", "icecon_south_avg", "icecon_south_des"
            };
            foreach (object set in alldatasets)
            {
                if (!HDFdatasets.Contains(set))//数据集必须完全匹配,才能用此数据集
                {
                    return(false);
                }
            }
            return(false);
        }
예제 #4
0
        protected override bool IsCompatible(string fileName, byte[] header1024, params object[] args)
        {
            string ext = Path.GetExtension(fileName).ToUpper();

            if (!HDF5Helper.IsHdf5(header1024))
            {
                return(false);
            }
            return(SICRasterDataProvider.IsSupport(fileName));
        }
예제 #5
0
        public override bool IsSupport(string fname, byte[] header1024, Dictionary <string, string> datasetNames)
        {
            string ext = Path.GetExtension(fname).ToUpper();

            if (!HDF5Helper.IsHdf5(header1024))
            {
                return(false);
            }
            return(HasDatasets(fname));
        }
예제 #6
0
        public override bool IsSupport(string fname, byte[] header1024, Dictionary <string, string> datasetNames)
        {
            string ext = Path.GetExtension(fname).ToUpper();

            if (ext != ".HDF" || !HDF5Helper.IsHdf5(header1024))
            {
                return(false);
            }
            TryGetBandProviderDefinition(fname, datasetNames);
            return(_matchedBandProviderDef != null);
        }
예제 #7
0
 private IHdfOperator HdfOperatorFactory(string filename)
 {
     if (HDF5Helper.IsHdf5(filename))
     {
         return(new Hdf5Operator(filename));
     }
     if (HDF4Helper.IsHdf4(filename))
     {
         return(new Hdf4Operator(filename));
     }
     return(null);
 }
예제 #8
0
 private bool IsHDF5(string fileName)
 {
     byte[] 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))
     {
         return(false);
     }
     return(true);
 }
예제 #9
0
        protected override bool IsCompatible(string fileName, byte[] header1024, params object[] args)
        {
            if (args == null || args.Length == 0)
            {
                return(false);
            }
            string ext = Path.GetExtension(fileName).ToUpper();

            if (ext != ".HDF" || !HDF5Helper.IsHdf5(header1024))
            {
                return(false);
            }
            return(true);
        }
예제 #10
0
        protected override bool IsCompatible(string fileName, byte[] header1024, params object[] args)
        {
            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))
            {
                return(false);
            }
            Hdf5Operator hdfic = new Hdf5Operator(fileName);

            string[] HDFdatasets = hdfic.GetDatasetNames;
            bool     matched     = false;

            foreach (String[] sets in FY3AASOandASLProvider._datasets)
            {
                foreach (string set in sets)
                {
                    matched = false;
                    for (int i = 0; i < HDFdatasets.Length; i++)
                    {
                        if (HDFdatasets[i] == set)
                        {
                            matched = true;
                        }
                    }
                    if (!matched)
                    {
                        break;
                    }
                }
                if (matched)
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #11
0
        protected override bool IsCompatible(string fileName, byte[] header1024, params object[] args)
        {
            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))
            {
                return(false);
            }
            string       geoprjstr = "Projection Type".ToUpper();
            string       geoprj1   = "Geographic Longitude/Latitude".ToUpper();
            string       geoprj2   = "Geographic Longitude/Latitute".ToUpper();
            string       geoprj3   = "GLL";
            string       prjType   = null;
            Hdf5Operator hdfic     = new Hdf5Operator(fileName);
            Dictionary <string, string> fileAttributes = hdfic.GetAttributes();

            foreach (KeyValuePair <string, string> fileAttribute in fileAttributes)
            {
                if (fileAttribute.Key.ToUpper() == geoprjstr)
                {
                    prjType = fileAttribute.Value.ToUpper();
                    break;
                }
            }
            if (prjType == null)
            {
                return(false);
            }
            if (prjType != null && (prjType != geoprj1 && prjType != geoprj2 && prjType != geoprj3))
            {
                return(false);
            }
            return(true);
        }
예제 #12
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);
 }