| 1 | package App::SeismicUnixGui::sunix::model::surandstat; | ||
| 2 | |||
| 3 | =head2 SYNOPSIS | ||
| 4 | |||
| 5 | PERL PROGRAM NAME: | ||
| 6 | |||
| 7 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 8 | |||
| 9 | DATE: | ||
| 10 | |||
| 11 | DESCRIPTION: | ||
| 12 | |||
| 13 | Version: | ||
| 14 | |||
| 15 | =head2 USE | ||
| 16 | |||
| 17 | =head3 NOTES | ||
| 18 | |||
| 19 | =head4 Examples | ||
| 20 | |||
| 21 | =head2 SYNOPSIS | ||
| 22 | |||
| 23 | =head3 SEISMIC UNIX NOTES | ||
| 24 | SURANDSTAT - Add RANDom time shifts STATIC errors to seismic traces | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | surandstat <stdin >stdout [optional parameters] | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Required parameters: | ||
| 33 | |||
| 34 | none | ||
| 35 | |||
| 36 | Optional Parameters: | ||
| 37 | |||
| 38 | seed=from_clock random number seed (integer) | ||
| 39 | |||
| 40 | max=tr.dt maximum random time shift (ms) | ||
| 41 | |||
| 42 | scale=1.0 scale factor for shifts | ||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | Credits: | ||
| 49 | |||
| 50 | U Houston: Chris Liner c. 2009 | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | =head2 User's notes (Juan Lorenzo) | ||
| 57 | untested | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | |||
| 62 | =head2 CHANGES and their DATES | ||
| 63 | |||
| 64 | =cut | ||
| 65 | |||
| 66 | use Moose; | ||
| 67 | our $VERSION = '0.0.1'; | ||
| 68 | |||
| 69 | |||
| 70 | =head2 Import packages | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 75 | |||
| 76 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin); | ||
| 77 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 78 | |||
| 79 | |||
| 80 | =head2 instantiation of packages | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | my $get = L_SU_global_constants->new(); | ||
| 85 | my $Project = Project_config->new(); | ||
| 86 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 87 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 88 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 89 | |||
| 90 | my $var = $get->var(); | ||
| 91 | my $on = $var->{_on}; | ||
| 92 | my $off = $var->{_off}; | ||
| 93 | my $true = $var->{_true}; | ||
| 94 | my $false = $var->{_false}; | ||
| 95 | my $empty_string = $var->{_empty_string}; | ||
| 96 | |||
| 97 | =head2 Encapsulated | ||
| 98 | hash of private variables | ||
| 99 | |||
| 100 | =cut | ||
| 101 | |||
| 102 | my $surandstat = { | ||
| 103 | _max => '', | ||
| 104 | _scale => '', | ||
| 105 | _seed => '', | ||
| 106 | _Step => '', | ||
| 107 | _note => '', | ||
| 108 | |||
| 109 | }; | ||
| 110 | |||
| 111 | =head2 sub Step | ||
| 112 | |||
| 113 | collects switches and assembles bash instructions | ||
| 114 | by adding the program name | ||
| 115 | |||
| 116 | =cut | ||
| 117 | |||
| 118 | sub Step { | ||
| 119 | |||
| 120 | $surandstat->{_Step} = 'surandstat'.$surandstat->{_Step}; | ||
| 121 | return ( $surandstat->{_Step} ); | ||
| 122 | |||
| 123 | } | ||
| 124 | |||
| 125 | |||
| 126 | =head2 sub note | ||
| 127 | |||
| 128 | collects switches and assembles bash instructions | ||
| 129 | by adding the program name | ||
| 130 | |||
| 131 | =cut | ||
| 132 | |||
| 133 | sub note { | ||
| 134 | |||
| 135 | $surandstat->{_note} = 'surandstat'.$surandstat->{_note}; | ||
| 136 | return ( $surandstat->{_note} ); | ||
| 137 | |||
| 138 | } | ||
| 139 | |||
| 140 | |||
| 141 | |||
| 142 | =head2 sub clear | ||
| 143 | |||
| 144 | =cut | ||
| 145 | |||
| 146 | sub clear { | ||
| 147 | |||
| 148 | $surandstat->{_max} = ''; | ||
| 149 | $surandstat->{_scale} = ''; | ||
| 150 | $surandstat->{_seed} = ''; | ||
| 151 | $surandstat->{_Step} = ''; | ||
| 152 | $surandstat->{_note} = ''; | ||
| 153 | } | ||
| 154 | |||
| 155 | |||
| 156 | =head2 sub max | ||
| 157 | |||
| 158 | |||
| 159 | =cut | ||
| 160 | |||
| 161 | sub max { | ||
| 162 | |||
| 163 | my ( $self,$max ) = @_; | ||
| 164 | if ( $max ne $empty_string ) { | ||
| 165 | |||
| 166 | $surandstat->{_max} = $max; | ||
| 167 | $surandstat->{_note} = $surandstat->{_note}.' max='.$surandstat->{_max}; | ||
| 168 | $surandstat->{_Step} = $surandstat->{_Step}.' max='.$surandstat->{_max}; | ||
| 169 | |||
| 170 | } else { | ||
| 171 | print("surandstat, max, missing max,\n"); | ||
| 172 | } | ||
| 173 | } | ||
| 174 | |||
| 175 | |||
| 176 | =head2 sub scale | ||
| 177 | |||
| 178 | |||
| 179 | =cut | ||
| 180 | |||
| 181 | sub scale { | ||
| 182 | |||
| 183 | my ( $self,$scale ) = @_; | ||
| 184 | if ( $scale ne $empty_string ) { | ||
| 185 | |||
| 186 | $surandstat->{_scale} = $scale; | ||
| 187 | $surandstat->{_note} = $surandstat->{_note}.' scale='.$surandstat->{_scale}; | ||
| 188 | $surandstat->{_Step} = $surandstat->{_Step}.' scale='.$surandstat->{_scale}; | ||
| 189 | |||
| 190 | } else { | ||
| 191 | print("surandstat, scale, missing scale,\n"); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | |||
| 196 | =head2 sub seed | ||
| 197 | |||
| 198 | |||
| 199 | =cut | ||
| 200 | |||
| 201 | sub seed { | ||
| 202 | |||
| 203 | my ( $self,$seed ) = @_; | ||
| 204 | if ( $seed ne $empty_string ) { | ||
| 205 | |||
| 206 | $surandstat->{_seed} = $seed; | ||
| 207 | $surandstat->{_note} = $surandstat->{_note}.' seed='.$surandstat->{_seed}; | ||
| 208 | $surandstat->{_Step} = $surandstat->{_Step}.' seed='.$surandstat->{_seed}; | ||
| 209 | |||
| 210 | } else { | ||
| 211 | print("surandstat, seed, missing seed,\n"); | ||
| 212 | } | ||
| 213 | } | ||
| 214 | |||
| 215 | |||
| 216 | =head2 sub get_max_index | ||
| 217 | |||
| 218 | max index = number of input variables -1 | ||
| 219 | |||
| 220 | =cut | ||
| 221 | |||
| 222 | sub get_max_index { | ||
| 223 | my ($self) = @_; | ||
| 224 | my $max_index = 2; | ||
| 225 | |||
| 226 | return($max_index); | ||
| 227 | } | ||
| 228 | |||
| 229 | |||
| 230 | 1; |