Request.get attributes for a function call

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
yusriy
Posts: 3
Joined: Wed Aug 08, 2018 9:29 am America/New_York
Answers: 0

Request.get attributes for a function call

by yusriy » Fri Jun 24, 2022 1:33 am America/New_York

Hi,

I hope anyone can help with the entry names for a request.get() call to the CMR.

I want to generate a list of URLs for the chlorophyll-a data of MODIS. An example file name is 'A2016345.L3m_DAY_CHL_chlor_a_4km.nc.'

The python code I used in the jupyter notebook is written below:

collection_id = 'C1442922862-OB_DAAC'#'C1449861405-OB_DAAC'
date_range = '2015-01-01T00:00:00Z,2016-12-30T23:59:59Z'
bbox = '87.407227,0.527336,105.600586,15.792254’

response = requests.get(url,
params={
'concept_id': collection_id,
'temporal': date_range,
'bounding_box': bbox,
'page_size': 10,
},
headers=headers
)
print(response.status_code)

The output of the call is

OB_DAAC | Aqua MODIS Global Mapped Chlorophyll (CHL) Data, version 2018 | G1449570461-OB_DAAC
OB_DAAC | Aqua MODIS Global Mapped Chlorophyll (CHL) Data, version 2018 | G1449570462-OB_DAAC
OB_DAAC | Aqua MODIS Global Mapped Chlorophyll (CHL) Data, version 2018 | G1449570463-OB_DAAC
OB_DAAC | Aqua MODIS Global Mapped Chlorophyll (CHL) Data, version 2018 | G1449570464-OB_DAAC
OB_DAAC | Aqua MODIS Global Mapped Chlorophyll (CHL) Data, version 2018 | G1449620403-OB_DAAC
[truncated]

When I pprint(granules[0]), the output is just one nc file, while I expected a list of nc files for the dates in the date_range:

https_urls = [l['href'] for l in granules[0]['links'] if 'https' in l['href'] and '.nc' in l['href']]
https_urls

['https://oceandata.sci.gsfc.nasa.gov (/cmr/getfile/A20021822017212.L3m_MC_CHL_chl_ocx_4km.nc)',
'https://oceandata.sci.gsfc.nasa.gov (/opendap/MODISA/L3SMI/2002/182/A20021822017212.L3m_MC_CHL_chl_ocx_4km.nc)']

How can I narrow down the search to just the chlor a 4 km nc files? Maybe, I need to know other param attributes so that it can only list the wanted files.

Thanks for any assistance provided!

Tags:


Post Reply