createScreenshot#

hvpy.createScreenshot(date, imageScale, layers, events=None, eventLabels=False, scale=False, scaleType=None, scaleX=None, scaleY=None, width=None, height=None, x0=None, y0=None, x1=None, y1=None, x2=None, y2=None, watermark=False, overwrite=False, filename=None)[source]#

Automatically creates a screenshot using takeScreenshot, downloadScreenshot functions.

Parameters:
  • overwrite (bool) – Whether to overwrite the file if it already exists. Default is False.

  • filename (Union[str, Path, None]) – The path to save the file to. Optional, will default to f"{res['id']}_{date.date()}.png".

  • date (datetime) – Desired datetime of the image.

  • imageScale (float) – Image scale in arcseconds per pixel.

  • layers (str) – Image datasource layer(s) to include in the screenshot.

  • events (Optional[str]) – List feature/event types and FRMs to use to annotate the movie. Use the empty string to indicate that no feature/event annotations should be shown. Default is None, optional.

  • eventLabels (bool) – Annotate each event marker with a text label. Default is False, optional.

  • scale (bool) – Overlay an image scale indicator. Default is False, optional.

  • scaleType (Optional[str]) – The Image scale indicator. Default is None, optional.

  • scaleX (Optional[int]) – Horizontal offset of the image scale indicator in arcseconds with respect to the center of the Sun. Default is None, optional.

  • scaleY (Optional[int]) – Vertical offset of the image scale indicator in arcseconds with respect to the center of the Sun. Default is None, optional.

  • width (Optional[int]) – Width of the field of view in pixels. Used in conjunction width x0,``y0``, and height. Default is None, optional.

  • height (Optional[int]) – Height of the field of view in pixels. Used in conjunction width x0,``y0``, and width. Default is None, optional.

  • x0 (Optional[int]) – The horizontal offset of the center of the field of view from the center of the Sun. Used in conjunction with y0, width, and height. Default is None, optional.

  • y0 (Optional[int]) – The vertical offset of the center of the field of view from the center of the Sun. Used in conjunction with x0, width, and height. Default is None, optional.

  • x1 (Optional[int]) – The horizontal offset of the top-left corner of the field of view with respect to the center of the Sun (in arcseconds). Used in conjunction with y1, x2, and y2. Default is None, optional.

  • y1 (Optional[int]) – The vertical offset of the top-left corner of the field of view with respect to the center of the Sun (in arcseconds). Used in conjunction with x1, x2, and y2. Default is None, optional.

  • x2 (Optional[int]) – The horizontal offset of the bottom-right corner of the field of view with respect to the center of the Sun (in arcseconds). Used in conjunction with x1, y1, and y2. Default is None, optional.

  • y2 (Optional[int]) – The vertical offset of the bottom-right corner of the field of view with respect to the center of the Sun (in arcseconds). Used in conjunction with x1, y1, and x2. Default is None, optional.

  • display – Set to true to directly output binary PNG image data. Default is False (which outputs a JSON object), optional.

  • watermark (bool) – Overlay a watermark consisting of a Helioviewer logo, the datasource abbreviation(s) and timestamp(s) displayed in the screenshot. Default is False, optional. Optional.

  • callback – Wrap the response object in a function call of your choosing. Default is None (no wrapping), optional.

Return type:

Path

References

Examples

>>> from hvpy import createScreenshot, DataSource, create_events, create_layers, EventType
>>> from datetime import datetime, timedelta
>>> screenshot_location = createScreenshot(
...     date=datetime.today() - timedelta(days=15),
...     layers=create_layers([(DataSource.AIA_171, 100)]),
...     events=create_events([EventType.ACTIVE_REGION]),
...     eventLabels=True,
...     imageScale=1,
...     x0=0,
...     y0=0,
...     width=100,
...     height=100,
...     filename="my_screenshot",
... )
>>> # This is to cleanup the file created from the example
>>> # you don't need to do this
>>> from pathlib import Path
>>> Path('my_screenshot.png').unlink()