Skip to content

Commit cb684bb

Browse files
committed
flaked
1 parent f9bd414 commit cb684bb

File tree

5 files changed

+30
-22
lines changed

5 files changed

+30
-22
lines changed

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
ignore = E203, E266, E501, W503, F403, F401
3+
max-line-length = 79
4+
max-complexity = 18
5+
select = B,C,E,F,W,T4,B9

seebuoy/_ndbc/historic.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import pandas as pd
2+
import urllib2
3+
4+
15
class Historic:
26
def __init__(self, buoy, year, year_range=None):
37

@@ -137,7 +141,7 @@ def get_all_stand_meteo(self):
137141
urllib2.urlopen(link)
138142
links.append(link)
139143

140-
except:
144+
except IndexError:
141145
print(str(ii) + " not in records")
142146

143147
# need to also retrieve jan, feb, march, etc.
@@ -167,7 +171,7 @@ def get_all_stand_meteo(self):
167171
urllib2.urlopen(link)
168172
links.append(link)
169173

170-
except:
174+
except IndexError:
171175
print(str(month[ii]) + "2016" + " not in records")
172176
print(link)
173177

seebuoy/_ndbc/real_time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _spec(txt):
168168
# convert to floats
169169
cols = ["WVHT", "SwH", "SwP", "WWH", "WWP", "APD", "MWD"]
170170
df[cols] = df[cols].astype(float)
171-
except:
171+
except IndexError:
172172

173173
# convert the dates to datetimes
174174
df.index = pd.to_datetime(df.index, format="%Y %m %d %H %M")

seebuoy/ww3/forecast.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
class WW3:
88
"""Pull wave watch 3 model data in Pandas dataframes.
9-
9+
1010
Parameters
1111
----------
1212
date : str
1313
Date of data to pull. If None, it will return the most recent
14-
14+
1515
"""
1616

1717
def __init__(self, date=None):
@@ -31,33 +31,33 @@ def get_file(self):
3131

3232
def get_var(self, var):
3333
"""Get the specified variable from the netcdf file.
34-
34+
3535
dirpwsfc - primary wave direction [deg]
36-
36+
3737
dirswsfc - secondary wave direction [deg]
38-
38+
3939
htsgwsfc- significant height of combined wind waves and swell [m]
40-
40+
4141
perpwsfc - primary wave mean period [s]
42-
42+
4343
perswsfc - secondary wave mean period [s]
44-
44+
4545
ugrdsfc - u-component of wind [m/s]
46-
46+
4747
vgrdsfc - v-component of wind [m/s]
48-
48+
4949
wdirsfc - wind direction (from which blowing) [deg]
50-
50+
5151
windsfc - wind speed [m/s]
52-
52+
5353
wvdirsfc - direction of wind waves [deg]
54-
55-
wvpersfc - mean period of wind waves [s]
54+
55+
wvpersfc - mean period of wind waves [s]
5656
Parameters
5757
----------
5858
var : str
5959
Variable from the netcdf file to retreive.
60-
60+
6161
Returns
6262
-------
6363
x : np.array
@@ -68,7 +68,7 @@ def get_var(self, var):
6868

6969
def get_closest_lat_lon(self, lat, lon):
7070
"""Retrieves the indexes of the closest latitude and longitude.
71-
71+
7272
Parameters
7373
----------
7474
lat : float
@@ -118,7 +118,7 @@ def get_standard_df(self, lat, lon):
118118
Latitude to retrieve for the data
119119
lon : float
120120
Longitude to retrieve for the data
121-
121+
122122
Returns
123123
-------
124124
df : pd.DataFrame

tests/ndbc/test_ndbc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ def test_buoy_data():
1717

1818
for d in datasets:
1919
df = ndbc(buoy, d)
20-
21-
20+
assert len(df) > 0

0 commit comments

Comments
 (0)