FREVA-CLINT / freva

The Free Evaluation System Framework (FreVa)
Other
10 stars 3 forks source link

issue copying gif outputs into preview #136

Open eelucio opened 1 year ago

eelucio commented 1 year ago

When copy/transforming output images/animations into share/preview there is a problem with GIF images, they are resized and only the first (?) frame is copied, e.g. https://www.xces.dkrz.de/history/923870/results/

In principle it should be copying:

                if ext in ".jpg .jpeg .png .gif .mp4 .mov".split():
                    metadata["type"] = "plot"
                    metadata["todo"] = "copy"

this leads to:

        if todo == "copy":
            ext = os.path.splitext(file_name)[-1]
            target_name = _preview_unique_file(plugin_name, ext, metadata)
            todo_list.append((_preview_copy, file_name, target_name))
            metadata["preview_path"] = target_name
            result_list.append(target_name)

then to:

    extension = Path(source_path).suffix
    supported = Image.registered_extensions()
    if extension in supported and supported[extension] not in IMAGE_RESIZE_EXCEPTIONS:
        _preview_convert(source_path, dest_path)
    else:
        shutil.copyfile(source_path, dest_path)

which looks into:

IMAGE_RESIZE_EXCEPTIONS = ["PDF", "HDF5", "GRIB"]

wouldn't this mean that we are converting everything that is not PDF,HDF5,GRIB ?

antarcticrainforest commented 8 months ago

I think this is solved now. Isn't it?

eelucio commented 8 months ago

No, is not working fully yet.

I just plotted with movieplotter that gives the outputs in gifs, e.g. here the output is indeed a gif /work/bm1159/XCES/xces-work/k204229/evaluation_system/output/movieplotter/20240205_144228/929956/input1-psl_1hr_reanalysis_era5_r1i1p1_20210701-20210731.nc_nc3_SELDATE_psl_movie.gif but the preview is not /work/bm1159/XCES/xces-work/share/preview/20240205/movieplotter_20240205_154927_oQxKgkTN.gif

however for mp4 it does work (e.g. with animator) https://www.xces.dkrz.de/history/928784/results/

eelucio commented 4 months ago

the PR of #198 should close this issue