def test_volplot_manynegative(): qc_frame = pd.DataFrame([ { "EQLNUM": 1, "Z": 1000, "SWATINIT": 0.9, "PORV": 100000, "SWAT": 0.2, "VOLUME": 80, "QC_FLAG": __SWL_TRUNC__, "SATNUM": 1, "PCOW_MAX": 2, "PPCW": 4, "PC_SCALING": 2, "OIP_INIT": 0, }, { "EQLNUM": 1, "Z": 1000, "SWATINIT": 0.9, "PORV": 100000, "SWAT": 0.2, "VOLUME": 80, "QC_FLAG": __SWATINIT_1__, "SATNUM": 1, "PCOW_MAX": 2, "PPCW": 4, "PC_SCALING": 2, "OIP_INIT": 0, }, ]) wvol_waterfall(qc_volumes(qc_frame)) print("Verify that y limits in particular are correct") pyplot.show()
def test_volplot_negative_bars(): """Test the volumetrics waterfall chart with negative values, giving negative bars, interaticve plot test""" qc_frame = pd.DataFrame([ # This dataframe is a minimum dataset for check_swatinit # to run. { "EQLNUM": 1, "Z": 1000, "SWATINIT": 0.9, "PORV": 100, "SWAT": 0.8, "VOLUME": 80, "QC_FLAG": __SWL_TRUNC__, "SATNUM": 1, "PCOW_MAX": 2, "PPCW": 4, "PC_SCALING": 2, "OIP_INIT": 0, } ]) wvol_waterfall(qc_volumes(qc_frame)) print("Verify that all annotations are visible") pyplot.show()
def main() -> None: """Executed when called from the command line. Acts on command line arguments, loads data, performs qc and dumps to CSV if requested.""" parser = get_parser() args = parser.parse_args() if args.DATAFILE.endswith(".csv"): qc_frame = pd.read_csv(args.DATAFILE) else: eclfiles = ecl2df.EclFiles(args.DATAFILE) # Fail hard if the deck is not suitable for this tool or # give warnings/hints to the user: check_applicability(eclfiles) qc_frame = make_qc_gridframe(eclfiles) if args.output != "": logger.info("Exporting CSV to %s", args.output) reorder_dframe_for_nonnans(qc_frame).to_csv(args.output, index=False) if "SWATINIT" not in qc_frame: print("Model did not use SWATINIT") return qc_vols = qc_volumes(qc_frame) print(human_report_qc_vols(qc_vols)) qcsum = qc_vols["SWATINIT_WVOL"] + sum( [qc_vols[qc_flag] for qc_flag in QC_FLAGS]) diff = qc_vols["SWAT_WVOL"] - qcsum if not np.isclose(diff, 0, atol=1e-6): print(f"Unexplained difference: {diff} Rm3") print() print(human_report_pc_scaling(qc_frame)) if args.volplot or args.volplotfile: plotter.wvol_waterfall(qc_vols) if args.volplot: pyplot.show() if args.volplotfile: print(f"Dumping volume plot to {args.volplotfile}") pyplot.savefig(args.volplotfile) if (args.plotfile or args.plot) and args.eqlnum not in qc_frame["EQLNUM"].values: sys.exit( f"Error: EQLNUM {args.eqlnum} does not exist in grid. No plotting." ) if args.plot or args.plotfile: plotter.plot_qc_panels(qc_frame[qc_frame["EQLNUM"] == args.eqlnum]) if args.plot: pyplot.show() if args.plotfile: print(f"Dumping plot to {args.plotfile}") pyplot.savefig(args.plotfile)
def test_volplot_largenegative(): qc_frame = pd.DataFrame([{ "EQLNUM": 1, "Z": 1000, "SWATINIT": 0.9, "PORV": 100000, "SWAT": 0.2, "VOLUME": 80, "QC_FLAG": __SWL_TRUNC__, "SATNUM": 1, "PCOW_MAX": 2, "PPCW": 4, "PC_SCALING": 2, "OIP_INIT": 0, }]) wvol_waterfall(qc_volumes(qc_frame)) print("Verify that all annotations are visible and placed wisely") pyplot.show()
def test_volplot_zerospan(): # Test when there is no difference from SWATINIT to SWAT: qc_frame = pd.DataFrame([{ "EQLNUM": 1, "Z": 1000, "SWATINIT": 0.9, "PORV": 100000, "SWAT": 0.9, "VOLUME": 80, "QC_FLAG": __SWL_TRUNC__, "SATNUM": 1, "PCOW_MAX": 2, "PPCW": 4, "PC_SCALING": 2, "OIP_INIT": 0, }]) wvol_waterfall(qc_volumes(qc_frame)) print("Verify that all annotations are visible and placed wisely") pyplot.show()