1 %====================================================================== |
1 %====================================================================== |
2 % L O A D N A V . M |
2 % L O A D N A V . M |
3 % doc: Thu Jun 17 18:01:50 2004 |
3 % doc: Thu Jun 17 18:01:50 2004 |
4 % dlm: Fri Mar 5 15:49:00 2010 |
4 % dlm: Mon Jan 3 02:01:17 2011 |
5 % (c) 2004 ladcp@ |
5 % (c) 2004 ladcp@ |
6 % uE-Info: 167 13 NIL 0 0 72 0 2 8 NIL ofnI |
6 % uE-Info: 252 25 NIL 0 0 72 0 2 8 NIL ofnI |
7 %====================================================================== |
7 %====================================================================== |
8 |
8 |
9 % MODIFICATIONS BY ANT: |
9 % MODIFICATIONS BY ANT: |
10 % Jun 26, 2004: - totally re-wrote the file-reading, which reduces |
10 % Jun 26, 2004: - totally re-wrote the file-reading, which reduces |
11 % run time by over factor 90(!!!) --- 5.7 instead of |
11 % run time by over factor 90(!!!) --- 5.7 instead of |
31 % only when elapsed time was used) |
31 % only when elapsed time was used) |
32 % Jul 27, 2008: - nanmean() -> meannan() |
32 % Jul 27, 2008: - nanmean() -> meannan() |
33 % Oct 15, 2008: - replaced mean by median to get lat/lon (bad outliers in L1 data set) |
33 % Oct 15, 2008: - replaced mean by median to get lat/lon (bad outliers in L1 data set) |
34 % Dec 1, 2009: - BUG: geomag date check was wrong (Dec 1 2009 resulted in a date >= 2010) |
34 % Dec 1, 2009: - BUG: geomag date check was wrong (Dec 1 2009 resulted in a date >= 2010) |
35 % Jan 22, 2010: - adapted to Eric Firing's much simplified magdec utility |
35 % Jan 22, 2010: - adapted to Eric Firing's much simplified magdec utility |
|
36 % Jan 3, 2011: - changed IGRF11 validity to end of 2015 (from 2010) |
36 |
37 |
37 function [d,p]=loadnav(f,d,p) |
38 function [d,p]=loadnav(f,d,p) |
38 % function [d,p]=loadnav(f,d,p) |
39 % function [d,p]=loadnav(f,d,p) |
39 |
40 |
40 % This routine works for generic ASCII files, containing GPS time series, |
41 % This routine works for generic ASCII files, containing GPS time series, |
246 % if this test produces an error and a return value of 127, |
247 % if this test produces an error and a return value of 127, |
247 % the path is not set correctly |
248 % the path is not set correctly |
248 |
249 |
249 dstr = gregoria(date); % convert date (approx) |
250 dstr = gregoria(date); % convert date (approx) |
250 year = dstr(1); month = dstr(2); day = dstr(3); |
251 year = dstr(1); month = dstr(2); day = dstr(3); |
251 if (year < 1900 || year >= 2011) |
252 if (year < 1900 || year > 2015) |
252 error(sprintf('year = %d out of range',year)); |
253 error(sprintf('year = %d out of range',year)); |
253 end |
254 end |
254 % execute external program |
255 % execute external program |
255 CMD = sprintf('magdec %g %g %d %d %d',lon,lat,year,month,day); |
256 CMD = sprintf('magdec %g %g %d %d %d',lon,lat,year,month,day); |
256 disp(sprintf('executing %s',CMD)); |
257 disp(sprintf('executing %s',CMD)); |