Esempio n. 1
0
            w = port['grid_width']
            
            if h == 0:
                h = 0.25
            if w == 0:
                w = 0.25
            
            portID = port['ID']
            # Print status
            print 'Port: %s' % (portID,)
            # Run model
            response,error = portprotector.optimize(portID,h,w,GeoUtils.constants.Equations.BMASW,port['elev_data'])
            # If error, print error message
            if error == True:
                # Output error message
                output = GeoUtils.Interface.uniForm.fullErrorMsgGen(response)
                print output
            else:
                # Unpack response from optimization
                path,avg_elev,length,vol,dikeVol,coreVol,toeVol,foundVol,armorVol = response
                # Update database
                response,error = portprotector.updateDB('2ee9a2ec7ebffaecc61f8f011981852e',portID,path,avg_elev,length,vol,dikeVol,coreVol,toeVol,foundVol,armorVol,GeoUtils.constants.Equations.BMASW,port['elev_data'],GeoUtils.constants.computeCenter(),h,w)
                # Add entry to portdata as well
                updateq = 'UPDATE portdata SET defense_volume=%s WHERE ID=%s' % (vol,portID)
                response2,error2 = DBhandle.query(updateq)
        except:
            continue

#    print portprotector.optimize(6, '', .25, .25, GeoUtils.constants.Equations.BMASW, GeoUtils.constants.ElevSrc.DEFAULT30SEC)
    print GeoUtils.Interface.StdHTMLFooter()
Esempio n. 2
0
                print '%s %s simulation time: %f total: %f' % (current_structure, run_type, elapsed_time, total_time, )

                # If error, print error message
                if error == True:
                    # Output error message
                    print 'Error'
                    output = GeoUtils.Interface.uniForm.fullErrorMsgGen(response)
                    print output
                else:
                    # Unpack response from optimization
                    print 'Success'
                    path,avg_elev,vol,dikeVol,coreVol,toeVol,foundVol,armorVol,sand_volume,gravel_volume,quarry_run_stone_volume,large_riprap_volume,small_riprap_volume,concrete_volume,structural_steel_weight,structural_steel_volume,structure_height_above_msl,bucket_high,bucket_low,number_of_buckets,bucket_count_1,bucket_count_2,bucket_count_3,bucket_count_4,bucket_count_5,bucket_count_6,bucket_count_7,bucket_count_8,bucket_count_9,bucket_count_10,bucket_count_11,bucket_count_12,bucket_count_13,bucket_count_14,bucket_count_15,bucket_count_16,bucket_count_17,bucket_count_18,bucket_count_19,bucket_count_20,tallest_section_depth,shortest_section_depth = response

                    # Update database
                    #22938b6006b66b4eecd09f3b38c8c961 #Keith key development
                    response,error = portprotector.updateDB(current_structure,run_type,'22938b6006b66b4eecd09f3b38c8c961',portID,path,avg_elev,vol,dikeVol,coreVol,toeVol,foundVol,armorVol,sand_volume,gravel_volume,quarry_run_stone_volume,large_riprap_volume,small_riprap_volume,concrete_volume,structural_steel_weight,structural_steel_volume,structure_height_above_msl,simulation_equation,dataset,GeoUtils.constants.computeCenter(),h,w,bucket_high,bucket_low,number_of_buckets,bucket_count_1,bucket_count_2,bucket_count_3,bucket_count_4,bucket_count_5,bucket_count_6,bucket_count_7,bucket_count_8,bucket_count_9,bucket_count_10,bucket_count_11,bucket_count_12,bucket_count_13,bucket_count_14,bucket_count_15,bucket_count_16,bucket_count_17,bucket_count_18,bucket_count_19,bucket_count_20,tallest_section_depth,shortest_section_depth)

                    #print "attribution: %s" % ("Keith Mosher",)
                    print "equation: %s" % (simulation_equation,)
                    print "portid (again): %s" % (portID,)
                    print "structure_height_above_msl: %s" % (structure_height_above_msl,)
                    print "avg_elev: %s" % (avg_elev,)
                    print "tallest_section_depth: %s" % (tallest_section_depth,)
                    print "shortest_section_depth: %s" % (shortest_section_depth,)

                    # Create path for linestring creation
                    ShortestPath = GeoUtils.Features.Path()
                    ShortestPath.fromPointList(path)
                    print "path_length: %s" % (ShortestPath.length(),)
                    print "path_volume: %s" % (vol,)
                    print "0len:[%0.2f] C_len:[%0.2f] C_vol:[%0.2f]  R_len:[%0.2f] R_vol:[%0.2f]  F_len:[%0.2f] F_vol:[%0.2f]" % (bucket_count_20, bucket_count_19, bucket_count_18, bucket_count_17, bucket_count_16, bucket_count_15, bucket_count_14,)