« lib/App/SeismicUnixGui/sunix/plot/psmanager.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/statsMath/sufwmix.pm »
| 1 | package App::SeismicUnixGui::sunix::shell::suputgthr; | ||
| 2 | |||
| 3 | =head2 SYNOPSIS | ||
| 4 | |||
| 5 | PERL PROGRAM NAME: | ||
| 6 | |||
| 7 | AUTHOR: Juan Lorenzo (Perl module only) | ||
| 8 | |||
| 9 | DATE: | ||
| 10 | |||
| 11 | DESCRIPTION: | ||
| 12 | sumute | ||
| 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 | SUPUTGTHR - split the stdout flow to gathers on the bases of given | ||
| 25 | |||
| 26 | key parameter. | ||
| 27 | |||
| 28 | suputgthr <stdin dir= [Optional parameters] | ||
| 29 | |||
| 30 | Required parameters: | ||
| 31 | |||
| 32 | dir= Name of directory where to put the gathers | ||
| 33 | |||
| 34 | Optional parameters: | ||
| 35 | |||
| 36 | key=ep header key word to watch | ||
| 37 | |||
| 38 | suffix=".hsu" extension of the output files | ||
| 39 | |||
| 40 | verbose=0 verbose = 1 echos information | ||
| 41 | |||
| 42 | numlength=7 Length of numeric part of filename | ||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | Notes: | ||
| 47 | |||
| 48 | The name of the file is constructed from the key parameter. Traces | ||
| 49 | |||
| 50 | are put into a temporary disk file, and renamed when key parameter | ||
| 51 | |||
| 52 | changes in the input flow to "key.suffix". The result is that the | ||
| 53 | |||
| 54 | directory "dir" contains separate files by "key" ensemble. ", | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | Header field modified: ntr to be the number of traces in a given | ||
| 59 | |||
| 60 | ensemble. | ||
| 61 | |||
| 62 | Related programs: sugetgthr, susplit | ||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | Credits: Balazs Nemeth, Potash Corporation, Saskatoon Saskatchewan | ||
| 69 | |||
| 70 | given to CWP in 2008 | ||
| 71 | |||
| 72 | Note: | ||
| 73 | |||
| 74 | The "valxxx" subroutines are in su/lib/valpkge.c. In particular, | ||
| 75 | |||
| 76 | "valcmp" shares the annoying attribute of "strcmp" that | ||
| 77 | |||
| 78 | if (valcmp(type, val, valnew) { | ||
| 79 | |||
| 80 | ... | ||
| 81 | |||
| 82 | } | ||
| 83 | |||
| 84 | will be performed when val and valnew are different. | ||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | =head2 CHANGES and their DATES | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | use Moose; | ||
| 97 | our $VERSION = '0.0.1'; | ||
| 98 | |||
| 99 | =head2 Import packages | ||
| 100 | |||
| 101 | =cut | ||
| 102 | |||
| 103 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 104 | |||
| 105 | use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin); | ||
| 106 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 107 | |||
| 108 | =head2 instantiation of packages | ||
| 109 | |||
| 110 | =cut | ||
| 111 | |||
| 112 | my $get = L_SU_global_constants->new(); | ||
| 113 | my $Project = Project_config->new(); | ||
| 114 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); | ||
| 115 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 116 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); | ||
| 117 | |||
| 118 | my $var = $get->var(); | ||
| 119 | my $on = $var->{_on}; | ||
| 120 | my $off = $var->{_off}; | ||
| 121 | my $true = $var->{_true}; | ||
| 122 | my $false = $var->{_false}; | ||
| 123 | my $empty_string = $var->{_empty_string}; | ||
| 124 | |||
| 125 | =head2 Encapsulated | ||
| 126 | hash of private variables | ||
| 127 | |||
| 128 | =cut | ||
| 129 | |||
| 130 | my $suputgthr = { | ||
| 131 | _dir => '', | ||
| 132 | _key => '', | ||
| 133 | _numlength => '', | ||
| 134 | _suffix => '', | ||
| 135 | _verbose => '', | ||
| 136 | _Step => '', | ||
| 137 | _note => '', | ||
| 138 | |||
| 139 | }; | ||
| 140 | |||
| 141 | =head2 sub Step | ||
| 142 | |||
| 143 | collects switches and assembles bash instructions | ||
| 144 | by adding the program name | ||
| 145 | |||
| 146 | =cut | ||
| 147 | |||
| 148 | sub Step { | ||
| 149 | |||
| 150 | $suputgthr->{_Step} = 'suputgthr' . $suputgthr->{_Step}; | ||
| 151 | return ( $suputgthr->{_Step} ); | ||
| 152 | |||
| 153 | } | ||
| 154 | |||
| 155 | =head2 sub note | ||
| 156 | |||
| 157 | collects switches and assembles bash instructions | ||
| 158 | by adding the program name | ||
| 159 | |||
| 160 | =cut | ||
| 161 | |||
| 162 | sub note { | ||
| 163 | |||
| 164 | $suputgthr->{_note} = 'suputgthr' . $suputgthr->{_note}; | ||
| 165 | return ( $suputgthr->{_note} ); | ||
| 166 | |||
| 167 | } | ||
| 168 | |||
| 169 | =head2 sub clear | ||
| 170 | |||
| 171 | =cut | ||
| 172 | |||
| 173 | sub clear { | ||
| 174 | |||
| 175 | $suputgthr->{_dir} = ''; | ||
| 176 | $suputgthr->{_key} = ''; | ||
| 177 | $suputgthr->{_numlength} = ''; | ||
| 178 | $suputgthr->{_suffix} = ''; | ||
| 179 | $suputgthr->{_verbose} = ''; | ||
| 180 | $suputgthr->{_Step} = ''; | ||
| 181 | $suputgthr->{_note} = ''; | ||
| 182 | } | ||
| 183 | |||
| 184 | =head2 sub dir | ||
| 185 | |||
| 186 | |||
| 187 | =cut | ||
| 188 | |||
| 189 | sub dir { | ||
| 190 | |||
| 191 | my ( $self, $dir ) = @_; | ||
| 192 | if ( $dir ne $empty_string ) { | ||
| 193 | |||
| 194 | $suputgthr->{_dir} = $dir; | ||
| 195 | $suputgthr->{_note} = $suputgthr->{_note} . ' dir=' . $suputgthr->{_dir}; | ||
| 196 | $suputgthr->{_Step} = $suputgthr->{_Step} . ' dir=' . $suputgthr->{_dir}; | ||
| 197 | |||
| 198 | } else { | ||
| 199 | print("suputgthr, dir, missing dir,\n"); | ||
| 200 | } | ||
| 201 | } | ||
| 202 | |||
| 203 | =head2 sub key | ||
| 204 | |||
| 205 | |||
| 206 | =cut | ||
| 207 | |||
| 208 | sub key { | ||
| 209 | |||
| 210 | my ( $self, $key ) = @_; | ||
| 211 | if ( $key ne $empty_string ) { | ||
| 212 | |||
| 213 | $suputgthr->{_key} = $key; | ||
| 214 | $suputgthr->{_note} = $suputgthr->{_note} . ' key=' . $suputgthr->{_key}; | ||
| 215 | $suputgthr->{_Step} = $suputgthr->{_Step} . ' key=' . $suputgthr->{_key}; | ||
| 216 | |||
| 217 | } else { | ||
| 218 | print("suputgthr, key, missing key,\n"); | ||
| 219 | } | ||
| 220 | } | ||
| 221 | |||
| 222 | =head2 sub numlength | ||
| 223 | |||
| 224 | |||
| 225 | =cut | ||
| 226 | |||
| 227 | sub numlength { | ||
| 228 | |||
| 229 | my ( $self, $numlength ) = @_; | ||
| 230 | if ( $numlength ne $empty_string ) { | ||
| 231 | |||
| 232 | $suputgthr->{_numlength} = $numlength; | ||
| 233 | $suputgthr->{_note} = $suputgthr->{_note} . ' numlength=' . $suputgthr->{_numlength}; | ||
| 234 | $suputgthr->{_Step} = $suputgthr->{_Step} . ' numlength=' . $suputgthr->{_numlength}; | ||
| 235 | |||
| 236 | } else { | ||
| 237 | print("suputgthr, numlength, missing numlength,\n"); | ||
| 238 | } | ||
| 239 | } | ||
| 240 | |||
| 241 | =head2 sub suffix | ||
| 242 | |||
| 243 | |||
| 244 | =cut | ||
| 245 | |||
| 246 | sub suffix { | ||
| 247 | |||
| 248 | my ( $self, $suffix ) = @_; | ||
| 249 | if ( $suffix ne $empty_string ) { | ||
| 250 | |||
| 251 | $suputgthr->{_suffix} = $suffix; | ||
| 252 | $suputgthr->{_note} = $suputgthr->{_note} . ' suffix=' . $suputgthr->{_suffix}; | ||
| 253 | $suputgthr->{_Step} = $suputgthr->{_Step} . ' suffix=' . $suputgthr->{_suffix}; | ||
| 254 | |||
| 255 | } else { | ||
| 256 | print("suputgthr, suffix, missing suffix,\n"); | ||
| 257 | } | ||
| 258 | } | ||
| 259 | |||
| 260 | =head2 sub verbose | ||
| 261 | |||
| 262 | |||
| 263 | =cut | ||
| 264 | |||
| 265 | sub verbose { | ||
| 266 | |||
| 267 | my ( $self, $verbose ) = @_; | ||
| 268 | if ( $verbose ne $empty_string ) { | ||
| 269 | |||
| 270 | $suputgthr->{_verbose} = $verbose; | ||
| 271 | $suputgthr->{_note} = $suputgthr->{_note} . ' verbose=' . $suputgthr->{_verbose}; | ||
| 272 | $suputgthr->{_Step} = $suputgthr->{_Step} . ' verbose=' . $suputgthr->{_verbose}; | ||
| 273 | |||
| 274 | } else { | ||
| 275 | print("suputgthr, verbose, missing verbose,\n"); | ||
| 276 | } | ||
| 277 | } | ||
| 278 | |||
| 279 | =head2 sub get_max_index | ||
| 280 | |||
| 281 | max index = number of input variables -1 | ||
| 282 | |||
| 283 | =cut | ||
| 284 | |||
| 285 | sub get_max_index { | ||
| 286 | my ($self) = @_; | ||
| 287 | my $max_index = 4; | ||
| 288 | |||
| 289 | return ($max_index); | ||
| 290 | } | ||
| 291 | |||
| 292 | 1; |