Exemplo n.º 1
0
 def __init__(self, username, password):
     self.lmClient = LMClient(userId=username, pwd=password)
     self.epsgCode = 4326
     
     self.experimentBaseURL = "http://lifemapper.org/services/sdm/experiments/"
     self.layerBaseURL = "http://lifemapper.org/services/sdm/layers/"
     self.scenarioBaseURL = "http://lifemapper.org/services/sdm/scenarios/"
Exemplo n.º 2
0
def passwordSetAndUqiValue():
	'''This is userName and passwords and unique ID'''
	global cl
	#Setup your client ID and password in the file named password.py
	cl = LMClient(userId=userName, pwd=password)
	#Need to be an unique number within accout index
	uniqid = 'bf010'
	return uniqid
Exemplo n.º 3
0
def main():
    global cl
    cl = LMClient(userId=userName, pwd=password)

    path = "../views/experimentOutput/"
    if not os.path.exists(path):
        os.makedirs(path)

    experimentDict = loadExperiments()
    getExperimentAndProj(experimentDict, path)
Exemplo n.º 4
0
def main():
    global cl
    cl = LMClient(userId=userName, pwd=password)

    pickListOptions()
Exemplo n.º 5
0
class LifemapperClient:
    
    def __init__(self, username, password):
        self.lmClient = LMClient(userId=username, pwd=password)
        self.epsgCode = 4326
        
        self.experimentBaseURL = "http://lifemapper.org/services/sdm/experiments/"
        self.layerBaseURL = "http://lifemapper.org/services/sdm/layers/"
        self.scenarioBaseURL = "http://lifemapper.org/services/sdm/scenarios/"

    def postLayer(self, tiffURL, layerUnits, typeCode):
        
        identifier = str(uuid.uuid4())
        layerName = "ew-" + identifier
        layerTitle = "ELSEWeb Layer " + identifier
        print "layerName %s" % layerName
        print "layerTitle %s" % layerTitle
        print "layerURL %s" % tiffURL
        print "epsgCode %s" % self.epsgCode
        print "units %s" % layerUnits
        print "typeCode %s" % typeCode
        
        postedLayer = self.lmClient.sdm.postLayer(
                    layerName,
                    self.epsgCode,
                    typeCode,
                    layerUnits,
                    "GTiff",
                    layerUrl=tiffURL,
                    title=layerTitle)
        
        self.layerID = postedLayer.id
        self.layerURL = self.layerBaseURL + postedLayer.id
                
    
    def postScenario(self, scenarioLayerIDs):
        
        cellSizeUnits = "dd"
        
        identifier = str(uuid.uuid4())
        scenCode = "ew-" + identifier[14:]
        scenTitle = "ew-" + identifier[14:]

        print "scenCode %s" % scenCode
        print "scenTitle %s" % scenTitle

        print "scenarioLayerIDs %s" % scenarioLayerIDs

        postedScenario = self.lmClient.sdm.postScenario(
                                  layers = scenarioLayerIDs,
                                  code = scenCode,
                                  title = scenTitle,
                                  epsgCode = self.epsgCode,
                                  units = cellSizeUnits)
        
        self.scenarioID = postedScenario.id
        self.scenarioURL = self.scenarioBaseURL + postedScenario.id
        
        
    def postExperiment(self, algorithm, params, occurrenceSetID, scenarioID):

        mdlScn = scenarioID
        prjScns = [scenarioID]

        print("Scenario ID %s" % mdlScn)
        print("Projection ID %s" % prjScns)
        print("Algorithm %s" % algorithm)
        print "Chosen occurrence set ID %s" % occurrenceSetID

        alg = self.lmClient.getAlgorithmFromCode(algorithm)
        
        for binding