Skip to content

energy calc & years param mod#205

Open
sameersk2k wants to merge 2 commits intodevelopfrom
add-energy-calc-endpoints
Open

energy calc & years param mod#205
sameersk2k wants to merge 2 commits intodevelopfrom
add-energy-calc-endpoints

Conversation

@sameersk2k
Copy link
Collaborator

  • added year_range and year_set params in the both timeseries endpoints.
  • added timeseries/energy endpoint for csv downloads
  • both timeseries endpoints support "monthly" and "hourly" period

@sameersk2k sameersk2k requested a review from RLiNREL February 6, 2026 00:04

if start_year > end_year:
raise ValueError(f"Invalid range: Start year ({start_year}) cannot be greater than end year ({end_year}).")

Copy link
Collaborator

Choose a reason for hiding this comment

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

also, need to validate to the available range in the MODEL_CONFIG to make sure the range is not out of bound

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the range validation after this validation is handled in timeseries_core
years = [validate_year(year, model) for year in resolved_years]

resolved_years = list(range(start_year, end_year + 1))
elif year_set:
resolved_years = MODEL_CONFIG[model]["years"].get(year_set, [])
if not resolved_years:
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's add a validation method in validation.py and call it here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will this new validation method take all years type params and return resolved_years finally?

df_with_energy, _ = power_curve_manager.compute_energy_production_df(
df, heights, powercurve, model, relevant_columns_only=False
)
df_with_energy = df_with_energy.rename(columns= lambda x: x.replace("_kw", "_kwh") if x.startswith('windspeed') and x.endswith('_kw') else x)
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. can the renaming be taken care of in the .compute_energy_production_df()?
  2. should the column be 'energy_kwh' instead of 'windspeed_kwh'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes good idea i should handle both in the powercurve manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants