How to download Aqua Modis data through API
How to download Aqua Modis data through API
Hey guys,
I am pretty new with getting data so I would like to ask a beginner question.
I have seen this page about how to use NASA API: https://oceancolor.gsfc.nasa.gov/data/download_methods/ and have tried to use the obdaac_download python file in there but maybe I might just do the wrong command.
I have tried to download the AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc file.
I have tried the following command: python obdaac_download.py --verbose -v --force --appkey {{APP_KEY_VALUE}} AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc
I already have an API KEY
Can you please help me identify what I am doing incorrectly?
Thank you for your time!
I am pretty new with getting data so I would like to ask a beginner question.
I have seen this page about how to use NASA API: https://oceancolor.gsfc.nasa.gov/data/download_methods/ and have tried to use the obdaac_download python file in there but maybe I might just do the wrong command.
I have tried to download the AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc file.
I have tried the following command: python obdaac_download.py --verbose -v --force --appkey {{APP_KEY_VALUE}} AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc
I already have an API KEY
Can you please help me identify what I am doing incorrectly?
Thank you for your time!
Filters:
-
- Posts: 1519
- Joined: Wed Sep 18, 2019 6:15 pm America/New_York
- Been thanked: 9 times
Re: How to download Aqua Modis data through API
First, I'll make the assumption that you replaced {{APP_KEY}} with your app key value
Since you had --verbose set, what (if any) errors did it output?
Sean

Since you had --verbose set, what (if any) errors did it output?
Sean
Re: How to download Aqua Modis data through API
Hi Sean,
Thank you for your response. It's great to feel that I have support.
Yes I did use the APPKEY that I have, for security reasons I put in a variable format (the same applies in this output log).
I had tried to put the APPKEY and the filename inside the quotes and this is the message I get in all these cases:
Output directory: /Users/eyecondev/Documents/Andre/Habtrail/gee_test/download_data
Retrieving AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc
Session started
DEBUG:urllib3.util.retry:Converted retries value: 5 -> Retry(total=5, connect=None, read=None, redirect=None, status=None)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): oceandata.sci.gsfc.nasa.gov:443
DEBUG:urllib3.connectionpool:https://oceandata.sci.gsfc.nasa.gov:443 "GET /ob/getfile/AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc?appkey={{APP_KEY_VALUE}} HTTP/1.1" 301 None
DEBUG:urllib3.connectionpool:https://oceandata.sci.gsfc.nasa.gov:443 "GET /getfile/AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc?appkey={{APP_KEY_VALUE}} HTTP/1.1" 200 None
Traceback (most recent call last):
File "/Users/eyecondev/Documents/Andre/Habtrail/gee_test/download_data/obdaac_download.py", line 314, in <module>
status = retrieveURL(request,localpath=outpath, uncompress=args.uncompress,
File "/Users/eyecondev/Documents/Andre/Habtrail/gee_test/download_data/obdaac_download.py", line 227, in retrieveURL
status = httpdl(server, netpath, localpath=localpath, uncompress=uncompress, verbose=verbose,force_download=force_download)
File "/Users/eyecondev/Documents/Andre/Habtrail/gee_test/download_data/obdaac_download.py", line 129, in httpdl
total_length = int(total_length)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Thank you again for your time!
Thank you for your response. It's great to feel that I have support.
Yes I did use the APPKEY that I have, for security reasons I put in a variable format (the same applies in this output log).
I had tried to put the APPKEY and the filename inside the quotes and this is the message I get in all these cases:
Output directory: /Users/eyecondev/Documents/Andre/Habtrail/gee_test/download_data
Retrieving AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc
Session started
DEBUG:urllib3.util.retry:Converted retries value: 5 -> Retry(total=5, connect=None, read=None, redirect=None, status=None)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): oceandata.sci.gsfc.nasa.gov:443
DEBUG:urllib3.connectionpool:https://oceandata.sci.gsfc.nasa.gov:443 "GET /ob/getfile/AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc?appkey={{APP_KEY_VALUE}} HTTP/1.1" 301 None
DEBUG:urllib3.connectionpool:https://oceandata.sci.gsfc.nasa.gov:443 "GET /getfile/AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc?appkey={{APP_KEY_VALUE}} HTTP/1.1" 200 None
Traceback (most recent call last):
File "/Users/eyecondev/Documents/Andre/Habtrail/gee_test/download_data/obdaac_download.py", line 314, in <module>
status = retrieveURL(request,localpath=outpath, uncompress=args.uncompress,
File "/Users/eyecondev/Documents/Andre/Habtrail/gee_test/download_data/obdaac_download.py", line 227, in retrieveURL
status = httpdl(server, netpath, localpath=localpath, uncompress=uncompress, verbose=verbose,force_download=force_download)
File "/Users/eyecondev/Documents/Andre/Habtrail/gee_test/download_data/obdaac_download.py", line 129, in httpdl
total_length = int(total_length)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Thank you again for your time!
Re: How to download Aqua Modis data through API
Hello,
Please check your appkey and make sure it's not expired. You may want to try the code by passing the value directly (instead of using the variable):
Navigate to the directory where the code is saved and try:
./<file_name> -v --appkey <paste your appkey here> AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc
Please let us know if that works.
Masoud
Please check your appkey and make sure it's not expired. You may want to try the code by passing the value directly (instead of using the variable):
Navigate to the directory where the code is saved and try:
./<file_name> -v --appkey <paste your appkey here> AQUA_MODIS.20231115.L3m.DAY.PIC.pic.4km.NRT.nc
Please let us know if that works.
Masoud
-
- Posts: 1519
- Joined: Wed Sep 18, 2019 6:15 pm America/New_York
- Been thanked: 9 times
Re: How to download Aqua Modis data through API
Make sure the appkey was entered correctly, as well. The code will fail with the error you saw if the appkey is invalid (mistyped, or expired...We need to update the code trap this error better
).
Sean

Sean