<s> import logging <EOL> logging . basicConfig ( level = logging . ERROR ) <EOL> try : <EOL> import cmt . ee_authenticate <EOL> except : <EOL> import sys <EOL> import os . path <EOL> sys . path . append ( os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , '<STR_LIT:..>' ) ) <EOL> import cmt . ee_authenticate <EOL> import matplotlib <EOL> import sys <EOL> import os <EOL> import ee <EOL> import functools <EOL> import cmt . domain <EOL> from cmt . modis . flood_algorithms import * <EOL> from cmt . mapclient_qt import centerMap , addToMap <EOL> import cmt . util . evaluation <EOL> import cmt . util . gui_util <EOL> '''<STR_LIT>''' <EOL> ALGORITHMS = [ DIFFERENCE , EVI , XIAO , ADABOOST ] <EOL> def evaluation_function ( pair , alg ) : <EOL> '''<STR_LIT>''' <EOL> ( precision , recall , evalRes , noTruth ) = pair <EOL> print '<STR_LIT>' % ( get_algorithm_name ( alg ) , precision , recall , noTruth ) <EOL> if len ( sys . argv ) < <NUM_LIT:2> : <EOL> print '<STR_LIT>' <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> cmt . ee_authenticate . initialize ( ) <EOL> domain = cmt . domain . Domain ( ) <EOL> domain . load_xml ( sys . argv [ <NUM_LIT:1> ] ) <EOL> cmt . util . gui_util . visualizeDomain ( domain ) <EOL> waterMask = ee . Image ( "<STR_LIT>" ) . select ( [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> addToMap ( waterMask . mask ( waterMask ) , { '<STR_LIT>' : <NUM_LIT:0> , '<STR_LIT>' : <NUM_LIT:1> } , '<STR_LIT>' , False ) <EOL> for a in range ( len ( ALGORITHMS ) ) : <EOL> try : <EOL> ( alg , result ) = detect_flood ( domain , ALGORITHMS [ a ] ) <EOL> if result is None : <EOL> continue <EOL> color = get_algorithm_color ( ALGORITHMS [ a ] ) <EOL> addToMap ( result . mask ( result ) , { '<STR_LIT>' : <NUM_LIT:0> , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : <NUM_LIT:0.5> , '<STR_LIT>' : '<STR_LIT>' + color } , <EOL> alg , False ) <EOL> if domain . ground_truth : <EOL> cmt . util . evaluation . evaluate_approach_thread ( functools . partial ( <EOL> evaluation_function , alg = ALGORITHMS [ a ] ) , result , domain . ground_truth , domain . bounds , <EOL> is_algorithm_fractional ( ALGORITHMS [ a ] ) ) <EOL> except Exception , e : <EOL> print ( '<STR_LIT>' + get_algorithm_name ( ALGORITHMS [ a ] ) + '<STR_LIT:\n>' + <EOL> str ( e ) + '<STR_LIT:\n>' ) </s>
