Skip to content

Commit

Permalink
Merge branch 'master' of github.com:reegis/reegis
Browse files Browse the repository at this point in the history
  • Loading branch information
uvchik committed Feb 4, 2021
2 parents b95c38f + 87e038c commit 9bcf19e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__='0.2.0-dev'
__version__='0.2.1dev'
22 changes: 13 additions & 9 deletions reegis/coastdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ def fetch_coastdat_weather(year, coastdat_id):
Examples
--------
>>> coastdt_id=fetch_id_by_coordinates(53.655119, 11.181475)
>>> fetch_coastdat_weather(2014, coastdt_id)['v_wind'].mean().round(2)
>>> coastdat_id=fetch_id_by_coordinates(53.655119, 11.181475)
>>> fetch_coastdat_weather(2014, coastdat_id)['v_wind'].mean().round(2)
4.39
"""
weather_file_name = os.path.join(
Expand Down Expand Up @@ -274,9 +274,9 @@ def adapt_coastdat_weather_to_windpowerlib(weather, data_height):
--------
>>> cd_id=1132101
>>> cd_weather=fetch_coastdat_weather(2014, cd_id)
>>> data_hght=cfg.get_dict('coastdat_data_height')
>>> data_height=cfg.get_dict('coastdat_data_height')
>>> wind_weather=adapt_coastdat_weather_to_windpowerlib(
... cd_weather, data_hght)
... cd_weather, data_height)
>>> cd_weather.columns.nlevels
1
>>> wind_weather.columns.nlevels
Expand Down Expand Up @@ -396,7 +396,11 @@ def normalised_feedin_for_each_data_set(
# Loop over all regions
for coastdat_key in coastdat_keys:
# Get weather data set for one location
local_weather = weather[coastdat_key]
# Reset frequency because there are problems with the frequency in
# hdf5-files that were stored with an older pandas version.
local_weather = weather[coastdat_key].asfreq(
weather[coastdat_key].index.freq.rule_code
)

# Adapt the coastdat weather format to the needs of pvlib.
# The expression "len(list(hdf['solar'].keys()))" returns the number
Expand Down Expand Up @@ -672,14 +676,14 @@ def spatial_average_weather(
key = "A" + str(cid)
else:
key = cid
tmp[cid] = weather[key][parameter]
tmp[cid] = tmp[cid].asfreq("H")
wkp = weather[key][parameter]
wkp = wkp.asfreq("H")
tmp[cid] = wkp
tmp[cid].asfreq("H")
if len(cd_ids) < 1:
key = "A" + str(fix[region])
avg_value[region] = weather[key][parameter]
avg_value[region] = avg_value[region].asfreq("H")
else:
tmp = tmp.asfreq("H")
avg_value[region] = tmp.sum(1).div(number_of_sets)
weather.close()

Expand Down
5 changes: 4 additions & 1 deletion reegis/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ def get(section, key):
def get_list(section, parameter, sep=",", string=False):
"""Returns the values (separated by sep) of a given key in a given
section as a list.
string : boolean
Force all values to strings if set True.
"""
try:
my_list = get(section, parameter).split(sep)
my_list = [x.strip() for x in my_list]
my_list = [x.strip() for x in my_list if len(x) > 0]

except AttributeError:
if string is True:
Expand Down
2 changes: 1 addition & 1 deletion reegis/energy_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_de_balance(year):
head = pd.read_csv(fn_h, header=[0]).columns

df = pd.read_excel(fn_de, "tj", index_col=[0], skiprows=6)
df.columns = head[1:]
df.dropna(thresh=50, axis=1, inplace=True)
return df


Expand Down

0 comments on commit 9bcf19e

Please sign in to comment.