asf_search is an open source Python package for searching and downloading SAR data from ASF. This notebook demonstrates how to search and download NISAR GCOV data with asf_search.
Overview¶
1. Prerequisites¶
| Prerequisite | Importance | Notes |
|---|---|---|
| The software environment for this cookbook must be installed | Necessary |
Rough Notebook Time Estimate: 3 minutes
2. Search and download example¶
Search and download GCOV data with asf_search
2a. Search for GCOV data with asf_search.search()¶
import os
import asf_search as asf
from datetime import datetime
from getpass import getpass
session = asf.ASFSession()
session.auth_with_creds(input('EDL Username'), getpass('EDL Password'))
start_date = datetime(2025, 11, 22)
end_date = datetime(2025, 12, 5)
area_of_interest = "POLYGON((40.9131 12.3904,41.8891 12.3904,41.8891 13.2454,40.9131 13.2454,40.9131 12.3904))" # POINT or POLYGON as WKT (well-known-text)
opts=asf.ASFSearchOptions(**{
"maxResults": 250,
"intersectsWith": area_of_interest,
"start": start_date,
"end": end_date,
"processingLevel": [
"GCOV"
],
"dataset": [
"NISAR"
],
"productionConfiguration": [
"PR"
],
'session': session,
})
response = asf.search(opts=opts)
hdf5_files = response.find_urls(extension='.h5', directAccess=False)
hdf5_files2b. Filter the results¶
Note that the results include the QA_STATS files as well as the GCOV products. If you only want the GCOV data, you can remove the QA_STATS files with a pattern (regex) filter when calling response.find_urls
# Don't run this code cell if you wish to download the QA_STATS data
# Include include a negative lookahead for "QA_STATS"
pattern = r'^(?!.*QA_STATS).*'
# To include the static files, remove the `pattern=pattern` argument below
hdf5_files = response.find_urls(extension='.h5', pattern=pattern, directAccess=False)
hdf5_files2c. Download the data to a specified directory¶
from pathlib import Path
data_dir = Path.home() / "GCOV_data"
data_dir.mkdir(exist_ok=True)
print(f'data_dir: {data_dir}')
asf.download_urls(hdf5_files, data_dir, session=session, processes=4)3. Summary¶
You now have the tools and knowledge that you need to search and download data using the asf_search Python package.