[SciPy-user] scikits.timeseries : masking data after it hasbeen read in using tsfromtxt
Dharhas Pothina
Dharhas.Pothina at twdb.state.tx.us
Wed Jun 17 16:20:35 EDT 2009
That worked great. Thanks
- dharhas
>>> Pierre GM <pgmdevlist at gmail.com> 6/17/2009 1:44 PM >>>
On Jun 17, 2009, at 11:43 AM, Dharhas Pothina wrote:
>
> SB1S =
> ts
> .tsfromtxt
> ('SB1S
> .txt
> ',freq
> =
> 'T
> ',comments
> ='#',dateconverter=dateconverter,datecols=(0,1,2,3,4),usecols
> =
> (0,1,2,3,4,7,9,8),names='Y,M,D,hh,mm,Temperature,Salinity,WaterLevel')
>
> I want to perform some extra masking. ie mask all salinities below 0
> and above 100, mask all temperatures = -999 etc
Dharhas,
Here's an example:
>>> ndtype = [('T', '<f8'), ('S', '<f8')]
>>> series = ts.time_series(zip(np.arange(12),np.arange(12)),
>>> dtype=ndtype,
>>> start_date=ts.now('M'))
>>> print series
>>> # Mask all the records for which 'T' < 5
>>> series[series['T']<5] = ma.masked
>>> print series
>>> # Mask field 'S' if 'S' is even
>>> s = series['S']
>>> s[s%2==0] = ma.masked
>>> print series
As you can see, you can mask whole records or individual fields,
depending on what you want.
_______________________________________________
SciPy-user mailing list
SciPy-user at scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list