XPLOT is an X Window System-based application used to plot and schedule AVHRR scenes.
XPLOT initialization is done in main(). The list of available satellites is read from $ADAPSTABLES/satellite.ids. The display is opened and the panels are created by the routines in the create subdirectory. The background maps are read from the include files (world from WholeWorld.h, North Pole from NorthPole.h, South Pole from SouthPole.h). The scene queues are set up using the routines in the ADAPS queue library queue.a.
The list of all available satellites is read from $ADAPSTABLES/satellites.ids into the all_satellite list. This list is used to define satellite number options in the AUTOGEN, new pass, and recorder (DOMSAT) scheduling options. A separate list, chosen_satellite, is used to define which of the satellites in a given recorder schedule the user wants to work with. chosen_satellite is set up by get_recorder_satellites() from the satellite and data type selector when scheduling from a DOMSAT schedule. For example, if the schedule contains NOAA-9 and NOAA-11, even if the user does not schedule any of the NOAA-9 passes, they will still appear in the master schedule. However, if NOAA-9 is not in chosen_satellite, its passes will not be entered into the master schedule.
XPLOT uses two queues to keep track of lists of scenes. The queues keep information about each scene as defined in the SCENEINFO structure in scenes.h. The first, qtemp, holds the temporary scene list shown in the scrollable scene list of the main panel. The second, qkeep, holds all scenes that will be added to the master schedule. Scenes from the DOMSAT schedule that are not to be scheduled for acquisition will still be added to the schedule (this is required by the acquisition software, and it gives a record of all DOMSAT scenes, even the ones not received). The ADAPS queue library is used along with some extra routines in the que subdirectory that take care of allocating new memory for queue entries, clearing out all the entries of a queue, and providing a comparison function for ordering of queue entries.
Several routines control the main panel's scene list and scene information areas. get_sceneid() is used to get the sceneid of the current scene from the sceneList. clear_info_area() is used to clear out information in the information area. This usually occurs when the last scene is deleted from the scene list. The buttons under the scene list may appear in two modes: "normal" mode and "review" mode. In "normal" mode, the Delete button causes delete_scene() to remove that scene from the qtemp queue and the list and call plot_pos to set the position to the scene which now takes its place in the list. The Schedule button calls add_to_sched() which removes the scene from qtemp and the scene list and places it in qkeep. "Review" mode is set by review_all() which changes the buttons and loads the scheduled scenes into the scene list and qtemp. The Next button calls plot_next() which removes the scene from qtemp and calls delete_scene() to remove it from the scene list and plot the new scene in that position (see PLOTTING scenes, below). The Delete button calls drop_pass() which removes the scene from qtemp, qkeep, scene list, and calls delete_scene() to erase it and go on to the next scene in the list. The buttons are set back to "normal" mode by normal_buttons(), which is called by plot_pos() when all reviewed scenes are removed or by a new AUTOGEN, recorder schedule, or new pass operation.
The graphics portion of XPLOT consists of the maps and the scenes. The world and pole maps are read as pixmaps from WholeWorld.h, NorthPole.h, and SouthPole.h by set_up_background() and set_up_pole_pixmaps(). The world map is always displayed as the background in the drawingArea, and the north and south poles are set into the background of poleDrawingArea as needed. The coverage circle and each scene are drawn in the foreground of the drawing areas. The routines plotit() and plotpole() use the AVHRR forward model to correctly place the scene. plotit() converts from AVHRR line/sample to geographic degrees using the model, and then converts to Plate-Carree projection coordinates for display in the world map. This projection was chosen for its simple conversion from geographic coordinates. plotpole() converts from AVHRR line/sample to geographic degrees using the model, and then to Orthographic coordinates for the polar view of the scene. draw_circle() draws the coverage circle around a specified target location (default EDC). Callbacks for plotting are in callb_plot.c:
plot_pass() is set as a browseSelectionCallback in the scene list so that whenever the scene is selected in the list, plot_pass() is called (which calls plotit() and plotpole() ) to plot the scene. plot_next() is used when reviewing scenes, to plot the next scene in the list when the Next button is pressed. review_all() is the callback of the Review Scheduled Passes button in the File menu. It clears the scene list and refills it with scheduled scenes from the qkeep queue. Then it uses plot_pos() to select the first scene in the list and plot it.
The AUTOGEN processing is initiated by callb_auto.c. When AUTOGEN is selected from the File menu, get_autogen_info() pops up the AUTOGEN panel, allowing the user to enter parameters. The update_times() routine is called any time the satellite number is changed to set the default acquisition times for that satellite. cancel_auto() pops down the AUTOGEN panel without executing, and call_autogen() pops it down and calls the "guts" of the AUTOGEN processing which are in the autogen subdirectory. autogen.c is the main entry point, which validates the parameters, sets up the coverage circle based on the target, sets up the AUTOGEN report, and calls findpasses() to generate the scheduled scene information. The algorithm of findpasses() is as follows: get the start time of the orbit of the starting date/time. From there, loop one orbit at a time, finding the time of closest approach to the target at each orbit. If the scene is close enough, calculate the start and end time based on the time the satellite crosses the coverage circle. Scenes that meet the criteria (see the AUTOGEN User's Guide) are scheduled and written to the report. After the scenes are generated, the scene list is filled with the user-specified type of scenes, and plot_pos() selects and plots the first scene in the list.
Scheduling from the recorder schedule is a multi-step process. First, get_recorder_file is activated by selecting From Recorder Schedule... in the File menu, and pops up the schedule file selector (recorderFrame). isdir() is used to verify that the user enters a valid file, not a directory. Selecting a file and "OK" from this panel triggers get_recorder_satellites, which calls scanrecorder() and then pops up the recorder schedule satellite and data type selector (satFrame). Accepting this panel triggers get_recorder_criteria(), which pops up the automatic scheduling criteria panel (criteriaFrame). Scheduling criteria are set up in this panel by setting the appropriate toggle buttons, and pressing the Add button below the toggle buttons. The Add button triggers add_rec_criteria() which adds the criterion to the selection box above. An existing criterion may be deleted by pressing the Delete button, triggering delete_rec_criteria(), and a criterion may be modified by using the Modify button, which triggers modify_rec_criteria(). The Go button triggers load_rec_sch(), which reads the schedule file by calling readrecorder() and then schedules scenes based on the criteria displayed. If the Cancel button is pressed at any time, cancel_load() will popdown any existing satFrame or criteriaFrame as well as the recorderFrame. Likewise, if the file selection OK triggers get_recorder_satellites() when a satFrame or criteriaFrame is already up, they will be destroyed and a new satFrame is created. When the user exits, all of the scenes read from any DOMSAT schedules (both scheduled and non-scheduled) will be written to a report by dom_header() and domsat_report() called from quit(). This is in contrast to the AUTOGEN report, which is appended to every time AUTOGEN is run.
Functions in callb_new.c handle creation of a new pass. Selecting the Create New Pass entry in the File menu calls get_new_pass_info(), which pops up the new pass panel, and sets the fields to correspond to the current scene if there is one. If the user wants to cancel, no_new_pass() will pop down the panel. create_new_pass() gets the information from the panel fields, adds the scene to the qtemp queue, displays it in the scrolling scene list, and plots the pass by selecting the scene in the list which causes a browseSelectionCallback callback (see PLOTTING scenes).
Errors are handled by plot_err(), which displays the given message in a popup window. The error dialog is set to XmDIALOG_FULL_APPLICATION_MODAL, which means that the user must acknowledge the error before going on. If the error occurs in a callback routine, after the user responds and plot_err() returns, the callback routine usually also returns.
PostScript dumps are handled by the routines in the PostScript subdirectory. The Dump button in the file menu calls dump_window(), which writes a PostScript format file. The file includes directions for an informational header, latitude/longitude grid marks and labels, the current coverage circle if visible, WDBII coastlines, and the current scene. If the scene is GAC, the whole world will be output since most GAC scenes are close to a full orbit of the earth. If the scene is LAC or HRPT, only the immediate area around the scene is displayed.
Times for scenes in the SCENEINFO structure are stored as integer seconds from 00:00:00 1/1/86. This convention was adopted because that is how the acquisition software expects to see date/times. Any dates before this time are counted backwards as seconds BEFORE 00:00:00 1/1/86, and are left as a negative number indicating such. consec() converts a seconds value to year, month, day, hour, minute, and seconds. makesecs() converts a date and time to an integer seconds count.
forcedialog() is used to force XPLOT to wait for the processing message dialog window to appear. The processing message is updated as scenes are scheduled from DOMSAT and AUTOGEN.
callb_edit.c contains user text field entry editing functions. They are set as modifyVerifyCallbacks on Text widgets (Texts were used instead of TextFields because XmTextFieldSetString and XtVaSetValues on a TextField don't work when a modifyVerifyCallback exists in some versions of Motif). They are as follows:
check_date(), which allows only [0-9] and '/' to be entered, used for the AUTOGEN and new pass dates; check_time(), which allows only [0-9] and ':' to be entered, used for the AUTOGEN and new pass times; and check_mins(), which allows only [0-9] to be entered, used for the new pass length.
callb_misc.c contains other miscellaneous callback routines.
quit(): initiated from the Exit button in the File menu, quit() frees resources and exits, using savsched() to dump all scenes from the qkeep queue to the add.sch file for transfer by XSCHED to the acquisition system. load_help(): initiates an XMosaic child process of XPLOT if one isn't already running, and loads the correct file. accept_count(): a popup message window appears after AUTOGEN and DOMSAT scheduling to inform the user about how many scenes were scheduled; the user may acknowledge the message and popdown the window. help_reset(): used to keep track when there is no more XMosaic help process running.
fallbacks.h defines the default resources for XPLOT. They are the default values when the user does not specify them otherwise in a personal resources file. An example personal resource file is XPLOT. The user should copy this file and modify it as they like, and place it in their home directory or in the directory specified by $XUSERFILESEARCHPATH.
To add a new satellite capability to XPLOT, add the satellite to the satellite.ids file in $ADAPSTABLES. This will allow access of the new satellite in the AUTOGEN and New Pass options. Reset the NSATS define in readrecorder.c. Currently readrecorder() allows satellites nine through 13. Also, make sure the new satellite's ephemeris file exists in $ADAPSTABLES.