-
Notifications
You must be signed in to change notification settings - Fork 2
/
get_oisst_urls.awk
37 lines (32 loc) · 1.16 KB
/
get_oisst_urls.awk
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
#!/usr/bin/awk -f
# Author: Alfredo Hernández <[email protected]>
# Legal Stuff:
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this script. If not, see <http://www.gnu.org/licenses/>.
BEGIN{
FS = ","
OFS = ""
print "# Script to download all needed OISST files to populate the HURDAT2."
print "# Author: Alfredo Hernández <[email protected]>\n"
}
FNR > 1 {
fileid = substr($4, 1, 10)
folderid = substr($4, 1, 7)
gsub("-","", fileid)
gsub("-","", folderid)
url = "wget -nc " "https://www.ncei.noaa.gov/data/sea-surface-temperature-optimum-interpolation/access/avhrr-only/" folderid "/avhrr-only-v2." fileid ".nc" " ;"
unique[url]++
}
END {
if (NR > 3) {
for (url in unique)
print url
}
}