static void Main(string[] args) { string fn = @"C:\Users\q0hecngn\Downloads\precip.2018.09.dss"; string pathname = "/SHG/MARFC/PRECIP///NEXRAD/"; var targetDSSPath = new DssPath(pathname); double sum = 0; for (int j = 0; j < 4; j++) { using (var dssr = new DssReader(fn, DssReader.MethodID.MESS_METHOD_GENERAL_ID, DssReader.LevelID.MESS_LEVEL_CRITICAL)) { var cat = dssr.GetCatalog(false); var paths = cat.Paths.Select(dssPath => dssPath.FullPath).ToArray(); var filterPaths = PathAssist.FilterByPart(paths, targetDSSPath); for (int i = 0; i < filterPaths.Count; i++) { string subpath = filterPaths[i]; var dssPath = new DssPath(subpath); var grd = dssr.GetGrid(dssPath, true); sum += grd.MaxDataValue; } Console.WriteLine(sum.ToString()); } } }
public void FilterTest() { string fn = Path.GetFullPath(TestUtility.BasePath + "NDFD_Wind.dss"); string pathname = "/SHG/CONUS/WIND DIRECTION///NDFD (YUBZ98) (001-003)/"; /* Catalog.Paths: * [0]: "/SHG/CONUS/WIND DIRECTION/08SEP2018:2400-11SEP2018:2400//NDFD (YUBZ98) (001-003)/" * [1]: "/SHG/CONUS/WIND SPEED/08SEP2018:2400-11SEP2018:2400//NDFD (YWUZ98) (001-003)/" */ using (var dssr = new DssReader(fn)) { var targetDSSPath = new DssPath(pathname); // Should cache catalogue in local var? var cat = dssr.GetCatalog(false); // var paths = cat.Paths.Select(dssPath => dssPath.FullPath).ToArray(); // var filterPaths = PathAssist.FilterByPart(paths, targetDSSPath); // No 'FilterByPart' overload that takes DSSPath objects (not strings) and accepts a dss path to filter on // D and E part are empty, but filtering is failing. Is there a wildcard? var filterPaths = PathAssist.FilterByPart(cat.Paths, targetDSSPath.Apart, targetDSSPath.Bpart, targetDSSPath.Cpart, targetDSSPath.Dpart, targetDSSPath.Epart, targetDSSPath.Fpart); if (filterPaths.Count == 0) { Console.WriteLine("No filtered paths found."); return; } } }
public void ReadAllGrids() { string fn = TestUtility.BasePath + "precip.2018.09.dss"; string pathname = "/SHG/MARFC/PRECIP///NEXRAD/"; var targetDSSPath = new DssPath(pathname); double sum = 0; using (var dssr = new DssReader(fn, DssReader.MethodID.MESS_METHOD_GENERAL_ID, DssReader.LevelID.MESS_LEVEL_CRITICAL)) { var cat = dssr.GetCatalog(false); var paths = cat.Paths.Select(dssPath => dssPath.FullPath).ToArray(); var filterPaths = PathAssist.FilterByPart(paths, targetDSSPath); for (int i = 0; i < filterPaths.Count; i++) { string subpath = filterPaths[i]; var dssPath = new DssPath(subpath); var grd = dssr.GetGrid(dssPath, true); sum += grd.MaxDataValue; } Console.WriteLine(sum.ToString()); } }
public void FilterGridByParts() { string fn = TestUtility.BasePath + "NDFD_Wind.dss"; using (DssReader dssr = new DssReader(fn)) { var cat = dssr.GetCatalog(false); var paths = cat.Paths.Select(dssPath => dssPath.FullPath).ToArray(); string _pathname = "/SHG/CONUS/WIND DIRECTION///NDFD (YUBZ98) (001-003)/"; var targetDSSPath = new DssPath(_pathname); var filterPaths = PathAssist.FilterByPart(paths, targetDSSPath); } }