Level 2.0 data from the "Cart_Site" for all SDA points¶
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"}, "SDA20"]},
{"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"}, "SDA20"]},
{"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"
},
"SDA20"
]
},
{
"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-18 21:48:19.395 | SUCCESS | pygeofilter_aeronet:aeronet_search:246 - Query on https://aeronet.gsfc.nasa.gov successfully obtained data:
2025-11-18 21:48:19.400 | SUCCESS | pygeofilter_aeronet:aeronet_search:259 - Data saved to to CSV file: /home/runner/work/pygeofilter-aeronet/pygeofilter-aeronet/docs/samples/c2443e91-c674-46c5-ac28-5dd0b6c80395.csv
2025-11-18 21:48:19.414 | SUCCESS | pygeofilter_aeronet:aeronet_search:293 - Data saved to GeoParquet file: /home/runner/work/pygeofilter-aeronet/pygeofilter-aeronet/docs/samples/c2443e91-c674-46c5-ac28-5dd0b6c80395.parquet
{
"type": "Feature",
"stac_version": "1.1.0",
"stac_extensions": [
"https://stac-extensions.github.io/table/v1.2.0/schema.json"
],
"id": "urn:uuid:c2443e91-c674-46c5-ac28-5dd0b6c80395",
"geometry": {
"type": "Point",
"coordinates": [
-97.48639,
36.60667
]
},
"bbox": [
-97.48639,
36.60667,
-97.48639,
36.60667
],
"properties": {
"datetime": "2025-11-18T21:48:19.416808Z"
},
"links": [
{
"rel": "related",
"href": "https://aeronet.gsfc.nasa.gov/cgi-bin/print_web_data_v3?site=Cart_Site&SDA20=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": "c2443e91-c674-46c5-ac28-5dd0b6c80395.csv",
"type": "text/csv",
"description": "Search result - CVS Format",
"table:row_count": 11,
"table:columns": [
{
"name": "AERONET_Site",
"col_type": "object"
},
{
"name": "Date_(dd:mm:yyyy)",
"col_type": "object"
},
{
"name": "Time_(hh:mm:ss)",
"col_type": "object"
},
{
"name": "Day_of_Year",
"col_type": "int64"
},
{
"name": "Total_AOD_500nm[tau_a]",
"col_type": "float64"
},
{
"name": "Fine_Mode_AOD_500nm[tau_f]",
"col_type": "float64"
},
{
"name": "Coarse_Mode_AOD_500nm[tau_c]",
"col_type": "float64"
},
{
"name": "FineModeFraction_500nm[eta]",
"col_type": "float64"
},
{
"name": "2nd_Order_Reg_Fit_Error-Total_AOD_500nm[regression_dtau_a]",
"col_type": "float64"
},
{
"name": "RMSE_Fine_Mode_AOD_500nm[Dtau_f]",
"col_type": "float64"
},
{
"name": "RMSE_Coarse_Mode_AOD_500nm[Dtau_c]",
"col_type": "float64"
},
{
"name": "RMSE_FineModeFraction_500nm[Deta]",
"col_type": "float64"
},
{
"name": "Angstrom_Exponent(AE)-Total_500nm[alpha]",
"col_type": "float64"
},
{
"name": "dAE/dln(wavelength)-Total_500nm[alphap]",
"col_type": "float64"
},
{
"name": "AE-Fine_Mode_500nm[alpha_f]",
"col_type": "float64"
},
{
"name": "dAE/dln(wavelength)-Fine_Mode_500nm[alphap_f]",
"col_type": "float64"
},
{
"name": "N[Total_AOD_500nm[tau_a]]",
"col_type": "int64"
},
{
"name": "N[Fine_Mode_AOD_500nm[tau_f]]",
"col_type": "int64"
},
{
"name": "N[Coarse_Mode_AOD_500nm[tau_c]]",
"col_type": "int64"
},
{
"name": "N[FineModeFraction_500nm[eta]]",
"col_type": "int64"
},
{
"name": "N[2nd_Order_Reg_Fit_Error-Total_AOD_500nm[regression_dtau_a]]",
"col_type": "int64"
},
{
"name": "N[RMSE_Fine_Mode_AOD_500nm[Dtau_f]]",
"col_type": "int64"
},
{
"name": "N[RMSE_Coarse_Mode_AOD_500nm[Dtau_c]]",
"col_type": "int64"
},
{
"name": "N[RMSE_FineModeFraction_500nm[Deta]]",
"col_type": "int64"
},
{
"name": "N[Angstrom_Exponent(AE)-Total_500nm[alpha]]",
"col_type": "int64"
},
{
"name": "N[dAE/dln(wavelength)-Total_500nm[alphap]]",
"col_type": "int64"
},
{
"name": "N[AE-Fine_Mode_500nm[alpha_f]]",
"col_type": "int64"
},
{
"name": "N[dAE/dln(wavelength)-Fine_Mode_500nm[alphap_f]]",
"col_type": "int64"
},
{
"name": "Data_Quality_Level",
"col_type": "object"
},
{
"name": "AERONET_Instrument_Number",
"col_type": "int64"
},
{
"name": "AERONET_Site_Name",
"col_type": "object"
},
{
"name": "Site_Latitude(Degrees)",
"col_type": "float64"
},
{
"name": "Site_Longitude(Degrees)",
"col_type": "float64"
},
{
"name": "Site_Elevation(m)",
"col_type": "float64"
},
{
"name": "Unnamed: 34",
"col_type": "float64"
}
]
},
"geoparquet": {
"href": "c2443e91-c674-46c5-ac28-5dd0b6c80395.parquet",
"type": "application/vnd.apache.parquet",
"description": "Search result - GeoParquet Format",
"table:row_count": 11,
"table:columns": [
{
"name": "AERONET_Site",
"col_type": "object"
},
{
"name": "Date_(dd:mm:yyyy)",
"col_type": "object"
},
{
"name": "Time_(hh:mm:ss)",
"col_type": "object"
},
{
"name": "Day_of_Year",
"col_type": "int64"
},
{
"name": "Total_AOD_500nm[tau_a]",
"col_type": "float64"
},
{
"name": "Fine_Mode_AOD_500nm[tau_f]",
"col_type": "float64"
},
{
"name": "Coarse_Mode_AOD_500nm[tau_c]",
"col_type": "float64"
},
{
"name": "FineModeFraction_500nm[eta]",
"col_type": "float64"
},
{
"name": "2nd_Order_Reg_Fit_Error-Total_AOD_500nm[regression_dtau_a]",
"col_type": "float64"
},
{
"name": "RMSE_Fine_Mode_AOD_500nm[Dtau_f]",
"col_type": "float64"
},
{
"name": "RMSE_Coarse_Mode_AOD_500nm[Dtau_c]",
"col_type": "float64"
},
{
"name": "RMSE_FineModeFraction_500nm[Deta]",
"col_type": "float64"
},
{
"name": "Angstrom_Exponent(AE)-Total_500nm[alpha]",
"col_type": "float64"
},
{
"name": "dAE/dln(wavelength)-Total_500nm[alphap]",
"col_type": "float64"
},
{
"name": "AE-Fine_Mode_500nm[alpha_f]",
"col_type": "float64"
},
{
"name": "dAE/dln(wavelength)-Fine_Mode_500nm[alphap_f]",
"col_type": "float64"
},
{
"name": "N[Total_AOD_500nm[tau_a]]",
"col_type": "int64"
},
{
"name": "N[Fine_Mode_AOD_500nm[tau_f]]",
"col_type": "int64"
},
{
"name": "N[Coarse_Mode_AOD_500nm[tau_c]]",
"col_type": "int64"
},
{
"name": "N[FineModeFraction_500nm[eta]]",
"col_type": "int64"
},
{
"name": "N[2nd_Order_Reg_Fit_Error-Total_AOD_500nm[regression_dtau_a]]",
"col_type": "int64"
},
{
"name": "N[RMSE_Fine_Mode_AOD_500nm[Dtau_f]]",
"col_type": "int64"
},
{
"name": "N[RMSE_Coarse_Mode_AOD_500nm[Dtau_c]]",
"col_type": "int64"
},
{
"name": "N[RMSE_FineModeFraction_500nm[Deta]]",
"col_type": "int64"
},
{
"name": "N[Angstrom_Exponent(AE)-Total_500nm[alpha]]",
"col_type": "int64"
},
{
"name": "N[dAE/dln(wavelength)-Total_500nm[alphap]]",
"col_type": "int64"
},
{
"name": "N[AE-Fine_Mode_500nm[alpha_f]]",
"col_type": "int64"
},
{
"name": "N[dAE/dln(wavelength)-Fine_Mode_500nm[alphap_f]]",
"col_type": "int64"
},
{
"name": "Data_Quality_Level",
"col_type": "object"
},
{
"name": "AERONET_Instrument_Number",
"col_type": "int64"
},
{
"name": "AERONET_Site_Name",
"col_type": "object"
},
{
"name": "Site_Latitude(Degrees)",
"col_type": "float64"
},
{
"name": "Site_Longitude(Degrees)",
"col_type": "float64"
},
{
"name": "Site_Elevation(m)",
"col_type": "float64"
},
{
"name": "Unnamed: 34",
"col_type": "float64"
},
{
"name": "geometry",
"col_type": "geometry"
},
{
"name": "datetime",
"col_type": "datetime64[ns]"
}
]
}
}
}
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 | Total_AOD_500nm[tau_a] | Fine_Mode_AOD_500nm[tau_f] | Coarse_Mode_AOD_500nm[tau_c] | FineModeFraction_500nm[eta] | 2nd_Order_Reg_Fit_Error-Total_AOD_500nm[regression_dtau_a] | RMSE_Fine_Mode_AOD_500nm[Dtau_f] | ... | N[dAE/dln(wavelength)-Fine_Mode_500nm[alphap_f]] | Data_Quality_Level | AERONET_Instrument_Number | AERONET_Site_Name | Site_Latitude(Degrees) | Site_Longitude(Degrees) | Site_Elevation(m) | Unnamed: 34 | geometry | datetime | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Cart_Site | 31:05:2000 | 12:00:00 | 152 | 0.110159 | 0.076089 | 0.034070 | 0.685081 | 0.006198 | 0.010284 | ... | 32 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-05-31 12:00:00 |
| 1 | Cart_Site | 01:06:2000 | 12:00:00 | 153 | 0.122092 | 0.074926 | 0.047167 | 0.615333 | 0.005520 | 0.009893 | ... | 12 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-01 12:00:00 |
| 2 | Cart_Site | 04:06:2000 | 12:00:00 | 156 | 0.312680 | 0.262406 | 0.050274 | 0.839186 | 0.006488 | 0.050660 | ... | 2 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-04 12:00:00 |
| 3 | Cart_Site | 05:06:2000 | 12:00:00 | 157 | 0.079892 | 0.050040 | 0.029852 | 0.627091 | 0.004806 | 0.006864 | ... | 55 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-05 12:00:00 |
| 4 | Cart_Site | 06:06:2000 | 12:00:00 | 158 | 0.169686 | 0.122910 | 0.046777 | 0.721316 | 0.006567 | 0.017211 | ... | 25 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-06 12:00:00 |
| 5 | Cart_Site | 07:06:2000 | 12:00:00 | 159 | 0.129509 | 0.091838 | 0.037671 | 0.714354 | 0.006138 | 0.011421 | ... | 16 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-07 12:00:00 |
| 6 | Cart_Site | 08:06:2000 | 12:00:00 | 160 | 0.093119 | 0.067934 | 0.025185 | 0.726142 | 0.005370 | 0.009316 | ... | 38 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-08 12:00:00 |
| 7 | Cart_Site | 09:06:2000 | 12:00:00 | 161 | 0.261388 | 0.211686 | 0.049702 | 0.805347 | 0.006535 | 0.037282 | ... | 7 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-09 12:00:00 |
| 8 | Cart_Site | 11:06:2000 | 12:00:00 | 163 | 0.083175 | 0.055649 | 0.027526 | 0.668308 | 0.005265 | 0.007773 | ... | 6 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-11 12:00:00 |
| 9 | Cart_Site | 12:06:2000 | 12:00:00 | 164 | 0.156430 | 0.084181 | 0.072250 | 0.539609 | 0.004594 | 0.012143 | ... | 9 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-12 12:00:00 |
| 10 | Cart_Site | 13:06:2000 | 12:00:00 | 165 | 0.152815 | 0.069873 | 0.082942 | 0.457893 | 0.004385 | 0.010806 | ... | 16 | lev20 | 99 | Cart_Site | 36.60667 | -97.48639 | 318.0 | NaN | POINT (-97.48639 36.60667) | 2000-06-13 12:00:00 |
11 rows × 37 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