Source code for hydrofunctions.helpers


This module holds functions designed to help out the user in an IPython

from __future__ import absolute_import, print_function, division, unicode_literals
from IPython.core.display import HTML

[docs]def draw_map(width=700, height=400, url=""): """Draws a map of stream gages in a Jupyter Notebook. This function will draw an interactive map of stream gages from into an iframe and display it in a Jupyter Notebook. Each dot represents a stream gage. Click on the dot to learn its name, which you can use to request data. Args: width (int): The width of the map iframe. height (int): The height of the map iframe. url (str): The URL to put inside of the IFrame. Defaults to\ Returns: HTML display object. **Example:** >>> import hydrofunctions as hf >>> hf.draw_map() A map appears. >>> hf.draw_map(width=900, height=600) Draws a larger map. """ # TODO: # use ipywidgets to allow users to click on the map, and this will # return a value that can be used in another IPython cell. This # feature would allow the map to act as an interactive site selection # tool. output = HTML( '<p>Use <a href="" target="_blank">' "</a> to find a stream gauge. " "Click on the dots to learn more about a site.</p>" "<iframe src= width={} height={}>" "</iframe>".format(width, height) ) return output
[docs]def count_number_of_truthy(my_list): return sum(bool(item) for item in my_list)