Observation
|
#include "Instrument.hh"
#include "Observation.hh"
#include "Data_Component.hh"
#include "Channel_ID.hh"
#include "Exceptions.hh"
#include "PVL.hh"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <exception>
#include <stdexcept>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>
Defines | |
#define | DEFAULT_CONFIGURATION_FILENAME "Database.conf" |
#define | DEFAULT_DATABASE_HOST "" |
#define | LISTING_WIDTH 80 |
#define | LABEL_FIELD_WIDTH (LISTING_WIDTH / 3) |
#define | EDR_FILENAME_EXTENSION "IMG" |
#define | VETTED_FILENAME_SUFFIX "-vetted" |
#define | _VERSION_ " " |
#define | PATHNAME_DELIMITER '/' |
Functions | |
int | usage (char *program, bool list_descriptions=false) |
bool | database_configuration (char *configuration_filename) |
bool | connect_to_database () |
string | Field_value (const string &field) |
bool | EDR_file (string filename) |
void | add_override_parameters (Aggregate &overrides, Aggregate ¶meters) |
void | remove_override_parameters (Aggregate &overrides, Aggregate ¶meters) |
void | set_effective_values (Aggregate &overrides, Channel &channel) |
void | apply_override_parameters (Aggregate &overrides, Aggregate ¶meters) |
char * | username () |
char * | home_directory () |
char * | skip_whitespace (char *characters) |
int | main (int count, char **arguments) |
Variables | |
const char * | EDR_Filename_Extension = EDR_FILENAME_EXTENSION |
Filename extension for output EDR files. | |
const char * | Vetted_Filename_Suffix = VETTED_FILENAME_SUFFIX |
Suffix appended to input filename to create output vetted filename. | |
const int | SUCCESS = 0 |
Exit status values. | |
const int | BAD_SYNTAX = 1 |
const int | CONFIGURATION_FAILURE = 2 |
const int | DATABASE_ERROR = 3 |
const int | INVALID_ARGUMENT = 11 |
const int | LENGTH_ERROR = 12 |
const int | UNDERFLOW_ERROR = 13 |
const int | OUT_OF_RANGE = 14 |
const int | LOGIC_ERROR = 19 |
const int | NO_OBSERVATION_FILE = 20 |
const int | NO_EDR_FILE = 21 |
const int | NO_CHANNEL_FILE = 22 |
const int | NO_PVL_FILE = 23 |
const int | IO_FAILURE = 29 |
const int | PVL_ERROR = 30 |
const int | UNKNOWN_ERROR = -1 |
const char * | ID = "(1.26 2020/02/25 00:21:30)" |
Application identification name with source code version and date. | |
const char * | DATABASE_TYPE = "MySQL" |
Database access configuration parameters. | |
const char * | TYPE_PARAMETER_NAME = "Type" |
const char * | SERVER_PARAMETER_NAME = "Server" |
const char * | HOST_PARAMETER_NAME = "Host" |
const char * | USER_PARAMETER_NAME = "User" |
const char * | PASSWORD_PARAMETER_NAME = "Password" |
const char * | CATALOG_PARAMETER_NAME = "Catalog" |
const char * | DEFAULT_CATALOG = "HiRISE_Test" |
const char * | PLANNED_OBSERVATIONS_TABLE = "Planned_Observations" |
Database field names. | |
const char * | OBSERVATION_ID_FIELD = "OBSERVATION_ID" |
const char * | CCD_FIELD_BASENAME = "CPMM_" |
const char * | CCD_ENABLED_VALUE = "ON" |
const char | pathname_delimiter = PATHNAME_DELIMITER |
Host filesystem pathname delimiter. | |
const char * | SOFTWARE_NAME = "SOFTWARE_NAME" |
Names of EDR PDS parameters that will have their values updated. | |
const char * | SOURCE_FILE_NAME = "SOURCE_FILE_NAME" |
const char * | GAP_TABLE_LOCATION = "^GAP_TABLE" |
const char * | GAP_TABLE_ROWS = "GAP_TABLE/ROWS" |
const char * | OBSERVATION_ID = "OBSERVATION_ID" |
Names of key "effective" parameters. | |
const char * | TIME_PARAMETERS = "TIME_PARAMETERS/" |
const char * | ANALOG_POWER_START_COUNT = "ANALOG_POWER_START_COUNT" |
const char * | OBSERVATION_START_COUNT = "OBSERVATION_START_COUNT" |
const char * | INSTRUMENT_SETTING_PARAMETERS = "INSTRUMENT_SETTING_PARAMETERS/" |
const char * | SCAN_EXPOSURE_DURATION = "SCAN_EXPOSURE_DURATION" |
const char * | CPMM_NUMBER = "CPMM_NUMBER" |
const char * | CHANNEL_NUMBER = "CHANNEL_NUMBER" |
const char * | DELTA_LINE_TIMER_COUNT = "DELTA_LINE_TIMER_COUNT" |
const char * | BINNING = "BINNING" |
const char * | TDI = "TDI" |
const char * | TRIM_LINES = "TRIM_LINES" |
const char * | CALIBRATION_IMAGE_LINES = "CALIBRATION_IMAGE/LINES" |
const char * | IMAGE = "IMAGE/" |
const char * | LINES = "LINES" |
const char * | LINE_SAMPLES = "LINE_SAMPLES" |
const char * | SAMPLE_BITS = "SAMPLE_BITS" |
const char * | PRODUCT_ID = "PRODUCT_ID" |
Names of other paramters to be accessed. | |
const char * | PRODUCT_CREATION_TIME = "PRODUCT_CREATION_TIME" |
const char * | LABEL_RECORDS = "LABEL_RECORDS" |
const string::size_type | EOS = std::string::npos |
End-of-string index. | |
Aggregate | Config_Parameters ("Configuration") |
Configuration parameters. | |
string | Database_Server |
string | Database_Host |
string | Database_User |
string | Database_Password |
string | Database_Catalog |
const int | LABEL_WIDTH = 20 |
Listing format widths. | |
const int | VALUE_WIDTH = 9 |
Lister | PDS_label_lister |
PDS formatting of PVL. | |
int | Verbosity = 0 |
Global flags. |
#define DEFAULT_CONFIGURATION_FILENAME "Database.conf" |
Referenced by Label_Patcher::Label_Patcher(), main(), and usage().
#define DEFAULT_DATABASE_HOST "" |
Referenced by Label_Patcher::configure_database().
#define LISTING_WIDTH 80 |
#define LABEL_FIELD_WIDTH (LISTING_WIDTH / 3) |
Referenced by EDR_file().
#define EDR_FILENAME_EXTENSION "IMG" |
#define VETTED_FILENAME_SUFFIX "-vetted" |
Referenced by usage().
#define _VERSION_ " " |
#define PATHNAME_DELIMITER '/' |
int usage | ( | char * | program, |
bool | list_descriptions = false |
||
) |
References BAD_SYNTAX, and VETTED_FILENAME_SUFFIX.
bool database_configuration | ( | char * | configuration_filename ) |
bool connect_to_database | ( | ) |
Referenced by Label_Patcher::database_field_value().
string Field_value | ( | const string & | field ) |
bool EDR_file | ( | string | filename ) |
References Observation::components(), LABEL_FIELD_WIDTH, LABEL_RECORDS, OBSERVATION_ID, PRODUCT_CREATION_TIME, PRODUCT_ID, Aggregate::read(), SOURCE_FILE_NAME, Parameter::value(), and Verbosity.
Referenced by main().
References Aggregate::add(), Vectal< T >::begin(), Aggregate::begin_depth(), Vectal< T >::end(), Aggregate::end_depth(), Parameter::name(), and Assignment::value().
Referenced by main().
References Vectal< T >::begin(), Aggregate::begin_depth(), Vectal< T >::end(), Aggregate::end_depth(), Vectal< T >::erase(), Parameter::name(), and Verbosity.
Referenced by main().
void set_effective_values | ( | Aggregate & | overrides, |
Channel & | channel | ||
) |
References Science_Channel_Header::Analog_Power_On_Start_Time, ANALOG_POWER_START_COUNT, BAD_SYNTAX, BINNING, Engineering_Header::Binning_Factor, Image_Line::BLACK_PIXELS_COUNT, Image_Line::BUFFER_PIXELS_COUNT, CALIBRATION_IMAGE_LINES, Instrument::calibration_lines_minimum(), Science_Channel_Header::Channel, CHANNEL_NUMBER, Science_Channel_Header::CPMM, CPMM_NUMBER, Engineering_Header::Delta_Line_Time, Instrument::DELTA_LINE_TIME_TICK_NANOS, DELTA_LINE_TIMER_COUNT, EOS, Science_Channel_Header::Exposure_Start_Time, IMAGE, INSTRUMENT_SETTING_PARAMETERS, Observation_ID::INVALID_OBSERVATION_ID, LINE_SAMPLES, Science_Channel_Header::Line_Time_Nanoseconds, Instrument::LINE_TIME_PRE_OFFSET, LINES, Science_Channel_Header::Observation_ID, OBSERVATION_ID, OBSERVATION_START_COUNT, parameter_name(), Science_Channel_Header::Pixel_Bytes, Science_Channel_Header::Post_Binned_Lines, Science_Channel_Header::Post_Binned_Pixels_Per_Line, SAMPLE_BITS, SCAN_EXPOSURE_DURATION, TDI, Engineering_Header::TDI_Stages, TIME_PARAMETERS, TRIM_LINES, Engineering_Header::Trimming, Parameter::value(), Observation_ID::value(), and Verbosity.
Referenced by main().
References Vectal< T >::begin(), Vectal< T >::end(), Parameter::name(), PDS_label_lister, PRODUCT_CREATION_TIME, PRODUCT_ID, SOFTWARE_NAME, SOURCE_FILE_NAME, Parameter::value(), and Verbosity.
Referenced by main().
char* username | ( | ) |
char * home_directory | ( | ) |
char * skip_whitespace | ( | char * | characters ) |
Referenced by main().
int main | ( | int | count, |
char ** | arguments | ||
) |
References add_override_parameters(), apply_override_parameters(), Lister::begin_aggregates(), Image_Line::Black_Pixels, Image_Line::Buffer_Pixels, Image_Line::calibration_lines(), Instrument::CCD_CHANNELS, Instrument::CCDS, Channel_ID::channel_number(), CCD_ID::cpmm_number(), Database_Catalog, DATABASE_ERROR, Database_Server, DB_QUERY_EXCEPTION, DEFAULT_CONFIGURATION_FILENAME, EDR_file(), EDR_Filename_Extension, EOS, file_exists(), GAP_TABLE_ROWS, ID, Image_Line::Image_Pixels, INVALID_ARGUMENT, IO_FAILURE, LABEL_RECORDS, LABEL_WIDTH, LENGTH_ERROR, LOGIC_ERROR, NO_EDR_FILE, NO_OBSERVATION_FILE, NO_PVL_FILE, OUT_OF_RANGE, PDS_label_lister, PRODUCT_ID, PVL_ERROR, Observation::PVL_PDS_BYTES, Aggregate::read(), remove_override_parameters(), set_effective_values(), skip_whitespace(), SOFTWARE_NAME, SOURCE_FILE_NAME, Parser::strict(), Lister::strict(), SUCCESS, Channel_ID::text(), Lister::total(), UNDERFLOW_ERROR, UNKNOWN_ERROR, usage(), Parameter::value(), VALUE_WIDTH, Verbosity, and Vetted_Filename_Suffix.
const char* EDR_Filename_Extension = EDR_FILENAME_EXTENSION |
Filename extension for output EDR files.
const char* Vetted_Filename_Suffix = VETTED_FILENAME_SUFFIX |
Suffix appended to input filename to create output vetted filename.
Referenced by main().
const int SUCCESS = 0 |
Exit status values.
const int BAD_SYNTAX = 1 |
const int CONFIGURATION_FAILURE = 2 |
const int DATABASE_ERROR = 3 |
Referenced by main().
const int INVALID_ARGUMENT = 11 |
const int LENGTH_ERROR = 12 |
const int UNDERFLOW_ERROR = 13 |
const int OUT_OF_RANGE = 14 |
const int LOGIC_ERROR = 19 |
const int NO_OBSERVATION_FILE = 20 |
const int NO_EDR_FILE = 21 |
const int NO_CHANNEL_FILE = 22 |
const int NO_PVL_FILE = 23 |
const int IO_FAILURE = 29 |
const int PVL_ERROR = 30 |
const int UNKNOWN_ERROR = -1 |
const char* ID = "(1.26 2020/02/25 00:21:30)" |
Application identification name with source code version and date.
const char* DATABASE_TYPE = "MySQL" |
Database access configuration parameters.
Referenced by Label_Patcher::configure_database().
const char * TYPE_PARAMETER_NAME = "Type" |
const char * SERVER_PARAMETER_NAME = "Server" |
const char * HOST_PARAMETER_NAME = "Host" |
const char * USER_PARAMETER_NAME = "User" |
const char * PASSWORD_PARAMETER_NAME = "Password" |
const char * CATALOG_PARAMETER_NAME = "Catalog" |
const char * DEFAULT_CATALOG = "HiRISE_Test" |
const char* PLANNED_OBSERVATIONS_TABLE = "Planned_Observations" |
Database field names.
const char * OBSERVATION_ID_FIELD = "OBSERVATION_ID" |
Referenced by main().
const char * CCD_FIELD_BASENAME = "CPMM_" |
const char * CCD_ENABLED_VALUE = "ON" |
const char pathname_delimiter = PATHNAME_DELIMITER |
Host filesystem pathname delimiter.
const char* SOFTWARE_NAME = "SOFTWARE_NAME" |
Names of EDR PDS parameters that will have their values updated.
Referenced by apply_override_parameters(), and main().
const char * SOURCE_FILE_NAME = "SOURCE_FILE_NAME" |
Referenced by apply_override_parameters(), EDR_file(), and main().
const char * GAP_TABLE_LOCATION = "^GAP_TABLE" |
const char * GAP_TABLE_ROWS = "GAP_TABLE/ROWS" |
Referenced by main().
const char* OBSERVATION_ID = "OBSERVATION_ID" |
Names of key "effective" parameters.
Referenced by EDR_file(), and set_effective_values().
const char * TIME_PARAMETERS = "TIME_PARAMETERS/" |
Referenced by set_effective_values().
const char * ANALOG_POWER_START_COUNT = "ANALOG_POWER_START_COUNT" |
Referenced by set_effective_values().
const char * OBSERVATION_START_COUNT = "OBSERVATION_START_COUNT" |
Referenced by set_effective_values().
const char * INSTRUMENT_SETTING_PARAMETERS = "INSTRUMENT_SETTING_PARAMETERS/" |
Referenced by set_effective_values().
const char * SCAN_EXPOSURE_DURATION = "SCAN_EXPOSURE_DURATION" |
Referenced by set_effective_values().
const char * CPMM_NUMBER = "CPMM_NUMBER" |
Referenced by set_effective_values().
const char * CHANNEL_NUMBER = "CHANNEL_NUMBER" |
Referenced by set_effective_values().
const char * DELTA_LINE_TIMER_COUNT = "DELTA_LINE_TIMER_COUNT" |
Referenced by set_effective_values().
const char * BINNING = "BINNING" |
Referenced by set_effective_values().
const char * TDI = "TDI" |
Referenced by set_effective_values().
const char * TRIM_LINES = "TRIM_LINES" |
Referenced by set_effective_values().
const char * CALIBRATION_IMAGE_LINES = "CALIBRATION_IMAGE/LINES" |
Referenced by set_effective_values().
const char * IMAGE = "IMAGE/" |
Referenced by set_effective_values().
const char * LINES = "LINES" |
Referenced by set_effective_values().
const char * LINE_SAMPLES = "LINE_SAMPLES" |
Referenced by set_effective_values().
const char * SAMPLE_BITS = "SAMPLE_BITS" |
Referenced by set_effective_values().
const char* PRODUCT_ID = "PRODUCT_ID" |
Names of other paramters to be accessed.
Referenced by apply_override_parameters(), EDR_file(), and main().
const char * PRODUCT_CREATION_TIME = "PRODUCT_CREATION_TIME" |
Referenced by apply_override_parameters(), and EDR_file().
const char * LABEL_RECORDS = "LABEL_RECORDS" |
Referenced by EDR_file(), and main().
const string::size_type EOS = std::string::npos |
End-of-string index.
Referenced by main(), and set_effective_values().
Aggregate Config_Parameters("Configuration") |
Configuration parameters.
string Database_Server |
Referenced by main().
string Database_Host |
string Database_User |
string Database_Password |
string Database_Catalog |
Referenced by main().
const int LABEL_WIDTH = 20 |
Listing format widths.
const int VALUE_WIDTH = 9 |
PDS formatting of PVL.
Referenced by apply_override_parameters(), and main().
int Verbosity = 0 |
Global flags.
Referenced by apply_override_parameters(), EDR_file(), main(), remove_override_parameters(), and set_effective_values().