-
Notifications
You must be signed in to change notification settings - Fork 0
/
EQ_print_insw.m
executable file
·67 lines (58 loc) · 2.17 KB
/
EQ_print_insw.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
function [ fID ] = EQ_print_insw (xx,inmat,data)
% EQ_print_insw.m
% EQ Function that defines the names of the input files
% Nathanael Wong Zhixin, Feng Lujia
%
% This function prints the data for the weighted variance-explained into
% text file.
%
% INPUT:
% -- xx : rake ID
% -- inmat : model data
% -- data : event initial information
%
% OUTPUT:
% -- fID : file name
%
% FORMAT OF CALL: EQ_print_insw (rakeii,inmat,data)
%
% OVERVIEW:
% 1) This function extracts information on the event to create the filename
%
% 2) The function then creates the file
%
% 3) The function then prints the 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) '_' ...
'insw' xx '_co.txt' ];
fin = fopen (fID,'w');
fprintf (fin,'# Input DataFile for EQID: %s\n',data.EQID);
fprintf (fin,'# COUNT: %s\n',xx);
fprintf (fin,'# SIZE: S (WEIGHTED)\n\n');
fprintf (fin,'# This file contains all the relevant input data for the abovementioned\n');
fprintf (fin,'# earthquake event. This includes the following datasets:\n');
fprintf (fin,'# - Longitude / Latitude (d)\n');
fprintf (fin,'# - Surface Longtitude / Latitude (d)\n');
fprintf (fin,'# - z1 and z2 Depth (m)\n');
fprintf (fin,'# - Strike, Dip, Rake (d)\n');
fprintf (fin,'# - Rake-, Strike-, Dip- and Tensile-Slip (m)\n\n');
fprintf (fin,[ '# ii ID lon1 (d) lat1 (d) lon2 (d)' ...
' ' ...
'lat2 (d) slon1 (d) slat1 (d) slon2 (d) slat2 (d)' ...
' ' ...
'z1 (m) z2 (m) str (d) dip (d) rake (d)' ...
' ' ...
'rs (m) ss (m) ds (m) ts (m)\n']);
fprintf (fin,[ ' %-4d %-5d %-8.3f %-7.3f %-8.3f %-7.3f' ...
' ' ...
'%-8.3f %-7.3f %-8.3f %-7.3f %-6.0f %-6.0f' ...
' ' ...
'%-5.1f %-5.1f %-5.1f' ...
' ' ...
'%-7.4f %-7.4f %-7.4f %-7.4f\n' ], inmat');
fclose(fin);