Utils

irisreader.utils.download

irisreader.utils.download(obs_identifier, target_directory, type='all', uncompress=True, open_obs=True, mirror=None)[source]

Downloads a given IRIS observation.

Parameters
  • obs_identifier (str) – Observation identifier in the form yyyymmdd_hhmmss_oooooooooo, e.g. 20140323_052543_3860263227

  • target_directory (str) – Path to store downloaded observation to (defaults to home directory)

  • type (str) – Type of data to download: ‘all’: all data ‘sji’: only SJI files ‘raster’: only raster files

  • uncompress (bool) – Uncompress files after download? (automatically set to True if open_obs is True)

  • open_obs (bool) – Immediately open observation and return observation object? Otherwise a boolean indicating download success is returned

  • mirror (str) – Mirror to be used: ‘lmsal’: LMSAL (http://www.lmsal.com/solarsoft/irisa/data/level2_compressed/) ‘uio’: University of Oslo (http://sdc.uio.no/vol/fits/iris/level2/)

Returns

Return type

An open observation handle or a boolean indicating download success.

irisreader.utils.animate

irisreader.utils.animate(data_cube, raster_pos=None, index_start=None, index_stop=None, interval_ms=50, gamma=0.4, figsize=(7, 7), cutoff_percentile=99.9, save_path=None)[source]

Creates an animation from the individual images of a data cube. This function can be pretty slow and take 1-2 minutes. Faster alternatives than matplotlib will be researched in the future.

Parameters
  • data_cube (iris_data_cube) – instance of sji_cube or raster_cube

  • raster_pos (int) – If not None, only display images at raster postion raster_pos

  • index_start (int) – index where to start animation (defaults to None -> will be set to 0)

  • index_stop (int) – index where to stop animation (defaults to None -> will be set to n)

  • interval_ms (int) – number of milliseconds between two frames

  • gamma (float) – gamma correction for plotting: number between 0 (infinitely gamma correction) and 1 (no gamma correction)

  • figsize (tuple) – figure size: (width,height)

  • cutoff_percentile (float) – Often the maximum pixels shine out everything else, even after gamma correction. In order to reduce this effect, the percentile at which to cut the intensity off can be specified with cutoff_percentile in a range between 0 and 100.

  • save_path (str) – path to file where animation output will be written to (use .mp4 extension)

Returns

HTML object with the animation

Return type

IPython.HTML

irisreader.utils.date.from_Tformat

irisreader.utils.date.from_Tformat(date_str)[source]

Converts from the FITS date format ‘%Y-%m-%dT%H:%M:%S.%f’ to a datetime object.

Parameters

date_str (str) – FITS date string with ‘T’ between date and time.

Returns

Python datetime object

Return type

datetime

irisreader.utils.date.to_Tformat

irisreader.utils.date.to_Tformat(date, milliseconds=True)[source]

Converts from a datetime object to the FITS date format ‘%Y-%m-%dT%H:%M:%S’.

Parameters
  • date (datetime) – Python datetime object

  • milliseconds (bool) – Whether to include milliseconds in the output (separated with a dot)

Returns

date_str – FITS date string with ‘T’ between date and time.

Return type

str

irisreader.utils.date.from_obsformat

irisreader.utils.date.from_obsformat(full_obsid_str)[source]

Converts a full OBSID string to a date.

Parameters

full_obsid_str (str) – Full OBSID

Returns

Python datetime object

Return type

datetime

irisreader.utils.date.to_epoch

irisreader.utils.date.to_epoch(date)[source]

Converts a date to an integer with the number of seconds since 1.1.1970. This can be useful for time difference calculations.

Parameters

date (datetime) – Python datetime object

Returns

Seconds since 1.1.1970 00:00:00

Return type

int