Use wget to download multiple ocean data from NASA

This article talks about how to download ocean data from NASA using wget.

The contents mainly refer to NASA’s official website here:

First, please refer to the official website to apply an Earthdata account.  Here I describe an example to download multiple ocean data only.

Second, configure wget following instructions provided by formal website as well. Here is a short summary (for Linux/Mac only):

  • Create a .netrc  file in your home directory with following contents: machine login <uid> password <password>(without <>)
  • Give permission to this file: chmod 0600 .netrc
  • Create a blank cookie file in home directory named .urs_cookies

Third, taking downloading “Aquarius Official Release Level 3 Rain-flagged Sea Surface Salinity Standard Mapped Image Descending Daily Data V5.0” data for the whole 2012 for example.

To start, find the “Data Access” section and go to ‘OPENDAP’ method to reach the data location. Select ‘2012’ and further go to ‘001’ directory, we’ll see several different files that in this folder, actually they are different data but have the same logical data structure, so they are arranged in the same directory. What we are looking for is “RAIN_MASK_SSS” data, so we click the corresponding link and reach the location of this file.

Just copy the content in DATA URL line and we will obtain the url for this file.

You can of course download this file directly via clicking “Get as NetCDF-4” button, but you can also use a cooler method to download it using this url in a command terminal by typing:

This cooler method makes it possible for us to download multiple files at once.

So the next question is how to obtain the multiple url for files we’re interested in. By observing the naming rules of the file, we can use a MATLAB script to make it. Here is a sample MATLAB script to make it.

Finally, it cannot be easier for us any more, just type following command in the terminal in your preferred directory:



邮箱地址不会被公开。 必填项已用*标注