1
0
Fork 0

Convert satid to giza with cpgplot2giza script

giza-pure
Jeff Moe 2022-08-20 14:36:49 -06:00
parent b97f0417b5
commit 55320ce3cf
1 changed files with 34 additions and 34 deletions

View File

@ -83,7 +83,7 @@ plot_satellites (char *tlefile, struct image img, long satno, double mjd0,
double a, b, c;
double rx, ry;
cpgqch (&isch);
giza_get_character_height_float (&isch);
// Image determinant
d = img.a[1] * img.b[2] - img.a[2] * img.b[1];
@ -93,7 +93,7 @@ plot_satellites (char *tlefile, struct image img, long satno, double mjd0,
if (fp == NULL)
return;
cpgsci (color);
giza_set_colour_index (color);
// Open file
sprintf (filename, "%s.id", img.filename);
@ -181,18 +181,18 @@ plot_satellites (char *tlefile, struct image img, long satno, double mjd0,
// Visibility state
if (ptot - pearth < -psun)
{
cpgsls (4);
giza_set_line_style (4);
strcpy (state, "eclipsed");
}
else if (ptot - pearth > -psun && ptot - pearth < psun)
{
cpgsls (2);
giza_set_line_style (2);
strcpy (state, "umbra");
sflag = 1;
}
else if (ptot - pearth > psun)
{
cpgsls (1);
giza_set_line_style (1);
strcpy (state, "sunlit");
sflag = 1;
}
@ -208,14 +208,14 @@ plot_satellites (char *tlefile, struct image img, long satno, double mjd0,
&& textflag == 0)
{
if (flag != 0) {
cpgdraw (x, y);
cpgmove (x, y);
giza_draw_float (x, y);
giza_move_float (x, y);
}
cpgsch (0.65);
cpgsci (1); // Satellite names text color
cpgtext (x, y, norad);
cpgsch (isch);
cpgmove (x, y);
giza_set_character_height_float (0.65);
giza_set_colour_index (1); // Satellite names text color
giza_text_float (x, y, norad);
giza_set_character_height_float (isch);
giza_move_float (x, y);
textflag = 1;
}
if (i == 0)
@ -227,14 +227,14 @@ plot_satellites (char *tlefile, struct image img, long satno, double mjd0,
// Plot satellites
if (flag == 0)
{
cpgpt1 (x, y, 17);
cpgmove (x, y);
giza_single_point_float (x, y, 17);
giza_move_float (x, y);
flag = 1;
}
else
{
cpgdraw (x, y);
cpgmove (x, y);
giza_draw_float (x, y);
giza_move_float (x, y);
}
}
if (textflag == 1)
@ -251,7 +251,7 @@ plot_satellites (char *tlefile, struct image img, long satno, double mjd0,
}
fclose (fp);
fclose (file);
cpgsci (1);
giza_set_colour_index (1);
return;
}
@ -313,39 +313,39 @@ main (int argc, char *argv[])
if (argc == 3) {
giza_open_device_size_float ("/png", "satid", 680, 680, 3);
cpgscf (1);
cpgscr (0, 0.0, 0.0, 0.0);
cpgeras ();
giza_set_font (1);
giza_set_colour_representation_float (0, 0.0, 0.0, 0.0);
giza_draw_background ();
}
else {
giza_open_device_size_float ("/xs", "satid", 680, 680, 3);
}
cpgsvp (0.1, 0.95, 0.1, 0.8);
giza_set_viewport_float (0.1, 0.95, 0.1, 0.8);
cpgsch (0.8);
cpgsci (255); // White top date/COSPAR ID text
giza_set_character_height_float (0.8);
giza_set_colour_index (255); // White top date/COSPAR ID text
sprintf (text, "UT Date: %.23s COSPAR ID: %04d", img.nfd + 1, img.cospar);
cpgmtxt ("T", 6.0, 0.0, 0.0, text);
giza_annotate_float ("T", 6.0, 0.0, 0.0, text);
sprintf (text, "R.A.: %10.5f (%4.1f'') Decl.: %10.5f (%4.1f'')", img.ra0,
img.xrms, img.de0, img.yrms);
if (img.xrms < 1e-3 || img.yrms < 1e-3 || img.xrms / sx > 2.0
|| img.yrms / sy > 2.0)
cpgsci (2);
giza_set_colour_index (2);
else
cpgsci (255); // R.A. text white
cpgmtxt ("T", 4.8, 0.0, 0.0, text);
cpgsci (255); // White main text
giza_set_colour_index (255); // R.A. text white
giza_annotate_float ("T", 4.8, 0.0, 0.0, text);
giza_set_colour_index (255); // White main text
sprintf (text,
"FoV: %.2f\\(2218)x%.2f\\(2218) Scale: %.2f''x%.2f'' pix\\u-1\\d",
wx, wy, sx, sy);
cpgmtxt ("T", 3.6, 0.0, 0.0, text);
giza_annotate_float ("T", 3.6, 0.0, 0.0, text);
sprintf (text, "Stat: %5.1f+-%.1f (%.1f-%.1f)", zavg, zstd, zmin, zmax);
cpgmtxt ("T", 2.4, 0.0, 0.0, text);
giza_annotate_float ("T", 2.4, 0.0, 0.0, text);
cpgsch (1.0);
cpgwnad (0.0, img.naxis1, 0.0, img.naxis2);
giza_set_character_height_float (1.0);
giza_set_window_equal_scale_float (0.0, img.naxis1, 0.0, img.naxis2);
cpglab ("x (pix)", "y (pix)", " ");
cpgctab (heat_l, heat_r, heat_g, heat_b, 5, 1.0, 0.5);
@ -356,7 +356,7 @@ main (int argc, char *argv[])
else
cpgimag (img.zavg, img.naxis1, img.naxis2, 1, img.naxis1, 1, img.naxis2,
zmin, zmax, tr);
cpgbox ("BCTSNI", 0., 0, "BCTSNI", 0., 0);
giza_box ("BCTSNI", 0., 0, "BCTSNI", 0., 0);
cpgstbg (255); // Satellite names text background color
@ -371,7 +371,7 @@ main (int argc, char *argv[])
sprintf (filename, "%s/jsc.txt", env);
plot_satellites (filename, img, 0, img.mjd, img.exptime, 5);
cpgend ();
giza_close_device ();
return 0;