Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmerice/IceSheet/Greenland/DATA/scripts/GET_FROM_NSIDC.sh
5319 views
1
#!/bin/bash
2
3
## get data from nsidc
4
if [ $# -eq 0 ]
5
then
6
echo "No arguments supplied -- ABORT --"
7
echo
8
echo "provide the url of the file to download"
9
fi
10
## test if authentication file exist
11
if [ ! -e "$HOME/.netrc" ]; then
12
echo "~/.netrc does not exist"
13
echo
14
echo "see https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+cURL+And+Wget"
15
echo
16
echo " echo "machine urs.earthdata.nasa.gov login \<uid\> password \<password\>" >> ~/.netrc"
17
echo " chmod 0600 ~/.netrc"
18
echo
19
echo "or directly download file from you web browser from this link:"
20
echo $1
21
echo
22
exit 1
23
fi
24
# create cookies file
25
if [ ! -f "~/.urs_cookies" ]; then
26
touch ~/.urs_cookies
27
fi
28
## download file using curl
29
curl -O -b ~/.urs_cookies -c ~/.urs_cookies -L -n $1
30
31
32
33