Module Expr Str Import alias alias ImportFrom alias ImportFrom alias 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 Expr Str Assign NameStore Dict Assign NameStore Dict FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad Num NameLoad NameLoad NameLoad body Expr Str Assert Call NameLoad NameLoad NameLoad Str Assert BoolOpOr UnaryOpNot NameLoad CompareEq Call NameLoad NameLoad NameLoad Str Assert BoolOpOr UnaryOpNot NameLoad CompareIn Call NameLoad NameLoad TupleLoad NameLoad NameLoad Str Assert BoolOpOr UnaryOpNot NameLoad CompareEq Call NameLoad NameLoad NameLoad Str Assert BoolOpOr UnaryOpNot NameLoad CompareEq Call NameLoad NameLoad NameLoad Str Assert BoolOpOr UnaryOpNot NameLoad CompareEq Call NameLoad NameLoad NameLoad Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If UnaryOpNot AttributeLoad NameLoad attr body Assign NameStore Str Expr Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Num If CompareIs NameLoad NameLoad body Assign NameStore Dict Assign SubscriptStore AttributeLoad NameLoad attr Index SubscriptLoad NameLoad Index Num NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num If CompareIs NameLoad NameLoad body Assign NameStore Dict Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num If CompareIs NameLoad NameLoad body Assign NameStore Dict Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num If CompareIs NameLoad NameLoad body Assign NameStore Dict Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num If CompareIs NameLoad NameLoad body Assign NameStore Dict Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Num NameLoad Assert CompareIs Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num NameLoad Str Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Num 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 Expr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assert AttributeLoad NameLoad attr Str Assert AttributeLoad NameLoad attr Str Assert AttributeLoad NameLoad attr Str Assert AttributeLoad NameLoad attr Str Assert AttributeLoad NameLoad attr Str TryExcept body Assign NameStore SubscriptLoad SubscriptLoad SubscriptLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Assign NameStore Dict Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Return Call NameLoad ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr keyword Lambda arguments args NameParam defaults SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Return Call NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Return DictComp NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str comprehension NameStore NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Return DictComp NameLoad BinOpSub SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str Num comprehension NameStore NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Return DictComp NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str comprehension NameStore NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Return DictComp NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str comprehension NameStore NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad AttributeLoad NameLoad attr decorator_list NameLoad decorator_list
N/A N/A 
Created on 09/09/2014

@author: u76345
 N/A sys logging EOtools.utils log_multiline agdc DataCube 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 BandLookup N/A object N/A N/A 
    Class BandLookup manages band equivalence with band_tag lookups for a given set of
    lookup_scheme_name, tile_type_id, satellite_tag, sensor_name & level_name values
     N/A _band_lookup_dict N/A N/A _lookup_schemes N/A __init__ N/A N/A self data_cube lookup_scheme_name tile_type_id satellite_tag sensor_name level_name N/A None 1 None None None N/A N/A 
        Constructor for BandLookup class
        Parameters (can all be set later with the exception of data_cube):
             data_cube: Parent data_cube (or descendant) object 
             lookup_scheme_name: lookup scheme name. Needs to be a member of self.lookup_schemes 
             tile_type_id: Tile Type identifier. Defaults to 1 - should this be None?
             satellite_tag: Short name of satellite 
             sensor_name: Name of sensor
             level_name: Processing level name
         N/A N/A isinstance data_cube DataCube data_cube parameter must be of type DataCube N/A N/A N/A lookup_scheme_name N/A N/A type lookup_scheme_name str lookup_scheme_name parameter must be of type str N/A N/A N/A tile_type_id N/A N/A type tile_type_id N/A long int tile_type_id parameter must be of type long or int N/A N/A N/A satellite_tag N/A N/A type satellite_tag str satellite_tag parameter must be of type str N/A N/A N/A sensor_name N/A N/A type sensor_name str sensor_name parameter must be of type str N/A N/A N/A level_name N/A N/A type level_name str level_name parameter must be of type str N/A N/A data_cube debug N/A N/A N/A N/A console_handler setLevel N/A logging DEBUG N/A N/A self lookup_scheme_name lookup_scheme_name N/A N/A self tile_type_id tile_type_id N/A N/A self satellite_tag satellite_tag N/A N/A self sensor_name sensor_name N/A N/A self level_name level_name N/A N/A self db_connection N/A data_cube db_connection N/A db_cursor N/A N/A N/A self db_connection cursor N/A N/A N/A BandLookup _band_lookup_dict N/A N/A sql -- Retrieve all band equivalence information
 SELECT
    band_lookup_scheme.lookup_scheme_name,
    band_source.tile_type_id,
    coalesce(satellite.satellite_tag, 'DERIVED') as satellite_tag,
    coalesce(sensor_name, level_name) as sensor_name,
    processing_level.level_name,
    band_equivalent.master_band_tag,
    band_source.tile_layer,
    band_equivalent.nominal_centre::float,
    band_equivalent.nominal_bandwidth::float,
    band_equivalent.centre_tolerance::float,
    band_equivalent.bandwidth_tolerance::float,
    COALESCE(band_adjustment.adjustment_offset, 0.0)::float AS adjustment_offset,
    COALESCE(band_adjustment.adjustment_multiplier, 1.0)::float AS adjustment_multiplier,
    band_lookup_scheme.lookup_scheme_id,
    band.satellite_id,
    band.sensor_id,
    band.band_id,
    band_equivalent.master_band_name,
    band_type_name,
    band.min_wavelength::float,
    band.max_wavelength::float,
    band_lookup_scheme.lookup_scheme_description
   FROM band
   JOIN band_type using(band_type_id)
   JOIN band_source using (band_id)
   JOIN processing_level using(level_id)
   JOIN band_equivalent ON band_equivalent.band_type_id = band.band_type_id
     and abs((band.max_wavelength::numeric + band.min_wavelength::numeric) / 2.0 - band_equivalent.nominal_centre) <= band_equivalent.centre_tolerance 
     AND abs(band.max_wavelength::numeric - band.min_wavelength::numeric - band_equivalent.nominal_bandwidth) <= band_equivalent.bandwidth_tolerance
   JOIN band_lookup_scheme USING (lookup_scheme_id)
   LEFT JOIN band_adjustment USING (lookup_scheme_id, band_id)
   LEFT JOIN sensor using(satellite_id, sensor_id)
   LEFT JOIN satellite using(satellite_id)
   ORDER BY 1,2,3,4,5,7
 N/A N/A log_multiline N/A logger debug sql SQL N/A N/A N/A db_cursor execute sql N/A record db_cursor N/A N/A lookup_scheme_dict N/A N/A N/A BandLookup _band_lookup_dict get N/A record N/A 0 N/A N/A lookup_scheme_dict None N/A N/A lookup_scheme_dict N/A N/A N/A N/A BandLookup _band_lookup_dict N/A N/A record N/A 0 lookup_scheme_dict N/A N/A N/A BandLookup _lookup_schemes N/A N/A record N/A 0 N/A record N/A 21 N/A tile_type_id_dict N/A N/A lookup_scheme_dict get N/A record N/A 1 N/A N/A tile_type_id_dict None N/A N/A tile_type_id_dict N/A N/A N/A lookup_scheme_dict N/A N/A record N/A 1 tile_type_id_dict N/A satellite_tag_dict N/A N/A tile_type_id_dict get N/A record N/A 2 N/A N/A satellite_tag_dict None N/A N/A satellite_tag_dict N/A N/A N/A tile_type_id_dict N/A N/A record N/A 2 satellite_tag_dict N/A sensor_name_dict N/A N/A satellite_tag_dict get N/A record N/A 3 N/A N/A sensor_name_dict None N/A N/A sensor_name_dict N/A N/A N/A satellite_tag_dict N/A N/A record N/A 3 sensor_name_dict N/A level_name_dict N/A N/A sensor_name_dict get N/A record N/A 4 N/A N/A level_name_dict None N/A N/A level_name_dict N/A N/A N/A sensor_name_dict N/A N/A record N/A 4 level_name_dict N/A N/A N/A N/A level_name_dict get N/A record N/A 5 None Duplicated band_tag record N/A N/A level_name_dict N/A N/A record N/A 5 N/A tile_layer nominal_centre nominal_bandwidth centre_tolerance bandwidth_tolerance adjustment_offset adjustment_multiplier lookup_scheme_id satellite_id sensor_id band_id master_band_name band_type_name min_wavelength max_wavelength 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 record N/A 15 N/A record N/A 16 N/A record N/A 17 N/A record N/A 18 N/A record N/A 19 N/A record N/A 20 N/A N/A log_multiline N/A logger debug N/A BandLookup _band_lookup_dict BandLookup._band_lookup_dict N/A _get_level_name_dict N/A N/A self N/A N/A N/A 
        Returns level_name_dict for pre-set lookup_scheme_name, tile_type_id, satellite_tag, sensor_name & level_name
        Returns None if not found
         N/A N/A self lookup_scheme_name lookup_scheme_name not set N/A N/A self tile_type_id tile_type_id not set N/A N/A self satellite_tag satellite_tag not set N/A N/A self sensor_name sensor_name not set N/A N/A self level_name level_name not set N/A N/A N/A level_name_dict N/A N/A N/A N/A N/A N/A BandLookup _band_lookup_dict N/A N/A self lookup_scheme_name N/A N/A self tile_type_id N/A N/A self satellite_tag N/A N/A self sensor_name N/A N/A self level_name N/A N/A N/A KeyError N/A N/A level_name_dict N/A N/A level_name_dict N/A lookup_schemes N/A N/A self N/A N/A N/A 
        Returns a dict of available lookup_scheme descriptions keyed by lookup_scheme_name
         N/A N/A dict N/A BandLookup _lookup_schemes N/A property bands N/A N/A self N/A N/A N/A 
        Returns a list of band tags for the current lookup_scheme_name, tile_type_id, satellite_tag, sensor_name & level_name sorted by centre wavelength
         N/A level_name_dict N/A N/A self _get_level_name_dict N/A N/A sorted N/A band_tag N/A band_tag N/A N/A level_name_dict keys key N/A N/A N/A band_tag N/A N/A N/A level_name_dict N/A band_tag N/A nominal_centre N/A property band_info N/A N/A self N/A N/A N/A 
        Returns a nested dict keyed by band tag containing all info for each band for the current lookup_scheme_name, tile_type_id, satellite_tag, sensor_name & level_name 
         N/A level_name_dict N/A N/A self _get_level_name_dict N/A N/A dict level_name_dict N/A property band_no N/A N/A self N/A N/A N/A 
        Returns a dict keyed by band tag containing the one-based integer band number for each band_tag for the current lookup_scheme_name, tile_type_id, satellite_tag, sensor_name & level_name
         N/A level_name_dict N/A N/A self _get_level_name_dict N/A N/A band_tag N/A N/A level_name_dict N/A band_tag N/A tile_layer N/A band_tag level_name_dict N/A property band_index N/A N/A self N/A N/A N/A 
        Returns a dict keyed by band tag containing the zero-based integer band number for each band_tag for the current lookup_scheme_name, tile_type_id, satellite_tag, sensor_name & level_name
         N/A level_name_dict N/A N/A self _get_level_name_dict N/A N/A band_tag N/A N/A N/A level_name_dict N/A band_tag N/A tile_layer 1 N/A band_tag level_name_dict N/A property adjustment_offset N/A N/A self N/A N/A N/A 
        Returns a dict keyed by band tag containing the floating point adjustment offset for each band_tag for the current lookup_scheme_name, tile_type_id, satellite_tag, sensor_name & level_name
         N/A level_name_dict N/A N/A self _get_level_name_dict N/A N/A band_tag N/A N/A level_name_dict N/A band_tag N/A adjustment_offset N/A band_tag level_name_dict N/A property adjustment_multiplier N/A N/A self N/A N/A N/A 
        Returns a dict keyed by band tag containing the floating point adjustment multiplier for each band_tag for the current lookup_scheme_name, tile_type_id, satellite_tag, sensor_name & level_name
         N/A level_name_dict N/A N/A self _get_level_name_dict N/A N/A band_tag N/A N/A level_name_dict N/A band_tag N/A adjustment_multiplier N/A band_tag level_name_dict N/A property band_lookup_dict N/A N/A self N/A N/A N/A 
        Returns a copy of the class value _band_lookup_dict
         N/A N/A dict N/A BandLookup _band_lookup_dict N/A property N/A