HiRISE
 Observation

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Observation Class Reference

Observation manages the components of a MRO HiRISE instrument science observation data set. More...

#include <Observation.hh>

Inheritance diagram for Observation:
Inheritance graph
[legend]
Collaboration diagram for Observation:
Collaboration graph
[legend]

Public Member Functions

 Observation ()
 Constructs an empty Observation. More...
 
 Observation (std::istream &stream)
 Constructs an Observation using the data obtained from a stream. More...
 
std::string data_ID () const
 Gets the string representation of the observation data identification values for the current header data components. More...
 
std::vector< Data_Component * > & data_components ()
 Gets the vector of pointers to the Observation Data_Component header data objects. More...
 
unsigned int line_count () const
 The number of lines read since the last set of header data components was read. More...
 
std::istream & source () const
 Gets the istream being used as the source of observation data. More...
 
Observationsource (std::istream &stream)
 Sets the input stream to be used as the source of observation data. More...
 
bool components ()
 Reads a set of header data components from the data source. More...
 
unsigned long components (std::ostream &stream) const
 Writes the current set of header data components. More...
 
Observationline ()
 Loads the next line of image data from the source into the Line cache. More...
 
std::ostream & line (std::ostream &stream) const
 Writes the contents of the Line cache to a stream. More...
 
void reset_line ()
 Resets the Observation Image_Line structure. More...
 
Observationmirror_channel_1 (bool enable)
 Enables or disables mirroring of channel 1 Line data. More...
 
bool mirror_channel_1 () const
 Tests if mirroring of channel 1 Line data is enabled. More...
 
unsigned long long bytes_read () const
 Gets the number of bytes read since the data source stream was attached to this Observation. More...
 
std::ostream & print (std::ostream &stream=std::cout, bool verbose=false) const
 Prints a detailed description of the current header data components. More...
 
std::string data_set_version () const
 Gets the version string for the DATA_SET_ID and DATA_SET_NAME PDS PVL parameters. More...
 
Observationdata_set_version (const char *version)
 Sets the version string for the DATA_SET_ID and DATA_SET_NAME PDS PVL parameters. More...
 
std::string product_version () const
 Gets the version string for the PRODUCT_VERSION_ID parameter. More...
 
Observationproduct_version (const char *version)
 Sets the version string for the PRODUCT_VERSION_ID PDS PVL parameter. More...
 
idaeim::PVL::AggregatePVL () const
 Produces an exhausitive PVL (Parameter Value Language) rendition of the header data components. More...
 
idaeim::PVL::AggregatePVL_PDS () const
 Produces a set of PVL parameters for use in generating a PDS standards compliant EDR product label. More...
 
idaeim::PVL::AggregatePVL_PDS (const Image_Line &image_line) const
 

Static Public Member Functions

static void mirror_channel_1_default (bool enable)
 Enables or disables the default mirroring of channel 1 Line data. More...
 
static bool mirror_channel_1_default ()
 Tests the state of default mirroring of channel 1 Line data. More...
 
static void gap_map_shift (idaeim::PVL::Parameter *gap_map, int shift)
 Shifts the locations of gaps in a gap map. More...
 
- Static Public Member Functions inherited from Instrument
static unsigned int calibration_lines_minimum (unsigned int TDI, unsigned int binning)
 
static int focal_plane_x_offset (unsigned int CPMM, unsigned int binning=1)
 

Public Attributes

MROSP_Header MROSP
 MROSP header. Usually absent (present in instrument manufacturer test data). More...
 
Science_Channel_Header Science
 Science channel data containing a wealth of instrument settings. More...
 
LUT Lookup_Table
 Lookup table used for 14-bit observation data to 8-bit image data mapping. More...
 
Engineering_Header Engineering
 CPMM/Telemetry engineering info (just a few key settings). More...
 
Image_Line Line
 Image data (lines cache). More...
 
Gap_Map Gaps
 Gap range map for the channel data (excludes the MROSP). More...
 
std::vector< Data_Component * > Components
 Data_Component header objects: Science, Lookup_Table, Engineering. More...
 

Static Public Attributes

static const char *const ID
 Class identification name with source code version and date. More...
 
static const char *const PDS_VERSION_ID
 Constant Parameter String values for the PDS label PVL contents. More...
 
static const char *const *const RECORD_TYPE
 
static const char *const *const *const DATA_SET_ID
 
static const char *const *const *const *const DATA_SET_NAME
 
static const char *const *const *const *const *const PRODUCER_INSTITUTION_NAME
 
static const char *const *const *const *const *const *const PRODUCER_ID
 
static const char *const *const *const *const *const *const *const PRODUCER_FULL_NAME
 
static const char *const *const *const *const *const *const *const *const INSTRUMENT_HOST_NAME
 
static const char *const *const *const *const *const *const *const *const *const INSTRUMENT_HOST_ID
 
static const char *const *const *const *const *const *const *const *const *const *const INSTRUMENT_NAME
 
static const char *const *const *const *const *const *const *const *const *const *const *const INSTRUMENT_ID
 
static const char *const *const *const *const *const *const *const *const *const *const *const *const TARGET_NAME
 
static const char *const *const *const *const *const *const *const *const *const *const *const *const *const FLIGHT_SOFTWARE_ID_PREFIX
 
static const char *const *const *const *const *const *const *const *const *const *const *const *const *const *const PDS_NAMESPACE_PARAMETER_PREFIX
 
static const char *const DEFAULT_DATA_SET_VERSION
 Default data set version specification. More...
 
static const char *const DEFAULT_PRODUCT_VERSION
 Default product version specification. More...
 
static const char *const NON_PDS_NAMESPACE_PARAMETERS []
 PDS label parameters that are not in the MRO namespace. More...
 
static const int MINIMUM_MICROSECONDS_PRECISION
 The minimum precision (all digits) of microsecond time values. More...
 
static const int PVL_PDS_BYTES = 32768
 The absolute size to set the PDS PVL label. More...
 
- Static Public Attributes inherited from Instrument
static const char *const ID
 
static const unsigned int CCDS
 
static const unsigned int CCD_UNKNOWN
 
static const char *const CCD_NAMES []
 
static const char *const CCD_FILTER_NAMES []
 
static const unsigned int CCD_BY_CPMM []
 
static const unsigned int CPMM_BY_CCD []
 
static const char *const WAVELENGTH_UNITS
 
static const unsigned int CCD_CENTER_WAVELENGTHS []
 
static const unsigned int CCD_BANDWIDTHS []
 
static const double CCD_FOCAL_PLANE_X_OFFSETS_MM []
 
static const double CCD_FOCAL_PLANE_Y_OFFSETS_MM []
 
static const double CCD_PIXEL_SIZE_MM
 
static const unsigned int CCD_CHANNELS
 
static const unsigned int CCD_CHANNEL_UNKNOWN
 
static const unsigned int CCD_IMAGE_SENSORS
 
static const unsigned int MAX_BYTES_PER_PIXEL
 
static const unsigned int MAX_PIXEL_VALUES []
 
static const unsigned int MAX_IMAGE_LINES
 
static const unsigned int TOTAL_TDI_STAGES
 
static const unsigned int TDI_STAGES []
 
static const unsigned int TOTAL_BINNING_FACTORS
 
static const unsigned int BINNING_FACTORS []
 
static const unsigned int CCD_BINNED_PIXELS []
 
static const unsigned int STORED_LUTS
 
static const unsigned int STIMULATOR_LEDS
 
static const char *const STIMULATOR_LED_NAMES []
 
static const double EXPOSURE_SETUP_MICROS
 
static const unsigned int DELTA_LINE_TIME_MAX
 
static const double DELTA_LINE_TIME_TICK_NANOS
 
static const double LINE_TIME_PRE_OFFSET
 
static const unsigned int TRIM_ADDITION_LINES
 
static const unsigned int REVERSE_READOUT_LINES
 
static const unsigned int MASKED_LINES
 
static const unsigned int DLL_LOCKED
 
static const unsigned int DLL_NOT_LOCKED
 
static const unsigned int SPACECRAFT_EPOCH
 
static const double MRO_CLOCK_SUBTICK_MICROS
 
static const double HIRISE_CLOCK_SUBTICK_MICROS
 
static const int SPACECRAFT_NAIF_ID
 
static const unsigned int SSR_BYTE_BOUNDARY
 
static const int UNKNOWN_NUMBER
 
static const int NOT_APPLICABLE_NUMBER
 
static const char *const UNKNOWN_STRING
 
static const char *const NOT_APPLICABLE_STRING
 

Detailed Description

Observation manages the components of a MRO HiRISE instrument science observation data set.

It contains a full complement of HiRISE data components which it can read and write from any data stream (I/O is done sequentially).

N.B.: Observation data is always organized as MSB ordered data values (the most significant byte of a value occurs first; i.e. at the lowest address or stream position). It is expected to be in this order when read from the data source stream, and will be written in this order. This conforms to the established MRO data storage order requirement. However, the data values are always provided to the application in native data order (dependent on the host system architecture). This is transparently managed by the Data_Block base class of every Data_Component implementation.

Author
Bradford Castalia, UA/PIRL

1.50

See also
UA::HiRISE::Instrument

Constructor & Destructor Documentation

◆ Observation() [1/2]

◆ Observation() [2/2]

Observation ( std::istream &  stream)
explicit

Constructs an Observation using the data obtained from a stream.

The stream is expected to contain the following components:

  1. MROSP_Header (not required)
  2. Science_Channel_Header
  3. LUT
  4. Engineering_Header
  5. Image_Line (image data will be cached)
Each set of components, including all of the Image_Line data
following the headers, constitutes an observation <i>channel</i>. A
data stream may contain more than one channel. Each component is
encapsulated by its own class object.

@param  stream  The istream from which to obtain the observation data.

References Observation::Components, Observation::Engineering, Observation::Lookup_Table, and Observation::Science.

Member Function Documentation

◆ data_ID()

string data_ID ( ) const

Gets the string representation of the observation data identification values for the current header data components.

An observation data ID is expected to be composed of a primary observation ID that is the same for all channels of an observation plus a CCD ID (there are two data channels per CCD assembly used by the HiRISE instrument) and the channel number for the CCD.

Returns
An observation channel data identification string. If no data components have been read the empty string will be returned.
See also
UA::HiRISE::Channel_ID;

References Science_Channel_Header::Channel, Science_Channel_Header::CPMM, Data_Component::get(), Science_Channel_Header::Observation_ID, Observation::Science, and Channel_ID::text().

◆ data_components()

std::vector<Data_Component*>& data_components ( )
inline

Gets the vector of pointers to the Observation Data_Component header data objects.

The vector is a convenience for treating the components as a consistent set of Data_Component objects. These are the same Data_Component objects that can be accessed individually by name.

Before reading a new set of header data components the vector is cleared. After each component has been successfully read the vector is updated with its Data_Component pointer. Thus the vector is also an indicator of which components have been read; an Observation that has not read any components will have data_components ().empty () return true.

The vector Data_Component entries (and individual names) are:

  1. Science_Channel_Header (Science)
  2. LUT (Lookup_Table)
  3. Engineering_Header (Engineering)
For test data generated by the HiRISE instrument manufacturer (Ball
Aerospace, Inc.) an MROSP_Header may be present in the observation
data stream, but it will not be included in the data components vector.
It is not expected in the downlinked data from the MRO spacecraft.

The final data component of an Observation is the collection of
image lines. Instead of reading all the image lines - there may be
very many - an Image_Line cache is maintained. Use the line methods
to step through the image line data.

@return The vector of Data_Component pointers to the objects in
    this Observation.

References Observation::Components.

◆ line_count()

unsigned int line_count ( ) const
inline

The number of lines read since the last set of header data components was read.

The Image_Line Line cache in the Observation contains the last image line that was read.

Returns
The number of image data lines read.
See also
components()

References Image_Line::count(), and Observation::Line.

◆ source() [1/2]

istream & source ( ) const

Gets the istream being used as the source of observation data.

Warning: If the stream is repositioned (e.g. by I/O) then the Observation's expectations about the location of data components in the stream may be confused.

Returns
An istream.
Exceptions
invalid_argumentIf the Observation has no data source.
See also
source(std::istream&)

References Observation::ID.

◆ source() [2/2]

Observation& source ( std::istream &  stream)
inline

Sets the input stream to be used as the source of observation data.

This method is generally used when a data stream source needs to be provided to an empty Observation. It may also be provided to change from one data source to another. However care must be taken to ensure that the stream is properly positioned according to how it is used with the Observation object. For example, after switching to a new stream it is expected that a new set of components will be read to reinitialize the Observation, which requires that the stream be positioned at the beginning of a set of observation component headers.

N.B.: The count of the number of bytes_read is reset.

Parameters
streamThe istream that will be used as the source of observation data.
Returns
This Observation.

◆ components() [1/2]

bool components ( )

Reads a set of header data components from the data source.

The data source must be positioned at the beginning of the header components. However, if the number of bytes read (since the stream source was attached to this Observation) is not a multiple of the Instrument::SSR_BYTE_BOUNDARY then additional bytes will be read to move the source stream to align on a boundary.

An attempt will be made to read an MROSP_Header data component. If the MROSP_Header thus produced identifies that the data is valid for that component then it is retained in the Observation's MROSP object and then a Science_Channel_Header data component is read. Otherwise the data from the MROSP object is moved into a Science_Channel_Header and the remainder of the Science_Channel_Header data is read in. In either case the Observation will now contain a Science object.

Following the Science_Channel_Header a LUT is read into the Observation's Lookup_Table object. Then an Engineering_Header is read into the Observation's Engineering object.

Finally an Image_Line is initialized for the number of pixels per line and bytes per pixel specified in the Science object. This is the Observation's Line object which will be used to cache image line data as it is read.

N.B.: A runtime_error exception will be thrown if line synchronization was lost during processing of the previous observation. In this case no data is read from the source.

The number of bytes_read is updated for each component read. The name field width for each component is reset to the maximum width of all component element names.

Returns
true, if the components were successfully read; false otherwise. Note that the only false return is when an EOF is encountered at the beginning of component reading; otherwise an exception is thrown.
Exceptions
std::ios::failureIf a problem reading any of the data header components was encountered.
std::length_errorIf the Post_Binned_Pixels_Per_Line Science_Channel_Header::Element of the Science object contains an invalid value (thrown by the Line object).
std::out_of_rangeIf the Pixel_Bytes Science_Channel_Header::Element of the Science object contains an invalid value (thrown by the Line object).
std::runtime_errorIf line synchronization has been lost.
See also
MROSP_Header::is_valid()
Image_Line::pixel_count(unsigned int)
Image_Line::pixel_bytes(unsigned int)
Data_Component::name_field_width(unsigned int)
PIRL::Data_Block

References Gap_Map::clear(), Engineering_Header::COMPONENT_BYTES, LUT::COMPONENT_BYTES, MROSP_Header::COMPONENT_BYTES, Science_Channel_Header::COMPONENT_BYTES, Observation::Components, Data_Component::data(), Observation::Engineering, Gap_Map::GAP_BYTE_VALUE, Observation::Gaps, Gap_Map::gaps_in(), Observation::ID, Gap_Map::in_gap(), Data_Block::input(), MROSP_Header::is_valid(), Observation::Line, Observation::Lookup_Table, Observation::MROSP, MROSP_Header::print(), Observation::reset_line(), Observation::Science, Gap_Map::sequence_threshold(), Gap_Map::set(), Gap_Map::shift(), and Image_Line::synchronization_lost().

Referenced by EDR_file(), and main().

◆ components() [2/2]

unsigned long components ( std::ostream &  stream) const

Writes the current set of header data components.

A MROSP_Header is never written even if it was present in the source data stream.

The components are written in the order they occur in the data_components vector. Thus if the vector is empty nothing is written.

Parameters
streamThe ostream to which the components will be written.
Returns
The number of bytes that were written.
Exceptions
std::ios::failureIf there was a problem writing to the stream.
See also
PIRL::Data_Block::output(std::ostream&)

References Observation::Components, and Observation::ID.

◆ line() [1/2]

Observation & line ( )

Loads the next line of image data from the source into the Line cache.

The line_count and the bytes_read are updated. If the Channel Science_Channel_Header::Element of the Science component is 1 then the Line may be mirrored to compensate for the reverse readout order from the CCD.

Returns
This Observation.
Exceptions
std::out_of_rangeIf the line_count matches the Post_Binned_Lines Science_Channel_Header::Element of the Science component; i.e. there are no more lines to be read for the current channel.
std::ios::failureIf there was a problem reading from the source.
See also
mirror_channel_1(bool)
mirror_channel_1_default(bool)

References Image_Line::bytes_read(), Science_Channel_Header::Channel, Engineering_Header::COMPONENT_BYTES, LUT::COMPONENT_BYTES, Science_Channel_Header::COMPONENT_BYTES, Image_Line::count(), Data_Component::data(), Observation::Engineering, Observation::Gaps, Gap_Map::gaps_in(), Data_Component::get(), Observation::Line, Image_Line::LINE_HEADER_BYTES, Observation::Lookup_Table, Image_Line::mirror(), Image_Line::next(), Image_Line::pixel_bytes(), Observation::Science, Gap_Map::set(), Gap_Map::shift(), and Data_Block::size().

Referenced by main().

◆ line() [2/2]

ostream & line ( std::ostream &  stream) const

Writes the contents of the Line cache to a stream.

All parts of the Image_Line - line header, buffer pixels, image pixels and black pixels - are written.

Special "observation" data sets from the instrument manufacturer contain extra "virtual" pixels at the end of the normal image data; these are also written if present.

Parameters
streamThe ostream to which the Line data will be written.
Returns
The stream that was written.
Exceptions
std::ios::failureIf there was a problem writing to the stream.

References Image_Line::count(), Observation::ID, Observation::Line, and Data_Block::output().

◆ reset_line()

void reset_line ( )

Resets the Observation Image_Line structure.

The structure of the Image_Line managed by the Observation is expected to be consistent with the line structure definition values in the header data components:

The number of bytes per pixel is determined by the Science_Channel_Header Pixel_Bytes Element. However, if this value is invalid the Engineering_Header LUT_Compressed Element is used as a fallback: image data that is LUT compressed is always one byte per pixel, otherwise it is two bytes per pixel.

The number of pixels per line is determined by the Science_Channel_Header Post_Binned_Pixels_Per_Line Element.

The total number of lines is determined by the Science_Channel_Header Post_Binned_Lines Element. However, if this value is invalid the Engineering_Header Post_Binned_Lines is used instead.

The expected channel number, used to check the line headers, is determined by the Science_Channel_Header Channel and CPMM values.

The data source for the line is reset to the data source for this Observation.

N.B.: The line number and number of bytes read are reset to zero.

This method should be used if the contents of the Observation header data components has been changed in a way that affects any of the values dermining the line structure (e.g. by some method other than components()) and the Image_Line managed by the Observation needs to be reset accordingly.

References Engineering_Header::Binning_Factor, Image_Line::calibration_lines(), Instrument::calibration_lines_minimum(), Science_Channel_Header::Channel, Science_Channel_Header::CPMM, Image_Line::DEFAULT_CALIBRATION_LINES, Observation::Engineering, Image_Line::expected_channel(), Data_Component::get(), Observation::Line, Engineering_Header::LUT_Compressed, Instrument::MAX_BYTES_PER_PIXEL, Instrument::MAX_IMAGE_LINES, Image_Line::pixel_bytes(), Science_Channel_Header::Pixel_Bytes, Image_Line::pixel_count(), Engineering_Header::Post_Binned_Lines, Science_Channel_Header::Post_Binned_Lines, Science_Channel_Header::Post_Binned_Pixels_Per_Line, Observation::Science, Image_Line::source(), Engineering_Header::TDI_Stages, and Image_Line::total_lines().

Referenced by Observation::components().

◆ mirror_channel_1() [1/2]

Observation& mirror_channel_1 ( bool  enable)
inline

Enables or disables mirroring of channel 1 Line data.

Each of the HiRISE instrument 14 CCD assemblies is composed of two data channels - each getting its data from a CCD sensor device - aligned such that channel 0 is logically on the right, and channel 1 on the left, of a continuous linear pixel sensor array. Each CCD assembly has an electronics module (CPMM) that reads image data from the center of each CCD assembly. Thus channel 1 pixels are read out in reverse order from channel 0 resulting in channel 1 pixels having a logically mirrored view of the observation.

To compensate for the instrument image data readout reverse ordering of channel 1, when the Channel Science_Channel_Header::Element of the Science component is 1 the Observation line method can mirror the Line data to restore the logically consistent observation view.

The default Line mirroring behavior is determined by the MIRROR_CHANNEL_1 symbol when the Observation class is compiled. Thus if this class has been appropriately compiled at the user's site the mirroring behavior is not likely to be an issue. This method allows the mirroring behavior to be enabled or disabled at run time when that is needed.

Parameters
enabletrue for mirroring of channel 1 image data, false if the image data is not to be automatically mirrored.
Returns
This Observation.
See also
line()

Referenced by main().

◆ mirror_channel_1() [2/2]

bool mirror_channel_1 ( ) const
inline

Tests if mirroring of channel 1 Line data is enabled.

Returns
true if mirroring of channel 1 Line data is enabled; false otherwise.
See also
mirror_channel_1(bool)

◆ mirror_channel_1_default() [1/2]

static void mirror_channel_1_default ( bool  enable)
inlinestatic

Enables or disables the default mirroring of channel 1 Line data.

When an Observation object is constructed the mode for mirroring of channel 1 data is set to this default state. The initial default state is set by the MIRROR_CHANNEL_1 compile time macro.

Parameters
enabletrue for enabling mirroring of channel 1 image data as the default; false otherwise.
See also
mirror_channel_1(bool)

◆ mirror_channel_1_default() [2/2]

static bool mirror_channel_1_default ( )
inlinestatic

Tests the state of default mirroring of channel 1 Line data.

N.B.: This is a static class datum. An Observation object may be set to a different state.

Returns
true if enabling mirroring of channel 1 image data is the default; false otherwise.
See also
mirror_channel_1(bool)
mirror_channel_1_default(bool)

Referenced by main(), and usage().

◆ bytes_read()

unsigned long long bytes_read ( ) const
inline

Gets the number of bytes read since the data source stream was attached to this Observation.

N.B.: The reported number of bytes read is the actual number of bytes that have been read from the source stream by this Observation object or its Image_Line object. The latter employs a cache mechanism that will have read more data than has yet been used. Thus the number of bytes read may remain constant even as additional line data is "read".

Returns
The cummulative number of bytes read.
See also
source(std::istream&)
line()

Referenced by main().

◆ print()

std::ostream & print ( std::ostream &  stream = std::cout,
bool  verbose = false 
) const

Prints a detailed description of the current header data components.

If the Observation has a valid MROSP_Header then the MROSP component is printed first. Then each component registered in the data_components vector is printed.

Parameters
streamThe ostream where the listing will be written.
verbosetrue if the listing is to be verbose, otherwise some structural details will be omitted for easier human consumption.
Returns
The stream that was written.
See also
Data_Component::print(std::ostream&, bool) const

References Observation::Components, MROSP_Header::is_valid(), Observation::MROSP, and MROSP_Header::print().

◆ data_set_version() [1/2]

std::string data_set_version ( ) const
inline

Gets the version string for the DATA_SET_ID and DATA_SET_NAME PDS PVL parameters.

Returns
The version string.

Referenced by main().

◆ data_set_version() [2/2]

Observation & data_set_version ( const char *  version)

Sets the version string for the DATA_SET_ID and DATA_SET_NAME PDS PVL parameters.

The version string is appended to the constant string values for the parameters after a "-V" or " V" prefix, respectively.

Parameters
versionThe version string pointer. If NULL, the DEFAULT_DATA_SET_VERSION will be used. The initial default version specification is set by the DATA_SET_VERSION compile time macro.
Returns
This Observation.

References Observation::DEFAULT_DATA_SET_VERSION.

◆ product_version() [1/2]

std::string product_version ( ) const
inline

Gets the version string for the PRODUCT_VERSION_ID parameter.

Returns
The version string.

Referenced by main().

◆ product_version() [2/2]

Observation & product_version ( const char *  version)

Sets the version string for the PRODUCT_VERSION_ID PDS PVL parameter.

The version string is appended to the constant string values for the parameters after a "-V" or " V" prefix, respectively.

Parameters
versionThe version string pointer. If NULL, the DEFAULT_PRODUCT_VERSION will be used. The initial default version specification is set by the PRODUCT_VERSION compile time macro.
Returns
This Observation.

References Observation::DEFAULT_PRODUCT_VERSION.

◆ PVL()

Aggregate * PVL ( ) const

Produces an exhausitive PVL (Parameter Value Language) rendition of the header data components.

A HiRISE_Observation PVL Aggregate is produced with a PVL Group for each component in the data_components vector and having the same name as the component. However, the Lookup_Table component will not be included if there is an Engineering component and its LUT_Compressed Engineering_Header::Element is false (i.e. no LUT was used to produce the channel data). Every Data_Component Element of the component will have a Parameter with the same name as its Element name and a Value representing the Element data. Parameters will be organized into logical subgroups.

Returns
A pointer to a PVL::Aggregate.
See also
Data_Component::PVL()

References Aggregate::add(), and Observation::Components.

◆ PVL_PDS() [1/2]

idaeim::PVL::Aggregate* PVL_PDS ( ) const
inline

Produces a set of PVL parameters for use in generating a PDS standards compliant EDR product label.

The Observation object must contain a set of valid Data_Component objects for valid PVL parameter values to be produced.

The PVL parameters are described in detail in the document "Software Interface Specification for HiRISE Experimental Data Record Products" produced for the Mars Reconnaissance Orbiter mission.

WARNING: Parameters that locate binary data objects have values that are the byte number of the component in the EDR product file. These values are set with the assumption that the EDR label will be written at the beginning of the file and padded with trailing space (' ') characters to a total size of PVL_PDS_BYTES. These parameters are:

  • LABEL_RECORDS
  • ^SCIENCE_CHANNEL_TABLE
  • ^LOOKUP_TABLE
  • ^CPMM_ENGINEERING_TABLE
  • ^CALIBRATION_LINE_PREFIX_TABLE
  • ^CALIBRATION_LINE_SUFFIX_TABLE
  • ^CALIBRATION_IMAGE
  • ^LINE_PREFIX_TABLE
  • ^LINE_SUFFIX_TABLE
  • ^IMAGE
Except for the LABEL_RECORDS parameter, which has the PVL_PDS_BYTES
value, the values of all ^location parameters are the byte number
where the corresponding data component is located (i.e. first byte)
in the file. <b>N.B.</b>: The first byte of the file is byte 1.

The SOURCE_FILE_NAME parameter is given the value "UNKNOWN". This
should be replaced with the filename to which the Observation data
source stream is attached.

The RATIONALE_DESCRIPTION parameter is left as an empty string. It
should probably be updated with an appropriately descriptive
string.

The SOFTWARE_NAME parameter is given the Observation class ID
string as its tentative value. It would be appropriate to update this
parameter with the identification of the application software.

@return A pointer to a PVL::Aggregate containing the PDS parameters
    for an EDR product label. The Aggregate is given the
    Parser::CONTAINER_NAME suitable for
    writing directly to the output EDR product file.
@see    UA::HiRISE::PVL_value(idaeim::PVL::Aggregate&, const char*, const std::string&, bool, int)

References Observation::Line.

Referenced by main().

◆ PVL_PDS() [2/2]

Aggregate * PVL_PDS ( const Image_Line image_line) const

References Engineering_Header::ADC_IMAGE_TIMING, Engineering_Header::ADC_RESET_TIMING, Engineering_Header::ADC_timing(), Aggregate::add(), Array::add(), Science_Channel_Header::Analog_Power_On_Start_Time, Engineering_Header::Binning_Factor, Image_Line::calibration_lines(), Instrument::calibration_lines_minimum(), Instrument::CCD_BANDWIDTHS, Instrument::CCD_CENTER_WAVELENGTHS, Instrument::CCD_FILTER_NAMES, Instrument::CCDS, Science_Channel_Header::Channel, Vectal< T >::clear(), UA::HiRISE::clock_count(), Science_Channel_Header::clock_count(), Science_Channel_Header::CLOSED_LOOP, Engineering_Header::COMPONENT_BYTES, LUT::COMPONENT_BYTES, Science_Channel_Header::COMPONENT_BYTES, Image_Line::compressed_data(), Science_Channel_Header::convert(), Science_Channel_Header::converted_units(), Science_Channel_Header::CPMM, Science_Channel_Header::CPMM_Negative_5_Current, Science_Channel_Header::CPMM_Positive_29_Voltage, Science_Channel_Header::CPMM_PWS_Board_Temperature, Observation::DATA_SET_ID, Observation::DATA_SET_NAME, Engineering_Header::Delta_Line_Time, Instrument::DELTA_LINE_TIME_TICK_NANOS, Engineering_Header::DLL_Frequency_Correct_Count, Instrument::DLL_LOCKED, Engineering_Header::DLL_Locked, Engineering_Header::DLL_Locked_Once, Instrument::DLL_NOT_LOCKED, Engineering_Header::DLL_Reset_Count, Science_Channel_Header::DUTY_CYCLES, Observation::Engineering, Science_Channel_Header::Expose_HiRISE_Time, Science_Channel_Header::Expose_MRO_Time, Instrument::EXPOSURE_SETUP_MICROS, Science_Channel_Header::Exposure_Start_Time, Engineering_Header::FIRST_CLOCK, Observation::FLIGHT_SOFTWARE_ID_PREFIX, Science_Channel_Header::Focus_Motor_Temperature, Science_Channel_Header::Focus_Position, Engineering_Header::FPGA_Code_Version, Science_Channel_Header::FPGA_last_response_stim_LEDs_on(), Vectal< T >::front(), Observation::Gaps, Data_Component::get(), Science_Channel_Header::Heater_Control_Mode, Science_Channel_Header::Heater_Current, Science_Channel_Header::Heater_Zones_Enabled, UA::HiRISE::HiRISE_Clock, Observation::ID, Science_Channel_Header::IE_PWS_Board_Temperature, Science_Channel_Header::IEA_Positive_5_Voltage, Science_Channel_Header::Instrument_Control_Board_Temperature, Science_Channel_Header::Instrument_Control_FPGA_Positive_2_5_Voltage, Observation::INSTRUMENT_HOST_ID, Observation::INSTRUMENT_HOST_NAME, Observation::INSTRUMENT_ID, Observation::INSTRUMENT_NAME, Observation_ID::is_preorbit(), Science_Channel_Header::Line_Time_Nanoseconds, Instrument::LINE_TIME_PRE_OFFSET, LUT::Linear, Observation::Lookup_Table, Engineering_Header::LUT_Compressed, Science_Channel_Header::LUT_Operation, Science_Channel_Header::Mech_TLM_Board_Temperature, Observation::MINIMUM_MICROSECONDS_PRECISION, Observation_ID::mission_phase(), Observation_ID::MISSION_PHASE_NAME, Aggregate::move_in(), UA::HiRISE::MRO_Clock, Instrument::MRO_CLOCK_SUBTICK_MICROS, Parameter::name(), Science_Channel_Header::NAMES, LUT::None, Instrument::NOT_APPLICABLE_NUMBER, Instrument::NOT_APPLICABLE_STRING, Science_Channel_Header::Observation_ID, Science_Channel_Header::Optical_Bench_Flexure_Temperature, Observation_ID::orbit_number(), Observation::PDS_VERSION_ID, Science_Channel_Header::Post_Binned_Lines, Science_Channel_Header::Powered_CPMMs_Map, Observation::PRODUCER_FULL_NAME, Observation::PRODUCER_ID, Observation::PRODUCER_INSTITUTION_NAME, Engineering_Header::PVL_description(), Gap_Map::PVL_description(), Image_Line::PVL_description(), LUT::PVL_description(), Science_Channel_Header::PVL_description(), LUT::PVL_PDS(), Observation::PVL_PDS_BYTES, LUT::PVL_PDS_TABLE_NAME, Science_Channel_Header::Readout_Start_Time, Observation::RECORD_TYPE, Observation::Science, Engineering_Header::SECOND_CLOCK, UA::HiRISE::seconds(), Data_Block::size(), LUT::Square_Root, Instrument::STIMULATOR_LEDS, LUT::Stored, Observation::TARGET_NAME, Engineering_Header::TDI_Stages, Channel_ID::text(), Science_Channel_Header::time(), UA::HiRISE::to_upper(), Image_Line::total_lines(), LUT::Total_LUT_Types, Instrument::TRIM_ADDITION_LINES, Engineering_Header::Trimming, String::type(), LUT::TYPE_NAMES, Value::units(), Instrument::UNKNOWN_NUMBER, Instrument::UNKNOWN_STRING, UA::HiRISE::UTC_time(), and Instrument::WAVELENGTH_UNITS.

◆ gap_map_shift()

void gap_map_shift ( idaeim::PVL::Parameter gap_map,
int  shift 
)
static

Shifts the locations of gaps in a gap map.

A gap map Parameter is an Array of location,size Integer pairs (a pair is itself a two element Array) that identifies where a downlink data gap occurs in the observation data stream. Each location is adjusted by a constant amount to reflect a corresponding relative shift of the gap map.

Due to PDS requirements, an empty gap map is represented by a single (0, 0) gap. This special pair is expected to be the first and only element of the gap map when there are no data gaps in the file. In this case the shift is not applied.

Parameters
gap_mapA pointer to an idaeim::PVL::Parameter. If the pointer is NULL, its Value is not an Array, or the map is empty nothing is done.
shiftThe relative amount to change each gap location value. If the shift is 0, nothing is done.
Exceptions
invalid_argumentIf the gap_map refers to an idaeim::PVL::Aggregate Parameter (in this case the exception thrown is also an idaeim::Exception::Error::Invalid_Argument), or an element of the gap_map is not a pair of idaeim::PVL::Integer Values.

References gap_map(), Observation::ID, Value::is_Array(), Value::is_Integer(), Gap_Map::name(), and UA::HiRISE::shift().

Member Data Documentation

◆ ID

const char *const ID
static
Initial value:
=
"UA::HiRISE::Observation (1.81 2020/02/14 01:17:18)"

Class identification name with source code version and date.

Referenced by Observation::components(), Observation::gap_map_shift(), Observation::line(), main(), Observation::PVL_PDS(), and Observation::source().

◆ PDS_VERSION_ID

const char *const PDS_VERSION_ID
static
Initial value:
=
"PDS3"

Constant Parameter String values for the PDS label PVL contents.

Referenced by Observation::PVL_PDS().

◆ RECORD_TYPE

const char *const *const RECORD_TYPE
static
Initial value:
=
"UNDEFINED"

Referenced by Observation::PVL_PDS().

◆ DATA_SET_ID

const char *const *const *const DATA_SET_ID
static
Initial value:
=
"MRO-M-HIRISE-2-EDR"

Referenced by Observation::PVL_PDS().

◆ DATA_SET_NAME

const char *const *const *const *const DATA_SET_NAME
static
Initial value:
=
"MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT EDR"

Referenced by Observation::PVL_PDS().

◆ PRODUCER_INSTITUTION_NAME

const char *const *const *const *const *const PRODUCER_INSTITUTION_NAME
static
Initial value:
=
"UNIVERSITY OF ARIZONA"

Referenced by Observation::PVL_PDS().

◆ PRODUCER_ID

const char *const *const *const *const *const *const PRODUCER_ID
static
Initial value:
=
"UA"

Referenced by Observation::PVL_PDS().

◆ PRODUCER_FULL_NAME

const char *const *const *const *const *const *const *const PRODUCER_FULL_NAME
static
Initial value:
=
"ALFRED MCEWEN"

Referenced by Observation::PVL_PDS().

◆ INSTRUMENT_HOST_NAME

const char *const *const *const *const *const *const *const *const INSTRUMENT_HOST_NAME
static
Initial value:
=
"MARS RECONNAISSANCE ORBITER"

Referenced by Observation::PVL_PDS().

◆ INSTRUMENT_HOST_ID

const char *const *const *const *const *const *const *const *const *const INSTRUMENT_HOST_ID
static
Initial value:
=
"MRO"

Referenced by Observation::PVL_PDS().

◆ INSTRUMENT_NAME

const char *const *const *const *const *const *const *const *const *const *const INSTRUMENT_NAME
static
Initial value:
=
"HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT"

Referenced by Observation::PVL_PDS().

◆ INSTRUMENT_ID

const char *const *const *const *const *const *const *const *const *const *const *const INSTRUMENT_ID
static
Initial value:
=
"HIRISE"

Referenced by Observation::PVL_PDS().

◆ TARGET_NAME

const char *const *const *const *const *const *const *const *const *const *const *const *const TARGET_NAME
static
Initial value:
=
"MARS"

Referenced by Observation::PVL_PDS(), and usage().

◆ FLIGHT_SOFTWARE_ID_PREFIX

const char *const *const *const *const *const *const *const *const *const *const *const *const *const FLIGHT_SOFTWARE_ID_PREFIX
static
Initial value:
=
"IE_FSW_V"

Referenced by Observation::PVL_PDS().

◆ PDS_NAMESPACE_PARAMETER_PREFIX

const char *const *const *const *const *const *const *const *const *const *const *const *const *const *const PDS_NAMESPACE_PARAMETER_PREFIX
static
Initial value:
=
"MRO:"

◆ DEFAULT_DATA_SET_VERSION

const char *const DEFAULT_DATA_SET_VERSION
static
Initial value:
=
#define DATA_SET_VERSION
Default DATA_SET_{ID,NAME} EDR version.
Definition: Observation.cc:149

Default data set version specification.

Referenced by Observation::data_set_version(), and usage().

◆ DEFAULT_PRODUCT_VERSION

const char *const DEFAULT_PRODUCT_VERSION
static
Initial value:
=
#define PRODUCT_VERSION
Default EDR PRODUCT_VERSION_ID.
Definition: Observation.cc:157

Default product version specification.

Referenced by Observation::product_version(), and usage().

◆ NON_PDS_NAMESPACE_PARAMETERS

const char *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const NON_PDS_NAMESPACE_PARAMETERS
static
Initial value:
=
{
"START_TIME",
"SPACECRAFT_CLOCK_START_COUNT",
"STOP_TIME",
"SPACECRAFT_CLOCK_STOP_COUNT",
"PRODUCT_CREATION_TIME",
"FILTER_NAME",
"CENTER_FILTER_WAVELENGTH",
"BANDWIDTH"
}

PDS label parameters that are not in the MRO namespace.

All group parameter names generated in the PVL_PDS method (not parameters generated by data component objects) are filtered for possible inclusion in the MRO namespace. Those parameters that are in the namespace have "MRO:" prefixed to their name. There may be some parameters that are not in a group that also have their name filtered in this way, but they are exceptions (by contrast, there are relatively few group parameters that are not in the MRO namespace).

◆ MINIMUM_MICROSECONDS_PRECISION

const int MINIMUM_MICROSECONDS_PRECISION
static
Initial value:
=
#define MICROSECONDS_PRECISION
Definition: Observation.cc:164

The minimum precision (all digits) of microsecond time values.

Referenced by Observation::PVL_PDS().

◆ PVL_PDS_BYTES

const int PVL_PDS_BYTES = 32768
static

The absolute size to set the PDS PVL label.

Referenced by main(), and Observation::PVL_PDS().

◆ MROSP

MROSP_Header MROSP

MROSP header. Usually absent (present in instrument manufacturer test data).

Referenced by Observation::components(), list_data(), list_selections(), and Observation::print().

◆ Science

◆ Lookup_Table

LUT Lookup_Table

Lookup table used for 14-bit observation data to 8-bit image data mapping.

Referenced by Observation::components(), Observation::line(), list_data(), list_selections(), main(), Observation::Observation(), and Observation::PVL_PDS().

◆ Engineering

Engineering_Header Engineering

◆ Line

Image_Line Line

◆ Gaps

Gap_Map Gaps

Gap range map for the channel data (excludes the MROSP).

Referenced by Observation::components(), Observation::line(), list_selections(), main(), and Observation::PVL_PDS().

◆ Components

std::vector<Data_Component*> Components

The documentation for this class was generated from the following files: