NatLabRockies / NatLabRockies/rdtools
Error in using - rdtools.degradation_year_on_year - function
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 189
- Forks
- 82
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to calculate the performance loss rate of a vertically installed PV module using the function rdtools.degradation_year_on_year.
However, the following error displays every time I run the function.
ValueError: Cannot convert from timedelta64[ns] to timedelta64[h]. Supported resolutions are 's', 'ms', 'us', 'ns'.
Here is what I'm doing:
daily['Timestamp'] = daily.index
daily['Timestamp'] = daily['Timestamp'].dt.to_timestamp() # From period(D) to DateTime
daily = daily.set_index(daily['Timestamp'])
daily = daily.rename(columns = {'PR [%]': 'PR'})
MPR = daily.PR
MPR.index = daily.index
yoy_rd, yoy_ci, yoy_info = rdtools.degradation_year_on_year(MPR, confidence_level=95)
Where, daily.info()
DatetimeIndex: 1147 entries, 2020-02-27 to 2023-04-18
Data columns (total 6 columns):
Column Non-Null Count Dtype
0 H [Wh/m2] 954 non-null float64
1 Em [Wh] 954 non-null float64
2 Em_Tcorr [Wh] 954 non-null float64
3 PR 954 non-null float64
4 PR_Tcorr [%] 954 non-null float64
5 Timestamp 1147 non-null datetime64[ns]
dtypes: datetime64ns, float64(5)
memory usage: 62.7 KB
I tried to convert datetime64[ns] to datetime64[h] before running the function, but there seems to be no way to do this in python.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied call to rdtools.degradation_year_on_year with the provided MPR series and inspect how the function handles the DatetimeIndex and timedelta conversion. Trace the source of the ValueError and verify that the calculation completes for this input without requiring an unsupported datetime resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- analytics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100