Click here to download this notebook.

Scatter Ku-band Range std / C-band Range std

[2]:
from casys import NadirData, CasysPlot, DateHandler, Field, PlotParams
from casys.readers import CLSTableReader

NadirData.enable_loginfo()

Dataset definition

[3]:
# Reader definition
table_name = "TABLE_C_J3_B_GDRD"
orf_name = "C_J3_GDRD"
cycle_number = 127
start = DateHandler.from_orf(orf_name, cycle_number, 1, pos="first")
end = DateHandler.from_orf(orf_name, cycle_number, 254, pos="last")

reader = CLSTableReader(
    name=table_name,
    date_start=start,
    date_end=end,
    orf=orf_name,
    time="time",
    longitude="LONGITUDE",
    latitude="LATITUDE",
)

# Data container definition
ad = NadirData(source=reader)

var_range_std_ku = Field(
    name="range_std_ku", source="IIF(FLAG_VAL.ALTI==0, RANGE_STD.ALTI,DV)", unit="m"
)
var_range_std_c = Field(
    name="range_std_c", source="IIF(FLAG_VAL.ALTI==0, RANGE_STD.ALTI.B2,DV)", unit="m"
)

Definition of the statistic

Using the add_scatter method:

[4]:
ad.add_scatter(
    name="Scatter Ku-band Range std / C-band Range std",
    x=var_range_std_ku,
    y=var_range_std_c,
    res_x=(0, 0.2, 0.001),
    res_y=(0, 2, 0.01),
)

Compute

[5]:
ad.compute()
2025-05-14 10:56:43 INFO    Reading ['range_std_ku', 'range_std_c']
2025-05-14 10:56:46 INFO    Computing diagnostics ['Scatter Ku-band Range std / C-band Range std']
2025-05-14 10:56:46 INFO    Computing done.

Plots

Scatter plot without the regression curve:

[6]:
disp_plot = CasysPlot(
    data=ad,
    data_name="Scatter Ku-band Range std / C-band Range std",
    plot_params=PlotParams(grid=True, show_reg=False),
)

disp_plot.show()
[6]:
../_images/examples_example_basic_Scatter_12_0.png

Scatter plot with the regression curve:

[7]:
disp_plot = CasysPlot(
    data=ad,
    data_name="Scatter Ku-band Range std / C-band Range std",
    plot_params=PlotParams(grid=True, show_reg=True),
)

disp_plot.show()
[7]:
../_images/examples_example_basic_Scatter_14_0.png

Regression curve parameters are available in the data_used attributes of the plot:

  • reg_slope

  • reg_intercept

  • reg_correlation

[8]:
disp_plot.data_used
[8]:
<xarray.Dataset> Size: 323kB
Dimensions:       (range_std_ku: 200, range_std_c: 200)
Coordinates:
  * range_std_ku  (range_std_ku) float64 2kB 0.0005 0.0015 ... 0.1985 0.1995
  * range_std_c   (range_std_c) float64 2kB 0.005 0.015 0.025 ... 1.985 1.995
Data variables:
    COUNT         (range_std_ku, range_std_c) int64 320kB 0 0 0 0 0 ... 0 0 0 0
Attributes:
    reg_slope:        1.0671188124867708
    reg_intercept:    0.08997122466706
    reg_correlation:  0.4125913198432696

To learn more about scatter definition, please visit this documentation page.