Logo
  • Home

Tutorials

  • Overview
  • Your first query
  • Translate a filter into API parameters
  • 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
    • Execute the operation
    • Visualize the results as Data Frame
    • Visualize results on Map screen
  • 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
  • How-to guides
  • Level 1.5 data from all sites with available data for all AOD points
  • Edit on Terradue/pygeofilter-aeronet

Level 1.5 data from all sites with available data for all AOD points¶

Define a cql2-json filter for:

https://aeronet.gsfc.nasa.gov/cgi-bin/print_web_data_v3?year=2000&month=6&day=1&year2=2000&month2=6&day2=14&AOD15=1&AVG=10

In [1]:
Copied!
from pathlib import Path
from pystac import Item

import json
import sys

out_dir: Path = Path('.')

cql2_filter = {
    "op": "and",
    "args": [
        {"op": "eq", "args": [{"property": "data_type"}, "AOD15"]},
        {"op": "eq", "args": [{"property": "format"}, "csv"]},
        {"op": "eq", "args": [{"property": "data_format"}, "all-points"]},
        {
            "op": "t_after",
            "args": [
                {"property": "time"},
                {"timestamp": "2000-06-01T00:00:00Z"},
            ],
        },
        {
            "op": "t_before",
            "args": [
                {"property": "time"},
                {"timestamp": "2000-06-14T23:59:59Z"},
            ],
        },
    ],
}

json.dump(cql2_filter, sys.stdout, indent=2)
from pathlib import Path from pystac import Item import json import sys out_dir: Path = Path('.') cql2_filter = { "op": "and", "args": [ {"op": "eq", "args": [{"property": "data_type"}, "AOD15"]}, {"op": "eq", "args": [{"property": "format"}, "csv"]}, {"op": "eq", "args": [{"property": "data_format"}, "all-points"]}, { "op": "t_after", "args": [ {"property": "time"}, {"timestamp": "2000-06-01T00:00:00Z"}, ], }, { "op": "t_before", "args": [ {"property": "time"}, {"timestamp": "2000-06-14T23:59:59Z"}, ], }, ], } json.dump(cql2_filter, sys.stdout, indent=2)
{
  "op": "and",
  "args": [
    {
      "op": "eq",
      "args": [
        {
          "property": "data_type"
        },
        "AOD15"
      ]
    },
    {
      "op": "eq",
      "args": [
        {
          "property": "format"
        },
        "csv"
      ]
    },
    {
      "op": "eq",
      "args": [
        {
          "property": "data_format"
        },
        "all-points"
      ]
    },
    {
      "op": "t_after",
      "args": [
        {
          "property": "time"
        },
        {
          "timestamp": "2000-06-01T00:00:00Z"
        }
      ]
    },
    {
      "op": "t_before",
      "args": [
        {
          "property": "time"
        },
        {
          "timestamp": "2000-06-14T23:59:59Z"
        }
      ]
    }
  ]
}

Execute the search operation¶

In [2]:
Copied!
from pygeofilter_aeronet import aeronet_search

item: Item = aeronet_search(
    cql2_filter=cql2_filter,
    output_dir=out_dir
)

json.dump(item.to_dict(), sys.stdout, indent=2)
from pygeofilter_aeronet import aeronet_search item: Item = aeronet_search( cql2_filter=cql2_filter, output_dir=out_dir ) json.dump(item.to_dict(), sys.stdout, indent=2)
2025-11-14 18:04:17.940 | SUCCESS  | pygeofilter_aeronet:aeronet_search:231 - Query on https://aeronet.gsfc.nasa.gov successfully obtained data:
2025-11-14 18:04:18.751 | SUCCESS  | pygeofilter_aeronet:aeronet_search:239 - Data saved to to CSV file: /home/stripodi/Documents/pygeofilter/pygeofilter-aeronet/docs/samples/0c0a6b0a-fb4c-4930-abbc-374e447739e8.csv
2025-11-14 18:04:18.976 | SUCCESS  | pygeofilter_aeronet:aeronet_search:270 - Data saved to GeoParquet file: /home/stripodi/Documents/pygeofilter/pygeofilter-aeronet/docs/samples/0c0a6b0a-fb4c-4930-abbc-374e447739e8.parquet
{
  "type": "Feature",
  "stac_version": "1.1.0",
  "stac_extensions": [],
  "id": "urn:uuid:0c0a6b0a-fb4c-4930-abbc-374e447739e8",
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          -157.789717,
          -34.555425
        ],
        [
          166.9159,
          -34.555425
        ],
        [
          166.9159,
          64.742805
        ],
        [
          -157.789717,
          64.742805
        ],
        [
          -157.789717,
          -34.555425
        ]
      ]
    ]
  },
  "bbox": [
    -157.789717,
    -34.555425,
    166.9159,
    64.742805
  ],
  "properties": {
    "datetime": "2025-11-14T18:04:19.064758Z"
  },
  "links": [
    {
      "rel": "related",
      "href": "https://aeronet.gsfc.nasa.gov/cgi-bin/print_web_data_v3?AOD15=1&if_no_html=1&AVG=10&year=2000&month=6&day=1&hour=0&year2=2000&month2=6&day2=14&hour2=23",
      "type": "text/csv",
      "title": "AERONET Web Service search"
    }
  ],
  "assets": {
    "csv": {
      "href": "0c0a6b0a-fb4c-4930-abbc-374e447739e8.csv",
      "type": "text/csv",
      "description": "Search result - CVS Format"
    },
    "geoparquet": {
      "href": "0c0a6b0a-fb4c-4930-abbc-374e447739e8.parquet",
      "type": "application/vnd.apache.parquet",
      "description": "Search result - GeoParquet Format"
    }
  }
}

Visualize the results as Data Frame¶

In [3]:
Copied!
from geopandas import read_parquet
from geopandas.geodataframe import GeoDataFrame

geoparquet_file: str = item.get_assets()['geoparquet'].href
geoparquet_data: GeoDataFrame = read_parquet(geoparquet_file)

geoparquet_data
from geopandas import read_parquet from geopandas.geodataframe import GeoDataFrame geoparquet_file: str = item.get_assets()['geoparquet'].href geoparquet_data: GeoDataFrame = read_parquet(geoparquet_file) geoparquet_data
Out[3]:
AERONET_Site Date(dd:mm:yyyy) Time(hh:mm:ss) Day_of_Year Day_of_Year(Fraction) AOD_1640nm AOD_1020nm AOD_870nm AOD_865nm AOD_779nm ... Exact_Wavelengths_of_PW(um)_935nm Exact_Wavelengths_of_AOD(um)_681nm Exact_Wavelengths_of_AOD(um)_709nm Exact_Wavelengths_of_AOD(um)_Empty Exact_Wavelengths_of_AOD(um)_Empty.1 Exact_Wavelengths_of_AOD(um)_Empty.2 Exact_Wavelengths_of_AOD(um)_Empty.3 Exact_Wavelengths_of_AOD(um)_Empty.4 geometry datetime
0 Alta_Floresta 01:06:2000 10:35:11 153 153.441100 -999.0 -999.000000 0.036698 -999.0 -999.0 ... 0.9364 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-56.10445 -9.87134) 2000-06-01 10:35:11
1 Alta_Floresta 01:06:2000 10:38:01 153 153.443067 -999.0 -999.000000 0.035715 -999.0 -999.0 ... 0.9364 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-56.10445 -9.87134) 2000-06-01 10:38:01
2 Alta_Floresta 01:06:2000 10:41:20 153 153.445370 -999.0 -999.000000 0.030944 -999.0 -999.0 ... 0.9364 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-56.10445 -9.87134) 2000-06-01 10:41:20
3 Alta_Floresta 01:06:2000 10:45:17 153 153.448113 -999.0 -999.000000 0.030626 -999.0 -999.0 ... 0.9364 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-56.10445 -9.87134) 2000-06-01 10:45:17
4 Alta_Floresta 01:06:2000 10:50:02 153 153.451412 -999.0 -999.000000 0.031351 -999.0 -999.0 ... 0.9364 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-56.10445 -9.87134) 2000-06-01 10:50:02
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
17678 Sioux_Falls_X 12:06:2000 00:34:12 164 164.023750 -999.0 0.045764 0.050797 -999.0 -999.0 ... 0.9353 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-96.62598 43.73628) 2000-06-12 00:34:12
17679 Sioux_Falls_X 12:06:2000 00:51:30 164 164.035764 -999.0 0.049516 0.054518 -999.0 -999.0 ... 0.9353 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-96.62598 43.73628) 2000-06-12 00:51:30
17680 Sioux_Falls_X 12:06:2000 00:57:49 164 164.040150 -999.0 0.048396 0.053796 -999.0 -999.0 ... 0.9353 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-96.62598 43.73628) 2000-06-12 00:57:49
17681 Sioux_Falls_X 14:06:2000 15:43:51 166 166.655451 -999.0 0.014850 0.016013 -999.0 -999.0 ... 0.9353 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-96.62598 43.73628) 2000-06-14 15:43:51
17682 Sioux_Falls_X 14:06:2000 15:58:53 166 166.665891 -999.0 0.014560 0.016502 -999.0 -999.0 ... 0.9353 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 POINT (-96.62598 43.73628) 2000-06-14 15:58:53

17683 rows × 116 columns

Visualize results on Map screen¶

In [4]:
Copied!
from folium import (
    GeoJson,
    LayerControl,
    Map
)
from folium.plugins import (
    Fullscreen
)
from IPython.display import (
    display,
    HTML
)

map: Map = Map()
layer_control = LayerControl(position="topright", collapsed=True)
fullscreen = Fullscreen()
style = {"fillColor": "#00000000", "color": "#0000ff", "weight": 1}

footprints: GeoJson = GeoJson(
    geoparquet_data.dissolve(by='AERONET_Site').to_json(default=str),
    name="Stac Item footprints",
    style_function=lambda x: style,
    control=True,
)

footprints.add_to(map)
layer_control.add_to(map)
fullscreen.add_to(map)
map.fit_bounds(map.get_bounds()) # type: ignore not to important for the demo
map
from folium import ( GeoJson, LayerControl, Map ) from folium.plugins import ( Fullscreen ) from IPython.display import ( display, HTML ) map: Map = Map() layer_control = LayerControl(position="topright", collapsed=True) fullscreen = Fullscreen() style = {"fillColor": "#00000000", "color": "#0000ff", "weight": 1} footprints: GeoJson = GeoJson( geoparquet_data.dissolve(by='AERONET_Site').to_json(default=str), name="Stac Item footprints", style_function=lambda x: style, control=True, ) footprints.add_to(map) layer_control.add_to(map) fullscreen.add_to(map) map.fit_bounds(map.get_bounds()) # type: ignore not to important for the demo map
Out[4]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Previous Next

Apache License, Version 2.0

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