Quick test procedures for ``pyspex``
===========================================

The tests described in the document are performed using pyspex_ v1.3.7, but
should also be valid for any later release.

The test data files are freely available from the OB-DAAC_.

.. _pyspex: https://github.com/rmvanhees/pyspex.git
.. _OB-DAAC: https://oceandata.sci.gsfc.nasa.gov/api/file_search


Quick single input tests
------------------------
This section contains quick tests which can be performed to check the L1A
products generated by ``l1agen_spex.py`` or ``spx1_level01a``.

#. One input file with binning table 20 and 24 data::

   l1agen_spex.py <PATH>/SPX000000573.spx

   This command should produce the netCDF4 file `PACE_SPEXONE_OCAL.20240324T114855.L1A.nc`,
   its human-readable notation for netCDF objects and data in CDL is stored in the file:
   `PACE_SPEXONE_OCAL.20240324T114855.L1A.cdl`.

#. One input file without Science data, fails with return code 110::

   l1agen_spex.py <PATH>/SPX000000436.spx
   
   This command produces no L1A product. If you are interested in the content of the file
   then you can use the option `--dump`, which dumps the L0 data packages in ASCII.
   The output can be found in `SPX000000436.dump` and `SPX000000436_hk.dump`.

Tests using YAML configuration
------------------------------
Operational processing requires multiple file input, including SPEXone L0
products and HKT products. The latter contain PACE navigation data, necessary
for the determination of geo-location information by the L1A->L1B processor.

#. This example uses as input multiple files, which contain a subset of the measurements
   we will perform inflight during eclipse. The measurements are performed in *diagnostic
   mode* (full frame) which are stored in the file:
   
    `PACE_SPEXONE_CAL.20230105T143532.L1A.nc`
   and *science mode* measurements stored in the file:
   
    `PACE_SPEXONE_DARK.20230105T143356.L1A.nc`.
   The CDL files of the generated L1A products can be found in the current directory.
   The L1A processor can be called as follows::
   
   l1agen_spex.py --yaml run_429-432.yaml
   
   This is the content of the YAML file used to process the data::

    outdir: <PATH>/L1A
    outfile: ''
    file_version: 1
    compression: False
    eclipse: True
    l0_list:
    - <PATH>/SPX000000429.spx
    - <PATH>/SPX000000430.spx
    - <PATH>/SPX000000431.spx
    - <PATH>/SPX000000432.spx
#. This example uses as input multiple L0 products and HKT products. A typical example of operational
   processing but still with simulated data::
   
   l1agen_spex.py --yaml run_393-398+hkt.yaml
   
   The name of the radiance product is:
   
    `PACE_SPEXONE.20240324T143103.L1A.nc`.
   The CDL files of the generated L1A products can be found in the current directory.
   This is the content of the YAML file used to process the data::

    outdir: <PATH>/L1A
    outfile: ''
    file_version: 1
    compression: False
    eclipse: False
    eclipse: False
    hkt_list:
    - <PATH>/PACE.20240324T142500.HKT.nc
    - <PATH>/PACE.20240324T151300.HKT.nc
    l0_list:
    - <PATH>/SPX000000393.spx
    - <PATH>/SPX000000394.spx
    - <PATH>/SPX000000395.spx
    - <PATH>/SPX000000396.spx
    - <PATH>/SPX000000397.spx
    - <PATH>/SPX000000398.spx

