[SciPy-User] Masking multiple fields in a structured timeseries object.

Dharhas Pothina Dharhas.Pothina@twdb.state.tx...
Fri Jan 8 10:16:20 CST 2010


Hi,

I have a structured time series object I have read in from a file. I am providing my script the following parameters
filename, startdate, enddate, parameter (All, Salinity, Temp., etc), Max , Min, Instrument type (2 digit code contained in the filename).

My timeseries is structured like :

timeseries([ ('JOB_20090812_CXT_MW9999.csv', 0, --, --, --, --, --, 22.0, 13.199999999999999, 28.949999999999999, --, 0.39928999999999998, --, --)
 ('JOB_20090812_CXT_MW9999.csv', 0, --, --, --, --, --, 22.100000000000001, 13.199999999999999, 28.690000000000001, --, 0.35965999999999998, --, --)
 ('JOB_20090812_CXT_MW9999.csv', 0, --, --, --, --, --, 22.100000000000001, 13.300000000000001, 28.420000000000002, --, 0.32917999999999997, --, --)
 ...,
 ('JOB_20090812_CXT_MW9999.csv', 0, --, --, --, --, 3.6699999999999999, 25.800000000000001, 15.699999999999999, 25.600000000000001, --, 1.5514300000000001, --, --)
 ('JOB_20090812_CXT_MW9999.csv', 0, --, --, --, --, 3.8900000000000001, 25.800000000000001, 15.699999999999999, 25.710000000000001, --, 1.61849, --, --)
 ('JOB_20090812_CXT_MW9999.csv', 0, --, --, --, --, 3.5899999999999999, 25.899999999999999, 15.699999999999999, 25.859999999999999, --, 1.6398200000000001, --, --)],
   dtype = [('Filename', '|S27'), ('Year', '<i8'), ('Month', '<f8'), ('Day', '<f8'), ('Hour', '<f8'), ('Minute', '<f8'), ('Second', '<f8'), ('DOSat', '<f8'), ('AirPressure', '<f8'), ('AirTemperature', '<f8'), ('BatteryVoltage', '<f8'), ('DO', '<f8'), ('EC_Norm', '<f8'), ('Salinity', '<f8')],
   dates = [11-Jun-1996 21:00 11-Jun-1996 22:00 11-Jun-1996 23:00 ...,
 05-Oct-2000 09:00 05-Oct-2000 10:00 05-Oct-2000 11:00],
   freq  = T)



I want to mask the data in the following way:

Mask all values between start & end dates that meet the following criteria:

1) selected parameter (mask all if blank) 
2) selected filename (mask all if blank)
3) selected instrument (mask all if blank). Note the instrument is the 18 & 19 character in the filename, ie 'MW' in the example above.
4) parameter value lies between the given max and min values.

I'm having trouble working out how to check all these conditions at once or sequentially before masking.

Any help is appreciated.

thanks

- dharhas



More information about the SciPy-User mailing list