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

Address SAM issue 289 - ignore leap years in timeseries axis #179

Merged
merged 6 commits into from
Nov 8, 2024

Conversation

sjanzou
Copy link
Collaborator

@sjanzou sjanzou commented Nov 6, 2024

Please test with lifetime, single year, hourly and sub-hourly files.

Please test for Feb 29 in out years as described in NREL/SAM#289

Please test transitions between years (Dec to Jan) at various zoom levels.

Test file - detailed PV residential here
SAM_289.zip

@sjanzou sjanzou self-assigned this Nov 6, 2024
@sjanzou sjanzou linked an issue Nov 6, 2024 that may be closed by this pull request
Copy link
Collaborator

@mjprilliman mjprilliman left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for figuring this out! A few side effects of this:

With this change, 'Heat map' now has an extra Jan label at the end of the monthly timeseries:

image

I managed to crash SAM when clicking and zooming around in the white space beyond the last data point, but I can't replicate it. This behavior is the same as before, so maybe it was just a fluke. Is that white space beyond the last data point required?

image

On the Solar Resource 'View data' Dview pop-up, on the Daily tab, scrolling to the end and clicking the right arrow at the end of the annual timeseries seems to cut it off at Dec 30, rather than 31st:

image

There is also strange behavior on the 'Monthly' tab, but this happens in the release as well. Do we need three tabs for this data viewer, or would it be possible to disable the zoom for daily and monthly?


// to skip leap years (SAM issue 289) - scale to first year
int m_min_offset = m_min / 8760;
double m_min_scaled = (double)((int)m_min % 8760); // m_min and m_max always based on 8760 (365 days with no leap years)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Likely a different issue, but there's hopes to actually handle leap days in the calculations this year. This would likely require an additional flag to this function to scale to 8784 if a leap year is detected, and base each year on a leap year instead (8784 * timesteps_per_hour * nyears).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Likely a different issue, but there's hopes to actually handle leap days in the calculations this year. This would likely require an additional flag to this function to scale to 8784 if a leap year is detected, and base each year on a leap year instead (8784 * timesteps_per_hour * nyears).

Good catch and way to use existing code. If we do leap years, we can probably assign a base year and then use the full wxDateTime class to handle as it was designed.

@cpaulgilman
Copy link
Collaborator

There is also strange behavior on the 'Monthly' tab, but this happens in the release as well. Do we need three tabs for this data viewer, or would it be possible to disable the zoom for daily and monthly?

I think we need zoom on the Daily and Monthly tabs for lifetime datasets so you can zoom in to a single year at a time. Daily and monthly averages are useful for some analysis.

@sjanzou
Copy link
Collaborator Author

sjanzou commented Nov 7, 2024

Looks good, thanks for figuring this out! A few side effects of this:

With this change, 'Heat map' now has an extra Jan label at the end of the monthly timeseries:

image

I managed to crash SAM when clicking and zooming around in the white space beyond the last data point, but I can't replicate it. This behavior is the same as before, so maybe it was just a fluke. Is that white space beyond the last data point required?

image

On the Solar Resource 'View data' Dview pop-up, on the Daily tab, scrolling to the end and clicking the right arrow at the end of the annual timeseries seems to cut it off at Dec 30, rather than 31st:

image

There is also strange behavior on the 'Monthly' tab, but this happens in the release as well. Do we need three tabs for this data viewer, or would it be possible to disable the zoom for daily and monthly?

@mjprilliman, thanks for the detailed review. With the latest commit, I think all issues have been addressed with the following comments:

Heat map no longer has extra Jan at end of lifetime data
image

The extra white space beyond the last data point is required for last tick mark of axis on a day boundary.

With the latest update, all the weather files I tested had Dec 31
image

The monthly tab is acting a little weird (Jan and Dec half lengths)
image

because the data is in the middle of each month
image

Another issue we can create from here is when switching from lifetime to hourly data in timeseries or heat maps, if the lifetime data is scrolled beyond the first year, then the hourly data is blank and can be recaptured using zoom to fit:
image

switch to hourly load data
image

click zoom fit
image

@sjanzou sjanzou requested a review from mjprilliman November 7, 2024 11:19
Copy link
Collaborator

@mjprilliman mjprilliman left a comment

Choose a reason for hiding this comment

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

I think everything works as intended, and looks good in the display. Thanks for fixing this!

src/plot/plaxis.cpp Outdated Show resolved Hide resolved
src/plot/plaxis.cpp Outdated Show resolved Hide resolved
@sjanzou sjanzou merged commit a6795da into develop Nov 8, 2024
8 checks passed
@sjanzou sjanzou deleted the SAM_289 branch November 8, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DView 5-minute lifetime outputs last day is not Dec 31
3 participants