Package atmopy :: Package observation :: Module temporal
[show private | hide private]
[frames | no frames]

Module atmopy.observation.temporal

Classes
Period Stores a time period.

Function Summary
sequence of datetime.datetime, numpy.array, numpy.array apply_mask_for_common_days(sim_dates, simulated, obs_dates, obs, mask_sim, mask_obs)
Applies a mask returned by mask_for_common_days on simulated and observation data, and gets corresponding dates.
(list of datetime, numpy.array, list of datetime, numpy.array) or (list of datetime, numpy.array, numpy.array) get_daily_obs_peaks(dates, sim, obs, hour_range, nb_range_min, nb_min, paired)
Returns the daily peaks for both observations and computed concentrations.
(list of datetime, numpy.array) get_daily_peaks(dates, conc, hour_range, nb_range_min, nb_min)
Returns the daily peaks.
Period get_period(dates)
Returns the period englobing all dates in dates.
sequence of Period get_periods(start, end, length, interperiod, fit_last)
Returns a list of periods of given length (except last period if fit_last is True), beginning at given start date, ending at given end date, and with an interperiod time between them.
sequence of datetime.datetime get_simulation_dates(t_min, delta_t, Nt)
Gets a list of dates corresponding to the simulation data.
numpy.array, numpy.array mask_for_common_days(sim_dates, simulated, obs_dates, obs)
Creates masks for simulated data and observation data corresponding to data of common dates.
array mask_for_series(dates, delta, Ndates)
Removes the dates if there are not enough preceding contiguous dates.
(numpy.array(type=Bool), numpy.array(type=Bool)) masks_for_common_dates(dates0, dates1)
Computes masks to be applied so that data sets available at 'dates0' and 'dates1' may be defined at the same dates.
datetime.datetime midnight(date)
Move to midnight in the current day.
(list of datetime, array) remove_days(dates, data, days)
Removes data in the first days.
(list of datetime, array) remove_incomplete_days(dates, data)
Removes dates and data from the first and/or last days of the period if there is missing data in these days.
(list of datetime, 2D numpy.array) remove_missing(dates, data, rm_value)
Removes given values from a data array and removes the corresponding dates.
sequence of datetime.datetime, numpy.array, numpy.array restrict_to_common_dates(sim_dates, simulated, obs_dates, obs)
Gets items from data and dates so as to keep only dates and corresponding data which are both in observations and simulated data.
sequence of datetime.datetime, numpy.array, numpy.array restrict_to_common_days(sim_dates, simulated, obs_dates, obs)
Gets items from data and dates so as to keep only daily data which are both in observations and simulated data.
sequence of datetime.datetime, numpy.array, numpy.array restrict_to_common_days2(sim_dates, simulated, obs_dates, obs)
Gets items from data and dates so as to keep only daily data which are both in observations and simulated.
(list of datetime, array) restrict_to_period(dates, data, period_date, end_date)
Returns data and associated dates within a given period.
sequence of dates sequences, sequence of numpy.array split_into_days(dates, data)
Gets a sequence of arrays which store the values for each day.
float timedelta2num(delta)
Converts datetime.timedelta to float day number as used in Matplotlib.

Function Details

apply_mask_for_common_days(sim_dates, simulated, obs_dates, obs, mask_sim, mask_obs)

Applies a mask returned by mask_for_common_days on simulated and observation data, and gets corresponding dates.
Parameters:
sim_dates - Dates for simulation data.
           (type=sequence of datetime.datetime)
simulated - Simulation data, 1D array
           (type=1D numpy.array)
obs_dates - Dates for observation data.
           (type=sequence of datetime.datetime)
obs - Observation data, 1D array.
           (type=1D numpy.array)
mask_sim - Mask array for simulation data corresponding to dates common to simulation and observation. This array can be obtain thanks to mask_for_common_days.
           (type=1D numpy.array)
mask_obs - Mask array for observation data corresponding to dates common to simulation and observation. This array can be obtain thanks to mask_for_common_days.
           (type=1D numpy.array)
Returns:
List of dates common to observation and simulation data, and corresponding data arrays for simulation and observation.
           (type=sequence of datetime.datetime, numpy.array, numpy.array)

get_daily_obs_peaks(dates, sim, obs, hour_range=[0, 23], nb_range_min=24, nb_min=0, paired=False)

Returns the daily peaks for both observations and computed concentrations.
Parameters:
dates - The dates at which the concentrations are provided.
           (type=list of datetime)
sim - The simulated concentrations.
           (type=numpy.array)
obs - Observations.
           (type=numpy.array)
hour_range - Range of hours over which the peak is to be sought. If not all hours of 'hour_range' are available in the observations, the day is discarded. The peak in the simulated concentrations is also taken in 'hour_range'.
           (type=list or tuple with two elements)
nb_range_min - The minimum number of available observations in the 'hour_range' so that the daily peak should be included.
           (type=int)
nb_min - The minimum number of available observations in the day so that the daily peak should be included.
           (type=int)
paired - True if observations and simulated peaks are assumed to be paired (i.e., occuring at the same hour), False otherwise.
           (type=Boolean)
Returns:
The new dates for computed concentrations, the computed peaks, the corresponding measured peaks preceded by their own dates.
           (type=(list of datetime, numpy.array, list of datetime, numpy.array) or (list of datetime, numpy.array, numpy.array))

get_daily_peaks(dates, conc, hour_range=[0, 23], nb_range_min=24, nb_min=0)

Returns the daily peaks.
Parameters:
dates - The dates at which the concentrations are provided.
           (type=list of datetime)
conc - The simulated concentrations.
           (type=numpy.array)
hour_range - Range of hours over which the peak is to be sought. If not all hours of 'hour_range' are available in the observations, the day is discarded. The peak in the simulated concentrations is also taken in 'hour_range'.
           (type=list or tuple with two elements)
nb_range_min - The minimum number of available observations in the 'hour_range' so that the daily peak should be included.
           (type=int)
nb_min - The minimum number of available observations in the day so that the daily peak should be included.
           (type=int)
Returns:
The concentration peaks preceded by their dates.
           (type=(list of datetime, numpy.array))

get_period(dates)

Returns the period englobing all dates in dates. dates must be sorted.
Parameters:
dates - Sequence of dates for which to find the englobing period.
           (type=sequence of datetime.datetime)
Returns:
Period englobing all dates in dates.
           (type=Period)

get_periods(start, end, length=datetime.timedelta(1), interperiod=datetime.timedelta(0), fit_last=False)

Returns a list of periods of given length (except last period if fit_last is True), beginning at given start date, ending at given end date, and with an interperiod time between them. By default, interperiod is null and length of period is one day.
Parameters:
start - Start of desired periods sequence.
           (type=datetime.datetime)
end - End of desired periods sequence.
           (type=datetime.datetime)
length - Length of one period (1 day by default).
           (type=datetime.timedelta)
interperiod - Interval of time between two consecutive periods (0 by default).
           (type=datetime.timedelta)
fit_last - If last period does not match the end date and fit_last is True, then the last period is shorter than the others. Otherwise the last period is of given length and is inside the start-end time interval (a time interval not covered with any period of the result sequence is therefore present)
           (type=Boolean)
Returns:
A sequence of periods, covering the given start-end interval.
           (type=sequence of Period)

get_simulation_dates(t_min, delta_t, Nt)

Gets a list of dates corresponding to the simulation data.
Parameters:
t_min - t_min is the time reference for simulation data.
           (type=datetime.datetime)
delta_t - The time delta between two consecutive time values, in hours.
           (type=int)
Nt - Number of time values.
           (type=int)
Returns:
A sequence of time values corresponding to the simulation data.
           (type=sequence of datetime.datetime)

mask_for_common_days(sim_dates, simulated, obs_dates, obs)

Creates masks for simulated data and observation data corresponding to data of common dates.
Parameters:
sim_dates - Dates for simulation data.
           (type=sequence of datetime.datetime)
simulated - Simulation data, 1D array
           (type=1D numpy.array)
obs_dates - Dates for observation data.
           (type=sequence of datetime.datetime)
obs - Observation data, 1D array.
           (type=1D numpy.array)
Returns:
Array masks for simulated and observation data. In each array, null values indicates that the corresponding data value has no common date in the other array, whereas a 1 value indicates the opposite.
           (type=numpy.array, numpy.array)

mask_for_series(dates, delta, Ndates)

Removes the dates if there are not enough preceding contiguous dates.
Parameters:
dates - Input dates.
           (type=list of datetime)
delta - The minimum time-delta between two dates.
           (type=timedelta)
Ndates - The number of contiguous dates that must be available before a given date so that the latter should be kept. Two dates are contiguous if the time delta between them is less than (or equal to) 'delta'.
           (type=integer)
Returns:
An array of Boolean filled with True for all dates to be kept.
           (type=array)

masks_for_common_dates(dates0, dates1)

Computes masks to be applied so that data sets available at 'dates0' and 'dates1' may be defined at the same dates.
Parameters:
dates0 - The first list of dates.
           (type=list of datetime)
dates1 - The second list of dates.
           (type=list of datetime)
Returns:
The masks are returned for both lists in Boolean arrays. There are common dates wherever a Boolean is True.
           (type=(numpy.array(type=Bool), numpy.array(type=Bool)))

midnight(date)

Move to midnight in the current day. Midnight is assumed to be the beginning of the day.
Parameters:
date - The date in the current day.
           (type=datetime.datetime)
Returns:
Midnight in the current day specified by date.
           (type=datetime.datetime)

remove_days(dates, data, days)

Removes data in the first days.
Parameters:
dates - The dates associated with 'data'.
           (type=list of datetime)
data - The data to be filtered.
           (type=array)
days - The number of days to be removed at the beginning.
           (type=integer)
Returns:
The dates and associated data without the first days.
           (type=(list of datetime, array))

remove_incomplete_days(dates, data)

Removes dates and data from the first and/or last days of the period if there is missing data in these days. There is missing data in a day if there is not as many timesteps as possible. The timestep is assumed to be constant and is computed with the number of hours between the first two timesteps.
Parameters:
dates - The dates associated with data.
           (type=list of datetime)
data - Array of data.
           (type=array)
Returns:
The dates and data with the first and/or last days removed.
           (type=(list of datetime, array))

remove_missing(dates, data, rm_value=-999)

Removes given values from a data array and removes the corresponding dates.
Parameters:
dates - The dates at which data is provided.
           (type=list of datetime)
data - The data array to be filtered.
           (type=1D numpy.array)
rm_value - The value(s) to be removed from 'data'.
           (type=float or list of floats)
Returns:
The data array and its dates without the specified values.
           (type=(list of datetime, 2D numpy.array))

restrict_to_common_dates(sim_dates, simulated, obs_dates, obs)

Gets items from data and dates so as to keep only dates and corresponding data which are both in observations and simulated data.
Parameters:
sim_dates - Dates for simulation data.
           (type=sequence of datetime.datetime)
simulated - Simulation data, 1D array.
           (type=1D numpy.array)
obs_dates - Dates for observation data.
           (type=sequence of datetime.datetime)
obs - Observation data, 1D array.
           (type=1D numpy.array)
Returns:
List of dates common to observation and simulation data, and corresponding data arrays for simulation and observation.
           (type=sequence of datetime.datetime, numpy.array, numpy.array)

restrict_to_common_days(sim_dates, simulated, obs_dates, obs)

Gets items from data and dates so as to keep only daily data which are both in observations and simulated data. Dates lists and data have to be sorted (by increasing time).
Parameters:
sim_dates - Dates for simulation data.
           (type=sequence of datetime.datetime)
simulated - Simulation data, 1D array.
           (type=1D numpy.array)
obs_dates - Dates for observation data.
           (type=sequence of datetime.datetime)
obs - Observation data, 1D array.
           (type=1D numpy.array)
Returns:
List of dates common to observation and simulation data, and corresponding data arrays for simulation and observation.
           (type=sequence of datetime.datetime, numpy.array, numpy.array)

restrict_to_common_days2(sim_dates, simulated, obs_dates, obs)

Gets items from data and dates so as to keep only daily data which are both in observations and simulated.
Parameters:
sim_dates - Dates for simulation data.
           (type=sequence of datetime.datetime)
simulated - Simulation data, 1D array.
           (type=1D numpy.array)
obs_dates - Dates for observation data.
           (type=sequence of datetime.datetime)
obs - Observation data, 1D array.
           (type=1D numpy.array)
Returns:
List of dates common to observation and simulation data, and corresponding data arrays for simulation and observation.
           (type=sequence of datetime.datetime, numpy.array, numpy.array)

restrict_to_period(dates, data, period_date, end_date=None)

Returns data and associated dates within a given period.
Parameters:
dates - The dates associated with data.
           (type=list of datetime)
data - Array of data.
           (type=array)
period_date - Defines:
  1. a period (Period object);
  2. a period through its bounds (list of datetime);
  3. the first date of the selected period.

           (type=Period, list of datetime, or datetime)
end_date - the last date of the selected period (if not provided by 'period_date').
           (type=datetime)
Returns:
The dates and data over the selected period.
           (type=(list of datetime, array))

split_into_days(dates, data)

Gets a sequence of arrays which store the values for each day.
Parameters:
dates - Sequence of dates corresponding to the given data.
           (type=sequence of datetime.datetime)
data - Array of data to split into arrays for days.
           (type=1D numpy.array)
Returns:
A list of dates sequences, splitted by days, and the corresponding sequence of numpy.array.
           (type=sequence of dates sequences, sequence of numpy.array)

timedelta2num(delta)

Converts datetime.timedelta to float day number as used in Matplotlib.
Parameters:
delta - The time-delta to be converted in days.
           (type=datetime.timedelta)
Returns:
The number of days in 'delta'.
           (type=float)

Generated by Epydoc 2.1 on Tue May 19 10:37:12 2009 http://epydoc.sf.net