Skip to content

Commit a28d333

Browse files
committed
Merge branch 'develop' of https://github.com/MHKiT-Software/MHKiT-Python into lint-river
2 parents 7428eb1 + f6f7301 commit a28d333

File tree

5 files changed

+6
-85
lines changed

5 files changed

+6
-85
lines changed

mhkit/tidal/graphics.py

+3-16
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,6 @@
55
It includes tools for creating polar plots, velocity distributions, exceedance
66
probability charts, and current time-series plots.
77
8-
Features:
9-
---------
10-
- Generates **polar histograms** (current roses) of tidal flow directions and speeds.
11-
- Computes and visualizes **joint probability distributions** of velocity and direction.
12-
- Plots **time-series data** of tidal currents in a given principal direction.
13-
- Creates **exceedance probability** plots for ebb and flood conditions.
14-
- Supports **custom metadata annotations** (site name, latitude, longitude).
15-
16-
Functions:
17-
----------
18-
- `plot_rose`: Creates a polar histogram of flow directions and velocities.
19-
- `plot_joint_probability_distribution`: Generates a joint probability distribution.
20-
- `plot_current_timeseries`: Plots velocity time-series in the principal direction.
21-
- `tidal_phase_probability`: Analyzes probability of flow in flood or ebb phases.
22-
- `tidal_phase_exceedance`: Creates a stacked exceedance probability plot.
238
"""
249

2510
import bisect
@@ -222,7 +207,9 @@ def plot_rose(
222207
color=colors[vel_bin],
223208
label=labels[vel_bin],
224209
)
225-
r_offset += histogram[:, vel_bin] # Update in place
210+
r_offset += histogram[
211+
:, vel_bin
212+
] # Increase the radius offset in all directions
226213

227214
# Configure legend and ticks
228215
plt.legend(

mhkit/tidal/io/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
This module initializes the tidal I/O package, importing necessary submodules.
2+
The io submodule contains functions to load NOAA and Delft3D data.
33
"""
44

55
from mhkit.tidal.io import noaa

mhkit/tidal/io/noaa.py

-20
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,6 @@
66
Currents API (https://api.tidesandcurrents.noaa.gov/api/prod/). It supports
77
retrieving data in XML and JSON formats, converting it into a pandas DataFrame
88
or xarray Dataset, and saving it as a JSON file for future use.
9-
10-
Features:
11-
---------
12-
- Fetch NOAA current, tidal, and environmental data from the API.
13-
- Convert XML and JSON responses into structured pandas DataFrames.
14-
- Cache and retrieve previously requested data to optimize performance.
15-
- Save and load data from JSON files for offline access.
16-
17-
Functions:
18-
----------
19-
request_noaa_data(station, parameter, start_date, end_date, options=None):
20-
Fetches NOAA data from the API, converts it into a pandas DataFrame (or xarray Dataset),
21-
and caches the result. Supports proxy settings and JSON file export.
22-
23-
_xml_to_dataframe(response):
24-
Converts NOAA response data from XML format into a pandas DataFrame and extracts metadata.
25-
26-
read_noaa_json(filename, to_pandas=True):
27-
Reads a previously saved JSON file containing NOAA data and returns a pandas DataFrame
28-
(or xarray Dataset) with time-series data and metadata.
299
"""
3010

3111
import os

mhkit/tidal/performance.py

-24
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,6 @@
66
methods for calculating power curves, efficiency, velocity profiles, and
77
other metrics relevant to marine energy devices.
88
9-
Features:
10-
---------
11-
- Computes **power curves** and performance statistics for marine energy devices.
12-
- Evaluates **device efficiency** based on IEC/TS 62600-200 standards.
13-
- Analyzes **velocity profiles** using time-averaging and statistical functions.
14-
- Supports **circular and rectangular turbine profiles** for swept area calculations.
15-
- Processes **ADCP data** to derive meaningful hydrodynamic insights.
16-
17-
Functions:
18-
----------
19-
- `_slice_circular_capture_area`: Slices a circular capture area based on ADCP depth bins.
20-
- `_slice_rectangular_capture_area`: Slices a rectangular capture area based on ADCP depth bins.
21-
- `power_curve`: Computes power curve and power statistics for a marine energy device.
22-
- `_average_velocity_bins`: Averages velocity profiles into velocity bins.
23-
- `_apply_function`: Applies statistical functions (mean, RMS, std) to velocity data.
24-
- `velocity_profiles`: Computes velocity profiles for different statistical measures.
25-
- `device_efficiency`: Computes the efficiency (power coefficient) of a tidal energy device.
26-
- `_calculate_density`: Computes averaged water density for a given time period.
27-
28-
Usage:
29-
------
30-
This module is intended for use with ADCP data to evaluate the performance
31-
of marine energy devices based on IEC/TS 62600-200 standards. It is useful for
32-
hydrodynamic modeling, resource assessment, and marine energy system optimization.
339
"""
3410

3511
from typing import Union, Optional

mhkit/tidal/resource.py

+2-24
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,16 @@
44
principal flow directions, classifying ebb and flood cycles, and
55
computing probability distributions of flow velocities.
66
7-
Features:
8-
---------
9-
- Computes joint probability histograms of flow directions and velocities.
10-
- Determines principal flow directions using histogram-based analysis.
11-
- Classifies ebb and flood conditions based on directional data.
12-
- Normalizes flow angles for consistent analysis.
13-
14-
Functions:
15-
----------
16-
- `_histogram(directions, velocities, width_dir, width_vel)`:
17-
Computes a joint probability histogram of flow directions and velocities.
18-
19-
- `_normalize_angle(degree)`:
20-
Normalizes an angle to the range [0, 360] degrees.
21-
22-
- `principal_flow_directions(directions, width_dir)`:
23-
Determines principal flow directions for ebb and flood cycles
24-
using a histogram-based approach.
25-
26-
- `_flood_or_ebb(d, flood, ebb)`:
27-
Identifies whether a given set of flow directions corresponds to
28-
ebb or flood conditions.
297
"""
308

319
import math
3210
import numpy as np
33-
from mhkit.river.resource import exceedance_probability, froude_number
11+
from mhkit.river.resource import exceedance_probability, Froude_number
3412
from mhkit.utils import convert_to_dataarray
3513

3614
__all__ = [
3715
"exceedance_probability",
38-
"froude_number",
16+
"Froude_number",
3917
"principal_flow_directions",
4018
"_histogram",
4119
"_flood_or_ebb",

0 commit comments

Comments
 (0)