Module Expr Str Import alias Import alias Import alias Import alias Import alias Import alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias Import alias Import alias identifier Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore Num Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword Num keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword Num keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword NameLoad keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword NameLoad keyword BinOpMod Str NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad Num body Expr Str If NameLoad body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr TryExcept body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str attr handlers ExceptHandler body TryExcept body Assign AttributeStore NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str attr handlers ExceptHandler body TryExcept body Assign AttributeStore NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body If BoolOpAnd Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Return Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index Num Index Str Assign NameStore NameLoad If CompareEq NameLoad Num body Assign NameStore NameLoad orelse If NameLoad body Assign NameStore NameLoad Assign NameStore NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Str Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr ListComp SubscriptLoad NameLoad Index Str comprehension NameStore NameLoad Expr Call AttributeLoad NameLoad attr Delete NameDel Assign NameStore Str If UnaryOpNot AttributeLoad NameLoad attr body AugAssignAdd NameStore Str AugAssignAdd NameStore BinOpMod Str TupleLoad NameLoad NameLoad If UnaryOpNot AttributeLoad NameLoad attr body AugAssignAdd NameStore BinOpMod Str NameLoad orelse Assign NameStore Str If CompareGt NameLoad Num body If NameLoad body AugAssignAdd NameStore Str AugAssignAdd NameStore BinOpMod Str TupleLoad NameLoad NameLoad NameLoad If NameLoad body If UnaryOpNot AttributeLoad NameLoad attr body AugAssignAdd NameStore BinOpMod Str NameLoad orelse Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad keyword NameLoad If SubscriptLoad NameLoad Index Str body Expr Call NameLoad AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str BinOpAdd Str NameLoad Str If SubscriptLoad NameLoad Index Str body Expr Call NameLoad AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str BinOpAdd Str NameLoad Str If SubscriptLoad NameLoad Index Str body Raise Call NameLoad Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assert NameLoad BinOpMod Str NameLoad For NameStore Call NameLoad Call NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd NameLoad Num Assign NameStore Call NameLoad SubscriptLoad NameLoad Index NameLoad For NameStore Call AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Index NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Str Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str Assert BoolOpOr NameLoad UnaryOpNot NameLoad Str Assign NameStore BoolOpOr NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore IfExp CompareIsNot NameLoad NameLoad TupleLoad NameLoad NameLoad Assign NameStore IfExp BoolOpAnd CompareIsNot NameLoad NameLoad CompareIsNot NameLoad NameLoad TupleLoad TupleLoad NameLoad NameLoad NameLoad Assign NameStore IfExp CompareIsNot NameLoad NameLoad TupleLoad NameLoad NameLoad Assign NameStore IfExp CompareIsNot NameLoad NameLoad TupleLoad NameLoad NameLoad Assign NameStore IfExp CompareIsNot NameLoad NameLoad TupleLoad NameLoad NameLoad Assign NameStore IfExp CompareIsNot NameLoad NameLoad TupleLoad NameLoad NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Str NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Assign NameStore Str If SubscriptLoad NameLoad Index Str body AugAssignAdd NameStore Str If SubscriptLoad NameLoad Index Str body AugAssignAdd NameStore Str If SubscriptLoad NameLoad Index Str body AugAssignAdd NameStore Str If SubscriptLoad NameLoad Index Str body AugAssignAdd NameStore Str If SubscriptLoad NameLoad Index Str body AugAssignAdd NameStore Str If SubscriptLoad NameLoad Index Str body AugAssignAdd NameStore Str AugAssignAdd NameStore Str Expr Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Dict For NameStore NameLoad body Assert NameLoad Str Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Assert Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str BinOpMod Str SubscriptLoad NameLoad Index Str Assign NameStore BoolOpOr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Dict If UnaryOpNot NameLoad body Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Str NameLoad Assign NameStore BoolOpOr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Dict If UnaryOpNot NameLoad body Assign NameStore NameLoad Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Str NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad If NameLoad body Assign NameStore DictComp NameLoad SubscriptLoad NameLoad Index NameLoad comprehension NameStore Call AttributeLoad NameLoad attr BoolOpAnd BinOpBitAnd Set Str Str Call NameLoad Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr CompareLtE Set Str Str Call NameLoad Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign NameStore Dict For NameStore Call NameLoad Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Index Num Expr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Str Assign NameStore SubscriptLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index SubscriptLoad NameLoad Index Str Index SubscriptLoad NameLoad Index Str Index SubscriptLoad NameLoad Index Str Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Assign NameStore DictComp SubscriptLoad NameLoad Index Num SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index SubscriptLoad NameLoad Index Str Index NameLoad comprehension NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index SubscriptLoad NameLoad Index Str attr CompareEq SubscriptLoad NameLoad Index Num Str Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Assign NameStore DictComp NameLoad DictComp SubscriptLoad NameLoad Index Str NameLoad comprehension NameStore Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str For NameStore Call NameLoad Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str If UnaryOpNot NameLoad body Continue Assign NameStore SubscriptLoad NameLoad Index NameLoad For NameStore NameLoad body Assign NameStore Dict NameLoad Call NameLoad NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str NameLoad NameLoad If UnaryOpNot NameLoad body Assign SubscriptStore NameLoad Index TupleLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str NameLoad NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str For TupleStore NameStore NameStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad BinOpAdd Call AttributeLoad Str attr TupleLoad NameLoad Call AttributeLoad NameLoad attr Str Str BinOpMod Str TupleLoad NameLoad NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad Call AttributeLoad NameLoad attr Index Num Index Str Assign NameStore Dict Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad Call NameLoad ListLoad Str Str Call AttributeLoad Call AttributeLoad NameLoad attr Num attr Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr Num attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Delete NameDel For NameStore Call NameLoad Call AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str BinOpMod Str SubscriptLoad NameLoad Index Str BinOpMod Str SubscriptLoad NameLoad Index Str BinOpMod Str TupleLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str NameLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str BinOpMod Str TupleLoad Num Num SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str BinOpMod Str TupleLoad Num Num SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str IfExp CompareIsNot SubscriptLoad NameLoad Index Str NameLoad BinOpMod Str SubscriptLoad NameLoad Index Str Str Str Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr Str NameLoad Str Expr Call AttributeLoad NameLoad attr DictComp NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad comprehension NameStore Call AttributeLoad NameLoad attr If CompareIsNot SubscriptLoad NameLoad Index Str NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults ListLoad Num Num Num Num body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assert NameLoad BinOpMod Str NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Num attr Delete NameDel Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Assign NameStore BinOpBitOr NameLoad Num Assign NameStore ListLoad ListLoad Num Num Num ListLoad Num Num Num ListLoad Num Num Num Assign NameStore BinOpRShift BinOpBitAnd NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad keyword Num Assign NameStore BinOpSub NameLoad NameLoad Assign SubscriptStore NameLoad Index CompareLt NameLoad Num Num AugAssignAdd NameStore BinOpLShift NameLoad Num Delete NameDel Assign NameStore BinOpRShift BinOpBitAnd NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad keyword Num Assign NameStore BinOpSub NameLoad NameLoad Assign SubscriptStore NameLoad Index CompareLt NameLoad Num Num AugAssignAdd NameStore BinOpLShift NameLoad Num Delete NameDel Assign NameStore BinOpRShift BinOpBitAnd NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad keyword Num Assign NameStore BinOpSub NameLoad NameLoad Assign SubscriptStore NameLoad Index CompareLt NameLoad Num Num AugAssignAdd NameStore BinOpLShift NameLoad Num Delete NameDel Assign NameStore BinOpRShift BinOpBitAnd NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad keyword Num Assign NameStore BinOpSub NameLoad NameLoad Assign SubscriptStore NameLoad Index CompareLt NameLoad Num Num AugAssignAdd NameStore BinOpLShift NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr For NameStore NameLoad body Assign SubscriptStore NameLoad Index CompareEq NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assert CompareEq Call NameLoad AttributeLoad NameLoad attr Num Str Assert CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Assign SubscriptStore NameLoad Index UnaryOpInvert NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore BoolOpOr NameLoad AttributeLoad NameLoad attr Assign NameStore BoolOpOr NameLoad AttributeLoad NameLoad attr Assign NameStore BoolOpOr NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Str Assign NameStore Dict Str Str Str Str NameLoad NameLoad NameLoad NameLoad Expr Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Dict Assign NameStore Str For NameStore NameLoad body Assign NameStore Dict Str Str Str SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Assert CompareNotEq SubscriptLoad NameLoad Index Str NameLoad BinOpMod Str SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr TupleLoad Str SubscriptLoad NameLoad Index Str Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Str Dict Str Str Str Str Str SubscriptLoad NameLoad Index Str SubscriptLoad SubscriptLoad Call AttributeLoad NameLoad attr Index Num Index Str SubscriptLoad NameLoad Index Str NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Assign NameStore BoolOpOr NameLoad AttributeLoad NameLoad attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore Dict Str Str Str Str Str Str Str NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Assign NameStore Dict For NameStore NameLoad body Assign NameStore Call NameLoad SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad If CompareIsNot NameLoad NameLoad body For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad ListLoad If UnaryOpNot NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str If NameLoad body For NameStore Call NameLoad Call AttributeLoad NameLoad attr body If BoolOpAnd Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str NameLoad Continue If Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr keyword SubscriptLoad NameLoad Index NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assert CompareEq Call NameLoad NameLoad NameLoad Str Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Assign NameStore Dict For NameStore ListLoad Str Str body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index SubscriptLoad NameLoad Index Str Index TupleLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Assign NameStore ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore Call NameLoad Call AttributeLoad NameLoad attr CompareEq SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Str Index Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assert NameLoad BinOpMod Str NameLoad Assign NameStore SubscriptLoad NameLoad Index Str For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str BinOpMod Str TupleLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str SubscriptLoad NameLoad Index Str Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call NameLoad NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str BinOpMod Str SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str Assign SubscriptStore NameLoad Index Str BinOpMod Str SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str Assign SubscriptStore NameLoad Index Str Num If BoolOpOr AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body If Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr Call AttributeLoad SubscriptLoad NameLoad Index Str attr Str Assert NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad orelse Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call NameLoad Num orelse Expr Call AttributeLoad NameLoad attr Str NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Return NameLoad decorator_list decorator_list If CompareEq NameLoad Str body FunctionDef arguments args NameParam NameParam defaults AttributeLoad NameLoad attr body If UnaryOpNot NameLoad body Return NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list Assign NameStore Call NameLoad Assert AttributeLoad NameLoad attr Str Assert AttributeLoad NameLoad attr Str Assert AttributeLoad NameLoad attr Str Assert Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Expr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Str Assign NameStore Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad AttributeLoad NameLoad attr
N/A N/A 
Stacker class implementation to create temporal stacks. Virtual stack_derived() function
creates un-masked temporal stacks for all available bands.
Should be subclassed for custom algorithms.

Created on 05/10/2012

@author: Alex Ip
 N/A os N/A sys N/A argparse N/A logging N/A re N/A psycopg2 osgeo gdal osr gdalconst copy copy datetime datetime time timedelta scipy ndimage N/A numpy N/A numpy.ma ma N/A shutil time sleep EOtools.execute execute EOtools.utils log_multiline agdc DataCube agdc.band_lookup BandLookup N/A PQA_CONTIGUITY 256 N/A DEFAULT_BAND_LOOKUP_SCHEME LANDSAT-UNADJUSTED N/A console_handler N/A N/A logging StreamHandler N/A sys stdout N/A N/A N/A console_handler setLevel N/A logging INFO N/A console_formatter N/A N/A logging Formatter %(message)s N/A N/A N/A console_handler setFormatter console_formatter N/A logger N/A N/A logging getLogger __name__ N/A N/A N/A logger level N/A N/A N/A N/A logger setLevel N/A logging DEBUG N/A N/A N/A logger addHandler console_handler Stacker N/A DataCube N/A parse_args N/A N/A self N/A N/A N/A Parse the command line arguments.
    
        Returns:
            argparse namespace object
         N/A N/A N/A logger debug   Calling parse_args() N/A _arg_parser N/A N/A argparse ArgumentParser stacker N/A N/A N/A _arg_parser add_argument -C --config dest config_file default N/A N/A N/A os path join N/A self agdc_root agdc_default.conf help Stacker configuration file N/A N/A N/A _arg_parser add_argument -d --debug dest debug default False action store_const const True help Debug mode flag N/A N/A N/A _arg_parser add_argument -x --x_index dest x_index required False default None help x-index of tile to be stacked N/A N/A N/A _arg_parser add_argument -y --y_index dest y_index required False default None help y-index of tile to be stacked N/A N/A N/A _arg_parser add_argument -o --output dest output_dir required False default 1 help Output directory path N/A N/A N/A _arg_parser add_argument -s --start_date dest start_date required False default None help Start Date in dd/mm/yyyy format N/A N/A N/A _arg_parser add_argument -e --end_date dest end_date required False default None help End Date in dd/mm/yyyy format N/A N/A N/A _arg_parser add_argument -a --satellite dest satellite required False default None help Short Satellite name (e.g. LS5, LS7) N/A N/A N/A _arg_parser add_argument -n --sensor dest sensor required False default None help Sensor Name (e.g. TM, ETM+) N/A N/A N/A _arg_parser add_argument -t --tile_type dest default_tile_type_id required False default 1 help Tile type ID of tiles to be stacked N/A N/A N/A _arg_parser add_argument -p --path dest path required False default None help WRS path of tiles to be stacked N/A N/A N/A _arg_parser add_argument -r --row dest row required False default None help WRS row of tiles to be stacked N/A N/A N/A _arg_parser add_argument --refresh dest refresh default False action store_const const True help Refresh mode flag to force updating of existing files N/A N/A N/A _arg_parser add_argument -of --out_format dest out_format required False default None help Specify a GDAL complient output format for the file to be physically generated. If unset, then only the VRT will be generated. Example use -of ENVI N/A N/A N/A _arg_parser add_argument -sfx --suffix dest suffix required False default None help Specify an output suffix for the physically generated file. Is only applied when -of <FORMAT> is set. N/A N/A N/A _arg_parser add_argument -b --band_lookup_scheme dest band_lookup_scheme required False default DEFAULT_BAND_LOOKUP_SCHEME help N/A Specify a valid band lookup scheme name (default="%s") DEFAULT_BAND_LOOKUP_SCHEME N/A N/A args unknown_args N/A N/A _arg_parser parse_known_args N/A args N/A __init__ N/A N/A self source_datacube default_tile_type_id N/A None 1 N/A N/A Constructor
        Arguments:
            source_datacube: Optional DataCube object whose connection and data will be shared
            tile_type_id: Optional tile_type_id value (defaults to 1)
         N/A source_datacube N/A N/A N/A self __dict__ N/A copy N/A source_datacube __dict__ N/A args N/A N/A self parse_args N/A attribute_name N/A N/A N/A args __dict__ keys N/A N/A attribute_value N/A N/A args __dict__ N/A attribute_name N/A N/A N/A self __setattr__ attribute_name attribute_value N/A N/A N/A N/A DataCube __init__ self N/A N/A self debug N/A N/A N/A N/A console_handler setLevel N/A logging DEBUG N/A N/A N/A N/A self default_tile_type_id N/A int N/A self default_tile_type_id N/A N/A N/A N/A N/A self default_tile_type_id default_tile_type_id N/A N/A N/A N/A self start_date N/A N/A N/A N/A datetime strptime N/A self start_date %Y%m%d date N/A N/A N/A N/A N/A N/A N/A self start_date N/A N/A N/A N/A datetime strptime N/A self start_date %d/%m/%Y date N/A N/A N/A N/A N/A self start_date None N/A N/A N/A N/A self end_date N/A N/A N/A N/A datetime strptime N/A self end_date %Y%m%d date N/A N/A N/A N/A N/A N/A N/A self end_date N/A N/A N/A N/A datetime strptime N/A self end_date %d/%m/%Y date N/A N/A N/A N/A N/A self end_date None N/A N/A N/A N/A self x_index N/A int N/A self x_index N/A N/A N/A N/A N/A self x_index None N/A N/A N/A N/A self y_index N/A int N/A self y_index N/A N/A N/A N/A N/A self y_index None N/A N/A N/A N/A self path N/A int N/A self path N/A N/A N/A N/A N/A self path None N/A N/A N/A N/A self row N/A int N/A self row N/A N/A N/A N/A N/A self row None N/A N/A N/A N/A self min_path N/A int N/A self min_path N/A N/A N/A N/A N/A self min_path None N/A N/A N/A N/A self max_path N/A int N/A self max_path N/A N/A N/A N/A N/A self max_path None N/A N/A N/A N/A self min_row N/A int N/A self min_row N/A N/A N/A N/A N/A self min_row None N/A N/A N/A N/A self max_row N/A int N/A self max_row N/A N/A N/A N/A N/A self max_row None N/A band_lookup N/A BandLookup self N/A N/A self band_lookup_dict N/A N/A band_lookup band_lookup_dict N/A N/A self band_lookup_scheme N/A stack_files N/A N/A self timeslice_info_list stack_dataset_path band1_vrt_path overwrite N/A None False N/A N/A N/A N/A N/A N/A os path exists stack_dataset_path N/A overwrite N/A N/A N/A N/A logger debug Stack VRT file %s already exists stack_dataset_path N/A N/A band_no N/A N/A timeslice_info_list N/A 0 N/A tile_layer N/A build_vrt True N/A N/A band_no 1 N/A N/A intermediate_path stack_dataset_path N/A N/A band1_vrt_path N/A N/A intermediate_path band1_vrt_path N/A build_vrt False N/A N/A intermediate_path N/A N/A re sub \.vrt$ .tmp stack_dataset_path N/A file_list_path N/A N/A re sub \.vrt$ .txt stack_dataset_path N/A build_vrt N/A N/A N/A N/A logger info Creating %d layer stack VRT file %s N/A len timeslice_info_list stack_dataset_path N/A list_file N/A open file_list_path w N/A N/A N/A list_file write N/A N/A join N/A N/A timeslice_info N/A tile_pathname N/A timeslice_info timeslice_info_list N/A N/A N/A list_file close N/A list_file N/A command_string gdalbuildvrt N/A N/A N/A self debug N/A N/A command_string  -q N/A command_string N/A  -separate -input_file_list %s -overwrite %s N/A file_list_path intermediate_path N/A N/A N/A self debug N/A N/A command_string N/A 
rm %s file_list_path N/A N/A command_string N/A N/A band_no 1 N/A N/A command_string N/A N/A command_string N/A command_string N/A cat %s | sed s/\<SourceBand\>1\<\\/SourceBand\>/\<SourceBand\>%d\<\\/SourceBand\>/g > %s N/A intermediate_path band_no stack_dataset_path N/A build_vrt N/A N/A N/A N/A self debug N/A N/A command_string N/A 
rm %s intermediate_path N/A N/A N/A N/A logger info Creating %d layer stack VRT file %s from %s N/A len timeslice_info_list stack_dataset_path intermediate_path N/A N/A N/A logger debug command_string = %s command_string N/A result N/A execute command_string command_string N/A N/A result N/A stdout N/A N/A N/A log_multiline N/A logger info N/A result N/A stdout N/A stdout from  command_string N/A N/A result N/A stderr N/A N/A N/A log_multiline N/A logger debug N/A result N/A stderr N/A stderr from  command_string N/A N/A result N/A returncode N/A N/A N/A Exception %s failed command_string N/A temporal_stack_dataset N/A N/A gdal Open stack_dataset_path N/A temporal_stack_dataset N/A Unable to open VRT %s stack_dataset_path N/A band_index N/A range N/A len timeslice_info_list N/A N/A band N/A N/A temporal_stack_dataset GetRasterBand N/A band_index 1 N/A metadata_dict N/A dict N/A timeslice_info_list N/A band_index N/A key N/A N/A metadata_dict keys N/A N/A N/A metadata_dict N/A key N/A str N/A metadata_dict N/A key N/A N/A N/A band SetMetadata metadata_dict N/A N/A log_multiline N/A logger debug N/A N/A band GetMetadata band.GetMetadata() N/A nodata_value N/A N/A timeslice_info_list N/A band_index N/A nodata_value N/A N/A nodata_value None N/A N/A N/A N/A logger debug nodata_value = %s nodata_value N/A N/A N/A band SetNoDataValue nodata_value N/A N/A N/A temporal_stack_dataset FlushCache N/A stack_tile N/A N/A self x_index y_index stack_output_dir start_datetime end_datetime satellite sensor tile_type_id path row create_band_stacks disregard_incomplete_data N/A None None None None None None None None True False N/A N/A 
        Function which returns a data structure and optionally creates band-wise VRT dataset stacks
        
        Arguments:
            x_index, y_index: Integer indices of tile to stack
            stack_output_dir: String defining output directory for band stacks 
                (not used if create_band_stacks == False)
            start_datetime, end_datetime: Optional datetime objects delineating temporal range
            satellite, sensor: Optional satellite and sensor string parameters to filter result set
            tile_type_id: Integer value of tile_type_id to search 
            path: WRS path of source scenes
            row: WRS row of source scenes
            create_band_stacks: Boolean flag indicating whether band stack VRT files should be produced
            disregard_incomplete_data: Boolean flag indicating whether to constrain results to tiles with
                complete L1T, NBAR and PQA data. This ensures identical numbers of stack layers but
                introduces a hard-coded constraint around processing levels.
         N/A N/A stack_output_dir N/A create_band_stacks Output directory must be supplied for temporal stack generation N/A tile_type_id N/A tile_type_id N/A self default_tile_type_id N/A db_cursor2 N/A N/A N/A self db_connection cursor N/A tile_type_ids_tuple N/A N/A tile_type_id None N/A tile_type_id None N/A tile_indices_tuple N/A N/A N/A x_index None N/A y_index None N/A N/A x_index y_index None N/A satellites_tuple N/A N/A satellite None N/A satellite None N/A sensors_tuple N/A N/A sensor None N/A sensor None N/A paths_tuple N/A N/A path None N/A path None N/A rows_tuple N/A N/A row None N/A row None N/A params N/A tile_type_ids tile_indices satellites sensors x_refs y_refs start_datetime end_datetime tile_type_ids_tuple tile_indices_tuple satellites_tuple sensors_tuple paths_tuple rows_tuple start_datetime end_datetime N/A N/A log_multiline N/A logger debug params params N/A sql -- Retrieve all tile details for specified tile range
select
  tile_type_id,
  x_index,
  y_index,            
  start_datetime, 
  end_datetime, 
  satellite_tag,
  sensor_name, 
  tile_pathname,
  x_ref as path,
  y_ref as start_row, 
  case when tile_class_id = 4 then y_ref + 1 else y_ref end as end_row, -- This will not work for mosaics with >2 source tiles
  level_name,
  nodata_value,
  gcp_count,
  cloud_cover
  
from acquisition
join dataset using(acquisition_id)
join tile using(dataset_id)
join satellite using(satellite_id)
join sensor using(satellite_id, sensor_id)
join processing_level using(level_id)

where (tile_class_id = 1 or tile_class_id = 4) -- Only good non-overlapped and mosaic tiles N/A N/A params N/A tile_type_ids N/A N/A sql 
  and tile_type_id in %(tile_type_ids)s N/A N/A params N/A tile_indices N/A N/A sql 
  and (x_index, y_index) in %(tile_indices)s N/A N/A params N/A satellites N/A N/A sql 
  and satellite_tag in %(satellites)s N/A N/A params N/A sensors N/A N/A sql 
  and sensor_name in %(sensors)s N/A N/A params N/A x_refs N/A N/A sql 
  and x_ref in %(x_refs)s N/A N/A params N/A y_refs N/A N/A sql 
  and y_ref in %(y_refs)s N/A sql   
  and (%(start_datetime)s is null or start_datetime >= %(start_datetime)s)
  and (%(end_datetime)s is null or end_datetime < %(end_datetime)s)
order by
  tile_type_id,
  x_index, 
  y_index,
  start_datetime, 
  end_datetime, 
  level_name,
  satellite_tag, 
  sensor_name;
 N/A N/A log_multiline N/A logger debug N/A N/A db_cursor2 mogrify sql params SQL N/A N/A N/A db_cursor2 execute sql params N/A stack_info_dict N/A N/A record db_cursor2 N/A N/A record No data found for this tile and temporal range N/A tile_info N/A tile_type_id x_index y_index start_datetime end_datetime satellite_tag sensor_name tile_pathname path start_row end_row level_name nodata_value gcp_count cloud_cover N/A record N/A 0 N/A record N/A 1 N/A record N/A 2 N/A record N/A 3 N/A record N/A 4 N/A record N/A 5 N/A record N/A 6 N/A record N/A 7 N/A record N/A 8 N/A record N/A 9 N/A record N/A 10 N/A record N/A 11 N/A record N/A 12 N/A record N/A 13 N/A record N/A 14 N/A N/A N/A N/A os path exists N/A tile_info N/A tile_pathname N/A File for tile %s does not exist N/A tile_info N/A tile_pathname N/A timeslice_dict N/A N/A N/A stack_info_dict get N/A tile_info N/A start_datetime N/A N/A N/A timeslice_dict N/A N/A N/A stack_info_dict N/A N/A tile_info N/A start_datetime timeslice_dict N/A level_dict N/A N/A N/A timeslice_dict get N/A tile_info N/A level_name N/A N/A N/A level_dict N/A N/A level_dict tile_info N/A N/A timeslice_dict N/A N/A tile_info N/A level_name level_dict N/A N/A log_multiline N/A logger debug stack_info_dict stack_info_dict N/A N/A N/A logger debug stack_info_dict has %s timeslices N/A len stack_info_dict N/A disregard_incomplete_data N/A N/A stack_info_dict N/A start_datetime N/A stack_info_dict N/A start_datetime N/A start_datetime N/A N/A stack_info_dict keys N/A N/A N/A L1T ORTHO N/A set N/A N/A N/A stack_info_dict N/A start_datetime keys N/A N/A NBAR PQA N/A set N/A N/A N/A stack_info_dict N/A start_datetime keys N/A N/A N/A logger debug stack_info_dict has %s timeslices after removal of incomplete datasets N/A len stack_info_dict N/A stack_output_dir N/A N/A N/A N/A self create_directory stack_output_dir N/A create_band_stacks N/A N/A band_stack_dict N/A N/A start_datetime N/A sorted N/A N/A stack_info_dict keys N/A N/A N/A N/A logger debug start_datetime = %s start_datetime N/A timeslice_dict N/A stack_info_dict N/A start_datetime N/A N/A log_multiline N/A logger debug timeslice_dict timeslice_dict N/A tile_info N/A N/A N/A timeslice_dict values N/A 0 N/A N/A log_multiline N/A logger debug N/A self band_lookup_dict self.band_lookup_dict N/A band_lookup_dict N/A N/A N/A N/A self band_lookup_dict N/A N/A tile_info N/A tile_type_id N/A N/A tile_info N/A satellite_tag N/A N/A tile_info N/A sensor_name N/A N/A log_multiline N/A logger debug band_lookup_dict band_lookup_dict N/A derived_band_dict N/A N/A key N/A 1 N/A N/A N/A self bands N/A N/A tile_info N/A tile_type_id N/A key N/A key N/A N/A N/A N/A self bands N/A N/A tile_info N/A tile_type_id keys N/A N/A key N/A 0 DERIVED N/A N/A log_multiline N/A logger debug derived_band_dict derived_band_dict N/A derived_band_dict N/A level_name N/A N/A value N/A band_tag value N/A value N/A N/A N/A derived_band_dict N/A level_name values N/A level_name N/A N/A derived_band_dict keys N/A N/A log_multiline N/A logger debug derived_band_dict modified derived_band_dict N/A N/A N/A band_lookup_dict update derived_band_dict N/A N/A log_multiline N/A logger debug band_lookup_dict modified band_lookup_dict N/A level_name N/A sorted N/A N/A timeslice_dict keys N/A N/A N/A N/A logger debug level_name = %s level_name N/A level_band_dict N/A N/A band_lookup_dict get level_name N/A N/A log_multiline N/A logger debug level_band_dict level_band_dict N/A N/A level_band_dict N/A N/A N/A tile_info_dict N/A timeslice_dict N/A level_name N/A band_tag level_band_dict N/A N/A band_tile_info N/A start_datetime N/A dict tile_info_dict N/A N/A N/A N/A band_tile_info N/A start_datetime update N/A level_band_dict N/A band_tag N/A band_tile_dict N/A N/A band_stack_dict get N/A N/A tile_info_dict N/A tile_type_id N/A tile_info_dict N/A x_index N/A tile_info_dict N/A y_index level_name band_tag N/A N/A band_tile_dict N/A N/A N/A band_stack_dict N/A N/A N/A tile_info_dict N/A tile_type_id N/A tile_info_dict N/A x_index N/A tile_info_dict N/A y_index level_name band_tag band_tile_info N/A N/A N/A N/A band_tile_dict update band_tile_info N/A N/A log_multiline N/A logger debug band_stack_dict band_stack_dict N/A N/A tile_type_id x_index y_index level_name band_tag N/A N/A band_stack_dict keys N/A N/A file_stack_dict N/A band_stack_dict N/A N/A tile_type_id x_index y_index level_name band_tag N/A stack_filename N/A N/A N/A os path join stack_output_dir N/A N/A N/A _ join N/A level_name N/A N/A re sub \+ N/A %+04d_%+04d N/A x_index y_index band_tag .vrt N/A N/A N/A logger debug stack_filename = %s stack_filename N/A template_dataset N/A N/A gdal Open N/A N/A N/A N/A file_stack_dict values N/A 0 N/A tile_pathname N/A raster_size N/A x y N/A template_dataset RasterXSize N/A template_dataset RasterYSize N/A block_size N/A dict N/A zip N/A x y N/A N/A N/A N/A template_dataset GetRasterBand 1 GetBlockSize N/A gdal_driver N/A N/A gdal GetDriverByName VRT N/A gdal_dtype N/A N/A N/A template_dataset GetRasterBand 1 DataType N/A dtype_name N/A N/A gdal GetDataTypeName gdal_dtype N/A vrt_dataset N/A N/A gdal_driver Create stack_filename N/A raster_size N/A x N/A raster_size N/A y 0 N/A N/A N/A vrt_dataset SetGeoTransform N/A N/A template_dataset GetGeoTransform N/A N/A N/A vrt_dataset SetProjection N/A N/A template_dataset GetProjection N/A template_dataset N/A start_datetime N/A sorted N/A N/A file_stack_dict keys N/A N/A tile_info N/A file_stack_dict N/A start_datetime N/A N/A N/A vrt_dataset AddBand gdal_dtype N/A output_band N/A N/A vrt_dataset GetRasterBand N/A vrt_dataset RasterCount N/A complex_source N/A N/A N/A N/A N/A N/A N/A <ComplexSource> N/A <SourceFilename relativeToVRT="0">%s</SourceFilename> N/A tile_info N/A tile_pathname N/A <SourceBand>%i</SourceBand> N/A tile_info N/A tile_layer N/A <SourceProperties RasterXSize="%i" RasterYSize="%i" DataType="%s" BlockXSize="%i" BlockYSize="%i"/> N/A N/A raster_size N/A x N/A raster_size N/A y dtype_name N/A block_size N/A x N/A block_size N/A y N/A <SrcRect xOff="%i" yOff="%i" xSize="%i" ySize="%i"/> N/A 0 0 N/A raster_size N/A x N/A raster_size N/A y N/A <DstRect xOff="%i" yOff="%i" xSize="%i" ySize="%i"/> N/A 0 0 N/A raster_size N/A x N/A raster_size N/A y N/A N/A N/A tile_info N/A nodata_value None N/A <NODATA>%d</NODATA> N/A tile_info N/A nodata_value </ComplexSource> N/A N/A log_multiline N/A logger debug complex_source complex_source N/A N/A N/A output_band SetMetadataItem source_0 complex_source new_vrt_sources N/A N/A N/A output_band SetMetadata N/A key N/A str N/A tile_info N/A key N/A key N/A N/A tile_info keys N/A N/A N/A tile_info N/A nodata_value None N/A N/A N/A N/A output_band SetNoDataValue N/A tile_info N/A nodata_value N/A stack_info_dict N/A get_pqa_mask N/A N/A self pqa_dataset_path good_pixel_masks dilation N/A N/A 32767 16383 2457 3 N/A N/A pqa_gdal_dataset N/A N/A gdal Open pqa_dataset_path N/A pqa_gdal_dataset N/A Unable to open PQA GeoTIFF file %s pqa_dataset_path N/A pqa_array N/A N/A N/A N/A pqa_gdal_dataset GetRasterBand 1 ReadAsArray N/A pqa_gdal_dataset N/A N/A log_multiline N/A logger debug pqa_array pqa_array N/A pqa_array N/A pqa_array 64 N/A s N/A N/A 1 1 1 N/A 1 1 1 N/A 1 1 1 N/A acca N/A N/A pqa_array 1024 10 N/A erode N/A N/A ndimage binary_erosion acca s iterations dilation border_value 1 N/A dif N/A erode acca N/A N/A dif N/A N/A dif 0 1 N/A pqa_array N/A dif 10 N/A acca N/A fmask N/A N/A pqa_array 2048 11 N/A erode N/A N/A ndimage binary_erosion fmask s iterations dilation border_value 1 N/A dif N/A erode fmask N/A N/A dif N/A N/A dif 0 1 N/A pqa_array N/A dif 11 N/A fmask N/A acca_shad N/A N/A pqa_array 4096 12 N/A erode N/A N/A ndimage binary_erosion acca_shad s iterations dilation border_value 1 N/A dif N/A erode acca_shad N/A N/A dif N/A N/A dif 0 1 N/A pqa_array N/A dif 12 N/A acca_shad N/A fmask_shad N/A N/A pqa_array 8192 13 N/A erode N/A N/A ndimage binary_erosion fmask_shad s iterations dilation border_value 1 N/A dif N/A erode fmask_shad N/A N/A dif N/A N/A dif 0 1 N/A pqa_array N/A dif 13 N/A pqa_mask N/A N/A numpy zeros N/A pqa_array shape dtype N/A numpy bool N/A good_pixel_mask good_pixel_masks N/A N/A N/A pqa_mask N/A N/A pqa_array good_pixel_mask True N/A pqa_mask N/A apply_pqa_mask N/A N/A self data_array pqa_mask no_data_value N/A N/A N/A N/A N/A len N/A data_array shape 2 apply_pqa_mask can only be applied to 2D arrays N/A N/A N/A data_array shape N/A pqa_mask shape Mis-matched data_array and pqa_mask N/A N/A data_array N/A N/A pqa_mask no_data_value N/A get_static_info N/A N/A self level_name x_index y_index tile_type_id N/A None None None None N/A N/A Retrieve static (i.e. not time varying) data for specified processing level(s) (e.g. 'DSM') N/A x_index N/A x_index N/A self x_index N/A y_index N/A y_index N/A self y_index N/A tile_type_id N/A tile_type_id N/A self default_tile_type_id N/A db_cursor2 N/A N/A N/A self db_connection cursor N/A sql -- Retrieve all tile details for static data
select distinct
  level_name,
  dataset_path,
  tile_pathname
from dataset
inner join processing_level using(level_id)
inner join tile t using (dataset_id)
inner join tile_footprint tf using (x_index, y_index, tile_type_id)
where tile_type_id = %(tile_type_id)s
  and tile_class_id = 1 -- Select only valid tiles
  and (%(level_name)s is null or level_name = %(level_name)s)
  and x_index = %(x_index)s
  and y_index = %(y_index)s
  and acquisition_id is null -- No acquisition for static data
order by
  level_name, 
  dataset_path;
 N/A params N/A level_name x_index y_index tile_type_id level_name x_index y_index tile_type_id N/A N/A log_multiline N/A logger debug N/A N/A db_cursor2 mogrify sql params SQL N/A N/A N/A db_cursor2 execute sql params N/A static_info_dict N/A N/A last_level_name N/A record db_cursor2 N/A N/A static_data N/A level_name dataset_path tile_pathname N/A record N/A 0 N/A record N/A 1 N/A record N/A 2 N/A N/A N/A static_data N/A level_name last_level_name N/A Duplicate data source found for level %s N/A static_data N/A level_name N/A band_info N/A N/A N/A N/A self bands N/A tile_type_id get N/A DERIVED N/A static_data N/A level_name N/A N/A static_info_dict N/A N/A static_data N/A level_name N/A level_name nodata_value tile_pathname x_index y_index N/A static_data N/A level_name N/A N/A N/A N/A band_info values N/A 0 N/A nodata_value N/A static_data N/A tile_pathname x_index y_index N/A static_info_dict N/A stack_derived N/A N/A self x_index y_index stack_output_dir start_datetime end_datetime satellite sensor tile_type_id create_stacks N/A None None None None None True N/A N/A tile_type_id N/A tile_type_id N/A self default_tile_type_id N/A tile_type_info N/A N/A self tile_type_dict N/A tile_type_id N/A stack_output_info N/A x_index y_index stack_output_dir start_datetime end_datetime satellite sensor x_index y_index stack_output_dir start_datetime end_datetime satellite sensor N/A stack_info_dict N/A N/A self stack_tile x_index x_index y_index y_index stack_output_dir stack_output_dir start_datetime start_datetime end_datetime end_datetime satellite satellite sensor sensor tile_type_id None create_band_stacks False disregard_incomplete_data False N/A N/A N/A logger debug self.stack_tile(x_index=%s, y_index=%s, stack_output_dir=%s, start_datetime=%s, end_datetime=%s, satellite=%s, sensor=%s, tile_type_id=%s, create_band_stacks=%s, disregard_incomplete_data=%s) called x_index y_index stack_output_dir start_datetime end_datetime satellite sensor None False False N/A N/A log_multiline N/A logger debug stack_info_dict stack_info_dict N/A static_info_dict N/A N/A self get_static_info level_name None x_index x_index y_index y_index N/A N/A log_multiline N/A logger debug static_info_dict static_info_dict N/A start_datetimes N/A sorted N/A N/A stack_info_dict keys N/A derived_stack_dict N/A N/A start_datetime start_datetimes N/A N/A input_dataset_dict N/A dict N/A stack_info_dict N/A start_datetime N/A N/A N/A input_dataset_dict update static_info_dict N/A output_dataset_info N/A N/A self derive_datasets input_dataset_dict stack_output_info tile_type_info N/A N/A output_dataset_info None N/A N/A output_stack_path output_dataset_info N/A N/A stack_list N/A N/A derived_stack_dict get output_stack_path N/A N/A N/A stack_list N/A N/A N/A derived_stack_dict N/A output_stack_path stack_list N/A N/A N/A stack_list append N/A output_dataset_info N/A output_stack_path N/A N/A log_multiline N/A logger debug derived_stack_dict derived_stack_dict N/A create_stacks N/A N/A output_stack_path N/A sorted N/A N/A derived_stack_dict keys N/A N/A N/A N/A N/A N/A os path exists output_stack_path N/A N/A self refresh N/A N/A N/A N/A logger info Skipped existing stack file %s output_stack_path N/A N/A N/A N/A self lock_object output_stack_path N/A N/A N/A N/A logger debug Creating temporal stack %s output_stack_path N/A N/A N/A self stack_files timeslice_info_list N/A derived_stack_dict N/A output_stack_path stack_dataset_path output_stack_path band1_vrt_path None overwrite True N/A N/A N/A self unlock_object output_stack_path N/A N/A N/A logger info VRT stack file %s created output_stack_path N/A derived_stack_dict N/A derive_datasets N/A N/A self input_dataset_dict stack_output_info tile_type_info N/A N/A N/A  Abstract function for calling in stack_derived() function. Should be overridden
        in a descendant class.
        
        Arguments:
            input_dataset_dict: Dict keyed by processing level (e.g. ORTHO, NBAR, PQA, DEM)
                containing all tile info which can be used within the function
                A sample is shown below (including superfluous band-specific information):
                
{
'NBAR': {'band_name': 'Visible Blue',
    'band_tag': 'B10',
    'end_datetime': datetime.datetime(2000, 2, 9, 23, 46, 36, 722217),
    'end_row': 77,
    'level_name': 'NBAR',
    'nodata_value': -999L,
    'path': 91,
    'satellite_tag': 'LS7',
    'sensor_name': 'ETM+',
    'start_datetime': datetime.datetime(2000, 2, 9, 23, 46, 12, 722217),
    'start_row': 77,
    'tile_layer': 1,
    'tile_pathname': '/g/data/v10/datacube/EPSG4326_1deg_0.00025pixel/LS7_ETM/150_-025/2000/LS7_ETM_NBAR_150_-025_2000-02-09T23-46-12.722217.tif',
    'x_index': 150,
    'y_index': -25},
'ORTHO': {'band_name': 'Thermal Infrared (Low Gain)',
     'band_tag': 'B61',
     'end_datetime': datetime.datetime(2000, 2, 9, 23, 46, 36, 722217),
     'end_row': 77,
     'level_name': 'ORTHO',
     'nodata_value': 0L,
     'path': 91,
     'satellite_tag': 'LS7',
     'sensor_name': 'ETM+',
     'start_datetime': datetime.datetime(2000, 2, 9, 23, 46, 12, 722217),
     'start_row': 77,
     'tile_layer': 1,
     'tile_pathname': '/g/data/v10/datacube/EPSG4326_1deg_0.00025pixel/LS7_ETM/150_-025/2000/LS7_ETM_ORTHO_150_-025_2000-02-09T23-46-12.722217.tif',
     'x_index': 150,
     'y_index': -25},
'PQA': {'band_name': 'Pixel Quality Assurance',
    'band_tag': 'PQA',
    'end_datetime': datetime.datetime(2000, 2, 9, 23, 46, 36, 722217),
    'end_row': 77,
    'level_name': 'PQA',
    'nodata_value': None,
    'path': 91,
    'satellite_tag': 'LS7',
    'sensor_name': 'ETM+',
    'start_datetime': datetime.datetime(2000, 2, 9, 23, 46, 12, 722217),
    'start_row': 77,
    'tile_layer': 1,
    'tile_pathname': '/g/data/v10/datacube/EPSG4326_1deg_0.00025pixel/LS7_ETM/150_-025/2000/LS7_ETM_PQA_150_-025_2000-02-09T23-46-12.722217.tif,
    'x_index': 150,
    'y_index': -25}
}                
                
        Arguments (Cont'd):
            stack_output_info: dict containing stack output information. 
                Obtained from stacker object. 
                A sample is shown below
                
stack_output_info = {'x_index': 144, 
                      'y_index': -36,
                      'stack_output_dir': '/g/data/v10/tmp/ndvi',
                      'start_datetime': None, # Datetime object or None
                      'end_datetime': None, # Datetime object or None 
                      'satellite': None, # String or None 
                      'sensor': None} # String or None 
                      
        Arguments (Cont'd):
            tile_type_info: dict containing tile type information. 
                Obtained from stacker object (e.g: stacker.tile_type_dict[tile_type_id]).
                A sample is shown below
                
    {'crs': 'EPSG:4326',
    'file_extension': '.tif',
    'file_format': 'GTiff',
    'format_options': 'COMPRESS=LZW,BIGTIFF=YES',
    'tile_directory': 'EPSG4326_1deg_0.00025pixel',
    'tile_type_id': 1L,
    'tile_type_name': 'Unprojected WGS84 1-degree at 4000 pixels/degree',
    'unit': 'degree',
    'x_origin': 0.0,
    'x_pixel_size': Decimal('0.00025000000000000000'),
    'x_pixels': 4000L,
    'x_size': 1.0,
    'y_origin': 0.0,
    'y_pixel_size': Decimal('0.00025000000000000000'),
    'y_pixels': 4000L,
    'y_size': 1.0}
                            
        Function must create one or more GDAL-supported output datasets. Useful functions in the
        Stacker class include Stacker.get_pqa_mask(), but it is left to the coder to produce exactly
        what is required for a single slice of the temporal stack of derived quantities.
            
        Returns:
            output_dataset_info: Dict keyed by stack filename
                containing metadata info for GDAL-supported output datasets created by this function.
                Note that the key(s) will be used as the output filename for the VRT temporal stack
                and each dataset created must contain only a single band. An example is as follows:
{'/g/data/v10/tmp/ndvi/NDVI_stack_150_-025.vrt': 
    {'band_name': 'Normalised Differential Vegetation Index with PQA applied',
    'band_tag': 'NDVI',
    'end_datetime': datetime.datetime(2000, 2, 9, 23, 46, 36, 722217),
    'end_row': 77,
    'level_name': 'NDVI',
    'nodata_value': None,
    'path': 91,
    'satellite_tag': 'LS7',
    'sensor_name': 'ETM+',
    'start_datetime': datetime.datetime(2000, 2, 9, 23, 46, 12, 722217),
    'start_row': 77,
    'tile_layer': 1,
    'tile_pathname': '/g/data/v10/tmp/ndvi/LS7_ETM_NDVI_150_-025_2000-02-09T23-46-12.722217.tif',
    'x_index': 150,
    'y_index': -25}
}
                
                
         N/A N/A N/A type input_dataset_dict dict input_dataset_dict must be a dict N/A N/A log_multiline N/A logger debug input_dataset_dict input_dataset_dict N/A output_dataset_dict N/A N/A input_level N/A NBAR ORTHO N/A N/A input_dataset_info N/A input_dataset_dict N/A input_level N/A input_path N/A input_dataset_info N/A tile_pathname N/A band_dict N/A N/A N/A self bands N/A N/A tile_type_info N/A tile_type_id N/A N/A N/A input_dataset_info N/A satellite_tag N/A input_dataset_info N/A sensor_name N/A band_info_list N/A N/A band_dict N/A tile_layer N/A tile_layer N/A sorted N/A N/A band_dict keys N/A N/A N/A band_dict N/A tile_layer N/A level_name input_level N/A pqa_mask N/A N/A self get_pqa_mask N/A N/A input_dataset_dict N/A PQA N/A tile_pathname N/A input_dataset N/A N/A gdal Open input_path N/A input_dataset N/A Unable to open dataset %s input_dataset N/A no_data_value N/A input_dataset_info N/A nodata_value N/A band_index N/A range N/A input_dataset RasterCount N/A N/A output_stack_path N/A N/A N/A os path join N/A self output_dir N/A %s_%s_pqa_masked.vrt N/A input_level N/A N/A band_info_list N/A band_index N/A band_tag N/A output_tile_path N/A N/A N/A os path join N/A self output_dir N/A N/A re sub \.\w+$ N/A _%s%s N/A N/A N/A band_info_list N/A band_index N/A band_tag N/A tile_type_info N/A file_extension N/A N/A N/A os path basename input_path N/A output_dataset_info N/A dict input_dataset_info N/A N/A output_dataset_info N/A tile_pathname output_tile_path N/A N/A output_dataset_info N/A band_name N/A %s with PQA mask applied N/A N/A band_info_list N/A band_index N/A band_name N/A N/A output_dataset_info N/A band_tag N/A %s-PQA N/A N/A band_info_list N/A band_index N/A band_tag N/A N/A output_dataset_info N/A tile_layer 1 N/A N/A N/A self refresh N/A N/A N/A N/A os path exists output_tile_path N/A N/A N/A gdal Open output_tile_path N/A N/A N/A N/A self lock_object output_tile_path N/A N/A input_band N/A N/A input_dataset GetRasterBand N/A band_index 1 N/A gdal_driver N/A N/A gdal GetDriverByName N/A tile_type_info N/A file_format N/A output_dataset N/A N/A gdal_driver Create output_tile_path N/A input_dataset RasterXSize N/A input_dataset RasterYSize 1 N/A input_band DataType N/A N/A N/A tile_type_info N/A format_options split , N/A output_dataset N/A Unable to open output dataset %s output_dataset N/A N/A N/A output_dataset SetGeoTransform N/A N/A input_dataset GetGeoTransform N/A N/A N/A output_dataset SetProjection N/A N/A input_dataset GetProjection N/A output_band N/A N/A output_dataset GetRasterBand 1 N/A data_array N/A N/A input_band ReadAsArray N/A N/A N/A self apply_pqa_mask data_array pqa_mask no_data_value N/A N/A N/A output_band WriteArray data_array N/A N/A N/A output_band SetNoDataValue no_data_value N/A N/A N/A output_band FlushCache N/A output_dataset_metadata N/A N/A input_dataset GetMetadata N/A N/A N/A output_dataset_metadata update N/A N/A input_band GetMetadata N/A output_dataset_metadata N/A N/A N/A N/A output_dataset SetMetadata output_dataset_metadata N/A N/A log_multiline N/A logger debug output_dataset_metadata output_dataset_metadata N/A N/A N/A output_dataset FlushCache N/A N/A N/A self unlock_object output_tile_path N/A N/A N/A logger info Finished writing dataset %s output_tile_path N/A N/A N/A N/A logger info Skipped locked dataset %s output_tile_path N/A N/A sleep 5 N/A N/A N/A N/A logger info Skipped existing, valid dataset %s output_tile_path N/A N/A output_dataset_dict N/A output_stack_path output_dataset_info N/A N/A log_multiline N/A logger debug output_dataset_dict output_dataset_dict N/A output_dataset_dict N/A N/A N/A N/A __name__ __main__ N/A date2datetime N/A N/A input_date time_offset N/A N/A time min N/A N/A N/A input_date N/A N/A None N/A N/A N/A datetime combine input_date time_offset N/A N/A stacker N/A Stacker N/A N/A stacker x_index Tile X-index not specified (-x or --x_index) N/A N/A stacker y_index Tile Y-index not specified (-y or --y_index) N/A N/A stacker output_dir Output directory not specified (-o or --output) N/A N/A N/A N/A os path isdir N/A stacker output_dir Invalid output directory specified (-o or --output) N/A N/A stacker output_dir N/A N/A N/A os path abspath N/A stacker output_dir N/A N/A log_multiline N/A logger debug N/A stacker __dict__ stacker.__dict__ N/A stack_info_dict N/A N/A stacker stack_tile x_index N/A stacker x_index y_index N/A stacker y_index stack_output_dir N/A stacker output_dir start_datetime N/A date2datetime N/A stacker start_date N/A time min end_datetime N/A date2datetime N/A stacker end_date N/A time max satellite N/A stacker satellite sensor N/A stacker sensor path N/A stacker path row N/A stacker row tile_type_id None create_band_stacks True disregard_incomplete_data False N/A N/A log_multiline N/A logger debug stack_info_dict stack_info_dict N/A N/A N/A logger info Finished creating %d temporal stack files in %s. N/A len stack_info_dict N/A stacker output_dir