Search for SLC Sentinel-1 products

[1]:
import lxml.etree as etree
import requests
import cioppy
ciop = cioppy.Cioppy()
[2]:
def get_params(osd):

    oss_ns = {'a':'http://www.w3.org/2001/XMLSchema',
          'b':'http://www.w3.org/2001/XMLSchema-instance',
          'c':'http://a9.com/-/opensearch/extensions/time/1.0/',
          'd':'http://www.opengis.net/eop/2.0',
          'e':'http://purl.org/dc/terms/',
          'f':'http://a9.com/-/spec/opensearch/extensions/parameters/1.0/',
          'g':'http://purl.org/dc/elements/1.1/',
          'h':'http://www.terradue.com/opensearch',
          'i':'http://a9.com/-/opensearch/extensions/geo/1.0/',
          'j':'http://a9.com/-/spec/opensearch/1.1/'}

    oss_content = etree.fromstring(requests.get(osd).content)

    url_template_element = oss_content.xpath('/j:OpenSearchDescription/j:Url[@type="application/atom+xml"]',
                                                 namespaces=oss_ns)[0]

    parameters = dict()

    for index, parameter in enumerate(url_template_element.xpath('.//f:Parameter', namespaces=oss_ns)):

        parameters[parameter.attrib['name']] = {'title' : parameter.attrib['title'],
                                                'value' : parameter.attrib['value']}

        options = []
        for option in parameter.xpath('.//f:Option', namespaces=oss_ns):

            options.append(option.attrib['value'])

        parameters[parameter.attrib['name']] = {'title' : parameter.attrib['title'],
                                                'value' : parameter.attrib['value'],
                                                'options' : options}
    return parameters
[3]:
def get_param_value(osd, os_parameter):

    params = get_params(osd)

    res = None

    for index, param in enumerate(params):

        if params[param]['value'] == os_parameter:

            res = params[param]
            res['name'] = param

    return res

Define the Sentinel-1 endpoint

[4]:
s1_osd_url = 'https://catalog.terradue.com/sentinel1/description'

Get the Sentinel-1 search parameters

[5]:
s1_parameters = get_params(s1_osd_url)

Print all the OpenSearch parameters

[6]:
for key, value in s1_parameters.iteritems():

    print '%24s' % s1_parameters[key]['value'], s1_parameters[key]['title']
              {geo:uid?} The identifier of the resource within the search engine context (local reference)
    {t2:downloadOrigin?} a string that identifies the download origin (keyword, hostname...) to adapt the enclosure. If the parameter is enclosed between [] (e.g. [terradue]), enclosure will be returned only if there is a enclosure found for this source.
       {eop:cloudCover?} A number, set or interval requesting the cloud coverage
            {startIndex} index of the first search result desired
   {t2:vendorSpecifics?} A number, set or interval filtering vendor specific name:value
             {startPage} page number of the set of search results desired
       {eop:sensorType?} A string identifying the sensor type
     {eop:accessedFrom?} A string identifying the location from which the resource will be accessed. The catalogue shall return the download location in the enclosure atom link according to the parameter value.
         {t2:landCover?} A number, set or interval requesting the land coverage
      {eop:productType?} A string identifying the product type
           {time:start?} start of the temporal interval (RFC-3339)
 {eop:sensorResolution?} A string identifying the sensor spectral range
           {sct:source?} The URI of a source link (rel=via in ATOM).
  {eop:swathIdentifier?} Swath identifier that corresponds to precise incidence angles for the sensor
         {geo:geometry?} Geometry in WKT
         {geo:relation?} Spatial relation (possible values are “intersects”, “contains”, “disjoint”). The default is intersects.
 {eop:parentIdentifier?} A string identifying the collection of the entry in a hierarchy of dataset
  {eop:processingLevel?} A string identifying the processing level applied to the dataset
              {language} desired language of the results
{eop:platformSerialIdentifier?} A string with the Platform serial identifier
         {eop:platform?} A string with the platform short name
            {eop:track?} A number, set or interval requesting the range of orbit tracks
{t2:doubleCheckGeomtry?} Set to apply a finer geometry filtering
             {time:end?} stop of the temporal interval (RFC-3339)
         {dct:modified?} date after which dataset are updated (RFC-3339)
              {geo:box?} Rectangular bounding box
                 {count} number of search results per page desired
        {time:relation?} Temporal relation (possible values are “intersects”, “contains”, “during”, “disjoint”, “equals”)
   {eop:orbitDirection?} A string identifying the orbit direction
          {dct:subject?} The identifier of a category. Recommended best practice is to use a controlled vocabulary.
           {searchTerms} EO Free Text Search
         {t2:extension?} The value:name of a extension.
       {eop:instrument?} A string identifying the instrument
            {eop:title?} A name given to the resource
        {eop:orbitType?} A string identifying the orbit type

Find the parameter associated to ‘{eop:productType?}’ and its options

[7]:
product_type_parameter = get_param_value(s1_osd_url, '{eop:productType?}')
download_origin_parameter = get_param_value(s1_osd_url, '{t2:downloadOrigin?}')
[8]:
product_type_parameter['name']
[8]:
'pt'
[9]:
options = s1_parameters[product_type_parameter['name']]['options']
[10]:
options
[10]:
['GRD', 'RAW', 'SLC', 'OCN']

Now search for SLC products creating a dictionary with the search parameters

[11]:
search_params = dict([(product_type_parameter['name'],
                       options[2]),(download_origin_parameter['name'], 'terradue')])
[12]:
search_params
[12]:
{'do': 'terradue', 'pt': 'SLC'}
[13]:
sensor_type_parameter = get_param_value(s1_osd_url, '{eop:sensorType?}')
[14]:
sensor_type_parameter['name']
[14]:
'st'
[15]:
options = s1_parameters[sensor_type_parameter['name']]['options']
[16]:
search = ciop.search(end_point=s1_osd_url,
                     params=search_params,
                     output_fields='self,productType,track,enclosure,identifier,wkt,startdate,enddate,polarisationChannels',
                     model='EOP')

Show the first result returned

[17]:
search[0]
[17]:
{'enclosure': 'https://store.terradue.com/download/sentinel1/files/v1/S1B_WV_SLC__1SSV_20190507T080616_20190507T081452_016135_01E5BC_48A6',
 'enddate': '2019-05-07T08:14:52.3990000Z',
 'identifier': 'S1B_WV_SLC__1SSV_20190507T080616_20190507T081452_016135_01E5BC_48A6',
 'polarisationChannels': 'VV',
 'productType': 'SLC',
 'self': 'https://catalog.terradue.com/sentinel1/search?format=atom&uid=S1B_WV_SLC__1SSV_20190507T080616_20190507T081452_016135_01E5BC_48A6',
 'startdate': '2019-05-07T08:06:16.8280000Z',
 'track': '9',
 'wkt': 'POLYGON((-53.356213 -55.926842,-53.234772 -55.763161,-50.32679 -55.642445,-49.999165 -55.711193,-49.890366 -55.539688,-48.947655 -54.019253,-47.956585 -52.322357,-47.048164 -50.615124,-46.197945 -48.901337,-45.399315 -47.182137,-44.646126 -45.458092,-43.919273 -43.732742,-43.243015 -42.000259,-42.598835 -40.263813,-41.983528 -38.5242,-41.381111 -36.783916,-40.815392 -35.038166,-40.270462 -33.289383,-39.744553 -31.537874,-39.693222 -31.359335,-39.235916 -29.784475,-38.732239 -28.031361,-38.253826 -26.274025,-38.206898 -26.094782,-38.413788 -26.048946,-40.464115 -26.514153,-40.513931 -26.687439,-40.980278 -28.263489,-41.031712 -28.436436,-41.514088 -30.010492,-41.567341 -30.183226,-42.067226 -31.755342,-42.122452 -31.927767,-42.647335 -33.495312,-42.704777 -33.667507,-43.244946 -35.233597,-43.304703 -35.405216,-43.86792 -36.967983,-43.930363 -37.139362,-44.519386 -38.699024,-44.584763 -38.870018,-45.208595 -40.424297,-45.277222 -40.594826,-45.926044 -42.146637,-45.99826 -42.316669,-46.681759 -43.863625,-46.757996 -44.033146,-47.480659 -45.575615,-47.56134 -45.744469,-48.32761 -47.281422,-48.413361 -47.449715,-49.236412 -48.979935,-49.327839 -49.147488,-50.198212 -50.671547,-50.295937 -50.838139,-51.228756 -52.35466,-51.333801 -52.520473,-52.337719 -54.028667,-52.451004 -54.193443,-53.54282 -55.6894,-53.665398 -55.852787,-53.356213 -55.926842))'}

You can, of course, set the search parameters directly with:

[18]:
search = ciop.search(end_point=s1_osd_url,
                     params={'pt': 'SLC'},
                     output_fields='self,productType,track,enclosure,identifier,wkt,startdate',
                     model='EOP')
[19]:
search[0]
[19]:
{'enclosure': "https://scihub.copernicus.eu/apihub/odata/v1/Products('7245f5c4-eecd-4afb-9834-82bb021d96e1')/$value",
 'identifier': 'S1B_WV_SLC__1SSV_20190507T080616_20190507T081452_016135_01E5BC_48A6',
 'productType': 'SLC',
 'self': 'https://catalog.terradue.com/sentinel1/search?format=atom&uid=S1B_WV_SLC__1SSV_20190507T080616_20190507T081452_016135_01E5BC_48A6',
 'startdate': '2019-05-07T08:06:16.8280000Z',
 'track': '9',
 'wkt': 'POLYGON((-53.356213 -55.926842,-53.234772 -55.763161,-50.32679 -55.642445,-49.999165 -55.711193,-49.890366 -55.539688,-48.947655 -54.019253,-47.956585 -52.322357,-47.048164 -50.615124,-46.197945 -48.901337,-45.399315 -47.182137,-44.646126 -45.458092,-43.919273 -43.732742,-43.243015 -42.000259,-42.598835 -40.263813,-41.983528 -38.5242,-41.381111 -36.783916,-40.815392 -35.038166,-40.270462 -33.289383,-39.744553 -31.537874,-39.693222 -31.359335,-39.235916 -29.784475,-38.732239 -28.031361,-38.253826 -26.274025,-38.206898 -26.094782,-38.413788 -26.048946,-40.464115 -26.514153,-40.513931 -26.687439,-40.980278 -28.263489,-41.031712 -28.436436,-41.514088 -30.010492,-41.567341 -30.183226,-42.067226 -31.755342,-42.122452 -31.927767,-42.647335 -33.495312,-42.704777 -33.667507,-43.244946 -35.233597,-43.304703 -35.405216,-43.86792 -36.967983,-43.930363 -37.139362,-44.519386 -38.699024,-44.584763 -38.870018,-45.208595 -40.424297,-45.277222 -40.594826,-45.926044 -42.146637,-45.99826 -42.316669,-46.681759 -43.863625,-46.757996 -44.033146,-47.480659 -45.575615,-47.56134 -45.744469,-48.32761 -47.281422,-48.413361 -47.449715,-49.236412 -48.979935,-49.327839 -49.147488,-50.198212 -50.671547,-50.295937 -50.838139,-51.228756 -52.35466,-51.333801 -52.520473,-52.337719 -54.028667,-52.451004 -54.193443,-53.54282 -55.6894,-53.665398 -55.852787,-53.356213 -55.926842))'}