pyiem.autoplot module#

Content from util for IEM Autoplot work.

pyiem.autoplot.get_autoplot_context(fdict, cfg, enforce_optional=False, **kwargs)[source]#

Get the variables out of a dict of strings

This helper for IEM autoplot gets values out of a dictionary of strings, as provided by CGI. It does some magic to get types right, defaults right and so on. The typical way this is called

ctx = iemutils.get_context(fdict, get_description())

Parameters:
  • fdict (dict) – what was likely provided by cgi.FieldStorage()

  • cfg (dict) – autoplot value of get_description

  • enforce_optional (bool,optional) – Should the optional flag be enforced

  • rectify_dates (bool,optional) – Attempt to fix common date errors like June 31. Default false.

Returns:

dictionary of variable names and values, with proper types!

Return type:

dict