requests¶
- albatross.requests.build_wtk_filepath(region, year, resolution=None)¶
A utility for building WIND Toolkit filepaths.
- Parameters
region (str) – region in which the lat/lon point is located (see get_regions)
year (int) – year to be accessed (see get_regions)
resolution (
str, optional) – data resolution (see get_regions)
- Returns
The filepath for the requested resource.
- Return type
str
- albatross.requests.get_regions(pprint=False)¶
Returns the full set of available regions with their configuration options.
Note that the year_range represents an inclusive (beginning, end), where any specified value within that range is a valid year for that region.
- Parameters
pprint (bool) – Pretty print results.
- Returns
Regions and configuration options.
- Return type
dict
- albatross.requests.identify_regions(lat_lon, coordinates=False)¶
Returns the region associated with the given lat/lon point.
- Parameters
lat_lon (
listoffloat) – latitude/longitude point to accesscoordinates (bool) – optionally include a list of all registered coordinates for the region (requires HSDS API calls)
- Returns
list of region names (coordinates=False) list: list of region dicts with coordinate info (coordinates=True)
- Return type
list
- albatross.requests.read_wtk_point_data(wtk_file, lat_lon, params, tree=None, unscale=True, str_decode=True, group=None)¶
Reads WIND Toolkit data directly from a file.
- Parameters
wtk_file (
str) – file pathlat_lon (
listoffloat) – latitude/longitude point to accessparams (
listofstr) – A list of parameters to include in the datasetresolution (
str, optional) – data resolution (see get_regions)tree (
str, optional) – cKDTree or path to .pkl file containing pre-computed tree of lat, lon coordinates, by default Noneunscale (
bool, optional) – Boolean flag to automatically unscale variables on extraction, by default Truestr_decode (
bool, optional) – Boolean flag to decode the bytestring meta data into normal strings. Setting this to False will speed up the meta data read. by default Truegroup (
str, optional) – Group within .h5 resource file to open, by default None
- Returns
A tuple (data, metadata) consisting of a DataFrame and associated metadata.
- Return type
tuple
- albatross.requests.request_wtk_point_data(lat_lon, year, params, region=None, resolution=None, tree=None, unscale=True, str_decode=True, group=None)¶
Requests WIND Toolkit data from NREL HSDS for a given lat/lon point. If a region is not specified, it will attempt to infer one using identify_regions. However, if multiple regions are identified for the lat_lon provided, it will raise an error, prompting the user to explicitly provide one.
- Parameters
lat_lon (
listoffloat) – latitude/longitude point to accessyear (int) – year to be accessed (see get_regions)
params (
listofstr) – A list of parameters to include in the datasetregion (str, optional) – region in which the lat/lon point is located (see get_regions)
resolution (
str, optional) – data resolution (see get_regions)tree (
str, optional) – cKDTree or path to .pkl file containing pre-computed tree of lat, lon coordinates, by default Noneunscale (
bool, optional) – Boolean flag to automatically unscale variables on extraction, by default Truestr_decode (
bool, optional) – Boolean flag to decode the bytestring meta data into normal strings. Setting this to False will speed up the meta data read. by default Truegroup (
str, optional) – Group within .h5 resource file to open, by default None
- Returns
A tuple (data, metadata) consisting of a DataFrame and associated metadata.
- Return type
tuple