Downloading MERRA2 data

I tried to download some MERRA2 data, and realised that I’d deleted all my old scripts! So, here I go again…

Preliminary steps:

  1. Register / Log in to the NASA EARTHDATA site:
  2. Follow the steps to link GES DISC with your account:
  3. Verify by downloading this example data file URL

Follow the steps to set up curl (copied from here

Create a .netrc file in your home directory.

  1. cd ~ or cd $HOME
  2. touch .netrc
  3. echo "machine login <uid> password <password>" >> .netrc (where <uid> is your user name and <password> is your Earthdata Login password without the brackets)
  4. chmod 0600 .netrc (so only you can access it)

Create a cookie file. This file will be used to persist sessions across calls to wget or curl.

  1. cd ~ or cd $HOME
  2. touch .urs_cookies.
    Note: you may need to re-create .urs_cookies in case you have already executed curl without valid authentication.

Download your data using curl:

  • To download multiple data files at once, create a plain-text (download.list) file with each line containing a GES DISC data file URL. Then, enter the following command:
cat download.list | tr -d '\r' | xargs -n 1 curl -LJO -n -c ~/.urs_cookies -b ~/.urs_cookies

Go to the NASA Goddard Earth Sciences (GES) Data and Information Services Center (DISC) page:

  • Source: Models/Analyses MERRA-2
  • Temporal Resolution: 1 hour

Choose “Subset / Get data” for the instantaneous ‘Single-Level Diagnostics’ file.

Under “Download Method” there are two relevant options, as we want to download a spatial domain:

  • Subset using OPeNDAP
  • Subset using GES DISC. This option seems to also allow regridding.

I selected OPeNDAP, as I don’t need to regrid the data.

I didn’t change the dates under ‘Refine Date Range’: 1980-01-01 to 2021-08-31

I used ‘Refine Region’ to select a region around Ireland: -11,51,-5,56 and I kept the ‘Use ‘Refine Region’ box checked.

Under ‘Variables’ I selected surface wind speed, and I kept output format as netCDF.

Click ‘Get Data’ and download the links list

I downloaded the data to the mccdata server using curl.