-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathget_navfile.m
69 lines (63 loc) · 2.02 KB
/
get_navfile.m
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
60
61
62
63
64
65
66
67
68
69
function fexist = get_navfile(cyyyy,cdoy)
%function fexist = get_navfile(cyyyy,cdoy)
% inputs are character strings for year and day of year
% which must be 4 and 3 characters long, respectively
%
% the code was modified 2020 April 12
% first look at CDDIS, then the NGS, then SOPAC
% unavco is no longer used as an archive for nav messages
%
% returns boolean with file existence
% author: kristine larson
fexist = false;
cyy = cyyyy(3:4);
% file will always be stored with station name auto
% always lowercase
autoname = ['auto' cdoy '0.' cyy 'n'];
% executable to get files
wgetexe=getenv('WGET');
sopac = ['ftp://garner.ucsd.edu/pub/rinex/' cyyyy '/' cdoy '/'];
unavco = ['ftp://data-out.unavco.org/pub/rinex/nav/' cyyyy '/' cdoy '/'];
cddis = ['ftp://cddis.nasa.gov/gnss/data/daily/' cyyyy '/' cdoy '/' cyy 'n/'];
bigDisk_in_MD = ['ftp://geodesy.noaa.gov/cors/rinex/' cyyyy '/' cdoy '/'];
try
navname = ['brdc' cdoy '0.' cyy 'n'];
url = [cddis navname '.Z'];
unix([wgetexe ' ' url]);
unix(['uncompress ' navname '.Z']);
unix(['mv ' navname ' ' autoname]);
catch
disp('prob at CDDIS')
try
navname = ['brdc' cdoy '0.' cyy 'n'];
disp('try the big disk in maryland');
url = [bigDisk_in_MD navname '.gz'];
unix([wgetexe ' ' url]);
unix(['gunzip ' navname '.gz']);
unix(['mv ' navname ' ' autoname]);
catch
disp('problem with the big disk in Maryland')
end
end
% try sopac as last resort
if ~exist(autoname)
disp('will look at SOPAC')
try
navname = autoname;
url = [sopac navname '.Z'];
unix([wgetexe ' ' url]);
unix(['uncompress ' navname '.Z']);
% don't need to move file because they use the convention I want.
catch
disp('problem at SOPAC')
unix(['rm -f ' navname '.Z']);
end
end
if exist(autoname)
fexist = true;
end
% navname = ['sc02' cdoy '0.' cyy 'n'];
% url = [unavco navname '.Z'];
% unix([wgetexe ' ' url]);
% unix(['uncompress ' navname '.Z']);
% unix(['mv ' navname ' ' autoname]);