For the record it would be good to provide the version of your wget program and OS version. Someone with the same configuration may have a solution.
As you can see, working with wget requires some familiarity with the command line (usually bash, but zsh is gaining popularity and is used on recent macOS).
I think you will find a helpful over the long run to spend a few afternoons studying command line concepts. A good place to start is
Linux Command.
Small downloads with wget are usually html login pages. Did you try adding
--adjust-extension
to your wget command line? This may give you html pages you can load in a browser. Every time this happened to me I got a EarthData login. Adding the second "machine" to your
~/.netrc
may help:
echo "machine oceandata.sci.gsfc.nasa.gov login USERNAME password PASSWD" >> ~/.netrc
The
>>
appends the new entry to the existing file. The permissions should already be OK, but you should check because wget may refuse to use a
~/.netrc
with the wrong permissions:
ls -l ~/.netrc
-rw------- 1 <user> <group> 149 Apr 25 09:09 /home/<user>/.netrc
You can check the type of a downloaded file using the
file
command. I used this to check the files downloaded using
obdaac_download.py
(note that NetCDF4 files use the HDF5 storage format) in my previous post. If you still have one of the short
.nc
files that contains html, just replace
.nc
with
.html
and try viewing it in a browser.
The recent change to require passwords for OBPG downloads caused similar problems for many users. The EarthData login uses "single signon" (SSO) in which your first attempt to connect the OceanData server is redirected to the EarthData server. After logging on, cookies are saved to validate your session when you connect to the OceanData server. The same process is used when you log into this forum with a browser. Different SSO mechanisms have been tried in the past, and various people have contributed support for them to the wget code base. As a result, the wget code became a tangled mess, so the current developers decided to "redo from start" and are working on wget2 which will eventually replace wget. Point 5 is the suggested workaround for SSO problems, using wget once to login and set cookies, and then using the cookies to validate your session with the OceanData server and start a download.