Page 1 of 1

Using Podaacpy to retrieve CYGNSS Level 3 Science Data

PostPosted: Thu Jul 27, 2017 6:11 pm
by lmcgibbn
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

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 -, 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()
#     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
#     ['',
#     '',
#     '',
#     '',
#     '',
#     ...

Podaac Engineers would like to thank valued community member Dorina Twigg for permitting use of the above recipe within the PO.DAAC Forum.

Re: Using Podaacpy to retrieve CYGNSS Level 3 Science Data

PostPosted: Wed Aug 22, 2018 12:55 pm
by lmcgibbn
Hi folks, as a follow up to this post, I recently put together a Jupiter notebook containing all of the above and more. ... Data.ipynb
It is focused on retrieving CYGNSS Level 2 v2.0 data.
Any issues, please let me know,