Skip to content

Conversation

@akeeste
Copy link

@akeeste akeeste commented Oct 11, 2023

Minor changes from the review of MHKiT-Software#252:

  • minor linting
  • module docstring
  • update parameter validation

hivanov-nrel and others added 17 commits July 14, 2023 08:56
Create functions for a mooring module:

 read MoorDyn OUT file
 read MoorDyn input file
 calculate lay length
 create 3d animation
 create 2d animation
---------

Co-authored-by: ssolson <[email protected]>
* Prevent nan values for zero-frequency component in spectrum

Previously providing a zero frequency when creating a spectrum (JONSWAP or Pierson Moskowitz) produced a NaN value. This is due the f^-5 and f^-4 terms in the calculation.

The zero frequency is a valid input and is important when calculating the surface elevation from the spectrum. We know, however, that the zero frequency should __always__ have zero amplitude as the surface elevation has a mean of zero.

This change ensures that if a zero frequency is provided, the amplitude is set to zero.

* Compute surface elevation using IFFT

Previously the surface elevation was only computed using the 'sum of sines' method. This has been found to be prohibitively slow when computing long duration surface elevation traces.

This commit introduces the capability to compute the surface elevation using the more computationally efficient IFFT. The IFFT routine is used by default if no frequency bins are provided and the input frequency vector is equally spaced.

For example a 1hr sea state realisation at 20Hz took 11s to compute using the 'sum of sines' and 0.007s using the IFFT.

Fixes MHKiT-Software#229

* add docstrings to surface_elevation

* update surface_elevation calls in examples

---------

Co-authored-by: akeeste <[email protected]>
A slew of bugfixes and inconsistency cleanup, as well as including ADCP turbulence functionality for MHKiT-Software#227

Changelog:

Bugfixes

Added check to ensure n_bin is shorter than the total data length when calling dolfyn.TimeBinner.reshape
Added checks to ensure n_fft and n_fft_coh can't be greater than n_bin
Fixed bug where dolfyn.adp.nan_beyond_surface overtrimmed TRDI instrument data
Fixed bug where dolfyn.ADVBinner.cross_spectral_density would fail if n_fft != n_fft_coh
Improved robustness of Nortek Signature reader for deployments not measuring water velocity
log file extension changed from ".log" to ".dolfyn.log"
API/Useability

Calculation of depth from pressure sensor updated to use linear approximation of the equation of state, rather than EOS-80
Added warnings for ADV motion and turbulence functions
Updated dataset.velds.U_dir shortcut to automatically convert "degrees CCW from X/East/streamwise" to "degrees CW from X/North/streamwise"
dolfyn.ADVBinner.cross_spectral_density now returns frequency coordinate coh_freq instead of freq
Added ADCP turbulence functions
Added function to calculate Doppler noise to ADV turbulence functions
Added "beam_angle" attribute to Nortek Signature datasets
Saved full Nortek Signature "config" dictionary as json string in attributes
Added warning if "rotate_vars" attribute not found
Standardized variable metadata based on CF conventions
Tidal power performance capabilities specified in IEC/TS 6200-200.

Also includes bugfixes, docstring clarifications, and useability edits for the Tidal module in general that I came across from a users standpoint. Changelog as follows:

Bugfixes:
- Standardized function inputs to accept both numpy.ndarrays and pandas.Series (some functions already have this implemented).
- Fixed assertions so that if a numpy array is supplied, the following assertions that rely on pandas don't fail (some functions already have this implemented).
- Added a (temporary) fix so that assertions can handle nans
- Fixed river.performance capture area calculation the multiplies by instead of dividing by 4.
- Fixed a misnamed variable in tidal.performance.principal_flow_directions.
- Corrected the "Returns" statement in the tidal.performance.principal_flow_directions docstring and added a "Notes" section.

API/useability
- Added 'ax' argument passthrough to tidal.graphics.plot_rose and tidal.graphics.plot_joint_prob_distribution to enable more complex matplotlib capabilities outside of the function.
- Added check and updated docstring in tidal.performance.principal_flow_directions to make sure directions are between 0 and 360 degrees, which the function requires.
* Added release to pypi github actions workflow

* Fix badges on pypi

* Fix README broken link
**MHKiT 0.7.0 Release Notes**

This release introduces exciting new features and improvements to the MHKiT package:

- **Mooring Module**: We are pleased to introduce the new mooring module. This addition primarily supports outputs from MoorDyn. Within this module, users can:
  - Import data
  - Calculate lay length
  - Visualize mooring line movements in 2D and 3D with graphical animations.
  
  Accompanying this module is an example notebook to guide users on its functionalities.

- **Dolfyn Module Revamp**: The Dolfyn module has been overhauled. Enhancements include:
  - Turbulence calculation capability
  - Performance measures for tidal power as outlined in IEC/TS 6200-200.

- **New Contributions**: A big shoutout to our community member, @mbruggs, for adding the ability to compute surface elevation using IFFT.

- **NDBC Buoy Metadata**: Users can now fetch NDBC buoy metadata directly through MHKiT.

- **Delft3D Module Update**: Stay up to date with support for the latest Delft3D NetCDF format.

**Additions**
- MHKiT-Software#235
- MHKiT-Software#232 
- MHKiT-Software#236 
- MHKiT-Software#250
- MHKiT-Software#239
- MHKiT-Software#248

**Bug Fixes**
- MHKiT-Software#226 
- MHKiT-Software#238

**Meta/Minor Changes**
- MHKiT-Software#220
- MHKiT-Software#243
- MHKiT-Software#225 
- MHKiT-Software#231
- MHKiT-Software#224

Thank you to all of the contributers who helpped with this release:
@mbruggs @Graham-EGI @castillocesar @jmcvey3 @hivanov-nrel  @browniea @cmichelenstrofer @akeeste  @maxwelllevin @rpauly18 @ssolson
* hardcode long description

* kebab-cased repository-url

* long description is md
* update mhkit package version
* docstring fixes 1

* docstring fixes 2

* docstring fixes 3
* docstring fixes 1

* docstring fixes 2

* docstring fixes 3
Use caching by default & reduce testing time
Copy link
Owner

@mbruggs mbruggs left a comment

Choose a reason for hiding this comment

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

Thanks for making these changes, Adam. Just a minor comment about the docstring.

Comment on lines 19 to 37
- `custom`: Fetches specified wind data parameters for given
latitude-longitude points and years from the WIND Toolkit hindcast dataset.
Supports caching for faster repeated data retrieval.
Dependencies:
-------------
- rex: Library to handle renewable energy datasets.
- pandas: Data manipulation and analysis.
- os, hashlib, pickle: Used for caching functionality.
- matplotlib: Used for plotting.
Notes:
------
- To access the WIND Toolkit hindcast data, users need to configure `h5pyd`
for data access on HSDS (see the WTK_hindcast_example notebook for more details).
- While some functions perform basic checks (e.g., verifying that latitude
and longitude are within a predefined region), it's essential to understand
the boundaries of each region and the available parameters and elevations in the dataset.
Copy link
Owner

Choose a reason for hiding this comment

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

Some of these comments don't appear relevant to this module (eg references to configuring h5pyd), just checking that we want to keep them here?

)

* run hindcast only on change

* always run hindcast on changes to master
@akeeste
Copy link
Author

akeeste commented Oct 16, 2023

@mbruggs Oops thanks for catching that. I copied the formatting from another module and forgot to remove all the extraneous items. I'll make that change when I update the location later this week.

@akeeste
Copy link
Author

akeeste commented Oct 18, 2023

@mbruggs I removed the extraneous doc string, moved the module into utils, and updated the places that upcrossing is imported. Let me know if you have any other suggestions.

The files changed increased drastically because I pulled in develop so that I could edit the updated utils module. Those changes should not appear in the original MHKiT-Software#252

I'm ready to merge this, confirm things look good in MHKiT-Software#252, then merge that. Thanks!

@akeeste akeeste merged commit 4427863 into mbruggs:up-crossing-analysis Oct 30, 2023
@akeeste akeeste deleted the up-crossing-analysis branch October 30, 2023 20:48
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.

6 participants