-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEQ_print_outl.m
executable file
·63 lines (51 loc) · 2.05 KB
/
EQ_print_outl.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
function [ fID ] = EQ_print_outl (xx,outmat,data,GPS)
% EQ_print_outl.m
% EQ Function that prints misfit data into files
% Nathanael Wong Zhixin, Feng Lujia
%
% This function prints a data matrix into text file containing the
% GPS displacement information for the large loop
%
% INPUT:
% -- xx : rake ii
% -- outmat : modelled GPS displacement
% -- data : earthquake event information
% -- GPS : GPS displacement information
%
% OUTPUT:
% -- fID : filename
%
% FORMAT OF CALL: EQ_print_outl (rakeii,mfitmat,data)
% OVERVIEW:
% 1) This function prints the output data into the file
%
% VERSIONS:
% 1) -- Final version validated and commented on 20190811 by Nathanael Wong
EQID = data.EQID; EQID = strrep (EQID,'co','');
regID = data.type(5); mu = data.slip(2);
regname = EQ_create_printregname (regID);
fID = [ EQID '_' regname '_' 'Rig' num2str(mu) '_outl' xx '_co.txt' ];
sites = GPS.sites; n = numel(sites);
fout = fopen (fID,'w');
fprintf (fout,'# Output DataFile for EQID: %s\n',data.EQID);
fprintf (fout,'# COUNT: %s\n',xx);
fprintf (fout,'# SIZE: L\n\n');
fprintf (fout,'# This file contains all the relevant output data for the abovementioned\n');
fprintf (fout,'# earthquake event. This includes the following datasets:\n');
fprintf (fout,'# - Observed Easting Displacement for all stations (m)\n');
fprintf (fout,'# - Observed Northing Displacement for all stations (m)\n');
fprintf (fout,'# - Observed Vertical Displacement for all stations (m)\n\n');
fprintf (fout,'# The following GPS stations recorded significant displacement\n');
for ii = 1 : n
fprintf (fout,'# - (%02d) %s\n',ii,sites{ii});
end
fprintf (fout,'\n');
fprintf (fout,'# ii ID '); formatspec = ' %-4d %-5d';
for ii = 1 : n
fprintf (fout,' %02dE (m) %02dN (m) %02dV (m)',ii,ii,ii);
formatspec = [ formatspec ' %-8.5f %-8.5f %-8.5f' ]; %#ok<AGROW>
end
fprintf (fout,'\n');
formatspec = [ formatspec '\n' ];
fprintf (fout,formatspec, outmat');
fclose(fout);