Skip to content
Snippets Groups Projects
entrypoint.py 4.25 KiB
Newer Older
Paolo Veglio's avatar
Paolo Veglio committed
from mvcm.main import main
# #################################################################### #
# TEST CASE
# data:
_datapath = "/ships19/hercules/pveglio/mvcm_viirs_hires"

# thresholds:
_threshold_file = "/home/pveglio/mvcm/thresholds/thresholds.mvcm.snpp.v0.0.1.yaml"

# ancillary files:
_geos_atm_1 = "GEOS.fpit.asm.inst3_2d_asm_Nx.GEOS5124.20220622_1200.V01.nc4"
_geos_atm_2 = "GEOS.fpit.asm.inst3_2d_asm_Nx.GEOS5124.20220622_1500.V01.nc4"
_geos_land = "GEOS.fpit.asm.tavg1_2d_lnd_Nx.GEOS5124.20220622_1330.V01.nc4"
_geos_ocean = "GEOS.fpit.asm.tavg1_2d_ocn_Nx.GEOS5124.20220622_1330.V01.nc4"
_geos_constants = "GEOS.fp.asm.const_2d_asm_Nx.00000000_0000.V01.nc4"
_ndvi_file = "NDVI.FM.c004.v2.0.WS.00-04.177.hdf"
_sst_file = "oisst.20220622"
_eco_file = "goge1_2_img.v1"

# #################################################################### #


if __name__ == "__main__":
    parser = argparse.ArgumentParser(prog="MVCM", description="")

    parser.add_argument(
        "--satellite",
        help="satellite name, not case-sensitive. Available options: [snpp, ]",
        choices=[
            "snpp",
        ],
    )
    parser.add_argument(
        "--sensor",
        help="sensor name, not case-sensitive. Available options: [viirs, ]",
        choices=[
            "viirs",
        ],
    )
    parser.add_argument("--path", help="path where the data is stored")
    parser.add_argument("--l1b", help="level 1b file name")
    parser.add_argument("--geolocation", help="geolocation file name")
    parser.add_argument("--hires-l1b", help="VIIRS IMG02 file name")
    parser.add_argument("--hires-geo", help="VIIRS IMG03 file name")
    parser.add_argument("-t", "--threshold", help="thresholds file name")
    parser.add_argument(
        "--atmos-1",
        help="file name of the first GEOS-IT file for atmospheric parameters",
    )
    parser.add_argument(
        "--atmos-2",
        help="file name of the second GEOS-IT file for atmospheric parameters",
    )
    parser.add_argument("--land", help="file name of GEOS-IT land parameters")
    parser.add_argument("--ocean", help="file name of GEOS-IT ocean parameters")
    parser.add_argument("--constants", help="file name of GEOS-IT constants")
    parser.add_argument("--ndvi", help="NDVI file name")
    parser.add_argument("--sst", help="Sea surface temperature file name")
    parser.add_argument("--eco", help="Ecosystem file")
    parser.add_argument("-o", "--out", help="output file name")
    # parser.add_argument(
    #     "-V",
    #     "--version",
    #     action="version",
    #     version=_VERSION,
    #     help="print version and exit",
    # )
    parser.add_argument(
        "-v", "--verbose", action="count", default=1, help="print verbose information"
    )
    parser.add_argument("-d", "--debug", action="store_true", help="activate debug mode")

    args = parser.parse_args()

    satellite = args.satellite or "snpp"
    sensor = args.sensor or "viirs"
    data_path = args.path or _datapath
    mod02 = args.l1b or ""  # _fname_mod02
    mod03 = args.geolocation or ""  # _fname_mod03
    img02 = args.hires_l1b or None
    img03 = args.hires_geo or None
    threshold_file = args.threshold or _threshold_file
    geos_atm_1 = args.atmos_1 or _geos_atm_1
    geos_atm_2 = args.atmos_2 or _geos_atm_2
    geos_land = args.land or _geos_land
    geos_ocean = args.ocean or _geos_ocean
    constants = args.constants or _geos_constants
    ndvi_file = args.ndvi or _ndvi_file
    sst_file = args.sst or _sst_file
    eco_file = args.eco or _eco_file
    out_file = args.out or "test_out.nc"
    verbose = args.verbose or False
    debug = args.debug or False

    main(
        satellite=satellite,
        sensor=sensor,
        data_path=data_path,
        mod02=mod02,
        mod03=mod03,
        img02=img02,
        img03=img03,
        threshold_file=threshold_file,
        geos_atm_1=geos_atm_1,
        geos_atm_2=geos_atm_2,
        geos_land=geos_land,
        geos_ocean=geos_ocean,
        geos_constants=constants,
        ndvi_file=ndvi_file,
        sst_file=sst_file,
        eco_file=eco_file,
        out_file=out_file,
        verbose=verbose,