API reference#
earthcarekit.calval
Functions for EarthCARE calibration and validation.
Notes#
This module depends on other internal modules:
- earthcarekit.constants
- earthcarekit.filter
- earthcarekit.plot
- earthcarekit.data
- earthcarekit.read
- earthcarekit.site
- earthcarekit.typing
- earthcarekit.utils
compare_bsc_ext_lr_depol
#
compare_bsc_ext_lr_depol(
input_ec: str | Dataset,
input_ground: str | Dataset | None = None,
time_var_ground: str = "time",
height_var_ground: str = "height",
bsc_var_ground: str | tuple[str, str] | list[str | tuple[str, str]] = [],
ext_var_ground: str | tuple[str, str] | list[str | tuple[str, str]] = [],
lr_var_ground: str | tuple[str, str] | list[str | tuple[str, str]] = [],
depol_var_ground: str | tuple[str, str] | list[str | tuple[str, str]] = [],
input_ec2: str | Dataset | None = None,
input_ec3: str | Dataset | None = None,
input_ec4: str | Dataset | None = None,
input_ground2: str | Dataset | None = None,
input_ground3: str | Dataset | None = None,
input_ground4: str | Dataset | None = None,
time_var_ground2: str | None = None,
height_var_ground2: str | None = None,
time_var_ground3: str | None = None,
height_var_ground3: str | None = None,
time_var_ground4: str | None = None,
height_var_ground4: str | None = None,
bsc_var_ground2: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
ext_var_ground2: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
lr_var_ground2: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
depol_var_ground2: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
bsc_var_ground3: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
ext_var_ground3: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
lr_var_ground3: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
depol_var_ground3: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
bsc_var_ground4: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
ext_var_ground4: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
lr_var_ground4: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
depol_var_ground4: str | tuple[str, str] | list[str | tuple[str, str]] | None = None,
site: SiteLike | None = None,
radius_km: float = 100.0,
resolution: str = "_low_resolution",
resolution2: str | None = None,
resolution3: str | None = None,
resolution4: str | None = None,
height_range: tuple[float, float] | None = (0, 30000.0),
selection_height_range: tuple[float, float] | None = None,
selection_height_range_bsc: tuple[float, float] | None = None,
selection_height_range_ext: tuple[float, float] | None = None,
selection_height_range_lr: tuple[float, float] | None = None,
selection_height_range_depol: tuple[float, float] | None = None,
value_range_bsc: ValueRangeLike | None = (0, 8e-06),
value_range_ext: ValueRangeLike | None = (0, 0.0003),
value_range_lr: ValueRangeLike | None = (0, 100),
value_range_depol: ValueRangeLike | None = (0, 0.6),
colors_ec: list[str] = ["ec:red", "ec:orange", "ec:yellow", "ec:purple"],
colors_ground: list[str] = [
"ec:blue",
"ec:darkblue",
"ec:lightgreen",
"ec:darkgreen",
"ec:purple",
],
linewidth_ec: list[float | int] | float | int = 1.5,
linewidth_ground: list[float | int] | float | int = 1.5,
linestyle_ec: list[str] | str = "solid",
linestyle_ground: list[str] | str = "solid",
label_ec: list[str | None] = [],
label_ground: list[str | None] = [],
alpha: float = 1.0,
show_steps: bool = DEFAULT_PROFILE_SHOW_STEPS,
show_error_ec: bool = False,
show_quality_status: bool = False,
show_rebinned: bool = False,
quality_status_width_scale: float = 1.0,
quality_status_var: str = "quality_status",
quality_status_value_range: tuple[float | None, float | None] | None = None,
to_mega: bool = False,
single_figsize: tuple[float | int, float | int] = (5 * CM_AS_INCH, 12 * CM_AS_INCH),
label_bsc: str = "Bsc. coeff.",
label_ext: str = "Ext. coeff.",
label_lr: str = "Lidar ratio",
label_depol: str = "Depol. ratio",
units_bsc: str = "m$^{-1}$ sr$^{-1}$",
units_ext: str = "m$^{-1}$",
units_lr: str = "sr",
units_depol: str = "",
verbose: bool = True,
) -> _CompareBscExtLRDepolResults
Compares Lidar profiles from up to 4 EarthCARE and 4 ground-based datasets.
Creates plots and statistics for backscatter, extinction, lidar ratio, and depolarization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_ec
|
str | Dataset
|
EarthCARE dataset or path (primary). |
required |
input_ground
|
str | Dataset | None
|
Ground-based dataset or path (primary). |
None
|
time_var_ground
|
str
|
Time variable name in ground dataset. |
'time'
|
height_var_ground
|
str
|
Height variable name in ground dataset. |
'height'
|
bsc_var_ground
|
str | tuple[str, str] | list[str | tuple[str, str]]
|
Backscatter variable name(s) in ground dataset (e.g., |
[]
|
ext_var_ground
|
str | tuple[str, str] | list[str | tuple[str, str]]
|
Extinction variable name(s) in ground dataset. |
[]
|
lr_var_ground
|
str | tuple[str, str] | list[str | tuple[str, str]]
|
Lidar ratio variable name(s) in ground dataset. |
[]
|
depol_var_ground
|
str | tuple[str, str] | list[str | tuple[str, str]]
|
Depolarization ratio variable name(s) in ground dataset. |
[]
|
input_ec2
|
str | Dataset | None
|
Optional second EarthCARE dataset. |
None
|
input_ec3
|
str | Dataset | None
|
Optional third EarthCARE dataset. |
None
|
input_ec4
|
str | Dataset | None
|
Optional fourth EarthCARE dataset. |
None
|
input_ground2
|
str | Dataset | None
|
Optional second ground-based dataset. |
None
|
input_ground3
|
str | Dataset | None
|
Optional third ground-based dataset. |
None
|
input_ground4
|
str | Dataset | None
|
Optional fourth ground-based dataset. |
None
|
time_var_ground2
|
str | None
|
Time variable name in second ground dataset. |
None
|
height_var_ground2
|
str | None
|
Height variable name in second ground dataset. |
None
|
time_var_ground3
|
str | None
|
Time variable name in third ground dataset. |
None
|
height_var_ground3
|
str | None
|
Height variable name in third ground dataset. |
None
|
time_var_ground4
|
str | None
|
Time variable name in fourth ground dataset. |
None
|
height_var_ground4
|
str | None
|
Height variable name in fourth ground dataset. |
None
|
bsc_var_ground2
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Backscatter variable name(s) in second ground dataset. |
None
|
ext_var_ground2
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Extinction variable name(s) in second ground dataset. |
None
|
lr_var_ground2
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Lidar ratio variable name(s) in second ground dataset. |
None
|
depol_var_ground2
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Depolarization ratio variable name(s) in second ground dataset. |
None
|
bsc_var_ground3
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Backscatter variable name(s) in third ground dataset. |
None
|
ext_var_ground3
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Extinction variable name(s) in third ground dataset. |
None
|
lr_var_ground3
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Lidar ratio variable name(s) in third ground dataset. |
None
|
depol_var_ground3
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Depolarization ratio variable name(s) in third ground dataset. |
None
|
bsc_var_ground4
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Backscatter variable name(s) in fourth ground dataset. |
None
|
ext_var_ground4
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Extinction variable name(s) in fourth ground dataset. |
None
|
lr_var_ground4
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Lidar ratio variable name(s) in fourth ground dataset. |
None
|
depol_var_ground4
|
str | tuple[str, str] | list[str | tuple[str, str]] | None
|
Depolarization ratio variable name(s) in fourth ground dataset. |
None
|
site
|
SiteLike | None
|
Ground site for spatial filtering. |
None
|
radius_km
|
float
|
Search radius around site in kilometers. |
100.0
|
resolution
|
str
|
EarthCARE resolution suffix (e.g., "_low_resolution"). |
'_low_resolution'
|
resolution2
|
str | None
|
Resolution suffix for second EarthCARE dataset. |
None
|
resolution3
|
str | None
|
Resolution suffix for third EarthCARE dataset. |
None
|
resolution4
|
str | None
|
Resolution suffix for fourth EarthCARE dataset. |
None
|
height_range
|
tuple[float, float] | None
|
Plot height range in meters. |
(0, 30000.0)
|
selection_height_range
|
tuple[float, float] | None
|
Height range for statistics (applies to all variables). |
None
|
selection_height_range_bsc
|
tuple[float, float] | None
|
Height range for backscatter statistics. |
None
|
selection_height_range_ext
|
tuple[float, float] | None
|
Height range for extinction statistics. |
None
|
selection_height_range_lr
|
tuple[float, float] | None
|
Height range for lidar ratio statistics. |
None
|
selection_height_range_depol
|
tuple[float, float] | None
|
Height range for depolarization statistics. |
None
|
value_range_bsc
|
ValueRangeLike | None
|
X-axis limits for backscatter plot. |
(0, 8e-06)
|
value_range_ext
|
ValueRangeLike | None
|
X-axis limits for extinction plot. |
(0, 0.0003)
|
value_range_lr
|
ValueRangeLike | None
|
X-axis limits for lidar ratio plot. |
(0, 100)
|
value_range_depol
|
ValueRangeLike | None
|
X-axis limits for depolarization plot. |
(0, 0.6)
|
colors_ec
|
list[str]
|
Colors for EarthCARE profiles. |
['ec:red', 'ec:orange', 'ec:yellow', 'ec:purple']
|
colors_ground
|
list[str]
|
Colors for ground-based profiles. |
['ec:blue', 'ec:darkblue', 'ec:lightgreen', 'ec:darkgreen', 'ec:purple']
|
linewidth_ec
|
list[float | int] | float | int
|
Line width(s) for EarthCARE profiles. |
1.5
|
linewidth_ground
|
list[float | int] | float | int
|
Line width(s) for ground-based profiles. |
1.5
|
linestyle_ec
|
list[str] | str
|
Line style(s) for EarthCARE profiles. |
'solid'
|
linestyle_ground
|
list[str] | str
|
Line style(s) for ground-based profiles. |
'solid'
|
label_ec
|
list[str | None]
|
Legend labels for EarthCARE profiles. |
[]
|
label_ground
|
list[str | None]
|
Legend labels for ground-based profiles. |
[]
|
alpha
|
float
|
Line transparency (0-1). |
1.0
|
show_steps
|
bool
|
Plot step functions instead of bin centers if True. |
DEFAULT_PROFILE_SHOW_STEPS
|
show_error_ec
|
bool
|
Plot error ribbons for EarthCARE profiles if True. |
False
|
show_rebinned
|
bool
|
Rebin ground data to EarthCARE grid if True. |
False
|
show_quality_status
|
bool
|
Plot quality status bars if True. |
False
|
show_rebinned
|
bool
|
Rebin ground data to EarthCARE grid if True. |
False
|
quality_status_width_scale
|
float
|
Scale factor for quality status bar width. |
1.0
|
quality_status_var
|
str
|
Variable name for quality status. |
'quality_status'
|
quality_status_value_range
|
tuple[float | None, float | None] | None
|
Value range for quality status display. |
None
|
to_mega
|
bool
|
Convert units to Mm-1 sr-1/Mm-1 if True. |
False
|
single_figsize
|
tuple[float | int, float | int]
|
Subfigure size (width, height) in inches. |
(5 * CM_AS_INCH, 12 * CM_AS_INCH)
|
label_bsc
|
str
|
Label for backscatter subfigure. |
'Bsc. coeff.'
|
label_ext
|
str
|
Label for extinction subfigure. |
'Ext. coeff.'
|
label_lr
|
str
|
Label for lidar ratio subfigure. |
'Lidar ratio'
|
label_depol
|
str
|
Label for depolarization subfigure. |
'Depol. ratio'
|
units_bsc
|
str
|
Units for backscatter axis. |
'm$^{-1}$ sr$^{-1}$'
|
units_ext
|
str
|
Units for extinction axis. |
'm$^{-1}$'
|
units_lr
|
str
|
Units for lidar ratio axis. |
'sr'
|
units_depol
|
str
|
Units for depolarization axis. |
''
|
verbose
|
bool
|
Print logs to console if True. |
True
|
Returns:
| Type | Description |
|---|---|
_CompareBscExtLRDepolResults
|
Results as a
|
Source code in earthcarekit/calval/_compare_bsc_ext_lr_depol.py
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 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | |
compute_anom_depol_statistics
#
compute_anom_depol_statistics(
ds_anom: Dataset,
selection_height_range: DistanceRangeLike,
is_rayleigh_corrected: bool = False,
rayleigh_correction_factor: float = 0.004,
**kwargs
) -> _ANOMDepolCalculationResults
Calculate depolarization statistics and uncertainties within a height range.
This function adds the depol. ratio (DPOL) calculated from co- (CPOL) and cross-polarized (XPOL)
attenuated backscatter to the dataset (ATL_NOM_1B) and computes related statistics.
Mean values and standard deviations are calculated for CPOL, XPOL, and DPOL within the selected
height range. Variability is separated into vertical and temporal components. Errors of DPOL are derived
using error propagation for the XPOL/CPOL ratio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds_anom
|
Dataset
|
ATL_NOM_1B dataset with cross- and co-polar signals. |
required |
selection_height_range
|
DistanceRangeLike
|
Height range for statistics. |
required |
is_rayleight_corrected
|
If True, the mean cross-polar profile is corrected by substracting the mean rayleigh profile scaled by a correction factor. Defaults to False. |
required | |
rayleigh_correction_factor
|
float
|
The scaling factor used when |
0.004
|
Returns:
| Type | Description |
|---|---|
_ANOMDepolCalculationResults
|
Results as a data container with
|
Examples:
>>> import earthcarekit as eck
>>> ds = eck.ecload("ATL_NOM_1B", "01508B", download=True)
>>> ds = eck.filter_radius(ds, radius_km=100, site="dushanbe")
>>> results = eck.perform_anom_depol_statistics(
... ds_anom=ds,
... selection_height_range=(1000, 4000),
... )
>>> results.print()
>>> # results.stats.to_csv("./stats.csv") # Optionally, save as CSV table
===========================================
Statistics: A-NOM depol ratio calculation
===========================================
Height range = 1000.0 to 4000.0 meters
mean(depol) = 0.2270
std(depol) = 0.0367
-------------------------------------------
error_t = 0.0551
error_z = 0.0542
error = 0.1093
-------------------------------------------
mean(cpol) = 4.6728e-07
std_t(cpol) = 4.6008e-08
std_z(cpol) = 5.0832e-08
std(cpol) = 9.6840e-08
-------------------------------------------
mean(xpol) = 1.0639e-07
std_t(xpol) = 2.3535e-08
std_z(xpol) = 2.2550e-08
std(xpol) = 4.6085e-08
===========================================
Source code in earthcarekit/calval/_compute_anom_depol_statistics.py
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 | |
