h2integrate.resource.utilities.download_tools

h2integrate.resource.utilities.download_tools#

Functions

download_from_api(url, filename)

Download data from url and save it to filename.

make_time_index_openmeteo(data, timezone, ...)

Make a pd.DatetimeIndex object from the 'time' column of the input data.

h2integrate.resource.utilities.download_tools.download_from_api(url, filename)#

Download data from url and save it to filename.

Parameters:
  • url (str) -- The API endpoint to return data from.

  • filename (str) -- The filename where data should be written.

Returns:

bool -- True if data was downloaded file successfully, False if encountered error.

h2integrate.resource.utilities.download_tools.make_time_index_openmeteo(data, timezone, lat, lon)#

Make a pd.DatetimeIndex object from the 'time' column of the input data. This is intended to be used with resource data obtained from OpenMeteo resource models.

Parameters:
  • data (pd.DataFrame) -- resource data with a 'time' column in ISO format

  • timezone (str) -- name of timezone for the site. Only checked to see if timezone is 'UTC' or 'GMT'

  • lat (float) -- site latitude

  • lon (float) -- site longitude

Returns:

pd.DatetimeIndex -- time index of OpenMeteo data