/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
Scraper::base::territory::Territory Class Reference
Inheritance diagram for Scraper::base::territory::Territory:
Inheritance graph
[legend]
Collaboration diagram for Scraper::base::territory::Territory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __repr__

Public Attributes

 floor
 srng

Detailed Description

Definition at line 30 of file territory.py.


Constructor & Destructor Documentation

def Scraper::base::territory::Territory::__init__ (   self,
  source,
  by = "date",
  suby = "date,
  hour,
  att = "date_time",
  floor = None 
)
:param source: SA mapped class
:param by:    comma delimited string of mysql single-argument function names specifiying top level grouping  
:param atn:   name of attribute passed to single argument functions   
:param floor: 

Establish ranges to restrict sub-group queries.  

For example if the objective is hourly values `date,hour` then using 
territory grouping of `date` will establish day by day groupings in which 
to perform the hourly `date,hour` group queries.
This approach is taken to avoid oversized queries (eg every hour in a year).

Definition at line 31 of file territory.py.

00032                                                                                             :
00033         """
00034         :param source: SA mapped class
00035         :param by:    comma delimited string of mysql single-argument function names specifiying top level grouping  
00036         :param atn:   name of attribute passed to single argument functions   
00037         :param floor: 
00038 
00039         Establish ranges to restrict sub-group queries.  
00040 
00041         For example if the objective is hourly values `date,hour` then using 
00042         territory grouping of `date` will establish day by day groupings in which 
00043         to perform the hourly `date,hour` group queries.
00044         This approach is taken to avoid oversized queries (eg every hour in a year).
00045 
00046         """  
00047         if not floor:
00048             floor = strp_("2000-01-01 00:00:00")   # always floored to avoid dud-dates in source tables
00049 
00050         period = m2u[by.split(",")[-1]]   
00051         subperiod = m2u[suby.split(",")[-1]]   
00052         att = Att( source , att )
00053         srng = att.range(floor=floor)     # (count,min,max) NamedTuple
00054         log.debug("floor %s source range %s " % (floor.ctime(), repr(srng)) ) 
00055         start, end = srng.min, srng.max
00056         DatetimeBins.__init__( self, start, end, period, subperiod ) 
00057         self.floor = floor
00058         self.srng = srng


Member Function Documentation

def Scraper::base::territory::Territory::__repr__ (   self)

Definition at line 59 of file territory.py.

00060                       :
00061         ct_ = lambda _:_.ctime() if _ else "-"
00062         return "\n".join(["Territory floor:%s" % self.floor,"source range %s " % map(ct_,[self.srng.min,self.srng.max]) , DatetimeBins.__repr__(self) ])
00063 
00064 


Member Data Documentation

Definition at line 44 of file territory.py.

Definition at line 44 of file territory.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:50:03 for Scraper by doxygen 1.7.4