diff --git a/mhkit/dolfyn/time.py b/mhkit/dolfyn/time.py index 96ff1bc3c..576c395d1 100644 --- a/mhkit/dolfyn/time.py +++ b/mhkit/dolfyn/time.py @@ -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: diff --git a/mhkit/river/io/d3d.py b/mhkit/river/io/d3d.py index 0620b2377..d4db2e266 100644 --- a/mhkit/river/io/d3d.py +++ b/mhkit/river/io/d3d.py @@ -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. diff --git a/mhkit/tidal/io/noaa.py b/mhkit/tidal/io/noaa.py index 17a1ae234..4c261fb43 100644 --- a/mhkit/tidal/io/noaa.py +++ b/mhkit/tidal/io/noaa.py @@ -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 diff --git a/mhkit/wave/contours.py b/mhkit/wave/contours.py index 8112c8e13..0574573f9 100644 --- a/mhkit/wave/contours.py +++ b/mhkit/wave/contours.py @@ -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: diff --git a/mhkit/wave/graphics.py b/mhkit/wave/graphics.py index a2d37db75..afb24016a 100644 --- a/mhkit/wave/graphics.py +++ b/mhkit/wave/graphics.py @@ -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' @@ -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 @@ -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 diff --git a/mhkit/wave/io/hindcast/hindcast.py b/mhkit/wave/io/hindcast/hindcast.py index 3cd984d84..81b83548f 100644 --- a/mhkit/wave/io/hindcast/hindcast.py +++ b/mhkit/wave/io/hindcast/hindcast.py @@ -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 @@ -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' @@ -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. @@ -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 diff --git a/mhkit/wave/io/hindcast/wind_toolkit.py b/mhkit/wave/io/hindcast/wind_toolkit.py index bb0fbc83f..3adb083c5 100644 --- a/mhkit/wave/io/hindcast/wind_toolkit.py +++ b/mhkit/wave/io/hindcast/wind_toolkit.py @@ -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. @@ -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 diff --git a/mhkit/wave/io/ndbc.py b/mhkit/wave/io/ndbc.py index 28ddff666..019481bc8 100644 --- a/mhkit/wave/io/ndbc.py +++ b/mhkit/wave/io/ndbc.py @@ -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 diff --git a/mhkit/wave/resource.py b/mhkit/wave/resource.py index c079b1718..5e6f54790 100644 --- a/mhkit/wave/resource.py +++ b/mhkit/wave/resource.py @@ -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]