コード例 #1
0
ファイル: rinex_nav_report.py プロジェクト: mfkiwl/where
def rinex_nav_report(dset: "Dataset") -> None:
    """Write report about a RINEX navigation file analysis run

    Args:
        dset:        A dataset containing the data.
    """
    file_vars = {**dset.vars, **dset.analysis}

    # TODO: Better solution?
    if "station" not in file_vars:  # necessary if called for example by ./where/tools/concatenate.py
        file_vars["station"] = ""
        file_vars["STATION"] = ""

    # Generate figure directory to save figures generated for RINEX navigation file report
    figure_dir = config.files.path("output_rinex_nav_report_figure",
                                   file_vars=file_vars)
    figure_dir.mkdir(parents=True, exist_ok=True)

    # Generate RINEX navigation file report
    path = config.files.path("output_rinex_nav_report", file_vars=file_vars)
    with config.files.open_path(path, create_dirs=True, mode="wt") as fid:
        rpt = Report(fid,
                     rundate=dset.analysis["rundate"],
                     path=path,
                     description="RINEX navigation file analysis")
        rpt.title_page()
        rpt.write_config()
        _add_figures(dset, rpt, figure_dir)
        _add_tables(dset, rpt, figure_dir)
        rpt.markdown_to_pdf()
コード例 #2
0
ファイル: rinex_obs_report.py プロジェクト: gahjelle/where
def rinex_obs_report(dset: "Dataset") -> None:
    """Write report about a RINEX observation file analysis run

    Args:
        dset:        A dataset containing the data.
    """

    # TODO: Better solution?
    if "station" not in dset.vars:  # necessary if called for example by ./where/tools/concatenate.py
        dset.vars["station"] = ""
        dset.vars["STATION"] = ""

    # Generate figure directory to save figures generated for RINEX observation file report
    figure_dir = config.files.path("output_rinex_obs_report_figure",
                                   file_vars=dset.vars)
    figure_dir.mkdir(parents=True, exist_ok=True)

    # Generate plots
    df_system, df_obstype = _generate_dataframes(dset)
    _plot_scatter_satellite_availability(dset, figure_dir)
    _plot_observation_system(df_system, figure_dir)
    _plot_observation_type(df_obstype, figure_dir)

    # Generate RINEX observation file report
    path = config.files.path("output_rinex_obs_report", file_vars=dset.vars)
    with config.files.open_path(path, create_dirs=True, mode="wt") as fid:
        rpt = Report(fid,
                     rundate=dset.analysis["rundate"],
                     path=path,
                     description="RINEX observation file analysis")
        rpt.title_page()
        rpt.write_config()
        _add_to_report(rpt, figure_dir, df_system, df_obstype)
        rpt.markdown_to_pdf()
コード例 #3
0
ファイル: gnss_spv_report.py プロジェクト: dahmic77/where
def gnss_spv_report(dset: "Dataset") -> None:
    """Write report about a GNSS analysis run

    Args:
        dset:        A dataset containing the data.
    """

    # TODO: Better solution?
    if "station" not in dset.vars:  # necessary if called for example by ./where/tools/concatenate.py
        dset.vars["station"] = ""
        dset.vars["STATION"] = ""

    # Generate figure directory to save figures generated for GNSS report
    figure_dir = config.files.path("output_gnss_spv_report_figure",
                                   file_vars=dset.vars)
    figure_dir.mkdir(parents=True, exist_ok=True)

    # Generate plots
    _plot_velocity(dset, figure_dir)
    # TODO_plot_residual(dset, figure_dir)
    _plot_dop(dset, figure_dir)

    # Generate GNSS report
    path = config.files.path(f"output_gnss_spv_report", file_vars=dset.vars)
    with config.files.open_path(path, create_dirs=True, mode="wt") as fid:
        rpt = Report(fid,
                     rundate=dset.analysis["rundate"],
                     path=path,
                     description="GNSS SPV analysis")
        rpt.title_page()
        rpt.write_config()
        _add_to_report(dset, rpt, figure_dir)
        rpt.markdown_to_pdf()
コード例 #4
0
ファイル: sisre_report.py プロジェクト: dahmic77/where
def sisre_report(dset):
    """Write SISRE report

    Args:
        dset (Dataset):       A dataset containing the data.
    """
    write_level = config.tech.get("write_level",
                                  default="operational").as_enum("write_level")

    # TODO: Better solution?
    if "sampling_rate" not in dset.analysis:  # necessary if called for example by ./where/tools/concatenate.py
        dset.analysis["sampling_rate"] = ""

    # Generate SISRE report
    path = config.files.path(f"output_sisre_report_{dset.vars['label']}",
                             file_vars={
                                 **dset.vars,
                                 **dset.analysis
                             })
    with config.files.open_path(path, create_dirs=True, mode="wt") as fid:
        rpt = Report(fid,
                     rundate=dset.analysis["rundate"],
                     path=path,
                     description="SISRE analysis")
        rpt.title_page()
        _write_information(fid)
        rpt.write_config()
        fid.write("\n# Satellite status\n\n")
        # _unhealthy_satellites(fid, dset)
        # _eclipse_satellites(fid, dset)

        # Generate figure directory to save figures generated for SISRE report
        fid.write("\n# SISRE analysis results\n\n")
        figure_dir = config.files.path("output_sisre_report_figure",
                                       file_vars={
                                           **dset.vars,
                                           **dset.analysis
                                       })
        figure_dir.mkdir(parents=True, exist_ok=True)

        _plot_scatter_orbit_and_clock_differences(fid, figure_dir, dset)
        _plot_scatter_sisre(fid, figure_dir, dset)
        _plot_scatter_field(fid, figure_dir, dset, "sisre")
        # _plot_scatter_field(fid, figure_dir, dset, 'sisre', label=False, legend=False)
        _plot_histogram_sisre(fid, figure_dir, dset)
        _plot_scatter_field(fid, figure_dir, dset, "age_of_ephemeris")
        _satellite_statistics_and_plot(fid, figure_dir, dset, rpt)

        # if write_level <= enums.get_value("write_level", "detail"):
        #    fid.write("\n# Analysis of input files\n\n")
        #    # _plot_scatter_satellite_bias(fid, figure_dir, dset)
        #    _plot_scatter_field(fid, figure_dir, dset, "bias_brdc")
        #    _plot_scatter_field(fid, figure_dir, dset, "bias_precise")

    # Generate PDF from Markdown file
    if config.where.sisre_report.get("markdown_to_pdf", default=False).bool:
        rpt.markdown_to_pdf()
コード例 #5
0
def gnss_comparison_report(dset: Dict[str, "Dataset"]) -> None:
    """Compare GNSS datasets

    Args:
        dset:  Dictionary with station name as keys and the belonging Dataset as value
    """
    dset_first = dset[list(dset.keys())[0]]
    dset_first.vars[
        "solution"] = config.tech.gnss_comparison_report.solution.str.lower()

    # Generate figure directory to save figures generated for GNSS report
    figure_dir = config.files.path("output_gnss_comparison_report_figure",
                                   file_vars=dset_first.vars)
    figure_dir.mkdir(parents=True, exist_ok=True)

    # Generate plots
    _, dfs_day, dfs_month = _generate_dataframes(dset)
    _plot_position_error(dfs_day, dfs_month, figure_dir, dset_first.vars)

    # Generate GNSS comparison report
    path = config.files.path("output_gnss_comparison_report",
                             file_vars=dset_first.vars)
    with config.files.open_path(path, create_dirs=True, mode="wt") as fid:
        rpt = Report(fid,
                     rundate=dset_first.analysis["rundate"],
                     path=path,
                     description="Comparison of GNSS analyses")
        rpt.title_page()
        _add_to_report(rpt, figure_dir, dfs_day, dfs_month, dset_first.vars)
        rpt.markdown_to_pdf()
コード例 #6
0
ファイル: gnss_compare_datasets.py プロジェクト: mfkiwl/where
def gnss_compare_datasets(dset: Dict[str, "Dataset"]) -> None:
    """Compare two different GNSS Where datasets

    Args:
        dset:  Dictionary with station name as keys and the belonging Dataset as value
    """

    dset1 = dset[list(dset.keys())[0]]
    dset2 = dset[list(dset.keys())[1]]

    # Decimate datasets
    difference_by = _get_difference_by(dset1.fields, dset2.fields)
    _decimate_datasets(dset1, dset2, difference_by)
    # +MURKS
    vars_ = dset2.vars.copy()
    vars_["stage"] = vars_["stage"] + "x"
    dset2_path = config.files.path("dataset", file_vars=vars_)
    if dset2_path.exists():
        dset2_path.unlink()
    dset2.write_as(stage=vars_["stage"])
    # -MURKS
    if dset1.num_obs == 0 or dset2.num_obs == 0:
        log.fatal(
            f"Nothing to compare. Number of observations are zero at least for one dataset "
            f"(dset1: {dset1.num_obs}, dset2: {dset2.num_obs}).")

    # Get common fields in both Datasets (+ adding of necessary fields)
    common_fields = _get_common_fields(dset1, dset2)

    # Generate difference of datasets
    ddiff = _difference_datasets(dset1, dset2, difference_by)

    # Generate figure directory to save figures generated for GNSS report
    figure_dir = config.files.path(
        f"output_{dset1.vars['pipeline']}_report_figure", file_vars=dset1.vars)
    figure_dir.mkdir(parents=True, exist_ok=True)

    # Generate plots
    _plot(dset1, dset2, ddiff, common_fields, figure_dir)

    # Generate report
    path = config.files.path(f"output_{dset1.vars['pipeline']}_report",
                             file_vars=dset1.vars)
    with config.files.open_path(path, create_dirs=True, mode="wt") as fid:
        rpt = Report(fid,
                     rundate=dset1.vars["rundate"],
                     path=path,
                     description="Comparison of two GNSS datasets")
        rpt.title_page()
        _add_to_report(rpt, common_fields, figure_dir)
        rpt.markdown_to_pdf()
コード例 #7
0
def sisre_comparison_report(dset: Dict[str, "Dataset"]) -> None:
    """Compare SISRE datasets
      
    Args:
        dset: Dictionary with SISRE solution name as keys (e.g. cnes_inav_e1, cnes_inav_e1e5b, cnes_fnav_e1e5a) and
              the belonging Dataset as value
    """
    dset_first = dset[list(dset.keys())[0]]
    file_vars = {**dset_first.vars, **dset_first.analysis}

    # Generate figure directory to save figures generated for SISRE report
    figure_dir = config.files.path("output_sisre_comparison_report_figure", file_vars=file_vars)
    figure_dir.mkdir(parents=True, exist_ok=True)

    # Generate plots
    df, df_month_perc, df_month_perc_rms, df_month_rms = _generate_dataframe(dset)
    _plot_bar_sisre_signal_combination_percentile(df_month_perc, figure_dir, threshold=False)
    _plot_bar_sisre_signal_combination_percentile(df_month_perc, figure_dir, threshold=True)
    _plot_bar_sisre_signal_combination_rms(df_month_rms, figure_dir)

    if df_month_perc_rms is not None:
        _plot_bar_sisre_signal_combination_percentile(df_month_perc_rms, figure_dir, threshold=False, suffix="_rms")
        _plot_bar_sisre_signal_combination_percentile(df_month_perc_rms, figure_dir, threshold=True, suffix="_rms")


    # Generate SISRE comparison report
    path = config.files.path("output_sisre_comparison_report", file_vars=file_vars)
    with config.files.open_path(path, create_dirs=True, mode="wt") as fid:

        rpt = Report(fid, rundate=dset_first.analysis["rundate"], path=path, description="Comparison of SISRE analyses")
        rpt.title_page()

        # +TODO: If possible should following lines added to _add_to_report().
        rpt.add_text("#Comparison of SISE analyses\n")
        rpt.add_text("In the following SISE analyses results are compared for:\n\n")
        rpt.add_text("* Monthly 95th percentile SISE for satellites\n")
        rpt.add_text("* Monthly 95th percentile and RMS SISE for signal combinations (users)\n")
        rpt.add_text("\\newpage\n")
        rpt.add_text(f"\n\n##Monthly 95th percentile SISE for satellites\n")
        # Produce plot with same yrange than for _plot_bar_sisre_signal_combination_percentile threshold plot
        _plot_bar_sisre_satellite_percentile(rpt, df, figure_dir, threshold=False, write_table=True, yrange=[0, 2])
        _plot_bar_sisre_satellite_percentile(rpt, df, figure_dir, threshold=True, write_table=False)
        # -TODO

        _add_to_report(rpt, figure_dir, df, df_month_perc, df_month_perc_rms, df_month_rms, file_vars)
        rpt.markdown_to_pdf()