
.. Label between '.. _' and ':' ; use :ref:`text <label>` for reference
.. _s5p-so2-cobra-processing:

*************************************
Sentinel-5p SO2-COBRA data processing
*************************************

This chapter describes the tasks performed for processing Sentinel-5p SO\ :sub:`2` data
from the COBRA processing.

See also the chapter on the operational :ref:`s5p-so2-processing`.




Product description
===================

The product is available from the `S5P-PAL Data Portal <https://data-portal.s5p-pal.com/>`_;
see the information on the `SO2CBR <https://data-portal.s5p-pal.com/products/so2cbr.html>`_ page.




.. Label between '.. _' and ':' ; use :ref:`text <label>` for reference
.. _s5p-so2-cobra-inquire:

Inquire Sentinel-5p/SO2-COBRA archive
=====================================

S5p/SO2-COBRA retreievals are available from the
`Product Algorithm Laboratory <https://www.s5p-pal.com/>`_, or more specif, the
`S5P-PAL Data Portal <https://data-portal.s5p-pal.com/>`_;
see the :ref:`cso-pal` module for a detailed description.
  
Data is available for a single processing stream only, identified by a 4-character key:

* ``PAL_`` : processed data stored on the *Product Algorithm Laboratory* portal.

There might be data available from more than one processor version.
It is therefore necessary to inquire the archive first to see which data is available,
and what the version numbers are.

The :py:class:`CSO_PAL_Inquire <cso_scihub.CSO_PAL_Inquire>` class is available to inquire the remote archive. 
The settings used by this class allow selection on for example time range and intersection area. 
The result is a csv file which with columns for keywords such as orbit number and processor version,
as well as the filename of the data and the url that should be used to actually download the data::

    orbit;start_time;end_time;processing;collection;processor_version;filename;href
    24688;2022-07-19 12:17:52;2022-07-19 13:59:21;PAL_;03;010001;S5P_PAL__L2__SO2CBR_20220719T121752_20220719T135921_24688_03_010001_20221020T082900.nc;https://data-portal.s5p-pal.com/cat/sentinel-5p/download/88c15681-db43-4219-b391-c8567e39cccf
    24689;2022-07-19 13:59:21;2022-07-19 15:40:51;PAL_;03;010001;S5P_PAL__L2__SO2CBR_20220719T135921_20220719T154051_24689_03_010001_20221020T083203.nc;https://data-portal.s5p-pal.com/cat/sentinel-5p/download/c3a4df41-8fb1-417e-9ccb-191c0c777658
    :

See the section on *File name convention* in the *Product User Manual* for the meaning of all 
parts of the filename.

To visualize what is available from the various portals, the
:py:class:`CSO_Inquire_Plot <cso_inquire.CSO_Inquire_Plot>` could be used to create an overview figure:

.. figure:: figs/SO2-COBRA/Copernicus_S5p_SO2-COBRA.png
   :scale: 50 %
   :align: center
   :alt: Overview of available SO2-COBRA processings.

The jobtree configuration to inquire the portals and create the overview figure could look like::

    ! single step:
    cso.s5p.so2-cobra.inquire-pal.class                 :  utopya.UtopyaJobStep
    ! two tasks:
    cso.s5p.so2-cobra.inquire-pal.tasks                 :  table plot
    ! inquire task:
    cso.s5p.so2-cobra.inquire-pal.table.class           :  cso.CSO_PAL_Inquire
    cso.s5p.so2-cobra.inquire-pal.table.args            :  '${PWD}/config/ESA-S5p/cso-s5p-so2-cobra.rc', \
                                                          rcbase='cso.s5p.so2-cobra.inquire-table-pal'
    !~ create plot of available versions:
    cso.s5p.so2-cobra.inquire-pal.plot.class            :  cso.CSO_Inquire_Plot
    cso.s5p.so2-cobra.inquire-pal.plot.args             :  '${PWD}/config/ESA-S5p/cso-s5p-so2-cobra.rc', \
                                                          rcbase='cso.s5p.so2-cobra.inquire-pal-plot'

