Пример #1
0
def _plot_model(dset: "Dataset", figure_dir: "pathlib.PosixPath") -> None:
    """Plot model parameters

    Args:
       dset:        A dataset containing the data.
       figure_dir:  Figure directory
    """

    # Limit x-axis range to rundate
    day_start, day_end = _get_day_limits(dset)

    for f in get_existing_fields_by_attrs(dset, FIELDS):

        # Generate x- and y-axis data per satellite
        x_arrays = []
        y_arrays = []
        labels = []

        for sat in dset.unique("satellite"):
            idx = dset.filter(satellite=sat)
            x_arrays.append(dset.time.gps.datetime[idx])
            y_arrays.append(get_field_by_attrs(dset, f.attrs, f.unit)[idx])
            labels.append(sat)

        # Plot with scatter plot
        plot(
            x_arrays=x_arrays,
            y_arrays=y_arrays,
            xlabel="Time [GPS]",
            ylabel=f.ylabel,
            y_unit=f.unit,
            labels=labels,
            figure_path=figure_dir / f"plot_{f.name}.{FIGURE_FORMAT}",
            opt_args={
                "colormap": "tab20",
                "figsize": (7, 6),
                "legend": True,
                "legend_ncol": 6,
                "legend_location": "bottom",
                "plot_to": "file",
                "plot_type": "scatter",
                "statistic":
                ["rms", "mean", "std", "min", "max", "percentile"],
                "xlim": [day_start, day_end],
            },
        )
Пример #2
0
def _add_to_report(dset: "Dataset", rpt: "Report", figure_dir: "pathlib.PosixPath") -> None:
    """Add figures and tables to report

    Args:
        dset:        A dataset containing the data.
        rpt:         Report object.
        figure_dir:  Figure directory.
    """

    #
    # Position
    #
    rpt.add_text("\n# GNSS site velocity analysis\n\n")

    # Plot site velocity
    rpt.add_figure(
        f"{figure_dir}/plot_timeseries_enu.{FIGURE_FORMAT}",
        caption="Site velocity in topocentric coordinates (East, North, Up).",
        clearpage=True,
    )

    # Plot horizontal error
    rpt.add_figure(
        f"{figure_dir}/plot_horizontal_velocity.{FIGURE_FORMAT}",
        caption="Horizontal velocity",
        clearpage=True,
    )

    # Plot 3D timeseries
    rpt.add_figure(
        f"{figure_dir}/plot_timeseries_pdop_hv_3d.{FIGURE_FORMAT}",
        caption="Horizontal, vertical and 3D velocity of site position",
        clearpage=True,
    )

    #
    # Residual
    #
    rpt.add_text("\n# GNSS residual\n\n")

    # Add outlier table
    # MURKS: does not work at the moment. complement_with is not implemented in Dataset v3.
    # MURKS rpt.write_dataframe_to_markdown(_table_outlier_overview(dset))

    # Plot residuals
    rpt.add_figure(
        f"{figure_dir}/plot_residual.{FIGURE_FORMAT}",
        # MURKScaption="Post-fit residuals, whereby the red dots represents the rejected outliers. The histogram represent only number of residuals from kept observations.",
        caption="Post-fit residuals.",
        clearpage=True,
    )

    #
    # Dilution of precision (DOP)
    #
    if "pdop" in dset.fields:
        rpt.add_text("\n# Dilution of precision\n\n")

        # Plot DOP
        rpt.add_figure(f"{figure_dir}/plot_dop.{FIGURE_FORMAT}", caption="Dilution of precision.", clearpage=True)

    #
    # Satellite plots
    #
    rpt.add_text("\n# Satellite plots\n\n")

    rpt.add_figure(
        f"{figure_dir}/plot_number_of_satellites.{FIGURE_FORMAT}",
        caption="Number of satellites for each observation epoch",
        clearpage=False,
    )

    figure_path = figure_path = figure_dir / f"plot_satellite_overview.{FIGURE_FORMAT}"
    if figure_path.exists():  # Note: Does not exists for concatenated Datasets.
        rpt.add_figure(
            figure_path,
            caption="Overview over satellite observations. Red coloured: Observation rejected in orbit stage (e.g. unhealthy satellites, exceeding validity length, no orbit data available); Orange coloured: Observation rejected in edit stage; Green coloured: Kept observations after edit stage.",
            clearpage=False,
        )

    rpt.add_figure(f"{figure_dir}/plot_skyplot.{FIGURE_FORMAT}", caption="Skyplot", clearpage=False)

    rpt.add_figure(
        f"{figure_dir}/plot_satellite_elevation.{FIGURE_FORMAT}", caption="Satellite elevation", clearpage=True
    )

    #
    # Model parameter plots
    #
    rpt.add_text("\n# Plots of model parameters\n\n")

    for f in get_existing_fields_by_attrs(dset, FIELDS):
        rpt.add_figure(f"{figure_dir}/plot_{f.name}.{FIGURE_FORMAT}", caption=f.caption, clearpage=False)