/// <param name="displayName"></param> /// <param name="filenamePrefix"></param> /// <param name="filenameSuffix"></param> /// <param name="filenameParserType"></param> /// <param name="invert"></param> /// <param name="longitude"></param> /// <param name="latitudeRange"></param> /// <param name="longitudeRange"></param> /// <param name="height">Satellite height above Earth (metres)</param> /// <param name="crop"></param> /// <param name="brightness"></param> public SatelliteDefinition( string displayName, string?filenamePrefix, string?filenameSuffix, FilenameParserType filenameParserType, bool invert, double longitude, Range latitudeRange, Range longitudeRange, double height = Constants.Satellite.DefaultHeight, double[]?crop = null, float brightness = 1.0f) { FilenamePrefix = filenamePrefix; FilenameSuffix = filenameSuffix; FilenameParserType = filenameParserType; Invert = invert; DisplayName = displayName; LatitudeRange = latitudeRange; LongitudeRange = longitudeRange; Height = height; Crop = crop; Brightness = brightness; // Convert satellite longitude to lat/long scale of -180 to 180 degrees Longitude = longitude.NormaliseLongitude(); FilenameParser = FilenameParserProvider.GetParser(FilenameParserType, FilenamePrefix, FilenameSuffix); }
public void HimawariMatched() { var(definition, timestamp) = SatelliteRegistry.Locate("c:/images/Himawari8_FD_IR_20200908T015100Z.jpg"); definition.Should().NotBeNull("satellite definition should have been found"); timestamp.Should().NotBeNull("timestamp should have been extracted"); definition !.FilenameParserType.Should().Be(FilenameParserType.Goesproc); timestamp.Should().Be(new DateTime(2020, 09, 08, 01, 51, 0)); }
public static IFilenameParser GetParser(FilenameParserType type, string?prefix, string?suffix) { return(type switch { FilenameParserType.Goesproc => new GoesFilenameParser(prefix, suffix), FilenameParserType.Xrit => new Gk2AFilenameParser(prefix, suffix), FilenameParserType.Electro => new ElectroFilenameParser(prefix, suffix), _ => throw new ArgumentOutOfRangeException(nameof(type), type, null) });
public void Gk2AMatched() { var(definition, timestamp) = SatelliteRegistry.Locate("c:/images/IMG_FD_003_IR105_20201217_003006.jpg"); definition.Should().NotBeNull("satellite definition should have been found"); timestamp.Should().NotBeNull("timestamp should have been extracted"); definition !.FilenameParserType.Should().Be(FilenameParserType.Xrit); timestamp.Should().Be(new DateTime(2020, 12, 17, 00, 30, 06)); }
public void Goes16Matched() { var(definition, timestamp) = SatelliteRegistry.Locate("c:/images/GOES16_FD_CH13_20200908T005019Z.jpg"); definition.Should().NotBeNull("satellite definition should have been found"); timestamp.Should().NotBeNull("timestamp should have been extracted"); definition !.FilenameParserType.Should().Be(FilenameParserType.Goesproc); timestamp.Should().Be(new DateTime(2020, 09, 08, 0, 50, 19)); }
public void ElectroMatched() { // Verify 4-9 definition var(definition, timestamp) = SatelliteRegistry.Locate("c:/images/200830_0230_6.jpg"); definition.Should().NotBeNull("satellite definition should have been found"); timestamp.Should().NotBeNull("timestamp should have been extracted"); definition !.FilenameParserType.Should().Be(FilenameParserType.Electro); timestamp.Should().Be(new DateTime(2020, 08, 29, 23, 30, 0)); // Verify 1-3 definition (definition, _) = SatelliteRegistry.Locate("c:/images/200830_0230_1.jpg"); definition.Should().NotBeNull("satellite definition should have been found"); }
protected static SatelliteDefinition NewDefinition(FilenameParserType filenameParserType, string?prefix = null, string?suffix = null) => new("", prefix, suffix, filenameParserType, false, 0, new Range(), new Range());
public IFilenameParser?GetParser(FilenameParserType type) => _parsers.TryGetValue(type, out var parser) ? parser : null;