MHKiT-Software / MHKiT-Python

MHKiT-Python provides the marine renewable energy (MRE) community tools for data processing, visualization, quality control, resource assessment, and device performance.
https://mhkit-software.github.io/MHKiT/
BSD 3-Clause "New" or "Revised" License
47 stars 45 forks source link

Wave performance `mean_annual_energy_production_matrix` has no test & is incompatible with example #339

Open ssolson opened 3 days ago

ssolson commented 3 days ago

In the wave_example.ipynb Input box [15] calls:

# Calcaulte maep from matrix
maep_matrix = wave.performance.mean_annual_energy_production_matrix(
    LM_mean, JM, LM_freq
)

In MHKiT v0.8.1 this will fail because mean_annual_energy_production_matrix is not setup to handle 2D DataFrames. Additionally the check:

    if not np.abs(frequency.sum() - 1) < 1e-6:
        raise ValueError("Frequency components must sum to one.")

was added but does not work for this LM_freq matrix provided.

@akeeste could you add a test for this function and determine why the example LM_freq does not pass this check which was previously commented out.

https://github.com/MHKiT-Software/MHKiT-Python/blob/a07ecc427ab924e32f8a2305d4be7193e5125614/mhkit/wave/performance.py#L258

For #330 I will calculate manually and leave the MHKiT function call commented out.