Exemple #1
0
def test_harvesting_GroundBasedMechWT():
    # test harvesting: harvestCost, HarvestSystem

    # Input
    PartialCut = 1
    Slope = 30
    SkidDist = 100
    Elevation = 100
    RemovalsCT = 200.0
    TreeVolCT = 5.0
    RemovalsSLT = 100.0
    TreeVolSLT = 70.0
    RemovalsLLT = 20.0
    TreeVolLLT = 200.0
    HdwdFractionCT = 0.15
    HdwdFractionSLT = 0.0
    HdwdFractionLLT = 0.0

    # Expected Output
    harvestCost = 0.3038
    HarvestSystem = 'GroundBasedMechWT'

    assert (harvesting.harvestcost(PartialCut, Slope, SkidDist, Elevation,
                                   RemovalsCT, TreeVolCT, RemovalsSLT,
                                   TreeVolSLT, RemovalsLLT, TreeVolLLT,
                                   HdwdFractionCT, HdwdFractionSLT,
                                   HdwdFractionLLT)) == (harvestCost,
                                                         HarvestSystem)
Exemple #2
0
def test_harvesting_GroundBasedMechWT():
        # test harvesting: harvestCost, HarvestSystem
        
        # Input
        PartialCut = 1 
        Slope = 30
        SkidDist = 100
        Elevation = 100
        RemovalsCT = 200.0 
        TreeVolCT = 5.0 
        RemovalsSLT = 100.0 
        TreeVolSLT = 70.0 
        RemovalsLLT = 20.0 
        TreeVolLLT = 200.0 
        HdwdFractionCT = 0.15 
        HdwdFractionSLT = 0.0 
        HdwdFractionLLT = 0.0
        
        # Expected Output
        harvestCost = 0.3038
        HarvestSystem = 'GroundBasedMechWT'
        
        assert(harvesting.harvestcost(
                PartialCut, Slope, SkidDist, Elevation,
                RemovalsCT, TreeVolCT, RemovalsSLT, TreeVolSLT, RemovalsLLT, TreeVolLLT,
                HdwdFractionCT, HdwdFractionSLT, HdwdFractionLLT))== (harvestCost, HarvestSystem)
Exemple #3
0
def test_harvesting_HelicopterManualWT():
    # test harvesting: harvestCost, HarvestSystem

    # Input
    PartialCut = 0
    Slope = 60
    SkidDist = 2000
    Elevation = 100
    RemovalsCT = 200.0
    TreeVolCT = 5.0
    RemovalsSLT = 100.0
    TreeVolSLT = 70.0
    RemovalsLLT = 20.0
    TreeVolLLT = 100.0
    HdwdFractionCT = 0.15
    HdwdFractionSLT = 0.0
    HdwdFractionLLT = 0.0

    # Expected Output
    harvestCost = 1.2036
    HarvestSystem = 'HelicopterManualWT'

    assert (harvesting.harvestcost(PartialCut, Slope, SkidDist, Elevation,
                                   RemovalsCT, TreeVolCT, RemovalsSLT,
                                   TreeVolSLT, RemovalsLLT, TreeVolLLT,
                                   HdwdFractionCT, HdwdFractionSLT,
                                   HdwdFractionLLT)) == (harvestCost,
                                                         HarvestSystem)
Exemple #4
0
def test_harvesting_HelicopterManualWT():
        # test harvesting: harvestCost, HarvestSystem
        
        # Input
        PartialCut = 0 
        Slope = 60
        SkidDist = 2000
        Elevation = 100
        RemovalsCT = 200.0 
        TreeVolCT = 5.0 
        RemovalsSLT = 100.0 
        TreeVolSLT = 70.0 
        RemovalsLLT = 20.0 
        TreeVolLLT = 100.0 
        HdwdFractionCT = 0.15 
        HdwdFractionSLT = 0.0 
        HdwdFractionLLT = 0.0
        
        # Expected Output
        harvestCost = 1.2036
        HarvestSystem = 'HelicopterManualWT'
        
        assert(harvesting.harvestcost(
                PartialCut, Slope, SkidDist, Elevation,
                RemovalsCT, TreeVolCT, RemovalsSLT, TreeVolSLT, RemovalsLLT, TreeVolLLT,
                HdwdFractionCT, HdwdFractionSLT, HdwdFractionLLT))== (harvestCost, HarvestSystem)
Exemple #5
0
def cost_func(stand_wkt, TPA, VPA, SkidDist, Slope):
    cur_path = os.path.dirname(os.path.realpath(__file__))

    ### Input Data
    slope_raster = cur_path + '/data/Slope.tif'

    # Reproject
    source = osr.SpatialReference()
    source.ImportFromEPSG(4326)

    target = osr.SpatialReference()
    target.ImportFromEPSG(26913)

    transform = osr.CoordinateTransformation(source, target)

    stand_geom = ogr.CreateGeometryFromWkt(stand_wkt)
    stand_geom.Transform(transform)
    stand_wkt = stand_geom.ExportToWkt()

    ### Calculation
    area = stand_geom.GetArea()                                         # get area in m2
    area = round(area*0.000247105, 4)                                   # convert to acre and round
    if Slope == None:
        Slope = rasterstats.raster_stats(stand_wkt, slope_raster,stats=['mean'])
        Slope = Slope[0]['mean']                                        # %

    if SkidDist == None:
        SkidDist = skidding.skidDist(stand_wkt)                         # ft

    totalVolume = area*VPA                                              # ft3
    totalWeight = totalVolume*0.0195                                    # US short tons (lodepole pine weight)

    harvestCostFt3 = harvesting.harvestcost(Slope, SkidDist, TPA, VPA)  # $/ft3
    totalHarvestCost = round(harvestCostFt3*totalVolume)                # $
    harvestCostTon = totalHarvestCost/totalWeight                       # $/ton


    return Slope, SkidDist, harvestCostTon, totalHarvestCost