Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ssolson committed Aug 30, 2023
2 parents 2a26885 + 3e66f8f commit 8967b48
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 58 deletions.
4 changes: 2 additions & 2 deletions mhkit/dolfyn/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def epoch2date(ep_time, offset_hr=0, to_str=False):
Notes
-----
The specific time instance is set during deployment, usually sync'd to the
deployment computer. The time seen by |dlfn| is in the timezone of the
deployment computer, which is unknown to |dlfn|.
deployment computer. The time seen by DOLfYN is in the timezone of the
deployment computer, which is unknown to DOLfYN.
"""

try:
Expand Down
18 changes: 9 additions & 9 deletions mhkit/river/io/d3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,26 +532,26 @@ def turbulent_intensity(data, points='cells', time_index= -1,
Parameters
----------
data: NetCDF4 object
data : NetCDF4 object
A NetCDF4 object that contains spatial data, e.g. velocity or shear
stress, generated by running a Delft3D model.
points: string, DataFrame
points : string, DataFrame
Points to interpolate data onto.
'cells': interpolates all data onto velocity coordinate system (Default).
'faces': interpolates all data onto the TKE coordinate system.
DataFrame of x, y, and z coordinates: Interpolates data onto user
provided points.
time_index: int
'cells': interpolates all data onto velocity coordinate system (Default).
'faces': interpolates all data onto the TKE coordinate system.
DataFrame of x, y, and z coordinates: Interpolates data onto user
provided points.
time_index : int
An integer to pull the time step from the dataset. Default is
late time step -1.
intermediate_values: boolean (optional)
intermediate_values : boolean (optional)
If false the function will return position and turbulent intensity values.
If true the function will return position(x,y,z) and values need to calculate
turbulent intensity (ucx, uxy, uxz and turkin1) in a Dataframe. Default False.
Returns
-------
TI_data: Dataframe
TI_data : Dataframe
If intermediate_values is true all values are output.
If intermediate_values is equal to false only turbulent_intesity and
x, y, and z variables are output.
Expand Down
4 changes: 2 additions & 2 deletions mhkit/tidal/io/noaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def request_noaa_data(station, parameter, start_date, end_date,
end_date : str
End date in the format yyyyMMdd
proxy : dict or None
To request data from behind a firewall, define a dictionary of proxy settings,
for example {"http": 'localhost:8080'}
To request data from behind a firewall, define a dictionary of proxy settings,
for example {"http": 'localhost:8080'}
write_json : str or None
Name of json file to write data
Expand Down
2 changes: 1 addition & 1 deletion mhkit/wave/contours.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def environmental_contours(x1, x2, sea_state_duration, return_period,
-------
copulas: Dictionary
Dictionary of x1 and x2 copula components for each copula method
"""
"""
try:
x1 = np.array(x1)
except:
Expand Down
44 changes: 25 additions & 19 deletions mhkit/wave/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,48 +128,52 @@ def plot_matrix(

def plot_chakrabarti(H, lambda_w, D, ax=None):
"""
Plots, in the style of Chakrabart (2005), relative importance of viscous,
Plots, in the style of Chakrabarti (2005), relative importance of viscous,
inertia, and diffraction phemonena
Chakrabarti, Subrata. Handbook of Offshore Engineering (2-volume set).
Elsevier, 2005.
Parameters
----------
H: float or numpy array or pandas Series
Wave height [m]
lambda_w: float or numpy array or pandas Series
Wave length [m]
D: float or numpy array or pandas Series
Characteristic length [m]
ax : matplotlib axes object (optional)
Axes for plotting. If None, then a new figure is created.
Returns
-------
ax : matplotlib pyplot axes
Examples:
Examples
--------
**Using floats**
>>> plt.figure()
>>> D = 5
>>> H = 8
>>> lambda_w = 200
>>> wave.graphics.plot_chakrabarti(H, lambda_w, D)
**Using numpy array**
>>> plt.figure()
>>> D = np.linspace(5,15,5)
>>> H = 8*np.ones_like(D)
>>> lambda_w = 200*np.ones_like(D)
>>> wave.graphics.plot_chakrabarti(H, lambda_w, D)
**Using pandas DataFrame**
>>> plt.figure()
>>> D = np.linspace(5,15,5)
>>> H = 8*np.ones_like(D)
>>> lambda_w = 200*np.ones_like(D)
>>> df = pd.DataFrame([H.flatten(),lambda_w.flatten(),D.flatten()], \
index=['H','lambda_w','D']).transpose()
>>> df = pd.DataFrame([H.flatten(),lambda_w.flatten(),D.flatten()], index=['H','lambda_w','D']).transpose()
>>> wave.graphics.plot_chakrabarti(df.H, df.lambda_w, df.D)
Parameters
----------
H: float or numpy array or pandas Series
Wave height [m]
lambda_w: float or numpy array or pandas Series
Wave length [m]
D: float or numpy array or pandas Series
Characteristic length [m]
ax : matplotlib axes object (optional)
Axes for plotting. If None, then a new figure is created.
Returns
-------
ax : matplotlib pyplot axes
"""
assert isinstance(H, (np.ndarray, float, int, np.int64,pd.Series)), \
'H must be a real numeric type'
Expand Down Expand Up @@ -305,6 +309,7 @@ def plot_environmental_contour(x1, x2, x1_contour, x2_contour, **kwargs):
'''
Plots an overlay of the x1 and x2 variables to the calculate
environmental contours.
Parameters
----------
x1: numpy array
Expand All @@ -331,6 +336,7 @@ def plot_environmental_contour(x1, x2, x1_contour, x2_contour, **kwargs):
Default None.
markers: string
string or list of strings to use as marker types
Returns
-------
ax : matplotlib pyplot axes
Expand Down
38 changes: 19 additions & 19 deletions mhkit/wave/io/hindcast/hindcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
spectrum data.
Functions:
- region_selection(lat_lon): Returns the name of the predefined region for
given latitude and longitude coordinates.
- request_wpto_point_data(data_type, parameter, lat_lon, years, tree=None,
unscale=True, str_decode=True, hsds=True): Returns data from the WPTO wave
hindcast hosted on AWS at the specified latitude and longitude point(s) for
the requested data type, parameter, and years.
- request_wpto_directional_spectrum(lat_lon, year, tree=None, unscale=True,
str_decode=True, hsds=True): Returns directional spectra data from the WPTO
wave hindcast hosted on AWS at the specified latitude and longitude point(s)
for the given year.
- region_selection(lat_lon): Returns the name of the predefined region for
given latitude and longitude coordinates.
- request_wpto_point_data(data_type, parameter, lat_lon, years, tree=None,
unscale=True, str_decode=True, hsds=True): Returns data from the WPTO wave
hindcast hosted on AWS at the specified latitude and longitude point(s) for
the requested data type, parameter, and years.
- request_wpto_directional_spectrum(lat_lon, year, tree=None, unscale=True,
str_decode=True, hsds=True): Returns directional spectra data from the WPTO
wave hindcast hosted on AWS at the specified latitude and longitude point(s)
for the given year.
Dependencies:
- sys
- time.sleep
- pandas
- xarray
- numpy
- rex.MultiYearWaveX, rex.WaveX
- sys
- time.sleep
- pandas
- xarray
- numpy
- rex.MultiYearWaveX, rex.WaveX
"""
import sys
from time import sleep
Expand Down Expand Up @@ -113,7 +113,7 @@ def request_wpto_point_data(
data_type : string
Data set type of interest
Options: '3-hour' '1-hour'
parameter: string or list of strings
parameter : string or list of strings
Dataset parameter to be downloaded
3-hour dataset options: 'directionality_coefficient',
'energy_period', 'maximum_energy_direction'
Expand All @@ -127,7 +127,7 @@ def request_wpto_point_data(
'significant_wave_height', 'spectral_width',
'water_depth', 'maximim_energy_direction',
'mean_wave_direction', 'frequency_bin_edges'
lat_lon: tuple or list of tuples
lat_lon : tuple or list of tuples
Latitude longitude pairs at which to extract data
years : list
Year(s) to be accessed. The years 1979-2010 available.
Expand All @@ -149,7 +149,7 @@ def request_wpto_point_data(
path : string (optional)
Optionally override with a custom .h5 filepath. Useful when setting
`hsds=False`.
as_xarray: bool (optional)
as_xarray : bool (optional)
Boolean flag to return data as an xarray Dataset. Default = False
Returns
Expand Down
4 changes: 2 additions & 2 deletions mhkit/wave/io/hindcast/wind_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def request_wtk_point_data(time_interval, parameter, lat_lon, years, preferred_r
time_interval : string
Data set type of interest
Options: '1-hour' '5-minute'
parameter: string or list of strings
parameter : string or list of strings
Dataset parameter to be downloaded. Other parameters may be available.
This list is limited to those available at both 5-minute and 1-hour
time intervals for all regions.
Expand All @@ -176,7 +176,7 @@ def request_wtk_point_data(time_interval, parameter, lat_lon, years, preferred_r
'windspeed_60m', 'windspeed_80m', 'windspeed_100m',
'windspeed_120m', 'windspeed_140m', 'windspeed_160m',
'windspeed_180m', 'windspeed_200m'
lat_lon: tuple or list of tuples
lat_lon : tuple or list of tuples
Latitude longitude pairs at which to extract data. Use plot_region() or
region_selection() to see the corresponding region for a given location.
years : list
Expand Down
6 changes: 3 additions & 3 deletions mhkit/wave/io/ndbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ def available_data(parameter, buoy_number=None, proxy=None):
'swr1': 'Spectral Wave Current Year Historical Data (r1)'
'swr2': 'Spectral Wave Current Year Historical Data (r2)'
'stdmet': 'Standard Meteorological Current Year Historical Data'
'cwind' : 'Continuous Winds Current Year Historical Data'
'cwind' : 'Continuous Winds Current Year Historical Data'
buoy_number: string (optional)
Buoy Number. 5-character alpha-numeric station identifier
Buoy Number. 5-character alpha-numeric station identifier
proxy: dict
Proxy dict passed to python requests,
Proxy dict passed to python requests,
(e.g. proxy_dict= {"http": 'http:wwwproxy.yourProxy:80/'})
Returns
Expand Down
2 changes: 1 addition & 1 deletion mhkit/wave/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def energy_period_to_peak_period(Te, gamma):
and Recommendations to the 23rd ITTC", Proceedings of the 23rd ITTC - Volume
2, Table A4.
Parameters:
Parameters
----------
Te: float or array
Spectral energy period [s]
Expand Down

0 comments on commit 8967b48

Please sign in to comment.