Logo
  • Home

Tutorials

  • Overview
  • Your first query
  • Translate a filter into API parameters
    • Build and translate the filter
    • What to look for
  • Level 1.0 data from the "Cart_Site" for AOD daily averages

How-to guides

  • Overview
  • CLI workflows
  • Level 1.5 data from all sites with available data for all AOD points
  • Level 2.0 data from the "Cart_Site" for AOD daily averages
  • Level 2.0 data from the "Cart_Site" for SDA daily averages
  • Geographical search
  • Stations Discovery
  • Match-Up
  • Stations Discovery + Match-Up
  • Development and documentation

Reference

  • Overview
  • CLI
  • Filters
  • Python API
  • AERONET OpenAPI

Explanation

  • Query processing
  • Software design
pygeofilter AERONET API support for CQL2
  • Tutorials
  • Translate a filter into API parameters
  • Edit on Terradue/pygeofilter-aeronet

Translate a filter into API parameters¶

In this exercise you will turn a CQL2 JSON filter into an AERONET query string without downloading observations.

Install pygeofilter-aeronet and jupyterlab, then open this notebook in JupyterLab. An internet connection is required because importing the package initializes DuckDB spatial support and reads the hosted station catalogue.

Run the cells below in order.

Build and translate the filter¶

The filter below selects daily Level 1.0 AOD observations for Cart_Site during February 2023. Run the next cell to inspect the translated query string.

What to look for¶

The output should contain site=Cart_Site, AOD10=1, if_no_html=1, and AVG=20, followed by the start and end date parameters. The result describes a request; it does not confirm that observations exist for that period.

After inspecting the output, change daily-average to all-points and rerun the code cell. AVG=20 becomes AVG=10.

Continue with Your first AERONET query to download and read observations, or consult the filter reference.

In [1]:
Copied!
from pygeofilter_aeronet.evaluator import to_aeronet_api

cql2_filter = {
    "op": "and",
    "args": [
        {"op": "eq", "args": [{"property": "site"}, "Cart_Site"]},
        {"op": "eq", "args": [{"property": "data_type"}, "AOD10"]},
        {"op": "eq", "args": [{"property": "format"}, "csv"]},
        {"op": "eq", "args": [{"property": "data_format"}, "daily-average"]},
        {
            "op": "t_after",
            "args": [
                {"property": "time"},
                {"timestamp": "2023-02-01T00:00:00Z"},
            ],
        },
        {
            "op": "t_before",
            "args": [
                {"property": "time"},
                {"timestamp": "2023-02-28T23:59:59Z"},
            ],
        },
    ],
}

query, _ = to_aeronet_api(cql2_filter)
query
from pygeofilter_aeronet.evaluator import to_aeronet_api cql2_filter = { "op": "and", "args": [ {"op": "eq", "args": [{"property": "site"}, "Cart_Site"]}, {"op": "eq", "args": [{"property": "data_type"}, "AOD10"]}, {"op": "eq", "args": [{"property": "format"}, "csv"]}, {"op": "eq", "args": [{"property": "data_format"}, "daily-average"]}, { "op": "t_after", "args": [ {"property": "time"}, {"timestamp": "2023-02-01T00:00:00Z"}, ], }, { "op": "t_before", "args": [ {"property": "time"}, {"timestamp": "2023-02-28T23:59:59Z"}, ], }, ], } query, _ = to_aeronet_api(cql2_filter) query
Out[1]:
'site=Cart_Site&AOD10=1&if_no_html=1&AVG=20&year=2023&month=2&day=1&hour=0&year2=2023&month2=2&day2=28&hour2=23'
Previous Next

Apache License, Version 2.0

Built with MkDocs using a theme provided by Read the Docs.
Terradue/pygeofilter-aeronet « Previous Next »