MERRA2 OpenDAP Bug (python)
Posted: Fri Sep 12, 2025 12:29 pm America/New_York
Hi,
I am following the online instructions to create a python notebook that will allow me to use OpenDap to download MERRA2 data. However, at the end of the retrieval I get an error message that “RuntimeError: Failed to decode variable 'time': NetCDF: Access failure”. Here are the steps I’ve been doing. Please let me know if you would like me to share the python notebook.
(1) I first use Option 3 on this site:
https://disc.gsfc.nasa.gov/information/howto?title=How%20to%20Generate%20Earthdata%20Prerequisite%20Files
to generate and store an Earthdata login token. This works fine using my credentials, and I get confirmation that the token was retrieved and stored in my home directly as an .edl_token.
(2) I then tried running the code example verbatim provided from here (specifically the code in cell 2 beginning with “%%time”):
https://disc.gsfc.nasa.gov/information/howto?keywords=merra-2%20python&title=How%20to%20Access%20MERRA-2%20Data%20using%20OPeNDAP%20with%20Python3%20and%20Calculate%20Daily/Weekly/Monthly%20Statistics%20from%20Hourly%20Data
The code initially runs, but while it is running, I get the following:
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied
It runs for a bit longer, and then crashes with the decode time error I mention above.
Thanks for your help.
I am following the online instructions to create a python notebook that will allow me to use OpenDap to download MERRA2 data. However, at the end of the retrieval I get an error message that “RuntimeError: Failed to decode variable 'time': NetCDF: Access failure”. Here are the steps I’ve been doing. Please let me know if you would like me to share the python notebook.
(1) I first use Option 3 on this site:
https://disc.gsfc.nasa.gov/information/howto?title=How%20to%20Generate%20Earthdata%20Prerequisite%20Files
to generate and store an Earthdata login token. This works fine using my credentials, and I get confirmation that the token was retrieved and stored in my home directly as an .edl_token.
(2) I then tried running the code example verbatim provided from here (specifically the code in cell 2 beginning with “%%time”):
https://disc.gsfc.nasa.gov/information/howto?keywords=merra-2%20python&title=How%20to%20Access%20MERRA-2%20Data%20using%20OPeNDAP%20with%20Python3%20and%20Calculate%20Daily/Weekly/Monthly%20Statistics%20from%20Hourly%20Data
The code initially runs, but while it is running, I get the following:
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied.
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: HTTP^ Basic: Access denied
It runs for a bit longer, and then crashes with the decode time error I mention above.
Thanks for your help.