Exemplo n.º 1
0
def get_project_seasonality(project_name):
    user, project = Project.get_user_and_project(g.username, project_name)
    if project.windTMatrix:
        return jsonify(result={
            "exists": True,
            "seasonality": project.get_Seasonality()
        })
    else:
        return jsonify(result={"exists": False})
Exemplo n.º 2
0
def get_project_seasonality(project_name):
    user, project = Project.get_user_and_project(g.username, project_name)
    if project.windTMatrix:
        return jsonify(
            result={
            "exists": True,
            "seasonality":project.get_Seasonality()
            })
    else:
        return jsonify(result={"exists": False})
Exemplo n.º 3
0
def check_wind_status(project_name):
    user, project = Project.get_user_and_project(g.username, project_name)
    expected_winddays_ready = bool(project.expected_winddays)
    expected_windday_risks_ready = bool(project.expected_windday_risks)
    if expected_winddays_ready and expected_windday_risks_ready:
        project.wind_status = "Wind Day calculations ready."
        project.save()
        return jsonify(
            result={
                "status": project.wind_status,
                "byMonth": project.expected_winddays,
                "risks": project.expected_windday_risks,
                "conditions": project.windday_conditions
            })
    return jsonify(result={"status": project.wind_status})
Exemplo n.º 4
0
def check_wind_status(project_name):
    user, project = Project.get_user_and_project(g.username, project_name)
    expected_winddays_ready = bool(project.expected_winddays)
    expected_windday_risks_ready = bool(project.expected_windday_risks)
    if expected_winddays_ready and expected_windday_risks_ready:
        project.wind_status = "Wind Day calculations ready."
        project.save()
        return jsonify(
            result = {
                "status": project.wind_status,
                "byMonth": project.expected_winddays,
                "risks": project.expected_windday_risks,
                "conditions": project.windday_conditions
            })
    return jsonify(
        result = {"status": project.wind_status}
        )
Exemplo n.º 5
0
def calulate_wind(project_name):
    user, project = Project.get_user_and_project(g.username, project_name)
    if project.windTMatrix:
        try:
            conditions = request.json
            project.windday_conditions = conditions
            project.expected_winddays = []
            project.expected_windday_risks = []
            project.wind_status = "Calculating Expected Risks of Wind Days"
            project.save()
            expected = calculate_expected_winddays.delay(*(g.username, project_name))
            risks = calculate_windday_risks.delay(*(g.username, project_name))
        except Exception as e:
            project.wind_status = "Error Calculating Wind Days"
            raise ProjectException("Error Calculating Wind Days: " + str(e))
        return jsonify(result={"message": project.wind_status})
    else:
        raise ProjectException("Please upload wind data.")
Exemplo n.º 6
0
def calulate_wind(project_name):
    user, project = Project.get_user_and_project(g.username, project_name)
    if project.windTMatrix:
        try:
            conditions = request.json
            project.windday_conditions = conditions
            project.expected_winddays = []
            project.expected_windday_risks = []
            project.wind_status = "Calculating Expected Risks of Wind Days"
            project.save()
            expected = calculate_expected_winddays.delay(*(g.username,
                                                           project_name))
            risks = calculate_windday_risks.delay(*(g.username, project_name))
        except Exception as e:
            project.wind_status = "Error Calculating Wind Days"
            raise ProjectException("Error Calculating Wind Days: " + str(e))
        return jsonify(result={"message": project.wind_status})
    else:
        raise ProjectException("Please upload wind data.")
Exemplo n.º 7
0
def calculate_windday_risks(username, project_name):
    user, project = Project.get_user_and_project(username, project_name)
    try:
        project.expected_windday_risks = []
        project.save()
        risks = risk_by_hour_and_month(
            project.windHeight,
            project.windday_conditions['height'],
            project.windday_conditions['maxws'],
            project.windday_conditions['maxhours'],
            project.windday_conditions['daylength'],
            project.get_TMatrix(),
            consecutive=project.windday_conditions['consecutive'])
        project.expected_windday_risks = risks
        project.save()
        return risks
    except Exception as e:
        project.wind_status = "Error Calculating Wind Days"
        project.save()
        print "Error Calculating Wind Days Risks: " + str(e)
Exemplo n.º 8
0
def calculate_windday_risks(username, project_name):
    user, project = Project.get_user_and_project(username, project_name)
    try:
        project.expected_windday_risks = []
        project.save()
        risks = risk_by_hour_and_month(
            project.windHeight,
            project.windday_conditions['height'],
            project.windday_conditions['maxws'],
            project.windday_conditions['maxhours'],
            project.windday_conditions['daylength'],
            project.get_TMatrix(),
            consecutive=project.windday_conditions['consecutive']
            )
        project.expected_windday_risks = risks
        project.save()
        return risks
    except Exception as e:
        project.wind_status = "Error Calculating Wind Days"
        project.save()
        print "Error Calculating Wind Days Risks: " + str(e)
Exemplo n.º 9
0
def calculate_expected_winddays(username, project_name):
    user, project = Project.get_user_and_project(username, project_name)
    try:
        project.expected_winddays = []
        project.save()
        winddays = estimate_winddays(
            project.windHeight,
            project.windday_conditions['height'],
            project.windday_conditions['maxws'],
            project.windday_conditions['maxhours'],
            project.windday_conditions['starthr'],
            project.windday_conditions['daylength'],
            project.get_TMatrix(),
            project.windday_conditions['certainty'],
            consecutive=project.windday_conditions['consecutive'])
        project.expected_winddays = winddays
        project.save()
        return winddays
    except Exception as e:
        project.wind_status = "Error Calculating Wind Days"
        project.save()
        print "Error Calculating Wind Days: " + str(e)
Exemplo n.º 10
0
def calculate_expected_winddays(username, project_name):
    user, project = Project.get_user_and_project(username, project_name)
    try:
        project.expected_winddays = []
        project.save()
        winddays = estimate_winddays(
                       project.windHeight,
                       project.windday_conditions['height'],
                       project.windday_conditions['maxws'],
                       project.windday_conditions['maxhours'],
                       project.windday_conditions['starthr'],
                       project.windday_conditions['daylength'],
                       project.get_TMatrix(),
                       project.windday_conditions['certainty'],
                       consecutive = project.windday_conditions['consecutive']
                       )
        project.expected_winddays = winddays
        project.save()
        return winddays
    except Exception as e:
        project.wind_status = "Error Calculating Wind Days"
        project.save()
        print "Error Calculating Wind Days: " + str(e)