nsrdb.utilities.extract_nsrdb_data.ExtractTestData
- class ExtractTestData(target, source)[source]
Bases:
ExtractNSRDB
Extraction utilities for miscellaneous NSRDB test data sets.
- Parameters:
target (str) – Target file (with path) to dump extracted data to (.csv for simple meta data extractions or .h5 for nsrdb data extractions).
source (str) – Source NSRDB file (with path). Data is extracted from this file and written to the target file.
Methods
copy_nsrdb_test_file
(dsets[, year])Make a copy NSRDB test file with certain dsets
extract_closest_meta
(coords)Get NSRDB meta data for pixels closest to input coordinate set.
extract_dsets
(dsets)Extract entire datasets with meta from h5 to new h5.
extract_map
(dset[, time_index, sort])Extract a lat-lon-data csv for one timestep and all sites for mapping applications.
extract_sites
([sites])Extract data from h5 for given site indices and write to new h5.
filter_meta
(values, label)Return a meta df filtered where the label is equal to the value.
Retrieve the NSRDB meta data and save to csv.
oregon_50
(dir_out[, year])Extract NSRDB data from 50 sites from oregon to target h5.
srrl_2017
(dir_out[, year])Extract NSRDB data from NREL SRRL site to target h5.
Attributes
IGNORE_LIST
Get the NSRDB meta data as a DataFrame.
- classmethod oregon_50(dir_out, year=2015)[source]
Extract NSRDB data from 50 sites from oregon to target h5.
- classmethod srrl_2017(dir_out, year=2017)[source]
Extract NSRDB data from NREL SRRL site to target h5.
- classmethod copy_nsrdb_test_file(dsets, year=1998)[source]
Make a copy NSRDB test file with certain dsets
- extract_closest_meta(coords)
Get NSRDB meta data for pixels closest to input coordinate set.
- Parameters:
coords (np.ndarray) – N x 2 array of lat/lon pairs.
- Returns:
subset_meta (pd.DataFrame) – A subset of the source meta data with the closest sites to the input coordinates. Has length N (length of coordinate array).
- extract_dsets(dsets)
Extract entire datasets with meta from h5 to new h5.
- Parameters:
dsets (list | tuple) – Target datasets in source h5 file to extract data from.
- extract_map(dset, time_index=0, sort=False)
Extract a lat-lon-data csv for one timestep and all sites for mapping applications.
- Parameters:
dset (str) – Target dataset in source h5 file to extract data from.
time_index (int) – Time series index to extract. Data from all sites for this single time index will be extracted.
sort (bool) – Flag on whether to sort the data by lat/lon.
- extract_sites(sites=range(0, 100))
Extract data from h5 for given site indices and write to new h5.
- Parameters:
sites (range | list | slice) – Site indicies to extract.
- filter_meta(values, label)
Return a meta df filtered where the label is equal to the value.
- Parameters:
values (str | int | float | list) – Search variable(s). Could be a country, state, population, etc…
label (str) – Meta data column label corresponding to the value.
- Returns:
meta (pd.DataFrame) – Filtered meta data.
- property meta
Get the NSRDB meta data as a DataFrame.
- meta_to_disk()
Retrieve the NSRDB meta data and save to csv.