Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

download-coastlines.sh 1.5 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  1. #!/usr/bin/env bash
  2. # Download and install the coastlines and boundaries datasets
  3. # General settings:
  4. EXT="tar.gz"
  5. GSHHG="gshhg-gmt-2.3.7"
  6. DCW="dcw-gmt-1.1.4"
  7. MD5_GSHHG=8ee2653f9daf84d49fefbf990bbfa1e7
  8. MD5_DCW=4f30857a8b12af0f910222fceb591538
  9. # Used for checking the downloaded files:
  10. check_md5 ()
  11. {
  12. md5_ref=$1
  13. file=$2
  14. test -f "$file" || return 1
  15. md5=$(openssl dgst -md5 $file | cut -d ' ' -f 2)
  16. test "$md5" = "$md5_ref"
  17. }
  18. # To return a failure if any commands inside fail
  19. set -e
  20. # Create the directory for coastline data
  21. mkdir -p $COASTLINEDIR
  22. # GSHHG and DCW tarballs are cached here:
  23. test -d $HOME/cache-gshhg-dcw || mkdir $HOME/cache-gshhg-dcw
  24. cd $HOME/cache-gshhg-dcw
  25. # GSHHG (coastlines, rivers, and political boundaries):
  26. echo ""
  27. echo "Downloading and unpacking GSHHG"
  28. echo "================================================================================"
  29. # download when md5sums don't match:
  30. check_md5 $MD5_GSHHG $GSHHG.$EXT || curl -L -O --retry 10 "https://mirrors.ustc.edu.cn/gmt/$GSHHG.$EXT"
  31. check_md5 $MD5_GSHHG $GSHHG.$EXT
  32. tar xzf $GSHHG.$EXT
  33. mv $GSHHG $COASTLINEDIR/gshhg
  34. # DCW (country polygons):
  35. echo ""
  36. echo "Downloading and unpacking DCW"
  37. echo "================================================================================"
  38. # download when md5sums don't match:
  39. check_md5 $MD5_DCW $DCW.$EXT || curl -L -O --retry 10 "https://mirrors.ustc.edu.cn/gmt/$DCW.$EXT"
  40. check_md5 $MD5_DCW $DCW.$EXT
  41. tar xzf $DCW.$EXT
  42. mv $DCW $COASTLINEDIR/dcw
  43. ls $COASTLINEDIR/gshhg $COASTLINEDIR/dcw
  44. # Turn off exit on failure.
  45. set +e
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...