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.7 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
56
57
58
59
  1. #!/usr/bin/env bash
  2. # Download and install the coastlines and boundaries datasets
  3. # General settings:
  4. EXT="tar.gz"
  5. GSHHG_VERSION="2.3.7"
  6. GSHHG="gshhg-gmt-${GSHHG_VERSION}"
  7. GSHHG_URL="https://github.com/GenericMappingTools/gshhg-gmt/releases/download/${GSHHG_VERSION}/${GSHHG}.${EXT}"
  8. MD5_GSHHG=8ee2653f9daf84d49fefbf990bbfa1e7
  9. DCW_VERSION="2.0.0"
  10. DCW="dcw-gmt-${DCW_VERSION}"
  11. DCW_URL="https://github.com/GenericMappingTools/dcw-gmt/releases/download/${DCW_VERSION}/${DCW}.${EXT}"
  12. MD5_DCW=1c817d29313be265e895be4534eccb01
  13. # Used for checking the downloaded files:
  14. check_md5 ()
  15. {
  16. md5_ref=$1
  17. file=$2
  18. test -f "$file" || return 1
  19. md5=$(openssl dgst -md5 $file | cut -d ' ' -f 2)
  20. test "$md5" = "$md5_ref"
  21. }
  22. # To return a failure if any commands inside fail
  23. set -e
  24. # Create the directory for coastline data
  25. mkdir -p $COASTLINEDIR
  26. # GSHHG and DCW tarballs are cached here:
  27. test -d $HOME/cache-gshhg-dcw || mkdir $HOME/cache-gshhg-dcw
  28. cd $HOME/cache-gshhg-dcw
  29. # GSHHG (coastlines, rivers, and political boundaries):
  30. echo ""
  31. echo "Downloading and unpacking GSHHG"
  32. echo "================================================================================"
  33. # download when md5sums don't match:
  34. check_md5 $MD5_GSHHG $GSHHG.$EXT || curl -L -O --retry 10 "${GSHHG_URL}"
  35. check_md5 $MD5_GSHHG $GSHHG.$EXT
  36. tar xzf $GSHHG.$EXT
  37. mv $GSHHG $COASTLINEDIR/gshhg
  38. # DCW (country polygons):
  39. echo ""
  40. echo "Downloading and unpacking DCW"
  41. echo "================================================================================"
  42. # download when md5sums don't match:
  43. check_md5 $MD5_DCW $DCW.$EXT || curl -L -O --retry 10 "${DCW_URL}"
  44. check_md5 $MD5_DCW $DCW.$EXT
  45. tar xzf $DCW.$EXT
  46. mv $DCW $COASTLINEDIR/dcw
  47. ls $COASTLINEDIR/gshhg $COASTLINEDIR/dcw
  48. # Turn off exit on failure.
  49. set +e
Tip!

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

Comments

Loading...