Polygon Concentration

1368
12
05-07-2018 09:58 AM
Md_Abdullah_All_Sourav
New Contributor
I have yield data of a field. Almost quarter million of polygons with the size of 30ft by 1.2ft representing the yield of the region. I have been asked to concentrate (dissolve) every 5 polygons, thus the result will be 30 ft by 6ft (1.2*5). The new polygon will contain the average yield of the old 5 polygons. I need to contrate them from left to right. Is there any way to do that?

Thanks

0 Kudos
12 Replies
DanPatterson_Retired
MVP Emeritus

What field is it you want the summary on?  I currently have it in array format for processing

a.dtype
dtype([('FID', '<i4'), ('Shape', '<f8', (2,)), ('Field', '<U254'), ('Dataset', '<U254'), ('Product', '<U254'), ('Obj__Id', '<f8'),
           ('Time', '<M8[us]'), ('Duration_s', '<f8'), ('Area_Count', '<U254'), ('Elevation_', '<f8'), ('Swth_Wdth_', '<f8'),
           ('Y_Offset_f', '<f8'), ('Hrv_Mass_W', '<f8'), ('Distance_f', '<f8'), ('Crop_Flw_M', '<f8'), ('Fuel_Con_T', '<f8'),
           ('Track_deg_', '<f8'), ('Moisture__', '<f8'), ('Pass_Num', '<f8'), ('Crop_Flw_V', '<f8'), ('Yld_Mass_W', '<f8'),
          ('Yld_Mass_D', '<f8'), ('Yld_Vol_We', '<f8'), ('Yld_Vol_Dr', '<f8'), ('One_Second', '<f8'), ('Speed_mph_', '<f8'),
          ('Prod_ac_h_', '<f8'), ('Date', '<M8[us]')])
a[0]  first record
list(zip(nms, a[0]))
 
[('FID', 0),
 ('Shape', array([-93.69,  41.98])),
 ('Field', 'Been'),
 ('Dataset', '3/20/2018'),
 ('Product', 'NO Product'),
 ('Obj__Id', 1.0),
 ('Time', numpy.datetime64('2017-10-30T00:00:00.000000')),
 ('Duration_s', 0.20499999999999999),
 ('Area_Count', 'On'),
 ('Elevation_', 1040.4000000000001),
 ('Swth_Wdth_', 30.0),
 ('Y_Offset_f', 0.0),
 ('Hrv_Mass_W', 1.4137),
 ('Distance_f', 0.53149999999999997),
 ('Crop_Flw_M', 3.7258),
 ('Fuel_Con_T', 10.48),
 ('Track_deg_', 359.62400000000002),
 ('Moisture__', 16.899999999999999),
 ('Pass_Num', 1.0),
 ('Crop_Flw_V', 239.52000000000001),
 ('Yld_Mass_W', 2086.6444000000001),
 ('Yld_Mass_D', 1993.0999999999999),
 ('Yld_Vol_We', 37.261499999999998),
 ('Yld_Vol_Dr', 35.590000000000003),
 ('One_Second', 1.0),
 ('Speed_mph_', 1.7677),
 ('Prod_ac_h_', 6.4028),
 ('Date', numpy.datetime64('2017-10-30T00:00:00.000000'))]
and you want a 5 plot running sum?
Any further clarification you want to provide?
0 Kudos
Md_Abdullah_All_Sourav
New Contributor

Thanks Dan. The objects of interest are Yld_Vol_Dr'(bu/ac) and Moisture content. Thus, I just need to merge every 5 polygons, make one finally which will contain the average of the Yld_Vol_Dr' and moisture of the previous 5 polygons.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Some results, each pair represents the Yield and Moisture average in 5 unit blocks

The first block before the ... represents 8 blocks of 5.  The last block is the last 8 blocks of 5

Check manually to make sure it is alright.

The code is simple, but I am still concerned about 'end-wrapping'

It seems that you have 40 blocks per row, so if the number of blocks is not divisible by 5,then you can't wrap the end or one rows values to the beginning of the next, so you have to return a truncated average.

Advise on any anomolies

Sample results

ym

array([( 35.59, 16.9 ), ( 61.14, 16.9 ), (122.4 , 16.9 ), (188.36, 16.9 ),
       (260.38, 16.9 ), (289.45, 16.08), (259.13, 16.08), (242.38, 16.08),

...,
       (208.47, 15.86), (230.03, 15.86), (221.9 , 15.86), (229.2 , 15.86),
       (224.42, 15.86), (233.92, 15.86), (206.63, 15.86), (218.36, 15.86)],
      dtype=[('Yield', '<f8'), ('Moisture', '<f8')])