Commit 31908e7b authored by Carl Schreck's avatar Carl Schreck
Browse files

Working find_first_ind in py

parent d4c75d0b
......@@ -14,7 +14,7 @@ import cjs
class Ibtracs:
''' This class uses IBTrACS data. '''
def __init__(self, inpath='since1980'):
epochs = [ 'last3years', 'All', 'since1980' ]
epochs = [ 'last3years', 'ALL', 'since1980' ]
if inpath in epochs:
self.inpath = ( '~/data/ibtracs/v04r00/IBTrACS.' + inpath
+ '.v04r00.nc' )
......@@ -45,16 +45,14 @@ class Ibtracs:
is_strong = self.ds.usa_wind == lmi
nstrong = np.sum(is_strong, axis=1)
is_eligible = is_main & is_tropical & is_strong
neligible = np.sum(is_eligible, axis=1)
ind_eligible = np.argmax(is_eligible,1)
retval = is_eligible
retval = False
retval[:,:] = False
for i,j in enumerate(ind_eligible):
if curr_any:
first_ind = list(is_eligible[i,:]).index(True)
is_eligible[i,first_ind+1:] = False
print(np.c_[self.ds.sid.values[i], nstrong[i], first_ind])
# print(np.c_[self.ds.sid.values[is_eligible], nstrong[is_eligible], any_eligible[is_eligible]])
if neligible[i] > 0:
retval[i,j] = True
return(retval)
......
......@@ -13,8 +13,10 @@ import ibtracs
cjs.tstamp('Here we go!')
ibt = ibtracs.Ibtracs('last3years')
ibt.find_first_ind(-1)
#ibt = ibtracs.Ibtracs('last3years')
ibt = ibtracs.Ibtracs('ALL')
#ibt = ibtracs.Ibtracs('last3years')
ibt.find_first_ind(96)
cjs.tstamp('Thank you, come again.')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment