« lib/App/SeismicUnixGui/geopsy/gpdcreport.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/model/normray.pm »
| 1 | package App::SeismicUnixGui::geopsy::gpprofile; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | =pod | ||
| 6 | |||
| 7 | =head1 DOCUMENTATION | ||
| 8 | |||
| 9 | =head2 SYNOPSIS | ||
| 10 | |||
| 11 | PROGRAM NAME: Gpprofile | ||
| 12 | AUTHOR: Derek Goff | ||
| 13 | DATE: May 5 2015 | ||
| 14 | DESCRIPTION: A package to use geopsy's gpprofile function | ||
| 15 | to resample Vs profiles from dinver | ||
| 16 | VERSION: 0.1 | ||
| 17 | |||
| 18 | =head2 Use | ||
| 19 | |||
| 20 | =head2 Notes | ||
| 21 | |||
| 22 | This Program derives from dinver in Geopsy | ||
| 23 | '_note' keeps track of actions for use in graphics | ||
| 24 | '_Step' keeps track of actions for execution in the system | ||
| 25 | |||
| 26 | =head2 Example | ||
| 27 | |||
| 28 | =head2 Gpprofile Notes | ||
| 29 | |||
| 30 | Usage: gpprofile [OPTIONS] [FILE1 [FILE2 ...]] | ||
| 31 | |||
| 32 | Print profile computed from a layered model given through stdin or FILE | ||
| 33 | |||
| 34 | Format for layered models: | ||
| 35 | Line 1 <number of layers including half-space for first model> | ||
| 36 | Line 2 <thickness (m)> <Vp (m/s)> <Vs (m/s)> <Density (kg/m3)>[ <Qp> <Qs>] | ||
| 37 | .... | ||
| 38 | Line n 0 <Vp (m/s)> <Vs (m/s)> <Density (kg/m3)>[ <Qp> <Qs>] | ||
| 39 | Line n+1 <number of layers including half-space for second model> | ||
| 40 | .... | ||
| 41 | |||
| 42 | Quality factors are not mandatory. Any number of models can be given as input. | ||
| 43 | |||
| 44 | Profile type options: | ||
| 45 | -vp Export Vp profiles | ||
| 46 | -vs Export Vs profiles (default) | ||
| 47 | -rho Export density profiles | ||
| 48 | -nu Export Poisson's ratio profiles | ||
| 49 | -imp Export impedance profiles | ||
| 50 | |||
| 51 | Output type options: | ||
| 52 | -original Export profiles with original sampling from input models (default) | ||
| 53 | -resample Export profiles with a custom sampling (see -h sampling for details) | ||
| 54 | -average-profiles Export averaged profiles with a custom sampling (see -h sampling for | ||
| 55 | details). Various profiles are averaged into one single output. | ||
| 56 | -average-depths Export averaged profiles with a custom sampling (see -h sampling for | ||
| 57 | details). Average is performed over the depth axis. | ||
| 58 | -average-at <DEPTH> Returns the average profile over DEPTH meters. | ||
| 59 | -minmax Export minimum and maximum profiles with a custom sampling (see -h sampling | ||
| 60 | for details) | ||
| 61 | |||
| 62 | Depth sampling options: | ||
| 63 | -d, -max-depth <DEPTH> Maximum depth for resampled output types (default=100m) | ||
| 64 | -n <N> Number of samples for resampled output types (default=100) | ||
| 65 | See also: | ||
| 66 | More information at http://www.geopsy.org | ||
| 67 | |||
| 68 | Authors: | ||
| 69 | Marc Wathelet | ||
| 70 | Marc Wathelet (LGIT, Grenoble, France) | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | my $Gpprofile = { | ||
| 75 | _Step => '', | ||
| 76 | _note => '', | ||
| 77 | _vp => '', | ||
| 78 | _vs => '', | ||
| 79 | _rho => '', | ||
| 80 | _nu => '', | ||
| 81 | _imp => '', | ||
| 82 | _original => '', | ||
| 83 | _resample => '', | ||
| 84 | _depth => '', | ||
| 85 | _samples => '', | ||
| 86 | _avgAt => '', | ||
| 87 | _file => '', | ||
| 88 | }; | ||
| 89 | |||
| 90 | =pod | ||
| 91 | |||
| 92 | =head1 Description of Subroutines | ||
| 93 | |||
| 94 | =head2 Subroutine clear | ||
| 95 | |||
| 96 | Sets all variable strings to '' (nothing) | ||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | sub clear { | ||
| 101 | $Gpprofile->{_Step} = ''; | ||
| 102 | $Gpprofile->{_note} = ''; | ||
| 103 | $Gpprofile->{_original} = ''; | ||
| 104 | $Gpprofile->{_vp} = ''; | ||
| 105 | $Gpprofile->{_vs} = ''; | ||
| 106 | $Gpprofile->{_rho} = ''; | ||
| 107 | $Gpprofile->{_nu} = ''; | ||
| 108 | $Gpprofile->{_imp} = ''; | ||
| 109 | $Gpprofile->{_resample} = ''; | ||
| 110 | $Gpprofile->{_depth} = ''; #-d | ||
| 111 | $Gpprofile->{_samples} = ''; #-n | ||
| 112 | $Gpprofile->{_avgAt} = ''; | ||
| 113 | $Gpprofile->{_file} = ''; | ||
| 114 | } | ||
| 115 | |||
| 116 | #### | ||
| 117 | |||
| 118 | =pod | ||
| 119 | |||
| 120 | =head2 Subroutine vp | ||
| 121 | |||
| 122 | Export Vp profiles | ||
| 123 | |||
| 124 | =cut | ||
| 125 | |||
| 126 | sub vp { | ||
| 127 | my ( $sub, $vp ) = @_; | ||
| 128 | $Gpprofile->{_vp} = $vp if defined($vp); | ||
| 129 | $Gpprofile->{_note} = $Gpprofile->{_note} . ' -vp ' . $Gpprofile->{_vp}; | ||
| 130 | $Gpprofile->{_Step} = $Gpprofile->{_Step} . ' -vp ' . $Gpprofile->{_vp}; | ||
| 131 | } | ||
| 132 | |||
| 133 | #### | ||
| 134 | |||
| 135 | =pod | ||
| 136 | |||
| 137 | =head2 Subroutine vs | ||
| 138 | |||
| 139 | Export Vs profiles (default) | ||
| 140 | |||
| 141 | =cut | ||
| 142 | |||
| 143 | sub vs { | ||
| 144 | my ( $sub, $vs ) = @_; | ||
| 145 | $Gpprofile->{_vs} = $vs if defined($vs); | ||
| 146 | $Gpprofile->{_note} = $Gpprofile->{_note} . ' -vs ' . $Gpprofile->{_vs}; | ||
| 147 | $Gpprofile->{_Step} = $Gpprofile->{_Step} . ' -vs ' . $Gpprofile->{_vs}; | ||
| 148 | } | ||
| 149 | |||
| 150 | =head2 Subroutine original | ||
| 151 | |||
| 152 | do not resample throughput | ||
| 153 | leave the original sampling | ||
| 154 | |||
| 155 | =cut | ||
| 156 | |||
| 157 | sub original { | ||
| 158 | my ( $sub, $original ) = @_; | ||
| 159 | $Gpprofile->{_original} = $original if defined($original); | ||
| 160 | $Gpprofile->{_note} = | ||
| 161 | $Gpprofile->{_note} . ' -original ' . $Gpprofile->{_original}; | ||
| 162 | $Gpprofile->{_Step} = | ||
| 163 | $Gpprofile->{_Step} . ' -original ' . $Gpprofile->{_original}; | ||
| 164 | } | ||
| 165 | #### | ||
| 166 | |||
| 167 | =pod | ||
| 168 | |||
| 169 | =head2 Subroutine rho | ||
| 170 | |||
| 171 | Export density profiles | ||
| 172 | |||
| 173 | =cut | ||
| 174 | |||
| 175 | sub rho { | ||
| 176 | my ( $sub, $rho ) = @_; | ||
| 177 | $Gpprofile->{_rho} = $rho if defined($rho); | ||
| 178 | $Gpprofile->{_note} = $Gpprofile->{_note} . ' -rho ' . $Gpprofile->{_rho}; | ||
| 179 | $Gpprofile->{_Step} = $Gpprofile->{_Step} . ' -rho ' . $Gpprofile->{_rho}; | ||
| 180 | } | ||
| 181 | |||
| 182 | #### | ||
| 183 | |||
| 184 | =pod | ||
| 185 | |||
| 186 | =head2 Subroutine nu | ||
| 187 | |||
| 188 | Export Poisson's ratio profiles | ||
| 189 | |||
| 190 | =cut | ||
| 191 | |||
| 192 | sub nu { | ||
| 193 | my ( $sub, $nu ) = @_; | ||
| 194 | $Gpprofile->{_nu} = $nu if defined($nu); | ||
| 195 | $Gpprofile->{_note} = $Gpprofile->{_note} . ' -nu ' . $Gpprofile->{_nu}; | ||
| 196 | $Gpprofile->{_Step} = $Gpprofile->{_Step} . ' -nu ' . $Gpprofile->{_nu}; | ||
| 197 | } | ||
| 198 | |||
| 199 | #### | ||
| 200 | |||
| 201 | =pod | ||
| 202 | |||
| 203 | =head2 Subroutine imp | ||
| 204 | |||
| 205 | Export impedance profiles | ||
| 206 | |||
| 207 | =cut | ||
| 208 | |||
| 209 | sub imp { | ||
| 210 | my ( $sub, $imp ) = @_; | ||
| 211 | $Gpprofile->{_imp} = $imp if defined($imp); | ||
| 212 | $Gpprofile->{_note} = $Gpprofile->{_note} . ' -imp ' . $Gpprofile->{_imp}; | ||
| 213 | $Gpprofile->{_Step} = $Gpprofile->{_Step} . ' -imp ' . $Gpprofile->{_imp}; | ||
| 214 | } | ||
| 215 | |||
| 216 | #### | ||
| 217 | |||
| 218 | =pod | ||
| 219 | |||
| 220 | =head2 Subroutine resample | ||
| 221 | |||
| 222 | Export profiles with a custom sampling | ||
| 223 | |||
| 224 | =cut | ||
| 225 | |||
| 226 | sub resample { | ||
| 227 | my ( $sub, $resample ) = @_; | ||
| 228 | $Gpprofile->{_resample} = $resample if defined($resample); | ||
| 229 | $Gpprofile->{_note} = | ||
| 230 | $Gpprofile->{_note} . ' -resample ' . $Gpprofile->{_resample}; | ||
| 231 | $Gpprofile->{_Step} = | ||
| 232 | $Gpprofile->{_Step} . ' -resample ' . $Gpprofile->{_resample}; | ||
| 233 | } | ||
| 234 | |||
| 235 | #### | ||
| 236 | |||
| 237 | =pod | ||
| 238 | |||
| 239 | =head2 Subroutine depth or -d | ||
| 240 | |||
| 241 | Max depth for resampled output types | ||
| 242 | (default=100) | ||
| 243 | |||
| 244 | =cut | ||
| 245 | |||
| 246 | sub depth { | ||
| 247 | my ( $sub, $depth ) = @_; | ||
| 248 | $Gpprofile->{_depth} = $depth if defined($depth); | ||
| 249 | $Gpprofile->{_note} = $Gpprofile->{_note} . ' -d ' . $Gpprofile->{_depth}; | ||
| 250 | $Gpprofile->{_Step} = $Gpprofile->{_Step} . ' -d ' . $Gpprofile->{_depth}; | ||
| 251 | } | ||
| 252 | |||
| 253 | #### | ||
| 254 | |||
| 255 | =pod | ||
| 256 | |||
| 257 | =head2 Subroutine samples | ||
| 258 | |||
| 259 | Number of samples for resampled output | ||
| 260 | (default=100) | ||
| 261 | n | ||
| 262 | |||
| 263 | =cut | ||
| 264 | |||
| 265 | sub samples { | ||
| 266 | my ( $sub, $samples ) = @_; | ||
| 267 | $Gpprofile->{_samples} = $samples if defined($samples); | ||
| 268 | $Gpprofile->{_note} = | ||
| 269 | $Gpprofile->{_note} . ' -n ' . $Gpprofile->{_samples}; | ||
| 270 | $Gpprofile->{_Step} = | ||
| 271 | $Gpprofile->{_Step} . ' -n ' . $Gpprofile->{_samples}; | ||
| 272 | } | ||
| 273 | |||
| 274 | #### | ||
| 275 | |||
| 276 | =pod | ||
| 277 | |||
| 278 | =head2 Subroutine avgAt | ||
| 279 | |||
| 280 | Returns average profile over DEPTH meters | ||
| 281 | Good for Vs30 | ||
| 282 | |||
| 283 | =cut | ||
| 284 | |||
| 285 | sub avgAt { | ||
| 286 | my ( $sub, $avgAt ) = @_; | ||
| 287 | $Gpprofile->{_avgAt} = $avgAt if defined($avgAt); | ||
| 288 | $Gpprofile->{_note} = | ||
| 289 | $Gpprofile->{_note} . ' -avg-at ' . $Gpprofile->{_avgAt}; | ||
| 290 | $Gpprofile->{_Step} = | ||
| 291 | $Gpprofile->{_Step} . ' -avg-at ' . $Gpprofile->{_avgAt}; | ||
| 292 | } | ||
| 293 | |||
| 294 | #### | ||
| 295 | |||
| 296 | =pod | ||
| 297 | |||
| 298 | =head2 Subroutine file | ||
| 299 | |||
| 300 | Define Input file | ||
| 301 | |||
| 302 | =cut | ||
| 303 | |||
| 304 | sub file { | ||
| 305 | my ( $sub, $file ) = @_; | ||
| 306 | $Gpprofile->{_file} = $file if defined($file); | ||
| 307 | $Gpprofile->{_note} = $Gpprofile->{_note} . ' ' . $Gpprofile->{_file}; | ||
| 308 | $Gpprofile->{_Step} = $Gpprofile->{_Step} . ' ' . $Gpprofile->{_file}; | ||
| 309 | } | ||
| 310 | |||
| 311 | #### | ||
| 312 | |||
| 313 | =pod | ||
| 314 | |||
| 315 | =head2 Subroutine Step | ||
| 316 | |||
| 317 | Keeps track of actions for execution in the system | ||
| 318 | |||
| 319 | =cut | ||
| 320 | |||
| 321 | sub Step { | ||
| 322 | $Gpprofile->{_Step} = 'gpprofile' . $Gpprofile->{_Step}; | ||
| 323 | return $Gpprofile->{_Step}; | ||
| 324 | } | ||
| 325 | |||
| 326 | #### | ||
| 327 | |||
| 328 | =pod | ||
| 329 | |||
| 330 | =head2 Subroutine note | ||
| 331 | |||
| 332 | Keeps track of actions for possible use in graphics | ||
| 333 | |||
| 334 | =cut | ||
| 335 | |||
| 336 | sub note { | ||
| 337 | $Gpprofile->{_note} = $Gpprofile->{_note}; | ||
| 338 | return $Gpprofile->{_note}; | ||
| 339 | } | ||
| 340 | |||
| 341 | =pod | ||
| 342 | |||
| 343 | =head3 Warnings for programmers | ||
| 344 | |||
| 345 | packages must end with | ||
| 346 | 1; | ||
| 347 | |||
| 348 | =cut | ||
| 349 | |||
| 350 | 1; |