ADCP
Bases: BaseInstrument
Class for processing data from Acoustic Doppler Current Profiler (ADCP) instruments.
Contains methods for:
- Loading data from source files
- Preprocessing (despiking, coordinate transformations, flow-dependent rotations)
- Calculating mean shear
- Calculating turbulence statistics: TKE dissipation, Reynolds stress
Source code in src/pytoast/ocean/adcp.py
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | |
__init__
__init__(files, name_map, deployment_type=FIXED, fs=None, z=None, z_convention=MAB, data_keys=None, source_coords='beam', orientation='up', beam_angle=25.0, manufacturer='nortek', burst_dim=None, **loader_kwargs)
Initialize an ADCP object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
str or List[str]
|
Path(s) to data files. If a list, each element is treated as a file containing data from an individual burst
period. Supported formats: .npy (saved as a dict), .mat (saved as a MATLAB struct), .csv (variables in
columns), or .nc (must specify |
required |
name_map
|
dict
|
Mapping of standard variable names to names in the data files, e.g.:
An error is raised if Each value in the mapping may take one of three forms:
|
required |
deployment_type
|
str
|
Must be "fixed" (the only supported value). self.z will be converted to a constant numpy array of instrument deployment depths or measurement cell heights. |
FIXED
|
fs
|
float
|
Sampling frequency (Hz). If not provided, it will be inferred (and rounded to 2 decimal places) from the
|
None
|
z
|
List[float] or ndarray
|
Vertical coordinate for each cell (interpreted as m above bed if |
None
|
z_convention
|
ZConvention
|
Convention for vertical coordinate, one of |
MAB
|
data_keys
|
str or List[str]
|
One or more nested keys to traverse after loading the file (e.g. "Data" if the variables in name_map are
stored at |
None
|
source_coords
|
str
|
Velocity coordinate system in the source files. One of { |
'beam'
|
orientation
|
str
|
Instrument orientation. One of { |
'up'
|
beam_angle
|
float
|
Beam angle from vertical (degrees). Used in beam-to-xyz coordinate transformations. Defaults to 25.0. |
25.0
|
manufacturer
|
str
|
Instrument manufacturer. One of { |
'nortek'
|
burst_dim
|
str
|
Name of the burst dimension inside a monolithic NetCDF file. When given, |
None
|
**loader_kwargs
|
Any
|
Additional keyword arguments forwarded to the underlying file reader selected by extension
( |
{}
|
Returns:
| Type | Description |
|---|---|
ADCP
|
Initialized |
Source code in src/pytoast/ocean/adcp.py
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
covariance
covariance(burst_data, method='variance', f_cutoff_ogive=0.1, ogive_r2_min=0.9, sigma_wave_ratio_max=None, pitch=array([0.0]), roll=array([0.0]), **kwargs)
Calculate Reynolds stress components for a given burst.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
burst_data
|
dict
|
Burst data dictionary (any coordinates allowed) |
required |
method
|
str
|
One of { |
'variance'
|
f_cutoff_ogive
|
float
|
Upper frequency bound (Hz) for the |
0.1
|
ogive_r2_min
|
float
|
Minimum coefficient of determination (r^2) for the |
0.9
|
sigma_wave_ratio_max
|
float
|
Maximum ratio of the wave velocity standard deviation to mean velocity for the |
None
|
pitch
|
ndarray
|
Instrument pitch angle (degrees) for the burst period. Used in the |
array([0.0])
|
roll
|
ndarray
|
Instrument roll angle (degrees) for the burst period. Used in the |
array([0.0])
|
kwargs
|
dict
|
Additional arguments passed to spectral_utils.csd |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
out |
dict
|
Dictionary containing vertical profiles for the various Reynolds stress components. |
References
Stacey, M. T., Monismith, S. G., & Burau, J. R. (1999). Measurements of Reynolds stress profiles in unstratified tidal flow. Journal of Geophysical Research: Oceans, 104(C5), 10933-10949.
Kirincich, A. R., Lentz, S. J., & Gerbi, G. P. (2010). Calculating Reynolds stresses from ADCP measurements in the presence of surface gravity waves using the cospectra-fit method. Journal of Atmospheric and Oceanic Technology, 27(5), 889-907.
Guerra, M., & Thomson, J. (2017). Turbulence measurements from five-beam acoustic Doppler current profilers. Journal of Atmospheric and Oceanic Technology, 34(6), 1267-1284.
Source code in src/pytoast/ocean/adcp.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | |
dissipation
dissipation(burst_data, method='4beam_spectral', f_min=None, f_max=None, spectral_r2_min=0.9, sf_kwargs=None, **kwargs)
Estimate the dissipation rate of TKE for a given burst.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
burst_data
|
dict
|
Burst data dictionary (any coordinates allowed) |
required |
method
|
str
|
One of { |
'4beam_spectral'
|
f_min
|
float | None
|
Lower bound of inertial subrange for the spectral fits |
None
|
f_max
|
float
|
Upper bound of inertial subrange for the spectral fits. |
None
|
spectral_r2_min
|
float
|
Minimum coefficient of determination (r^2) for the linear regression to the inertial subrange of the power
spectrum. Estimates with r^2 below this threshold are set to NaN. Applies to the |
0.9
|
sf_kwargs
|
dict
|
Additional keyword arguments to pass to the structure function method. Keys allowed:
|
None
|
kwargs
|
dict
|
Additional keyword arguments to pass to the spectral utils. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
eps |
ndarray
|
Vertical profile of dissipation for the burst period |
References
McMillan, J. M., Hay, A. E., Lueck, R. G., & Wolk, F. (2016). Rates of dissipation of turbulent kinetic energy in a high Reynolds number tidal channel. Journal of Atmospheric and Oceanic Technology, 33(4), 817-837.
McMillan, J. M., & Hay, A. E. (2017). Spectral and structure function estimates of turbulence dissipation rates in a high-flow tidal channel using broadband ADCPs. Journal of Atmospheric and Oceanic Technology, 34(1), 5-20.
Source code in src/pytoast/ocean/adcp.py
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | |
set_preprocess_opts
set_preprocess_opts(opts)
Enable preprocessing for all subsequent burst loads using the options defined in the input dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
opts
|
dict
|
Preprocessing options. Supported keys: despike : dict, optional
rotate : dict, optional
|
required |
Source code in src/pytoast/ocean/adcp.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
shear
shear(burst_data)
Calculates the mean vertical shear of the 3 cartesian velocity components.
Uses numpy's gradient function with second-order accuracy at the boundaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
burst_data
|
dict
|
Burst data dictionary. Must be in non-beam coordinates. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
out |
dict
|
Dictionary containing vertical shear profiles for each velocity component. |
Source code in src/pytoast/ocean/adcp.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
subsample
subsample(start_idx, end_idx)
Subsample the ADCP object between files[start_idx] and files[end_idx].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_idx
|
int
|
First file to include in subsampling |
required |
end_idx
|
int
|
Upper bound (exclusive) on file index in subsampling |
required |
Returns:
| Name | Type | Description |
|---|---|---|
new_adcp |
ADCP
|
Subsampled ADCP object |
Source code in src/pytoast/ocean/adcp.py
904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | |