/// <summary> /// Updates a record in the Organizer table. /// </summary> /// <param name=""></param> public static void Update(OrganizerData data, SqlTransaction transaction) { // Create and execute the command SqlCommand cmd = GetSqlCommand(CONNECTION_STRING_KEY, "spOrganizer_Update", CommandType.StoredProcedure, COMMAND_TIMEOUT, transaction); //Create the parameters and append them to the command object cmd.Parameters.Add(new SqlParameter("@OrganizerId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "OrganizerId", DataRowVersion.Proposed, data.OrganizerId.DBValue)); cmd.Parameters.Add(new SqlParameter("@Name", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Name", DataRowVersion.Proposed, data.Name.DBValue)); cmd.Parameters.Add(new SqlParameter("@Address1", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Address.Address1", DataRowVersion.Proposed, data.Address.Address1.DBValue)); cmd.Parameters.Add(new SqlParameter("@Address2", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Address.Address2", DataRowVersion.Proposed, data.Address.Address2.DBValue)); cmd.Parameters.Add(new SqlParameter("@City", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Address.City", DataRowVersion.Proposed, data.Address.City.DBValue)); cmd.Parameters.Add(new SqlParameter("@State", SqlDbType.Char, 2, ParameterDirection.Input, false, 0, 0, "Address.State", DataRowVersion.Proposed, data.Address.State.DBValue)); cmd.Parameters.Add(new SqlParameter("@Country", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Address.Country", DataRowVersion.Proposed, data.Address.Country.DBValue)); cmd.Parameters.Add(new SqlParameter("@PostalCode", SqlDbType.VarChar, 10, ParameterDirection.Input, false, 0, 0, "Address.PostalCode", DataRowVersion.Proposed, data.Address.PostalCode.DBValue)); cmd.Parameters.Add(new SqlParameter("@OrganizerContactName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "OrganizerContact.Name", DataRowVersion.Proposed, data.OrganizerContact.Name.DBValue)); cmd.Parameters.Add(new SqlParameter("@OrganizerContactPhone", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "OrganizerContact.Phone", DataRowVersion.Proposed, data.OrganizerContact.Phone.DBValue)); cmd.Parameters.Add(new SqlParameter("@OrganizerContactEmail", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "OrganizerContact.Email", DataRowVersion.Proposed, data.OrganizerContact.Email.DBValue)); cmd.Parameters.Add(new SqlParameter("@TechnicalContactName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "TechnicalContact.Name", DataRowVersion.Proposed, data.TechnicalContact.Name.DBValue)); cmd.Parameters.Add(new SqlParameter("@TechnicalContactPhone", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "TechnicalContact.Phone", DataRowVersion.Proposed, data.TechnicalContact.Phone.DBValue)); cmd.Parameters.Add(new SqlParameter("@TechnicalContactEmail", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "TechnicalContact.Email", DataRowVersion.Proposed, data.TechnicalContact.Email.DBValue)); // Execute the query cmd.ExecuteNonQuery(); // do not close the connection if it is part of a transaction if (transaction == null) { cmd.Connection.Close(); } }
/// <summary> /// Inserts a record into the Organizer table. /// </summary> /// <param name=""></param> public static IdType Insert(OrganizerData data, SqlTransaction transaction) { // Create and execute the command SqlCommand cmd = GetSqlCommand(CONNECTION_STRING_KEY, "spOrganizer_Insert", CommandType.StoredProcedure, COMMAND_TIMEOUT, transaction); SqlParameter rv = cmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int); rv.Direction = ParameterDirection.ReturnValue; //Create the parameters and append them to the command object cmd.Parameters.Add(new SqlParameter("@Name", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Name", DataRowVersion.Proposed, data.Name.DBValue)); cmd.Parameters.Add(new SqlParameter("@Address1", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Address.Address1", DataRowVersion.Proposed, data.Address.Address1.DBValue)); cmd.Parameters.Add(new SqlParameter("@Address2", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Address.Address2", DataRowVersion.Proposed, data.Address.Address2.DBValue)); cmd.Parameters.Add(new SqlParameter("@City", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Address.City", DataRowVersion.Proposed, data.Address.City.DBValue)); cmd.Parameters.Add(new SqlParameter("@State", SqlDbType.Char, 2, ParameterDirection.Input, false, 0, 0, "Address.State", DataRowVersion.Proposed, data.Address.State.DBValue)); cmd.Parameters.Add(new SqlParameter("@Country", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Address.Country", DataRowVersion.Proposed, data.Address.Country.DBValue)); cmd.Parameters.Add(new SqlParameter("@PostalCode", SqlDbType.VarChar, 10, ParameterDirection.Input, false, 0, 0, "Address.PostalCode", DataRowVersion.Proposed, data.Address.PostalCode.DBValue)); cmd.Parameters.Add(new SqlParameter("@OrganizerContactName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "OrganizerContact.Name", DataRowVersion.Proposed, data.OrganizerContact.Name.DBValue)); cmd.Parameters.Add(new SqlParameter("@OrganizerContactPhone", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "OrganizerContact.Phone", DataRowVersion.Proposed, data.OrganizerContact.Phone.DBValue)); cmd.Parameters.Add(new SqlParameter("@OrganizerContactEmail", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "OrganizerContact.Email", DataRowVersion.Proposed, data.OrganizerContact.Email.DBValue)); cmd.Parameters.Add(new SqlParameter("@TechnicalContactName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "TechnicalContact.Name", DataRowVersion.Proposed, data.TechnicalContact.Name.DBValue)); cmd.Parameters.Add(new SqlParameter("@TechnicalContactPhone", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "TechnicalContact.Phone", DataRowVersion.Proposed, data.TechnicalContact.Phone.DBValue)); cmd.Parameters.Add(new SqlParameter("@TechnicalContactEmail", SqlDbType.VarChar, 100, ParameterDirection.Input, false, 0, 0, "TechnicalContact.Email", DataRowVersion.Proposed, data.TechnicalContact.Email.DBValue)); // Execute the query cmd.ExecuteNonQuery(); // do not close the connection if it is part of a transaction if (transaction == null) { cmd.Connection.Close(); } // Set the output paramter value(s) return(new IdType((Int32)(cmd.Parameters["RETURN_VALUE"].Value))); }
/// <summary> /// Finds a Organizer entity using it's primary key. /// </summary> /// <param name="OrganizerId">A key field.</param> /// <returns>A OrganizerData object.</returns> /// <exception cref="Spring2.Core.DAO.FinderException">Thrown when no entity exists witht he specified primary key..</exception> public static OrganizerData Load(IdType organizerId) { WhereClause w = new WhereClause(); w.And("OrganizerId", organizerId.DBValue); SqlDataReader dataReader = GetListReader(CONNECTION_STRING_KEY, VIEW, w, null); if (!dataReader.Read()) { dataReader.Close(); throw new FinderException("Load found no rows for Organizer."); } OrganizerData data = GetDataObjectFromReader(dataReader); dataReader.Close(); return(data); }
public static void LoadLRIT() { UIConsole.Log($"Loading Headers from Visible file at {visFilename}"); XRITHeader header = FileParser.GetHeaderFromFile(visFilename); Regex x = new Regex(@".*\((.*)\)", RegexOptions.IgnoreCase); var regMatch = x.Match(header.ImageNavigationHeader.ProjectionName); satelliteLongitude = float.Parse(regMatch.Groups[1].Captures[0].Value, CultureInfo.InvariantCulture); var inh = header.ImageNavigationHeader; gc = new GeoConverter(satelliteLongitude, inh.ColumnOffset, inh.LineOffset, inh.ColumnScalingFactor, inh.LineScalingFactor); var od = new OrganizerData(); od.Segments.Add(0, visFilename); od.FirstSegment = 0; od.Columns = header.ImageStructureHeader.Columns; od.Lines = header.ImageStructureHeader.Lines; od.ColumnOffset = inh.ColumnOffset; od.PixelAspect = 1; UIConsole.Log($"Generating Visible Bitmap"); bmp = ImageTools.GenerateFullImage(od); if (bmp.PixelFormat != PixelFormat.Format32bppArgb) { bmp = bmp.ToFormat(PixelFormat.Format32bppArgb, true); } // od.Segments[0] = irfilename; irBmp = ImageTools.GenerateFullImage(od); if (bmp.PixelFormat != PixelFormat.Format32bppArgb) { bmp = bmp.ToFormat(PixelFormat.Format32bppArgb, true); } // Geo Converter latRange = new[] { gc.MinLatitude, gc.MaxLatitude }; lonRange = new[] { gc.MinLongitude, gc.MaxLongitude }; coverage = new[] { gc.LatitudeCoverage, gc.LongitudeCoverage }; trim = new[] { gc.TrimLatitude, gc.TrimLongitude }; size = new[] { (uint)bmp.Width, (uint)bmp.Height }; coff = inh.ColumnOffset; loff = inh.LineOffset; cfac = inh.ColumnScalingFactor; lfac = inh.LineScalingFactor; }
public async void LoadLRIT() { await Task.Run(async() => { LockControls(); UIConsole.Log($"Loading Headers from Visible file at {visFilename}"); XRITHeader header = FileParser.GetHeaderFromFile(visFilename); Regex x = new Regex(@".*\((.*)\)", RegexOptions.IgnoreCase); var regMatch = x.Match(header.ImageNavigationHeader.ProjectionName); float satelliteLongitude = float.Parse(regMatch.Groups[1].Captures[0].Value, CultureInfo.InvariantCulture); var inh = header.ImageNavigationHeader; gc = new GeoConverter(satelliteLongitude, inh.ColumnOffset, inh.LineOffset, inh.ColumnScalingFactor, inh.LineScalingFactor); var od = new OrganizerData(); od.Segments.Add(0, visFilename); od.FirstSegment = 0; od.Columns = header.ImageStructureHeader.Columns; od.Lines = header.ImageStructureHeader.Lines; od.ColumnOffset = inh.ColumnOffset; od.PixelAspect = 1; UIConsole.Log($"Generating Visible Bitmap"); visBmp = ImageTools.GenerateFullImage(od); visBmp = ImageTools.ResizeImage(visBmp, visBmp.Width / 4, visBmp.Height / 4, true); od = new OrganizerData(); od.Segments.Add(0, irfilename); od.FirstSegment = 0; od.Columns = header.ImageStructureHeader.Columns; od.Lines = header.ImageStructureHeader.Lines; od.ColumnOffset = inh.ColumnOffset; od.PixelAspect = 1; UIConsole.Log($"Generating Infrared Bitmap"); irBmp = ImageTools.GenerateFullImage(od); irBmp = ImageTools.ResizeImage(irBmp, irBmp.Width / 4, irBmp.Height / 4, true); UIConsole.Log("Generating False Color"); await GenerateFalseColor(); UIConsole.Log("Done"); UnlockControls(); }); }
/// <summary> /// Updates a record in the Organizer table. /// </summary> /// <param name=""></param> public static void Update(OrganizerData data) { Update(data, null); }
/// <summary> /// Inserts a record into the Organizer table. /// </summary> /// <param name=""></param> public static IdType Insert(OrganizerData data) { return(Insert(data, null)); }
/// <summary> /// Builds a data object from the current row in a data reader.. /// </summary> /// <param name="dataReader">Container for database row.</param> /// <returns>Data object built from current row.</returns> private static OrganizerData GetDataObjectFromReader(SqlDataReader dataReader) { OrganizerData data = new OrganizerData(); if (dataReader.IsDBNull(dataReader.GetOrdinal("OrganizerId"))) { data.OrganizerId = IdType.UNSET; } else { data.OrganizerId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("OrganizerId"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Name"))) { data.Name = StringType.UNSET; } else { data.Name = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Name"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Address1"))) { data.Address.Address1 = StringType.UNSET; } else { data.Address.Address1 = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Address1"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Address2"))) { data.Address.Address2 = StringType.UNSET; } else { data.Address.Address2 = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Address2"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("City"))) { data.Address.City = StringType.UNSET; } else { data.Address.City = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("City"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("State"))) { data.Address.State = USStateCodeEnum.UNSET; } else { data.Address.State = USStateCodeEnum.GetInstance(dataReader.GetString(dataReader.GetOrdinal("State"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Country"))) { data.Address.Country = StringType.UNSET; } else { data.Address.Country = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Country"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("PostalCode"))) { data.Address.PostalCode = StringType.UNSET; } else { data.Address.PostalCode = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("PostalCode"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("OrganizerContactName"))) { data.OrganizerContact.Name = StringType.UNSET; } else { data.OrganizerContact.Name = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("OrganizerContactName"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("OrganizerContactPhone"))) { data.OrganizerContact.Phone = StringType.UNSET; } else { data.OrganizerContact.Phone = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("OrganizerContactPhone"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("OrganizerContactEmail"))) { data.OrganizerContact.Email = StringType.UNSET; } else { data.OrganizerContact.Email = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("OrganizerContactEmail"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("TechnicalContactName"))) { data.TechnicalContact.Name = StringType.UNSET; } else { data.TechnicalContact.Name = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("TechnicalContactName"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("TechnicalContactPhone"))) { data.TechnicalContact.Phone = StringType.UNSET; } else { data.TechnicalContact.Phone = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("TechnicalContactPhone"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("TechnicalContactEmail"))) { data.TechnicalContact.Email = StringType.UNSET; } else { data.TechnicalContact.Email = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("TechnicalContactEmail"))); } return(data); }
public static void Main(string[] args) { Console.WriteLine($"XRIT Version: {LibInfo.Version}"); AppDomain.CurrentDomain.UnhandledException += CrashReport.DefaultExceptionHandler; //* //Organizer org = new Organizer("./himawari"); //org.Update(); //var gd = org.GroupData[1490489400]; //var od = gd.Infrared; /* * Console.WriteLine("Initializing organizer"); * Organizer org = new Organizer("/home/lucas/Works/OpenSatelliteProject/split/goesdump/XRITLibraryTest/bin/Debug/channels/Images/Full Disk/"); * org.Update(); * int k = 0; * int c = 0; * foreach (var z in org.GroupData.Keys) { * k = z; * c++; * if (c == 2) { // 20 For US * break; * } * } * var gd = org.GroupData[k]; * var od = gd.Visible; * * Console.WriteLine("Initializing GeoConverter"); * var gc = new GeoConverter(gd.SatelliteLongitude, gd.ColumnOffset, gd.LineOffset, gd.ColumnScalingFactor, gd.LineScalingFactor, true, od.Columns); * * Console.WriteLine("Generating BMP"); * //var bmp = ImageTools.GenerateFullImage(od); * var bmp = ImageTools.GenerateFalseColor(gd); * var mapDrawer = new MapDrawer("/home/lucas/Works/OpenSatelliteProject/split/borders/ne_10m_admin_1_states_provinces.shp"); * //var mapDrawer = new MapDrawer("/home/lucas/Works/OpenSatelliteProject/split/borders/ne_50m_admin_0_countries.shp"); * Console.WriteLine("Drawing Map"); * mapDrawer.DrawMap(ref bmp, gc, Color.Aqua, 2, true); * * Console.WriteLine("Drawing LatLon Lines"); * ImageTools.DrawLatLonLines(ref bmp, gc, Color.Brown, 1, true); * * bmp.Save("unitedstates.jpg", ImageFormat.Jpeg); * bmp.Dispose(); * // */ ///* string filename = "./OR_ABI-L2-CMIPF-M3C13_G16_s20170861545382_e20170861556160_c20170861556231.lrit"; string visFilename = "./OR_ABI-L2-CMIPF-M3C02_G16_s20170861545382_e20170861556149_c20170861556217.lrit"; XRITHeader header = FileParser.GetHeaderFromFile(filename); Console.WriteLine($"Parsing file {header.Filename}"); Regex x = new Regex(@".*\((.*)\)", RegexOptions.IgnoreCase); var regMatch = x.Match(header.ImageNavigationHeader.ProjectionName); float satelliteLongitude = float.Parse(regMatch.Groups[1].Captures[0].Value, CultureInfo.InvariantCulture); var inh = header.ImageNavigationHeader; var gc = new GeoConverter(satelliteLongitude, inh.ColumnOffset, inh.LineOffset, inh.ColumnScalingFactor, inh.LineScalingFactor); var od = new OrganizerData(); od.Segments.Add(0, filename); od.FirstSegment = 0; od.Columns = header.ImageStructureHeader.Columns; od.Lines = header.ImageStructureHeader.Lines; od.ColumnOffset = inh.ColumnOffset; od.PixelAspect = 1; var bmp = ImageTools.GenerateFullImage(od); od = new OrganizerData(); od.Segments.Add(0, visFilename); od.FirstSegment = 0; od.Columns = header.ImageStructureHeader.Columns; od.Lines = header.ImageStructureHeader.Lines; od.ColumnOffset = inh.ColumnOffset; od.PixelAspect = 1; var vbmp = ImageTools.GenerateFullImage(od); UIConsole.GlobalEnableDebug = true; var shapeFile = ShapeFiles.InitShapeFiles(); //bmp.Save(filename + "-orig.png", ImageFormat.Png); //vbmp.Save(visFilename + "-orig.png", ImageFormat.Png); var mapDrawer = new MapDrawer(shapeFile); //ImageTools.DrawLatLonLines(ref bmp, gc, Color.Brown); ImageTools.ApplyCurve(OpenSatelliteProject.Presets.NEW_VIS_FALSE_CURVE, ref vbmp); vbmp = ImageTools.ToFormat(vbmp, PixelFormat.Format32bppArgb, true); bmp = ImageTools.ToFormat(bmp, PixelFormat.Format32bppArgb, true); ImageTools.Apply2DLut(OpenSatelliteProject.Presets.FalseColorLUTVal, ref vbmp, bmp); var startTime = LLTools.TimestampMS(); mapDrawer.DrawMap(ref vbmp, gc, Color.Yellow, 2, false, true); var delta = LLTools.TimestampMS() - startTime; Console.WriteLine($"Took {delta} ms to generate map."); vbmp.Save(visFilename + ".jpg", ImageFormat.Jpeg); Bitmap landMap = mapDrawer.GenerateLandMap(gc, bmp.Width, bmp.Height); landMap.Save(filename + "-landmap.jpg", ImageFormat.Jpeg); landMap.Dispose(); bmp.Dispose(); return; // */ /* * Bitmap test0 = (Bitmap) Bitmap.FromFile("test0.jpg"); * Bitmap test1 = (Bitmap) Bitmap.FromFile("test1.jpg"); * Bitmap overlay = (Bitmap) Bitmap.FromFile("goes13-fulldisk.jpg"); * * test0 = test0.ToFormat(PixelFormat.Format24bppRgb, true); * * overlay.Save("hue.jpg", ImageFormat.Jpeg); * * ImageTools.ApplyOverlay(ref test0, overlay); * test0.Save("test0-ovl.jpg", ImageFormat.Jpeg); * * ImageTools.ApplyOverlay(ref test1, overlay); * test1.Save("test1-ovl.jpg", ImageFormat.Jpeg); * * test0.Dispose(); * test1.Dispose(); * overlay.Dispose(); */ //* //string dcsFile = "/home/lucas/Works/OpenSatelliteProject/split/goesdump/XRITLibraryTest/bin/Debug/channels/DCS/pM-17085003239-A.dcs"; //List<DCSHeader> d = DCSParser.parseDCS(dcsFile); //* //string debugFrames = "/media/ELTN/tmp/demuxdump-1490627438.bin"; //string debugFrames = "/media/ELTN/tmp/debug5/demuxdump-1492732814.bin"; //string debugFrames = "/home/lucas/Works/OpenSatelliteProject/split/issues/trango/3/debug_frames.bin"; //string debugFrames = "/media/ELTN/tmp/debug3/raw_data.bin"; /* * var mapDrawer = new MapDrawer("/home/lucas/Works/OpenSatelliteProject/split/borders/ne_50m_admin_0_countries.shp"); * var fList = mapDrawer.ShapeFile.Features.ToList (); * var bmp = new Bitmap (1280, 720, PixelFormat.Format24bppRgb); * using (var graphics = Graphics.FromImage (bmp)) { * Brush bgBrush = new SolidBrush (Color.Black); * Brush polyBrush = new SolidBrush (Color.White); * graphics.FillRectangle (bgBrush, 0, 0, 1280, 720); * int o = 0; * foreach (var fo in fList) { * Console.WriteLine ($"Writting Geometry {o}"); * Pen pen = new Pen(Color.FromArgb((int)((255.0 * o) / fList.Count), 127, 127), 3); * o++; * for (var n = 0; n < fo.NumGeometries; n++) { * //Console.WriteLine ($"Writting Geometry {n}"); * var fg = fo.GetBasicGeometryN (n); * var k = fg.Coordinates; * * float lastX = float.NaN; * float lastY = float.NaN; * * List<PointF> points = new List<PointF> (); * foreach (var z in k) { * float lon = (float)z.X; * float lat = (float)z.Y; * * float X = bmp.Width / 2 + bmp.Width * (lon / 360); * float Y = bmp.Height / 2 - bmp.Height * (lat / 180); * * if (!float.IsNaN (lastX) && !float.IsNaN (lastY)) { * //graphics.DrawLine (pen, lastX, lastY, X, Y); * } * lastX = X; * lastY = Y; * * points.Add (new PointF (X, Y)); * } * graphics.FillPolygon(polyBrush, points.ToArray()); * } * } * } * Console.WriteLine ("Saving"); * bmp.Save ("/home/lucas/test.png", ImageFormat.Png); * bmp.Dispose (); * Console.WriteLine ("Done"); * return; */ EventMaster.On("newFile", d => { var ed = (NewFileReceivedEventData)d.Data; //Console.WriteLine($"Received event for new file {ed.Name} at {ed.Path}"); //Console.WriteLine(ed.ToString()); }); Console.WriteLine("Hash: " + LibInfo.CommitID); Console.WriteLine("Log: " + LibInfo.LogLines); Console.WriteLine("Short Hash: " + LibInfo.ShortCommitID); Console.WriteLine("Version: " + LibInfo.Version); //string debugFrames = "/media/ELTN/tmp/demuxdump-1490627438.bin"; //string debugFrames = "/media/ELTN/tmp/G16JuneTest/demuxdump-1496790733.bin"; //string debugFrames = "/media/ELTN/tmp/G16JuneTest/demuxdump-1500179126.bin"; //string debugFrames = "/media/ELTN/tmp/debug14/demuxdump-1495166529.bin"; string debugFrames = "/media/ELTN/tmp/trango/demuxdump-1500736657.bin"; //var mapDrawer = new MapDrawer("/home/lucas/Works/OpenSatelliteProject/split/borders/ne_10m_admin_1_states_provinces.shp"); var im0 = new ImageManager("output/Images/Full Disk/"); var im1 = new ImageManager("output/Images/Northern Hemisphere/"); var im2 = new ImageManager("output/Images/Southern Hemisphere/"); var im3 = new ImageManager("output/Images/Area of Interest/"); var im4 = new ImageManager("output/Images/United States/"); var im5 = new ImageManager("output/Images/FM1/"); var im6 = new ImageManager("output/Images/Unknown/"); im0.InitMapDrawer(); im1.InitMapDrawer(); im2.InitMapDrawer(); im3.InitMapDrawer(); im4.InitMapDrawer(); im5.InitMapDrawer(); im6.InitMapDrawer(); ImageManager.GenerateVisible = true; ImageManager.GenerateInfrared = true; ImageManager.GenerateFalseColor = true; ImageManager.GenerateWaterVapour = true; ImageManager.GenerateOtherImages = true; ImageManager.EraseFiles = false; ImageManager.UseNOAAFileFormat = true; ImageManager.GenerateLatLonOverlays = true; ImageManager.GenerateMapOverlays = true; ImageManager.GenerateLabels = true; ImageManager.GenerateLatLonLabel = true; ImageManager.SaveNonOverlay = false; //im0.Start (); //im1.Start (); //im2.Start (); //im3.Start (); //im4.Start (); im5.Start(); //im6.Start (); // */ //*/ // /* /* * DemuxManager dm = new DemuxManager (); * FileHandler.SkipDCS = true; * FileHandler.SkipEMWIN = true; * //const int startFrame = 956000; * const int startFrame = 0; * FileStream file = File.OpenRead (debugFrames); * byte[] data = new byte[892]; * long bytesRead = startFrame * 892; * long bytesToRead = file.Length; * int frameN = startFrame; * file.Position = bytesRead; * while (bytesRead < bytesToRead) { * if (frameN % 1000 == 0) { * //Console.WriteLine("Injecting Frame {0}", frameN); * } * bytesRead += file.Read (data, 0, 892); * dm.parseBytes (data); * frameN++; * } * * Console.WriteLine ("CRC Fails: {0}", dm.CRCFails); * Console.WriteLine ("Bugs: {0}", dm.Bugs); * Console.WriteLine ("Frame Loss: {0}", dm.FrameLoss); * Console.WriteLine ("Length Fails: {0}", dm.LengthFails); * Console.WriteLine ("Packets: {0}", dm.Packets); * * Console.WriteLine ("Received Products: "); * foreach (int pID in dm.ProductsReceived.Keys) { * Console.WriteLine ("\t{0}: {1}", ((NOAAProductID)pID).ToString (), dm.ProductsReceived [pID]); * } * //*/ //im.Stop(); //*/ //ProcessFile("/home/lucas/Works/OpenSatelliteProject/split/goesdump/goesdump/bin/Debug/channels/Text/NWSTEXTdat043204159214.lrit"); /* * Organizer organizer = new Organizer("/home/lucas/Works/OpenSatelliteProject/split/goesdump/goesdump/bin/Debug/channels/Images/Full Disk"); * organizer.Update(); * * var data = organizer.GroupData; * * foreach (var z in data) { * var mData = z.Value; * var bmp = ImageTools.GenerateFalseColor(mData); * * if (bmp != null) { * bmp.Save(string.Format("{0}-{1}-{2}-{3}.jpg", mData.SatelliteName, mData.RegionName, "FLSCLR", z.Key), ImageFormat.Jpeg); * bmp.Dispose(); * mData.IsProcessed = true; * } else { * if (mData.Visible.IsComplete && mData.Visible.MaxSegments != 0) { * bmp = ImageTools.GenerateFullImage(mData.Visible); * bmp.Save(string.Format("{0}-{1}-{2}-{3}.jpg", mData.SatelliteName, mData.RegionName, "VIS", z.Key), ImageFormat.Jpeg); * bmp.Dispose(); * } * if (mData.Infrared.IsComplete && mData.Infrared.MaxSegments != 0) { * bmp = ImageTools.GenerateFullImage(mData.Infrared); * bmp.Save(string.Format("{0}-{1}-{2}-{3}.jpg", mData.SatelliteName, mData.RegionName, "IR", z.Key), ImageFormat.Jpeg); * bmp.Dispose(); * } * if (mData.WaterVapour.IsComplete && mData.WaterVapour.MaxSegments != 0) { * bmp = ImageTools.GenerateFullImage(mData.WaterVapour); * bmp.Save(string.Format("{0}-{1}-{2}-{3}.jpg", mData.SatelliteName, mData.RegionName, "WV", z.Key), ImageFormat.Jpeg); * bmp.Dispose(); * } * Console.WriteLine("Not all segments available!"); * } * } * * * //*/ /* * string visFile = "/home/lucas/Works/OpenSatelliteProject/split/samples/FD 26-02-17 2106 G13VI.jpg"; * string irFile = "/home/lucas/Works/OpenSatelliteProject/split/samples/FD 26-02-17 2106 G13IR.jpg"; * * Bitmap vis = new Bitmap(visFile); * ImageTools.ApplyCurve(Presets.VIS_FALSE_CURVE, ref vis); * vis.Save("test.jpg", ImageFormat.Jpeg); * //vis = vis.ToFormat(PixelFormat.Format32bppArgb, true); * * Bitmap ir = new Bitmap(irFile); * ir = ir.ToFormat(PixelFormat.Format32bppArgb, true); * ImageTools.ApplyLUT(Presets.THERMAL_FALSE_LUT, ref ir, 3); * ir.Save("test2.jpg", ImageFormat.Jpeg); * * ir = ir.ToFormat(PixelFormat.Format32bppArgb); * ImageTools.CombineHStoV(ref ir, vis); * * ir.Save("final.jpg", ImageFormat.Jpeg); * //*/ do { while (!Console.KeyAvailable) { Thread.Sleep(1000); } } while (Console.ReadKey(true).Key != ConsoleKey.Escape); }