solarforecastarbiter.io.fetch.arm.fetch_arm¶
-
solarforecastarbiter.io.fetch.arm.
fetch_arm
(user_id, api_key, datastream, variables, start, end)[source]¶ Gets data from ARM API and concatenates requested datastreams into a single Pandas Dataframe.
Parameters: - user_id (string) – ARM user id.
- api_key (string) – ARM live API access token.
- datastream (string) – The datastream to request.
- variables – List of variables to parse from the datastream.
- start (datetime) – The start of the interval to request data for.
- end (datetime) – The end of the interval to request date for.
Returns: DataFrame – A DataFrame containing all of the available variables over the requested period.
Notes
Elements of the variable list that are not found in the datastream are ignored, this is to allow iteration over many datastreams without knowing their exact contents. If none of the requested variables are found, an empty DataFrame will be returned. Users should verify the contents of the return value before use.
Occassionally ARM API returns multiple files that contain the same valid time. This function keeps only the last occurance of the data at a given time.
Example
A user requesting data for the variables ‘down_short_hemisp’ and ‘short_direct_normal’ from the datastream ‘sgpqcrad1longC1.c1’ for the days between 2019-02-27 and 2019-03-01 could expect the following DataFrame.
down_short_hemisp short_direct_normal 2019-02-27 00:00:00+00:00 7.182889 -1.399250 2019-02-27 00:01:00+00:00 6.943601 -1.317890 2019-02-27 00:02:00+00:00 6.686488 -1.235140 ... 2019-03-01 23:57:00+00:00 6.943601 -1.317890 2019-03-01 23:58:00+00:00 6.686488 -1.235140 2019-03-01 23:59:00+00:00 6.395981 -1.226730