text: set search_path= lemma, public;
  copy (select pixels_kmeans "Stand",
         'CA' "State",
         round(avg(pixel_slope)) "Slope",
         round(avg(distance)*3.28084) "AYD",
         round(count(*)*100*0.000247105) "Treatment Area",
         0 "Elev",
         case when round(avg(pixel_slope)) < 50 then 'Ground-Based Mech WT' when round(avg(pixel_slope)) > 50 then 'Cable Manual WT' end "System",
         round(avg(density_tree_m2*4046.86)) "CT/ac",
         0.8 "CT residue fraction",
         avg("Av_BM_TR"*2.20462/45) "ft3/CT",
         45 "lb/ft3 CT",
         0 "CT hardwood fraction",
         0 "ST/ac",
         0 "ST residue fraction",
         0 "ft3/ST",
         0 "lb/ft3 ST",
         0 "ST hardwood fraction",
         0 "LT/ac",
         0 "LT residue fraction",
         0 "ft3/LT",
         0 "lb/ft3 LT",
         0 "LT hardwood fraction",
         1 "Include move-in cost?",
         25 "Move-in miles",
         1 "Collect & chip residues?",
         1 "Partial cut?",
         1 "Include loading costs?"
  from cost_result_test join priority_areas pa on pixels_id=key where pol_id = 23510 group by pixels_kmeans order by pixels_kmeans) to stdout with csv header;
  