HelioviewerClient#

class sunpy.net.helioviewer.HelioviewerClient(url=None)[source]#

Bases: object

Deprecated since version 4.1: The HelioviewerClient class is deprecated and may be removed in version 5.1. Use hvpy - https://hvpy.readthedocs.io/en/stable instead.

Helioviewer.org Client

Attributes Summary

data_sources

We trawl through the return from getDataSources to create a clean dictionary for all available sourceIDs.

Methods Summary

download_jp2(date[, progress, observatory, ...])

Downloads the JPEG 2000 that most closely matches the specified time and data source.

download_png(date, image_scale, layers[, ...])

Downloads the PNG that most closely matches the specified time and data source.

get_closest_image(date[, observatory, ...])

Finds the closest image available for the specified source and date.

get_data_sources()

Return a hierarchical dictionary of the available datasources on helioviewer.org.

get_jp2_header(date[, observatory, ...])

Get the XML header embedded in a JPEG2000 image.

is_online()

Returns True if Helioviewer is online and available.

Attributes Documentation

data_sources#

We trawl through the return from getDataSources to create a clean dictionary for all available sourceIDs.

Here is a list of all of them: https://api.helioviewer.org/docs/v2/#appendix_datasources

Methods Documentation

download_jp2(date, progress=True, observatory=None, instrument=None, detector=None, measurement=None, source_id=None, directory=None, overwrite=False)[source]#

Downloads the JPEG 2000 that most closely matches the specified time and data source.

This uses getJP2Image from the Helioviewer API.

Note

We can use observatory and measurement or instrument and measurement to get the value for source ID which can then be used to get required information.

Parameters:
  • date (astropy.time.Time, str) – A string or Time object for the desired date of the image

  • progress (bool) – Defaults to True. If set to False, disables progress bars seen on terminal when downloading files.

  • observatory (str) – Observatory name

  • instrument (str) – Instrument name

  • measurement (str) – Measurement name

  • detector (str) – Detector name

  • source_id (int) – ID number for the required instrument/measurement. This can be used directly instead of using the previous parameters.

  • directory (str) – Directory to download JPEG 2000 image to.

  • overwrite (bool) – Defaults to False. If set to True, will overwrite any files with the same name.

Returns:

out (str) – Returns a filepath to the downloaded JPEG 2000 image.

download_png(date, image_scale, layers, progress=True, directory=None, overwrite=False, watermark=False, events='', event_labels=False, scale=False, scale_type='earth', scale_x=0, scale_y=0, width=4096, height=4096, x0=0, y0=0, x1=None, y1=None, x2=None, y2=None)[source]#

Downloads the PNG that most closely matches the specified time and data source.

This function is different to download_jp2. Here you get PNG images and return more complex images.

For example you can return an image that has multiple layers composited together from different sources. Also mark solar features/events with an associated text label. The image can also be cropped to a smaller field of view.

These parameters are not pre-validated before they are passed to Helioviewer API. See https://api.helioviewer.org/docs/v2/#appendix_coordinates for more information about what coordinates values you can pass into this function.

This uses takeScreenshot from the Helioviewer API.

Note

Parameters x1, y1, x2 and y2 are set to None. If all 4 are set to values, then keywords: width, height, x0, y0 will be ignored.

Parameters:
  • date (astropy.time.Time, str) – A parse_time parsable string or Time object for the desired date of the image

  • image_scale (float) – The zoom scale of the image in arcseconds per pixel. For example, the scale of an AIA image is 0.6.

  • layers (str) – Image datasource layer/layers to include in the screeshot. Each layer string is comma-separated with either: “[sourceId,visible,opacity]” or “[obs,inst,det,meas,visible,opacity]”. Multiple layers are: “[layer1],[layer2],[layer3]”.

  • progress (bool, optional) – Defaults to True. If set to False, disables progress bars seen on terminal when downloading files.

  • events (str, optional) – Defaults to an empty string to indicate no feature/event annotations. List feature/event types and FRMs to use to annotate the image. Example could be “[AR,HMI_HARP;SPoCA,1]” or “[CH,all,1]”

  • event_labels (bool, optional) – Defaults to False. Annotate each event marker with a text label.

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

  • directory (str, optional) – Directory to download JPEG 2000 image to.

  • overwrite (bool, optional) – Defaults to False. If set to True, will overwrite any files with the same name.

  • scale (bool, optional) – Defaults to False. Overlay an image scale indicator.

  • scale_type (str, optional) – Defaults to Earth. What is the image scale indicator will be.

  • scale_x (int, optional) – Defaults to 0 (i.e, in the middle) Horizontal offset of the image scale indicator in arcseconds with respect to the center of the Sun.

  • scale_y (int, optional) – Defaults to 0 (i.e, in the middle) Vertical offset of the image scale indicator in arcseconds with respect to the center of the Sun.

  • x0 (float, optional) – The horizontal offset from the center of the Sun.

  • y0 (float, optional) – The vertical offset from the center of the Sun.

  • width (int, optional) – Defaults to 4096. Width of the image in pixels.

  • height (int, optional) – Defaults to 4096. Height of the image in pixels.

  • x1 (float, optional) – Defaults to None The offset of the image’s left boundary from the center of the sun, in arcseconds.

  • y1 (float, optional) – Defaults to None The offset of the image’s top boundary from the center of the sun, in arcseconds.

  • x2 (float, optional) – Defaults to None The offset of the image’s right boundary from the center of the sun, in arcseconds.

  • y2 (float, optional) – Defaults to None The offset of the image’s bottom boundary from the center of the sun, in arcseconds.

Returns:

out (str) – Returns a filepath to the downloaded PNG image.

get_closest_image(date, observatory=None, instrument=None, detector=None, measurement=None, source_id=None)[source]#

Finds the closest image available for the specified source and date. This does not download any file.

This uses getClosestImage from the Helioviewer API.

Note

We can use observatory and measurement or instrument and measurement to get the value for source ID which can then be used to get required information.

Parameters:
  • date (astropy.time.Time, str) – A parse_time parsable string or Time object for the desired date of the image

  • observatory (str) – Observatory name

  • instrument (str) – Instrument name

  • detector (str) – Detector name

  • measurement (str) – Measurement name

  • source_id (int) – ID number for the required instrument/measurement. This can be used directly instead of using the previous parameters.

Returns:

out (dict) – A dictionary containing meta-information for the closest image matched

get_data_sources()[source]#

Return a hierarchical dictionary of the available datasources on helioviewer.org.

This uses getDataSources from the Helioviewer API.

Returns:

out (dict) – A dictionary containing meta-information for each data source that Helioviewer supports.

get_jp2_header(date, observatory=None, instrument=None, detector=None, measurement=None, jp2_id=None)[source]#

Get the XML header embedded in a JPEG2000 image. Includes the FITS header as well as a section of Helioviewer-specific metadata.

This uses getJP2Header from the Helioviewer API.

Note

We can use observatory and measurement or instrument and measurement to get the value for source ID which can then be used to get required information.

Parameters:
  • date (astropy.time.Time, str) – A parse_time parsable string or Time object for the desired date of the image

  • observatory (str) – Observatory name

  • instrument (str) – Instrument name

  • measurement (str) – Measurement name

  • detector (str) – Detector name

  • jp2_id (int) – Unique JP2 image identifier. This can be used directly instead of using the previous parameters.

Returns:

out (dict) – Returns a dictionary containing the header information of JPEG 2000 image. The returned dictionary may have either one or two keys: fits and helioviewer.

is_online()[source]#

Returns True if Helioviewer is online and available.