I tried to download some MERRA2 data, and realised that I’d deleted all my old scripts! So, here I go again…
Preliminary steps:
- Register / Log in to the NASA EARTHDATA site: https://urs.earthdata.nasa.gov/home
- Follow the steps to link GES DISC with your account: https://disc.gsfc.nasa.gov/earthdata-login
- Verify by downloading this example data file URL
Follow the steps to set up curl (copied from here https://disc.gsfc.nasa.gov/data-access#mac_linux_wget):
Create a .netrc file in your home directory.
cd ~
orcd $HOME
touch .netrc
echo "machine urs.earthdata.nasa.gov login <uid> password <password>" >> .netrc
(where <uid> is your user name and <password> is your Earthdata Login password without the brackets)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
.
cd ~
orcd $HOME
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: https://disc.gsfc.nasa.gov/
- 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.