% This script makes the default structures for the slipBERI code for the
% 2016 Central Tottori, Japan, earthquake, as seen in:
%
% Amey, R.M.J., Hooper, A. and Morishita, Y. Going to Any Lengths: Solving
% for Fault Size and Fractal Slip for the 2016, Mw 6.2 Central Tottori
% Earthquake, Japan, using a Trans-dimensional Inversion Scheme, Journal of
% Geophysical Research: Solid Earth
%
% For details on what each parameter is, please see the help for slipBERI
%
% R.M.J.Amey 2018

clear all

% first structure: 'fault'
fault = struct('fault_descriptor_file', 'kurayoshi_fault_plane.txt',...
                'fault_coordinate_unit', 'UTM');

% second structure: 'data'
data = struct('InSAR_datafile', {{'downsampled_InSAR_kurayoshi.txt', '20150117_20161022_disp.txt', '20141207_20161023_disp.txt', '20150523_20161024_disp.txt', '20160803_20161026_disp.txt'}}, ...
              'GPS_datafile_2d', 'none',...
              'GPS_datafile_3d', 'japankurayoshi_gps.7cols',...
              'atolls_datafile', 'none',...
              'InSAR_coordinate_unit', 'long/lat',...
              'GPS_coordinate_unit', 'long/lat',...
              'UTMzone', 53,...
              'origin', [35.368, 133.815],...
              'EQ_epicenter', [35.368, 133.815, 5.7], ...     https://earthquake.usgs.gov/earthquakes/eventpage/us20007fta#executive
              'seismic_moment', 2.818e+18, ...    % (Nm) from USGS
              'moment_std', 2.1310e+17,...
              'mindist', 0,...          % choose whether you want to remove faults a certain distance from the fault or not
              'weight_InSAR', 1,...
              'weight_GPS', 1,...
              'weight_atolls', 1,...
              'varcovar_deets', {{'kurayoshi_covar.txt', '20150117_20161022_covar.txt', '20141207_20161023_covar.txt', '20150523_20161024_covar.txt', '20160803_20161026_covar.txt'}},...
              'quadtree_n_points', {{'nesteddownsample_npoints.txt', '20150117_20161022_nestedownsamplenpoints.txt', '20141207_20161023_nestedownsamplenpoints.txt', '20150523_20161024_nestedownsamplenpoints.txt', '20160803_20161026_nestedownsamplenpoints.txt'}},...
              'GPS_datafile', 'yes');
          
% third structure: 'testing'
testing = struct('testing_mode', 'no',...
                 'making_model', 'making_model_surfaceslip.mat',...
                 'var', 0.01,...
                 'add_noise', 0)  ;        
          
% fourth structure: 'invert'
invert = struct('inversion_type', 'bayesian', ...       % or 'least_squares'
                'smoothing', 'VK',...                 % or 'laplacian' or 'VK'
                'smooth_across_fault_strands', 'yes',... % or 'no', or [] if you want me to work out if you should smooth across them or not
                'iterations', 1000000, ...               % only relevant for bayesian inversions
                'regularise_moment', 'no', ...         % or 'no'
                'solve_for_dip', 'no',...
                'solve_for_correlation_length', 'no',... % or 'no'
                'solve_for_InSAR_offset', 'yes',...      % or 'no'
                'solve_for_fault_size', 'no', ...
                'slip_initial', 0.7, ...                  % meters
                'step_size', 0.005, ...                   % metres
                'alpha2_initial', 0.7,...                
                'probability_target_initial', 0.0001, ...
                'alpha2_step_size', 0.01,...    
                'pad_edges_with_zeros', 'no',...       % other option: 'yes'        
                'variable_rake', 'yes',...             % other option: 'yes'
                'load_old_MCMC_chain', 'no',...
                'solve_for_beta', 'no',...
                'beta_initial', 1,...
                'beta_step_size', 0,...
                'simulated_annealing_start', 'yes',...
                'ensemble_sampling', 'no',...
                'ensemble_move_style', [],...
                'ensemble_start', [],...
                'select_patches', 'no',...
                'circular_harmonics', 'no',...
                'add_correlation_matrix_stabiliser', 'no',...
                'quickcheck', 'yes');       
            
priors = struct('min_dip', 90,...
        'max_dip', 90,...
        'slip_prior', 'boxcar', ...             % or 'logarithmic' 
        'min_slip', 0, ...                     % metres
        'max_slip', 10, ...                    % metres
        'min_rake', -40,...                    % degrees.
        'max_rake', 20,...                    % degrees.
        'alpha2_prior', 'logarithmic',...
        'min_alpha2', 0.00001,...
        'max_alpha2', 20,...
        'alpha2flag', [],...
        'min_offset', [-1;-1;-1;-1;-1],...
        'max_offset', [1;1;1;1;1],...
        'predominant_faulting_style', {{'ss'}},...
        'max_beta', [],...
        'min_beta', [],...
        'min_circharm_coeffs', 0,...
        'max_circharm_coeffs', 15000,...
        'min_circharm_phi', 0,...
        'max_circharm_phi', 2*pi,...
        'min_circharm_center', [0, 0],...
        'max_circharm_center', [20559, 15000]);
        
% fifth structure: 'elastic_params'
elastic_params = struct('lambda', 3.23e10,...
                        'mu_okada', 3.23e10);

% sixth structure: 'disp', within which 'figures' is a nested structure of which figures you'd like
display = struct('plot_resolution_matrix', 'no',...     
                 'plotmean', 'no',...                        % other option: 'yes'
                 'plotmode', 'no',...                        % other option: 'yes'
                 'plotmedian', 'no',...                      % other option: 'no'              
                 'plotmaxlikely', 'yes',...                  % other option: 'yes'  % IN FUTURE VERSIONS THIS WILL BE DELETED, coz I've replaced it with MAP
                 'plotallslips', 'yes',...                   % other option: 'no'
                 'plotprob', 'yes',...                       % other option: 'no'
                 'plothists', 'plothistsall',...              % other option: 'plothistsample' (i.e. choose some at random to plot)
                 'plotsurfacedisp', 'yes',...                % other option: 'no'
                 'plotmarginalPDFs', 'yes',...
                 'plotMAP', 'yes',...
                 'plot3d', 'yes') ;                % other option: 'no'
             
             
                     
 % last
 housekeeping = struct('save_name', 'kurayoshislip');


% display all the structures so people actually look and check
disp('elastic_params'), disp(elastic_params)
disp('housekeeping ='); disp(housekeeping)
disp('testing ='), disp(testing)
disp('display ='), disp(display)
disp('fault ='); disp(fault)
disp('data ='); disp(data)
disp('invert ='); disp(invert)


