Level 2.0 data from the "Cart_Site" for AOD daily averages¶
Define a cql2-json filter for:
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": "site"}, "Cart_Site"]},
{"op": "eq", "args": [{"property": "data_type"}, "AOD20"]},
{"op": "eq", "args": [{"property": "format"}, "csv"]},
{"op": "eq", "args": [{"property": "data_format"}, "daily-average"]},
{
"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": "site"}, "Cart_Site"]},
{"op": "eq", "args": [{"property": "data_type"}, "AOD20"]},
{"op": "eq", "args": [{"property": "format"}, "csv"]},
{"op": "eq", "args": [{"property": "data_format"}, "daily-average"]},
{
"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": "site"
},
"Cart_Site"
]
},
{
"op": "eq",
"args": [
{
"property": "data_type"
},
"AOD20"
]
},
{
"op": "eq",
"args": [
{
"property": "format"
},
"csv"
]
},
{
"op": "eq",
"args": [
{
"property": "data_format"
},
"daily-average"
]
},
{
"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:07:57.256 | SUCCESS | pygeofilter_aeronet:aeronet_search:231 - Query on https://aeronet.gsfc.nasa.gov successfully obtained data: 2025-11-14 18:07:57.258 | SUCCESS | pygeofilter_aeronet:aeronet_search:239 - Data saved to to CSV file: /home/stripodi/Documents/pygeofilter/pygeofilter-aeronet/docs/samples/845a1e47-b937-4ed6-8a8f-1524df33d9fd.csv 2025-11-14 18:07:57.266 | SUCCESS | pygeofilter_aeronet:aeronet_search:270 - Data saved to GeoParquet file: /home/stripodi/Documents/pygeofilter/pygeofilter-aeronet/docs/samples/845a1e47-b937-4ed6-8a8f-1524df33d9fd.parquet
{
"type": "Feature",
"stac_version": "1.1.0",
"stac_extensions": [],
"id": "urn:uuid:845a1e47-b937-4ed6-8a8f-1524df33d9fd",
"geometry": {
"type": "Point",
"coordinates": [
-97.48639,
36.60667
]
},
"bbox": [
-97.48639,
36.60667,
-97.48639,
36.60667
],
"properties": {
"datetime": "2025-11-14T18:07:57.296674Z"
},
"links": [
{
"rel": "related",
"href": "https://aeronet.gsfc.nasa.gov/cgi-bin/print_web_data_v3?site=Cart_Site&AOD20=1&if_no_html=1&AVG=20&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": "845a1e47-b937-4ed6-8a8f-1524df33d9fd.csv",
"type": "text/csv",
"description": "Search result - CVS Format"
},
"geoparquet": {
"href": "845a1e47-b937-4ed6-8a8f-1524df33d9fd.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 | AOD_1640nm | AOD_1020nm | AOD_870nm | AOD_865nm | AOD_779nm | AOD_675nm | ... | N[340-440_Angstrom_Exponent] | N[440-675_Angstrom_Exponent[Polar]] | Data_Quality_Level | AERONET_Instrument_Number | AERONET_Site_Name | Site_Latitude(Degrees) | Site_Longitude(Degrees) | Site_Elevation(m) | geometry | datetime | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Cart_Site | 31:05:2000 | 12:00:00 | 152 | -999.0 | 0.035200 | 0.051679 | -999.0 | -999.0 | 0.061963 | ... | 34 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-05-31 12:00:00 |
| 1 | Cart_Site | 01:06:2000 | 12:00:00 | 153 | -999.0 | 0.049179 | 0.065103 | -999.0 | -999.0 | 0.075437 | ... | 13 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-01 12:00:00 |
| 2 | Cart_Site | 04:06:2000 | 12:00:00 | 156 | -999.0 | 0.110029 | 0.141054 | -999.0 | -999.0 | 0.200035 | ... | 2 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-04 12:00:00 |
| 3 | Cart_Site | 05:06:2000 | 12:00:00 | 157 | -999.0 | 0.031582 | 0.042280 | -999.0 | -999.0 | 0.046784 | ... | 55 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-05 12:00:00 |
| 4 | Cart_Site | 06:06:2000 | 12:00:00 | 158 | -999.0 | 0.053464 | 0.077199 | -999.0 | -999.0 | 0.101528 | ... | 25 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-06 12:00:00 |
| 5 | Cart_Site | 07:06:2000 | 12:00:00 | 159 | -999.0 | 0.041645 | 0.057704 | -999.0 | -999.0 | 0.073657 | ... | 16 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-07 12:00:00 |
| 6 | Cart_Site | 08:06:2000 | 12:00:00 | 160 | -999.0 | 0.026916 | 0.039999 | -999.0 | -999.0 | 0.051110 | ... | 38 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-08 12:00:00 |
| 7 | Cart_Site | 09:06:2000 | 12:00:00 | 161 | -999.0 | 0.086260 | 0.115657 | -999.0 | -999.0 | 0.163068 | ... | 7 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-09 12:00:00 |
| 8 | Cart_Site | 11:06:2000 | 12:00:00 | 163 | -999.0 | 0.027895 | 0.040069 | -999.0 | -999.0 | 0.048234 | ... | 6 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-11 12:00:00 |
| 9 | Cart_Site | 12:06:2000 | 12:00:00 | 164 | -999.0 | 0.079964 | 0.094614 | -999.0 | -999.0 | 0.109477 | ... | 9 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-12 12:00:00 |
| 10 | Cart_Site | 13:06:2000 | 12:00:00 | 165 | -999.0 | 0.090479 | 0.104427 | -999.0 | -999.0 | 0.113828 | ... | 16 | 0 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | POINT (-97.48639 36.60667) | 2000-06-13 12:00:00 |
11 rows × 84 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