Using Podaacpy to retrieve CYGNSS Level 3 Science Data

Recently, one of our community members was required to retrieve a listing of all CYGNSS L0,1,2,3 and TLM files published and made available by the PO-DAAC. At this stage PO.DAAC makes CYGNSS Level 3 Science Data Record Version 1.1 data available for public download at https://podaac.jpl.nasa.gov/dataset/CYGNSS_L3_V1.1.
The purpose of this recipe was so a verification could be undertaken to ensure all files had been downloaded to the community members' local data system holdings.
For the purpose of the greater community, we've decided to make this into a neat data recipe displaying how Podaacpy - https://github.com/nasa/podaacpy, can achieve this within some ~10 lines of Podaacpy Python code. Please note we have augmented the code below with some super helpful print statements displaying incremental output from the retrieval task.
The output of executing the above code can be seen below
Podaac Engineers would like to thank valued community member Dorina Twigg for permitting use of the above recipe within the PO.DAAC Forum.
The purpose of this recipe was so a verification could be undertaken to ensure all files had been downloaded to the community members' local data system holdings.
For the purpose of the greater community, we've decided to make this into a neat data recipe displaying how Podaacpy - https://github.com/nasa/podaacpy, can achieve this within some ~10 lines of Podaacpy Python code. Please note we have augmented the code below with some super helpful print statements displaying incremental output from the retrieval task.
- Code: Select all
from pprint import pprint
import podaac.podaac as podaac
import podaac.podaac_utils as utils
p = podaac.Podaac()
u = utils.PodaacUtils()
print '\nHeres list_available_granule_search_dataset_ids()'
result = u.list_available_granule_search_dataset_ids()
dsetId = [i for i in result if 'CYG' in i][0]
print dsetId
print '\nHeres list_available_granule_search_dataset_short_names()'
result = u.list_available_granule_search_dataset_short_names()
dsetShortName = [i for i in result if 'CYG' in i][0]
print dsetShortName
print '\nHeres p.dataset_metadata()'
result = p.dataset_metadata( dataset_id=dsetId, format='gcmd' )
# NOTE: dataset_id=dsetID pulled up nothing, had to use short_name=
print '\nHeres p.dataset_search()'
result = p.dataset_search( short_name=dsetShortName )
print '\nHeres total results using p.granule_search()'
maxResultsPerPage = '400'
result = p.granule_search( dataset_id=dsetId,items_per_page=maxResultsPerPage )
searchStr = 'totalResults'
numResultsStr = [ str(i) for i in result.strip().split() if searchStr in i ]
print numResultsStr
print '\nHeres the length of file listing: '+str(len(fileStrL))+'\n'
searchStr = '<title>cyg'
fileStrL = [ str(i) for i in result.strip().split() if searchStr in i ]
podaacL3 = [ i.replace('<title>','').replace('</title>','') for i in fileStrL ]
pprint( podaacL3 )
The output of executing the above code can be seen below
- Code: Select all
# OUTPUT:
#
# Heres list_available_granule_search_dataset_ids()
# PODAAC-CYGNS-L3X11
#
# Heres list_available_granule_search_dataset_short_names()
# CYGNSS_L3_V1.1
#
# Heres p.dataset_metadata()
#
# Heres p.dataset_search()
#
# Heres total results using p.granule_search()
# ['<opensearch:totalResults>128</opensearch:totalResults>']
#
# Heres the length of file listing: 128
#
# ['cyg.ddmi.s20170318-003000-e20170318-233000.l3.grid-wind.a10.d11.nc',
# 'cyg.ddmi.s20170319-003000-e20170319-233000.l3.grid-wind.a10.d11.nc',
# 'cyg.ddmi.s20170320-003000-e20170320-233000.l3.grid-wind.a10.d11.nc',
# 'cyg.ddmi.s20170321-003000-e20170321-233000.l3.grid-wind.a10.d11.nc',
# 'cyg.ddmi.s20170322-003000-e20170322-233000.l3.grid-wind.a10.d11.nc',
# ...
Podaac Engineers would like to thank valued community member Dorina Twigg for permitting use of the above recipe within the PO.DAAC Forum.