Skip to content
README.md 11 KiB
Newer Older
# Metis L1 pipeline

This file describes the structure of the Metis L1 pipeline. The pipeline source code is written using the Interactive Data Language (IDL). The present version has been developed and tested using IDL 8.7 and higher versions.

## Schema and description

![](schema.png)

### Inputs
| Name                | Description                                                                                              |
| ------------------- | -------------------------------------------------------------------------------------------------------- |
| L0 FITS file        | Metis L0 FITS file to be processed                                                                       |
| Calibration package | Folder containing the applicable Metis calibration package                                               |
| SPICE kernels       | Folder containing the latest version of the Solar Orbiter's SPICE ephemeris and attitude kernels         |
| HK parameters       | JSON file listing values of specific Solar Orbiter and Metis HK parameters relevant to the input L0 file |
| Planning info       | JSON file listing planning information relevant to the input L0 file                                     |
| Auxiliary info      | JSON file listing the relative pathnames of the input files and folders                                  |

The input files shall be collected in the working directory. The working directory must also contain two folders with names `input` and `output`. The input folder must contain the auxiliary info JSON file named contents.json. The structure of this file is described below.
#### Calibration package
The applicable Metis calibration package is the L1 calibration package called `LTP00`.
#### SPICE kernels
The latest version of Solar Orbiter’s SPICE kernels can be retrieved from the repository at the following URL:
https://s2e2.cosmos.esa.int/bitbucket/scm/spice_kernels/solar-orbiter.git
#### HK parameters
The HK parameter JSON file shall contain the following fields.
| Name         | Description                                    | Type         |
| ------------ | ---------------------------------------------- | ------------ |
| **PAR_NAME** | Parameter name                                 | String array |
| **PACKET**   | Name of the TM packet the parameter belongs to | String array |
| **GEN_TIME** | Packet generation time in UTC                  | String array |
| **REC_TIME** | Packet reception time in UTC (not used)        | String array |
| **RAW_VAL**  | Parameter raw (uncalibrated) value             | String array |
| **ENG_VAL**  | Parameter engineering (calibrated) value       | String array |
| **UNIT**     | Calibration unit (if applicable)               | String array |
| **DESC**     | Description                                    | String array |
##### Mandatory HK parameters
The HK parameter JSON file shall contain values for the following mandatory parameters.
| Name         | Description                   | Applicable data types |
| ------------ | ----------------------------- | --------------------- |
| **NIT0E050** | UVDA temperature              | 1, 4, 6               |
| **NIT0E070** | HVU Screen commanded voltage  | 1, 4, 6               |
| **NIT0E071** | HVU MCP commanded voltage     | 1, 4, 6               |
| **NIT0E0B5** | HVU temperature               | 1, 4, 6               |
| **NIT0E0B6** | HVU MCP read voltage          | 1, 4, 6               |
| **NIT0E0B7** | HVU Screen + MCP read voltage | 1, 4, 6               |
| **NIT0E0BF** | HVU MCP read current          | 1, 4, 6               |
| **NIT0E0E0** | VLDA temperature              | 0, 3, 5               |
| **NIT0L00D** | PMP temperature               | 0, 3, 5               |
#### Planning info

The planning info JSON file shall contain the following fields.

| Name               | Description                                                                                 | Type    | Default             |
| ------------------ | ------------------------------------------------------------------------------------------- | ------- | ------------------- |
| **MISSION_LTP**    | Number of the mission LTP the data belongs to                                               | Integer | N/A                 |
| **MISSION_STP**    | Number of the mission STP the data belongs to                                               | Integer | N/A                 |
| **IOR_NUMBER**     | ID of the IOR file the observation belongs to (not used)                                    | Integer | N/A                 |
| **IOR_VERSION**    | Version ID of the IOR file the observation belongs to (not used)                            | Integer | N/A                 |
| **SOOP_NAME**      | Name of the SOOP the data belongs to, if applicable                                         | String  | “none”              |
| **SESSION_NUMBER** | Acquisition session number                                                                  | String  | N/A                 |
| **SEQUENCE_NAME**  | Name of the start-acquisition sequence that generated the data (not used)                   | String  | N/A                 |
| **OBS_ID**         | Observation ID                                                                              | String  | “none”              |
| **OBS_MODE**       | Observation mode                                                                            | String  | “METIS_GENERIC_OBS” |
| **UNIQUE_ID**      | Unique ID associated with the start-acquisition sequence that generated the data (not used) | String  | N/A                 |
| **ACTION_TIME**    | Action time of the start-acquisition sequence that generated the data (not used)            | String  | N/A                 |
| **PARAM_COUNT**    | Number of parameters of the start-acquisition sequence that generated the data (not used)   | Integer | N/A                 |
#### Auxiliary info
The auxiliary info JSON file shall contain the following fields.
| Name                   | Description                                                                                    | Type    |
| ---------------------- | ---------------------------------------------------------------------------------------------- | ------- |
| **FILE_NAME**          | Pathname of the L0 FITS file to be processed                                                   | String  |
| **CAL_PACK_PATH**      | Pathname of the calibration package folder                                                     | String  |
| **SPICE_KERNELS**      | Pathname of the Solar Orbiter’s SPICE kernel folder                                            | String  |
| **HK_FILE_NAME**       | Pathname of the HK parameter JSON file                                                         | String  |
| **PLANNING_FILE_NAME** | Pathname of the planning info JSON file                                                        | String  |
| **L1_VERSION**         | Highest number version of existing L1 FITS files generated from the same L0 FITS file in input | Integer |
| **HDR_VERSION**        | Version of the scientific header                                                               | String  |
| **SW_VERSION**         | Version of environment and pipeline software                                                   | String  |
| **IDB_VERSION**        | Version of Metis IDB                                                                           | String  |
| **OBSW_VERSION**       | Version of Metis on-board software                                                             | String  |
| **SK_ARC_VERSION**     | Version of Solar Orbiter’s SPICE kernels (not used)                                            | String  |
All pathnames listed in the auxiliary info JSON file shall be relative to the working directory.
### Outputs
| Name           | Description                                                   |
| -------------- | ------------------------------------------------------------- |
| L1 FITS file   | Generated L1 FITS file                                        |
| Log            | Plain-text file with information about the pipeline execution |
| Auxiliary info | JSON file listing the relative pathnames of the output files  |

The output files will be saved into the output folder contained in the working directory. The auxiliary info JSON file will have name `contents.json`.

#### Auxiliary info

The auxiliary info JSON file shall contain the following fields.

| Name              | Description                                                                                     | Type         |
| ----------------- | ----------------------------------------------------------------------------------------------- | ------------ |
| **FILE_NAME**     | Pathname of the generated L1 FITS file                                                          | String       |
| **L0_FILE_NAME**  | Pathname of the input L0 FITS file                                                              | String       |
| **LOG_FILE_NAME** | Pathname off the log file                                                                       | String       |
| **EMPTY_PARAMS**  | List of parameters in the HK parameter JSON file for which calibrated values were not available | String array |

### Exit codes

The following codes are returned.

| Code | Description                                                    | Type    |
| ---- | -------------------------------------------------------------- | ------- |
| 0    | Successful execution                                           | Success |
| 1    | Parameter not found in house-keeping table                     | Error   |
| 2    | Insufficient number of parameter values in house-keeping table | Error   |
| 3    | Interpolation of HK parameter failed                           | Error   |

## Deploy and execution

### Build and Deploy Environment

Below is a list of the specific tools that shall be used for the build and deploy of the release.

| Tool/Software | Version        |
| ------------- | -------------- |
| IDL           | 8.7.2 or later |

### Dependencies

| Tool/Software              | Version | Comments                                        |
| -------------------------- | ------- | ----------------------------------------------- |
| NASA Astronomy Libraries   | Latest  | See https://idlastro.gsfc.nasa.gov              |
| NAIF SPICE Toolkit for IDL | Latest  | See https://naif.jpl.nasa.gov/naif/toolkit.html |

### Procedures

- check_quality.pro
- decode_obt.pro
- fits_hdr2struct.pro
- fix_fits_header.pro
- get_light_time.pro
- interpol_param.pro
- json_write.pro
- load_spice_kernels.pro
- make_bin_table.pro
- metis_l1_prep.pro (main program)
- metis_rectify.pro
- metis_wcs.pro
- solo_get_carringrot.pro
- solo_get_coords.pro
- solo_get_ephemeris.pro
- solo_get_pointing.pro
- solo_get_solar_angles.pro
- solo_obt2utc.pro
- solo_utc2obt.pro

### Execution

The main program shall be executed with the following command:

    idl -e metis_l1_prep
This command shall be run from a working directory containing the input and output folders and the input data files as described in the previous sections.