nasa / CrisisMappingToolkit

NASA Ames Crisis Mapping Toolkit
Apache License 2.0
190 stars 78 forks source link

AttributeError #14

Closed nanotyrannus closed 8 years ago

nanotyrannus commented 8 years ago

I'm trying to run the DNNS algorithm on one of the example domains.

from cmt import ee_authenticate
ee_authenticate.initialize()
from cmt import domain
from cmt.modis import flood_algorithms

d = domain.Domain()
d.load_xml("config/domains/modis/corrientes_2014_7.xml")
print flood_algorithms.detect_flood(d, 7)

However, I get this exception.

[...]
Loading band: swir1                                                                                                            
Loading band: swir2                                                                                                            
Loading band: pan                                                                                                              
Loading band: cirrus                                                                                                           
Loading band: temp                                                                                                             
Loading band: temp2                                                                                                            
Loaded sensor: landsat8                                                                                                        
Traceback (most recent call last):                                                                                             
  File "test.py", line 8, in <module>                                                                                          
    print flood_algorithms.detect_flood(d, 7)                                                                                  
  File "/home/ryan/Desktop/cmt/CrisisMappingToolkit/cmt/modis/flood_algorithms.py", line 100, in detect_flood                  
    return (approach[0], approach[1](domain, compute_modis_indices(domain)))                                                   
  File "/home/ryan/Desktop/cmt/CrisisMappingToolkit/cmt/modis/dnns.py", line 82, in dnns                                       
    classes   = ee_classifiers.earth_engine_classifier(domain, b, 'Pegasos', {'classifier_mode' : 'probability'})              
  File "/home/ryan/Desktop/cmt/CrisisMappingToolkit/cmt/modis/ee_classifiers.py", line 158, in earth_engine_classifier         
    classifier = ee.apply("TrainClassifier", args)  # Call the EE classifier                                                   
  File "/usr/lib/python2.7/site-packages/earthengine_api-0.1.97-py2.7.egg/ee/_helpers.py", line 98, in apply                   
    return func.apply(named_args)                                                                                              
AttributeError: 'NoneType' object has no attribute 'apply'  
bcoltin commented 8 years ago

Looks like a recent change to the google earth engine api removed the trainclassifier function. Please pull and try again. If you have an old version of the ee python api you may need to update that as well.

Thank you for bringing this to our attention!