Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gb/solar module #92

Merged
merged 23 commits into from
Sep 16, 2022
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3967370
started test setup for solar module
grantbuster Sep 13, 2022
14a2dd6
added two weeks of cleasky data for nsrdb solar tests
grantbuster Sep 13, 2022
624224c
added farms requirement for solar module
grantbuster Sep 13, 2022
d46f7b1
added basic solar module that will take clearsky ratio GAN outputs an…
grantbuster Sep 13, 2022
7b1ad5e
added solar irrad output handling
grantbuster Sep 13, 2022
69e1431
more tests
grantbuster Sep 13, 2022
d0b57e0
added get_node_cmd for solar module
grantbuster Sep 13, 2022
15d06ca
added solar file parser with test
grantbuster Sep 13, 2022
3569890
added cli
grantbuster Sep 13, 2022
62ff8aa
finished solar cli with tests
grantbuster Sep 13, 2022
88b2597
fixed up tests
grantbuster Sep 13, 2022
d9b96fe
added solar cli to the main cli and pipeline
grantbuster Sep 13, 2022
b23230e
moved i_t_chunks to optional arg and enabled the solar class method e…
grantbuster Sep 13, 2022
d306db3
fixed node count logic
grantbuster Sep 13, 2022
5e92b11
fixed a stupid assumption that the nsrdb time index would always have…
grantbuster Sep 13, 2022
d973a75
changed i_t_chunk arg -> temporal_id which makes a lot more sense
grantbuster Sep 14, 2022
d785fc1
logging updates
grantbuster Sep 14, 2022
883a77f
linter fixes
grantbuster Sep 14, 2022
2fb8630
added new rex version requirement for sup3r solar multitimeresource i…
grantbuster Sep 14, 2022
0476f26
added the option for the user to specify qa datsets with mapping from…
grantbuster Sep 14, 2022
b99c42a
fixed qa features as list
grantbuster Sep 14, 2022
2833f0f
CC-based clearsky ratio should be set with ceiling not scaled to the …
grantbuster Sep 15, 2022
ca33492
moved solar test utilities
grantbuster Sep 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added the option for the user to specify qa datsets with mapping from…
… sup3r output to source alias name
  • Loading branch information
grantbuster committed Sep 15, 2022
commit 0476f26cbc4d30730550586e2a980bad50fe6658
37 changes: 29 additions & 8 deletions sup3r/qa/qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Sup3rQa:

def __init__(self, source_file_paths, out_file_path, s_enhance, t_enhance,
temporal_coarsening_method,
features=None,
temporal_slice=slice(None),
target=None,
shape=None,
Expand Down Expand Up @@ -63,6 +64,11 @@ def __init__(self, source_file_paths, out_file_path, s_enhance, t_enhance,
Subsample will take every t_enhance-th time step, average will
average over t_enhance time steps, total will sum over t_enhance
time steps
features : list | dict | None
Explicit list of features to validate. Can be a list of string
feature names, a dictionary mapping the sup3r output feature name
to the source_handler feature name (e.g. {'ghi': 'rsds'}), or None
for all features found in the out_file_path.
temporal_slice : slice | tuple | list
Slice defining size of full temporal domain. e.g. If we have 5
files each with 5 time steps then temporal_slice = slice(None) will
Expand Down Expand Up @@ -134,14 +140,15 @@ def __init__(self, source_file_paths, out_file_path, s_enhance, t_enhance,
self.t_enhance = t_enhance
self._t_meth = temporal_coarsening_method
self._out_fp = out_file_path
self._features = features
self.qa_fp = qa_fp
self.save_sources = save_sources
self.output_handler = self.output_handler_class(self._out_fp)

HandlerClass = get_input_handler_class(source_file_paths,
input_handler)
self.source_handler = HandlerClass(source_file_paths,
self.features,
self.source_features,
target=target,
shape=shape,
temporal_slice=temporal_slice,
Expand All @@ -160,7 +167,6 @@ def __enter__(self):

def __exit__(self, type, value, traceback):
self.close()

if type is not None:
raise

Expand Down Expand Up @@ -206,19 +212,34 @@ def features(self):
-------
list
"""

# all lower case
ignore = ('meta', 'time_index', 'times', 'xlat', 'xlong')

if self.output_type == 'nc':
features = list(self.output_handler.variables.keys())
elif self.output_type == 'h5':
features = self.output_handler.dsets
if self._features is None:
if self.output_type == 'nc':
features = list(self.output_handler.variables.keys())
elif self.output_type == 'h5':
features = self.output_handler.dsets
features = [f for f in features if f.lower() not in ignore]

features = [f for f in features if f.lower() not in ignore]
elif isinstance(self._features, dict):
features = sorted(self._features.keys())

return features

@property
def source_features(self):
"""Get a list of feature names from the source input file, excluding
meta and time index datasets. This property considers the features
input mapping if a dictionary was provided, e.g. if
features={'ghi': 'rsds'}, this property will return ['rsds']"""
if isinstance(self._features, dict):
source_features = [self._features[f] for f in self.features]
else:
source_features = self.features

return source_features

@property
def output_type(self):
"""Get output data type
Expand Down