dates = list(
    set([f.split("_")[4][0:8] for f in glob.glob1(process_path, "*.nc")]))
if not os.path.exists(os.path.join(r"outputs")):
    os.mkdir(os.path.join(r"outputs"))

hour_ = "1200"
visual = False
export = True
for date_ in dates:
    files = [
        os.path.join(process_path, row)
        for row in glob.glob1(process_path, "W_XX*" + date_ + hour_ + "*.nc")
    ]
    print(date_, files)
    scn = Scene(reader="seviri_l1b_nc", filenames=files)
    pprint.pprint(scn.available_composite_names())
    scn.load(['natural_color', 'snow'], calibrations=['radiance'])
    if visual:
        scn.show("natural_color")
        scn.show("snow")
        scn.show("natural_enh")
    if not os.path.exists(os.path.join(r"outputs", date_)):
        os.mkdir(os.path.join(r"outputs", date_))
    if export:
        out = scn.save_datasets(
            filename='{name}_{start_time:%Y%m%d_%H%M%S}.png',
            base_dir=os.path.join(r"outputs", date_))
        # compute_writer_results(out)
end = datetime.datetime.now()
print("Duration is : ", str(end - start))
Exemple #2
0
    if len(sys.argv) < 2:
        print("Usage: " + sys.argv[0] + " MAIA_file ")
        sys.exit()

    fnmaia = sys.argv[1]
    maia_scene = Scene(reader='maia', filenames=[fnmaia])
    print(maia_scene.available_dataset_ids())
    maia_scene.load(["CloudType", "ct", "cma", "cma_conf",
                     'opaq_cloud', "CloudTopPres",
                     "CloudTopTemp", "Alt_surface"])

    # CloudType is a bit field containing the actual "ct" with values
    # from 0 to 20 which can be interpreted according to the cpool colormap

    # "ct" can be display in black and white:
    maia_scene.show("ct")

    # but it is better to palettize the image:
    # step 1: creation of the palette
    mycolors = []
    for i in range(21):
        mycolors.append(hex_to_rgb(cpool[i]))
    arr = np.array(mycolors)
    np.save("/tmp/binary_maia_ct_colormap.npy", arr)

    # step2: creation of the composite
    compositor = BWCompositor("test", standard_name="maia_ct")
    composite = compositor((maia_scene["ct"],))
    kwargs = {"palettes": [
        {"filename": "/tmp/binary_maia_ct_colormap.npy",
         "min_value": 0, "max_value": 20}]}
Exemple #3
0
        print("Usage: " + sys.argv[0] + " MAIA_file ")
        sys.exit()

    fnmaia = sys.argv[1]
    maia_scene = Scene(reader='maia', filenames=[fnmaia])
    print(maia_scene.available_dataset_ids())
    maia_scene.load([
        "CloudType", "ct", "cma", "cma_conf", 'opaq_cloud', "CloudTopPres",
        "CloudTopTemp", "Alt_surface"
    ])

    # CloudType is a bit field containing the actual "ct" with values
    # from 0 to 20 which can be interpreted according to the cpool colormap

    # "ct" can be display in black and white:
    maia_scene.show("ct")

    # but it is better to palettize the image:
    # step 1: creation of the palette
    mycolors = []
    for i in range(21):
        mycolors.append(hex_to_rgb(cpool[i]))
    arr = np.array(mycolors)
    np.save("/tmp/binary_maia_ct_colormap.npy", arr)

    # step2: creation of the composite
    compositor = BWCompositor("test", standard_name="maia_ct")
    composite = compositor((maia_scene["ct"], ))
    kwargs = {
        "palettes": [{
            "filename": "/tmp/binary_maia_ct_colormap.npy",