diff --git a/CODE/etc/rawformats.conf b/CODE/etc/rawformats.conf index 5755fa24..34d189e5 100644 --- a/CODE/etc/rawformats.conf +++ b/CODE/etc/rawformats.conf @@ -22,8 +22,8 @@ winston|EARTHWORM|EarthWorm Winston Wave Server data request||host:port gipsy|GNSS|JPL GIPSY-OASIS .tdp file|ANTENNA,RECEIVER,XYZ|fullpath of root directory containing YYYY/FID/*.tdp files gipsyx|GNSS|JPL GipsyX .tdp file|ANTENNA,RECEIVER,XYZ|fullpath of root directory containing YYYY/FID/*.tdp files globkval|GNSS|MIT GAMIT/GLOBK VAL file||fullpath of directory containing the .VAL file -spotgins-enu-v2|GNSS|SPOTGINS solutions - version 2 (<2025-08)||fullpath of file(s) with bash wildcard facilities, possible $FID, or URL to single file -spotgins-ippp|GNSS|SPOTGINS IPPP time series||fullpath of file(s) with bash wildcard facilities, possible $FID, or URL to single file +spotgins-enu|GNSS|SPOTGINS ENU solutions - v2&3||fullpath of file(s) with bash wildcard facilities, possible $FID, or URL to single file +spotgins-ippp|GNSS|SPOTGINS IPPP time series (ITES)||fullpath of file(s) with bash wildcard facilities, possible $FID, or URL to single file gamit-pos|GNSS|MIT GAMIT/GLOBL POS time series||fullpath of file(s) with bash wildcard facilities, possible $FID, or URL to single file pbogps-pos|GNSS|PBO GPS POS time series||fullpath of file(s) with bash wildcard facilities, possible $FID, or URL to single file usgs-rneu|GNSS|USGS RNEU text file||fullpath of file(s) with bash wildcard facilities diff --git a/CODE/matlab/readfmtdata.m b/CODE/matlab/readfmtdata.m index b553e83f..33cd49d2 100644 --- a/CODE/matlab/readfmtdata.m +++ b/CODE/matlab/readfmtdata.m @@ -65,7 +65,7 @@ case {'miniseed','seedlink','arclink','combined','fdsnws-dataselect'} D(n) = readfmtdata_miniseed(WO,P,N(n),F); - case {'globkval','gipsy','gipsyx','gipsy-tdp','usgs-rneu','ies-neu','ogc-neu','ingv-gps','sbe37-ascii','spotgins-enu-v2','spotgins-ippp','gamit-pos','pbogps-pos'} + case {'globkval','gipsy','gipsyx','gipsy-tdp','usgs-rneu','ies-neu','ogc-neu','ingv-gps','sbe37-ascii','spotgins-enu','spotgins-ippp','gamit-pos','pbogps-pos'} D(n) = readfmtdata_gnss(WO,P,N(n),F); case {'hyp71sum2k','fdsnws-event','scevtlog-xml'} diff --git a/CODE/matlab/readfmtdata_gnss.m b/CODE/matlab/readfmtdata_gnss.m index 4912f8af..e8ce6611 100644 --- a/CODE/matlab/readfmtdata_gnss.m +++ b/CODE/matlab/readfmtdata_gnss.m @@ -40,6 +40,13 @@ % data format: jjjjj.jj E N V dE dN dV yyyymmddhhmmss yyyy.yyyyyyyyy % node calibration: no .CLB file or 4 components (East, North, Up) in meters and (Orbit) % +% format 'spotgins-enu' +% type: SPOTGINS solutions - supports v2 and v3 formats (auto-detection) +% filename/url: P.RAWDATA (use $FID to point the right file/url) +% data format v2: jjjjj.jj E N V dE dN dV yyyymmddhhmmss yyyy.yyyyyyyyy +% data format v3: MJD DispEast DispNorth DispUp SigmaEast SigmaNorth SigmaUp CorrEN CorrEU CorrNU yyyy-mm-ddTHH:MM:SS DecimalYear Const Flag DateOfExe GinsVersion PrairieVersion +% node calibration: no .CLB file or 4 components (East, North, Up) in meters and (Orbit)READFMTDATA_GNSS subfunction of readfmtdata.m +% % format 'spotgins-ippp' % type: GINS IPPP solutions % filename/url: P.RAWDATA (use $FID to point the right file/url) @@ -306,19 +313,66 @@ end %D.ITRF_YEAR = 'ITRF08'; - % ----------------------------------------------------------------------------- -case 'spotgins-enu-v2' - % format exemple - %#jjjjj.jjjjjjjj _____E _____N _____U ____dE ____dN ____dU yyyymmddHHMMSS yyyy.yyyyyyy Const Dateofexe GinsVersion - % 52670.83876160 0.055822 0.051638 0.005578 0.001263 0.001163 0.004899 20030131200749 2003.0844898 G 250404_185253 VALIDE_24_2 - % 52671.50195600 0.057207 0.054240 -0.004722 0.000705 0.000619 0.002600 20030201120249 2003.0863067 G 250404_185253 VALIDE_24_2 - +case 'spotgins-enu' + % Supports both v2 and v3 SPOTGINS formats + % + % v2 format example: + %#jjjjj.jjjjjjjj _____E _____N _____U ____dE ____dN ____dU yyyymmddHHMMSS yyyy.yyyyyyy Const Dateofexe GinsVersion + % 52670.83876160 0.055822 0.051638 0.005578 0.001263 0.001163 0.004899 20030131200749 2003.0844898 G 250404_185253 VALIDE_24_2 + % 52671.50195600 0.057207 0.054240 -0.004722 0.000705 0.000619 0.002600 20030201120249 2003.0863067 G 250404_185253 VALIDE_24_2 + % + % v3 format example: + %#MJD DispEast DispNorth DispUp SigmaEast SigmaNorth SigmaUp CorrEN CorrEU CorrNU yyyy-mm-ddTHH:MM:SS DecimalYear Const Flag DateOfExe GinsVersion PrairieVersion + % 51668.5 0.080276 -2.058358 0.009854 0.000312 0.000439 0.001339 -0.028963 -0.085824 -0.011884 2000-05-04T12:00:00 2000.340164 G 0 250910_120313 25_1 v56 + % 51669.5 0.077154 -2.057207 0.005923 0.000257 0.000371 0.001109 -0.017412 -0.060937 -0.124317 2000-05-05T12:00:00 2000.342896 G 0 250910_120313 25_1 v56 + fdat = sprintf('%s/%s.dat',F.ptmp,N.ID); wosystem(sprintf('rm -f %s',fdat),P); + + % Detect format version from first file + format_version = ''; + if ~isempty(F.raw) + first_raw = F.raw{1}; + if strncmpi('http',first_raw,4) + [s,header] = wosystem(sprintf('curl -s -S "%s" | head -20',first_raw),P); + else + [s,header] = wosystem(sprintf('head -20 %s',first_raw),P); + end + if s == 0 + if ~isempty(strfind(header,'SPOTGINS SOLUTION [POSITION] v3')) || ~isempty(strfind(header,'MJD DispEast')) + format_version = 'v3'; + elseif ~isempty(strfind(header,'SPOTGINS SOLUTION [POSITION] v2')) || ~isempty(strfind(header,'jjjjj.jjjjjjjj')) + format_version = 'v2'; + else + % Try to detect from data columns (fallback method) + if strncmpi('http',first_raw,4) + [s,sample] = wosystem(sprintf('curl -s -S "%s" | grep -v "^#" | head -1',first_raw),P); + else + [s,sample] = wosystem(sprintf('grep -v "^#" %s | head -1',first_raw),P); + end + if s == 0 && ~isempty(sample) + cols = length(strsplit(strtrim(sample))); + if cols >= 17 % v3 has 17+ columns + format_version = 'v3'; + elseif cols >= 11 % v2 has 11+ columns + format_version = 'v2'; + end + end + end + end + end + + if isempty(format_version) + format_version = 'v2'; % default fallback + fprintf('%s: ** INFO ** Could not detect SPOTGINS format version, assuming v2.\n',wofun); + else + fprintf('%s: ** INFO ** Detected SPOTGINS format %s.\n',wofun,format_version); + end + for a = 1:length(F.raw) fraw = F.raw{a}; - cmd0 = sprintf('awk ''/^[^#]/ {print}'' >> %s',fdat); % removes header lines + cmd0 = sprintf('awk ''/^[^#]/ {print}'' >> %s',fdat); % removes header lines if strncmpi('http',fraw,4) s = wosystem(sprintf('curl -s -S "%s" | %s',fraw,cmd0),P); if s ~= 0 @@ -331,20 +385,31 @@ fprintf('%s: ** WARNING ** Raw data "%s" not found.\n',wofun,fraw); end end - - - % load the file + + % load the file if exist(fdat,'file') dd = dlmread(fdat); else dd = []; end + if ~isempty(dd) - t = dd(:,1) + 678941.5007; % converts MJD to datenum - d = [dd(:,2:4),zeros(size(dd,1),1)]; % North(mm),East(mm),Up(mm) => E(m),N(m),U(m),Orbit - e = dd(:,5:7); + switch format_version + case 'v3' + % v3 format: MJD DispEast DispNorth DispUp SigmaEast SigmaNorth SigmaUp ... + t = dd(:,1) + 678941.5007; % converts MJD to datenum + d = [dd(:,2:4),zeros(size(dd,1),1)]; % DispEast,DispNorth,DispUp,Orbit => E(m),N(m),U(m),Orbit + e = dd(:,5:7); % SigmaEast,SigmaNorth,SigmaUp + + case 'v2' + % v2 format: jjjjj.jj E N U dE dN dU ... + t = dd(:,1) + 678941.5007; % converts MJD to datenum + d = [dd(:,2:4),zeros(size(dd,1),1)]; % E,N,U,Orbit => E(m),N(m),U(m),Orbit + e = dd(:,5:7); % dE,dN,dU + end + e(e