nsrdb.utilities.extract_nsrdb_data.ExtractValidationData

class ExtractValidationData(target, source)[source]

Bases: ExtractNSRDB

Extraction utilities for NSRDB validation ground-measurement sites.

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_map(dset[, time_index, sort])

Extract a lat-lon-data csv for one timestep and all sites for mapping applications.

extract_sites()

Extract validation data to target h5.

filter_meta(values, label)

Return a meta df filtered where the label is equal to the value.

meta_to_disk()

Retrieve the NSRDB meta data and save to csv.

save_meta(target[, source])

Save the meta data for the validation ground-measurement sites.

Attributes

COORDS

IGNORE_LIST

meta

Get the NSRDB meta data as a DataFrame.

classmethod save_meta(target, source='/projects/PXS/nsrdb/v3.0.1/nsrdb_2017.h5')[source]

Save the meta data for the validation ground-measurement sites.

extract_sites()[source]

Extract validation data 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.

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.