nsrdb.utilities.extract_nsrdb_data.ExtractPuertoRico
- class ExtractPuertoRico(target, source)[source]
Bases:
ExtractNSRDB
Extraction utilities for Puerto Rico data.
- 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
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_gen_meta
(target, source)Extract PR solar site data.
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.
puerto_rico_data
([year])Extract the Puerto Rico NSRDB data for a given year to target h5.
puerto_rico_data_50
([year])Extract 50 sites in PR for a given year to target h5.
Extract the Puerto Rico meta data to csv.
puerto_rico_vi_data
([year])Extract the Puerto Rico with USVI and BVI NSRDB data for a given year to target h5.
Extract the Puerto Rico with USVI and BVI meta data to csv.
Attributes
IGNORE_LIST
Get the NSRDB meta data as a DataFrame.
- classmethod puerto_rico_vi_meta()[source]
Extract the Puerto Rico with USVI and BVI meta data to csv.
- classmethod puerto_rico_vi_data(year=2015)[source]
Extract the Puerto Rico with USVI and BVI NSRDB data for a given year to target h5.
- classmethod puerto_rico_data(year=2015)[source]
Extract the Puerto Rico NSRDB data for a given year to target h5.
- classmethod puerto_rico_data_50(year=2015)[source]
Extract 50 sites in PR for a given year to target h5.
- 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.