コード例 #1
0
ファイル: cli.py プロジェクト: earthobservations/wetterdienst
def station_options(command):
    """
    Station options for cli, which can be used for stations_result and values endpoint

    :param command:
    :return:
    """
    arguments = [
        cloup.option("--parameter",
                     type=StringListParamType(","),
                     required=True),
        cloup.option("--resolution", type=click.STRING, required=True),
        cloup.option("--period", type=StringListParamType(",")),
        cloup.option_group("All stations_result",
                           click.option("--all", "all_", is_flag=True)),
        cloup.option_group(
            "Station id filtering",
            cloup.option("--station", type=StringListParamType(",")),
        ),
        cloup.option_group(
            "Station name filtering",
            cloup.option("--name", type=click.STRING),
        ),
        cloup.option_group(
            "Latitude-Longitude rank/distance filtering",
            cloup.option("--coordinates",
                         metavar="LATITUDE,LONGITUDE",
                         type=click.STRING),
            cloup.option("--rank", type=click.INT),
            cloup.option("--distance", type=click.FLOAT),
            help="Provide --coordinates plus either --rank or --distance.",
        ),
        cloup.constraint(
            If("coordinates", then=RequireExactly(1), else_=accept_none),
            ["rank", "distance"],
        ),
        cloup.option_group(
            "BBOX filtering",
            cloup.option("--bbox",
                         metavar="LEFT BOTTOM RIGHT TOP",
                         type=click.STRING),
        ),
        cloup.option_group(
            "SQL filtering",
            click.option("--sql", type=click.STRING),
        ),
        cloup.constraint(
            RequireExactly(1),
            ["all_", "station", "name", "coordinates", "bbox", "sql"],
        ),
    ]
    return functools.reduce(lambda x, opt: opt(x), reversed(arguments),
                            command)
コード例 #2
0
output_options = option_group(
    "Output options",
    option(
        "-o",
        "--output_file",
        type=str,
        default=None,
        help="Specify the filename(s) of the rendered scene(s).",
    ),
    option(
        "-0",
        "--zero_pad",
        type=click.IntRange(0, 9),
        default=None,
        help="Zero padding for PNG file names.",
    ),
    option(
        "--write_to_movie",
        is_flag=True,
        default=None,
        help="Write the video rendered with opengl to a file.",
    ),
    option(
        "--media_dir",
        type=click.Path(),
        default=None,
        help="Path to store rendered videos and latex.",
    ),
    option(
        "--log_dir",
        type=click.Path(),
        help="Path to store render logs.",
        default=None,
    ),
    option(
        "--log_to_file",
        is_flag=True,
        default=None,
        help="Log terminal output to file.",
    ),
)
コード例 #3
0
render_options = option_group(
    "Render Options",
    option(
        "-n",
        "--from_animation_number",
        callback=validate_scene_range,
        help="Start rendering from n_0 until n_1. If n_1 is left unspecified, "
        "renders all scenes after n_0.",
    ),
    option(
        "-a",
        "--write_all",
        is_flag=True,
        help="Render all scenes in the input file.",
    ),
    option(
        "--format",
        type=click.Choice(["png", "gif", "mp4"], case_sensitive=False),
    ),
    option("-s", "--save_last_frame", is_flag=True),
    option(
        "-q",
        "--quality",
        default="h",
        type=click.Choice(["l", "m", "h", "p", "k"], case_sensitive=False),
        help="""
            Render quality at the follow resolution framerates, respectively:
            854x480 30FPS,
            1280x720 30FPS,
            1920x1080 60FPS,
            2560x1440 60FPS,
            3840x2160 60FPS
            """,
    ),
    option(
        "-r",
        "--resolution",
        callback=validate_resolution,
        help="Resolution in (W,H) for when 16:9 aspect ratio isn't possible.",
    ),
    option(
        "--fps",
        "--frame_rate",
        "frame_rate",
        type=float,
        help="Render at this frame rate.",
    ),
    option(
        "--renderer",
        type=click.Choice(["cairo", "opengl", "webgl"], case_sensitive=False),
        help="Select a renderer for your Scene.",
    ),
    option(
        "--use_opengl_renderer",
        is_flag=True,
        help="Render scenes using OpenGL (Deprecated).",
    ),
    option(
        "--use_webgl_renderer",
        is_flag=True,
        help="Render scenes using the WebGL frontend (Deprecated).",
    ),
    option(
        "--webgl_renderer_path",
        default=None,
        type=click.Path(),
        help="The path to the WebGL frontend.",
    ),
    option(
        "-g",
        "--save_pngs",
        is_flag=True,
        default=None,
        help="Save each frame as png (Deprecated).",
    ),
    option(
        "-i",
        "--save_as_gif",
        default=None,
        is_flag=True,
        help="Save as a gif (Deprecated).",
    ),
    option(
        "-s",
        "--save_last_frame",
        default=None,
        is_flag=True,
        help="Save last frame as png (Deprecated).",
    ),
    option("-t",
           "--transparent",
           is_flag=True,
           help="Render scenes with alpha channel."),
)
コード例 #4
0
global_options: OptionGroupDecorator = option_group(
    "Global options",
    option(
        "-c",
        "--config_file",
        help="Specify the configuration file to use for render settings.",
        default=None,
    ),
    option(
        "--custom_folders",
        is_flag=True,
        default=None,
        help="Use the folders defined in the [custom_folders] section of the "
        "config file to define the output folder structure.",
    ),
    option(
        "--disable_caching",
        is_flag=True,
        default=None,
        help="Disable the use of the cache (still generates cache files).",
    ),
    option(
        "--flush_cache",
        is_flag=True,
        help="Remove cached partial movie files.",
        default=None,
    ),
    option("--tex_template", help="Specify a custom TeX template file.", default=None),
    option(
        "-v",
        "--verbosity",
        type=click.Choice(
            ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
            case_sensitive=False,
        ),
        help="Verbosity of CLI output. Changes ffmpeg log level unless 5+.",
        default=None,
    ),
    option(
        "--notify_outdated_version/--silent",
        is_flag=True,
        default=None,
        help="Display warnings for outdated installation.",
    ),
    option(
        "--enable_gui",
        is_flag=True,
        help="Enable GUI interaction.",
        default=None,
    ),
    option(
        "--gui_location",
        default=None,
        callback=validate_gui_location,
        help="Starting location for the GUI.",
    ),
    option(
        "--fullscreen",
        is_flag=True,
        help="Expand the window to its maximum possible size.",
        default=None,
    ),
    option(
        "--enable_wireframe",
        is_flag=True,
        help="Enable wireframe debugging mode in opengl.",
        default=None,
    ),
    option(
        "--force_window",
        is_flag=True,
        help="Force window to open when using the opengl renderer, intended for debugging as it may impact performance",
        default=False,
    ),
    option(
        "--dry_run",
        is_flag=True,
        help="Renders animations without outputting image or video files and disables the window",
        default=False,
    ),
)
コード例 #5
0
global_options = option_group(
    "Global options",
    option(
        "-c",
        "--config_file",
        help="Specify the configuration file to use for render settings.",
    ),
    option(
        "--custom_folders",
        is_flag=True,
        help="Use the folders defined in the [custom_folders] section of the "
        "config file to define the output folder structure.",
    ),
    option(
        "--disable_caching",
        is_flag=True,
        help="Disable the use of the cache (still generates cache files).",
    ),
    option("--flush_cache", is_flag=True, help="Remove cached partial movie files."),
    option("--tex_template", help="Specify a custom TeX template file."),
    option(
        "-v",
        "--verbosity",
        type=click.Choice(
            ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
            case_sensitive=False,
        ),
        help="Verbosity of CLI output. Changes ffmpeg log level unless 5+.",
    ),
    option(
        "--notify_outdated_version/--silent",
        is_flag=True,
        default=None,
        help="Display warnings for outdated installation.",
    ),
    option(
        "--enable_gui",
        is_flag=True,
        help="Enable GUI interaction.",
    ),
    option(
        "--gui_location",
        default="0,0",
        callback=validate_gui_location,
        help="Starting location for the GUI.",
    ),
)
コード例 #6
0
import click
from cloup import option, option_group

output_options = option_group(
    "Output options",
    option(
        "-o",
        "--output_file",
        multiple=True,
        help="Specify the filename(s) of the rendered scene(s).",
    ),
    option(
        "--write_to_movie",
        is_flag=True,
        default=None,
        help="Write to a file.",
    ),
    option(
        "--media_dir",
        type=click.Path(),
        help="Path to store rendered videos and latex.",
    ),
    option("--log_dir", type=click.Path(), help="Path to store render logs."),
    option(
        "--log_to_file",
        is_flag=True,
        help="Log terminal output to file.",
    ),
)
コード例 #7
0
ease_of_access_options = option_group(
    "Ease of access options",
    option(
        "--progress_bar",
        default=None,
        show_default=False,
        type=click.Choice(
            ["display", "leave", "none"],
            case_sensitive=False,
        ),
        help="Display progress bars and/or keep them displayed.",
    ),
    option(
        "-p",
        "--preview",
        is_flag=True,
        help="Preview the Scene's animation. OpenGL does a live preview in a "
        "popup window. Cairo opens the rendered video file in the system "
        "default media player.",
        default=None,
    ),
    option(
        "-f",
        "--show_in_file_browser",
        is_flag=True,
        help="Show the output file in the file browser.",
        default=None,
    ),
    option(
        "--jupyter",
        is_flag=True,
        help="Using jupyter notebook magic.",
        default=None,
    ),
)
コード例 #8
0
render_options = option_group(
    "Render Options",
    option(
        "-n",
        "--from_animation_number",
        callback=validate_scene_range,
        help="Start rendering from n_0 until n_1. If n_1 is left unspecified, "
        "renders all scenes after n_0.",
        default=None,
    ),
    option(
        "-a",
        "--write_all",
        is_flag=True,
        help="Render all scenes in the input file.",
        default=None,
    ),
    option(
        "--format",
        type=click.Choice(["png", "gif", "mp4", "webm", "mov"], case_sensitive=False),
        default=None,
    ),
    option("-s", "--save_last_frame", is_flag=True, default=None),
    option(
        "-q",
        "--quality",
        default=None,
        type=click.Choice(
            list(reversed([q["flag"] for q in QUALITIES.values() if q["flag"]])),  # type: ignore
            case_sensitive=False,
        ),
        help="Render quality at the follow resolution framerates, respectively: "
        + ", ".join(
            reversed(
                [
                    f'{q["pixel_width"]}x{q["pixel_height"]} {q["frame_rate"]}FPS'
                    for q in QUALITIES.values()
                    if q["flag"]
                ]
            )
        ),
    ),
    option(
        "-r",
        "--resolution",
        callback=validate_resolution,
        default=None,
        help="Resolution in (W,H) for when 16:9 aspect ratio isn't possible.",
    ),
    option(
        "--fps",
        "--frame_rate",
        "frame_rate",
        type=float,
        default=None,
        help="Render at this frame rate.",
    ),
    option(
        "--renderer",
        type=click.Choice(["cairo", "opengl", "webgl"], case_sensitive=False),
        help="Select a renderer for your Scene.",
        default=None,
    ),
    option(
        "--use_opengl_renderer",
        is_flag=True,
        help="Render scenes using OpenGL (Deprecated).",
        default=None,
    ),
    option(
        "--use_webgl_renderer",
        is_flag=True,
        help="Render scenes using the WebGL frontend (Deprecated).",
        default=None,
    ),
    option(
        "--webgl_renderer_path",
        default=None,
        type=click.Path(),
        help="The path to the WebGL frontend.",
    ),
    option(
        "-g",
        "--save_pngs",
        is_flag=True,
        default=None,
        help="Save each frame as png (Deprecated).",
    ),
    option(
        "-i",
        "--save_as_gif",
        default=None,
        is_flag=True,
        help="Save as a gif (Deprecated).",
    ),
    option(
        "--save_sections",
        default=None,
        is_flag=True,
        help="Save section videos in addition to movie file.",
    ),
    option(
        "-s",
        "--save_last_frame",
        default=None,
        is_flag=True,
        help="Save last frame as png (Deprecated).",
    ),
    option(
        "-t",
        "--transparent",
        is_flag=True,
        help="Render scenes with alpha channel.",
    ),
    option(
        "--use_projection_fill_shaders",
        is_flag=True,
        help="Use shaders for OpenGLVMobject fill which are compatible with transformation matrices.",
        default=None,
    ),
    option(
        "--use_projection_stroke_shaders",
        is_flag=True,
        help="Use shaders for OpenGLVMobject stroke which are compatible with transformation matrices.",
        default=None,
    ),
)
コード例 #9
0
global_options = option_group(
    "Global options",
    option(
        "-c",
        "--config_file",
        help="Specify the configuration file to use for render settings.",
    ),
    option(
        "--custom_folders",
        is_flag=True,
        help="Use the folders defined in the [custom_folders] section of the "
        "config file to define the output folder structure.",
    ),
    option(
        "--disable_caching",
        is_flag=True,
        help="Disable the use of the cache (still generates cache files).",
    ),
    option("--flush_cache",
           is_flag=True,
           help="Remove cached partial movie files."),
    option("--tex_template", help="Specify a custom TeX template file."),
    option(
        "-v",
        "--verbosity",
        type=click.Choice(
            ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
            case_sensitive=False,
        ),
        help="Verbosity of CLI output. Changes ffmpeg log level unless 5+.",
    ),
)
コード例 #10
0
ファイル: cli.py プロジェクト: earthobservations/wetterdienst
from wetterdienst import Provider, Wetterdienst, __appname__, __version__
from wetterdienst.exceptions import ProviderError
from wetterdienst.provider.dwd.radar.api import DwdRadarSites
from wetterdienst.provider.eumetnet.opera.sites import OperaRadarSites
from wetterdienst.ui.core import get_stations, get_values, set_logging_level

log = logging.getLogger(__name__)

appname = f"{__appname__} {__version__}"

provider_opt = cloup.option_group(
    "Provider",
    click.option(
        "--provider",
        type=click.Choice([provider.name for provider in Provider],
                          case_sensitive=False),
        required=True,
    ),
)

network_opt = cloup.option_group(
    "Network",
    click.option(
        "--network",
        type=click.STRING,
        required=True,
    ),
)

debug_opt = click.option("--debug", is_flag=True)
コード例 #11
0
import click
from cloup import option, option_group

streaming_options = option_group(
    "Streaming options",
    option(
        "--use-ipython",
        is_flag=True,
        help="Use IPython as the interactive console",
    ),
    # Make this option sensible and available
    # option(
    #     "-sp",
    #     "--streaming_protocol",
    #     type=click.Choice(
    #         ["rtp", "udp"],
    #         case_sensitive=False,
    #     ),
    #     help="Streaming protocol to use for livestreaming configuration",
    # ),
)