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

tmy update for meteosat 15min #64

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 15 additions & 11 deletions nsrdb/tmy/tmy.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,13 +855,16 @@ def source_freq(self):
with Handler(fpath) as f:
ti_len = len(f.time_index)

if (ti_len == 17520) | (ti_len == 17568):
freq = '30min'
elif (ti_len == 8760) | (ti_len == 8784):
freq = '1h'
if ti_len % 8760 == 0:
freq = f'{60 * 8760 // ti_len}min'
elif ti_len % 8784 == 0:
freq = f'{60 * 8784 // ti_len}min'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good although i think the most robust way to do this is calculate the forward-difference TimeDelta on the time index and then take the mode. I did this somewhere.... maybe in the cloud data handler? doesnt matter, what you have is fine.

else:
raise ValueError('Could not parse source temporal frequency '
'from time index length {}'.format(ti_len))
if freq == '60min':
freq = '1h'

return freq

def get_weighted_fs(self):
Expand Down Expand Up @@ -1172,12 +1175,13 @@ def _make_tmy_timeseries(self, dset, tmy_years, unscale=True):
self._tmy_years_long[masks[month], site] = \
tmy_years[(month - 1), site]

if len(data) > 8760:
data = data[1::2, :]
self._tmy_years_long = self._tmy_years_long[1::2, :]
if len(data) != 8760:
raise ValueError('TMY timeseries was not evaluated as an 8760! '
'Instead had final length {}.'.format(len(data)))
step = len(data) // 8760
msg = ('Original TMY timeseries is not divisible by 8760 '
f'length = {len(data)}.')
assert len(data) % 8760 == 0, msg

data = data[1::step, :]
self._tmy_years_long = self._tmy_years_long[1::step, :]

return data

Expand Down Expand Up @@ -1987,7 +1991,7 @@ def eagle_collect_all(cls, nsrdb_base_fp, years, out_dir,
(directory setup depends on having run eagle_all() first)."""

for fun_str in ('tmy', 'tgy', 'tdy'):
y = sorted(list(years))[-1]
y = sorted(years)[-1]
fun_out_dir = os.path.join(out_dir, '{}_{}/'.format(fun_str, y))
fun_fn_out = 'nsrdb_{}-{}.h5'.format(fun_str, y)
cls.eagle_collect(nsrdb_base_fp, years, fun_out_dir,
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ netCDF4>=1.5
matplotlib
NREL-cloud_fs>=0.0.8
NREL-farms>=1.0.5
NREL-reV>=0.5.16
NREL-reV<0.8.0
NREL-rest2>=1.0.1
scikit-learn>=1.0
scikit-learn>=1.0
Loading