其他按月分析

三、农机运营分析(按月分析)

这里的运营是指除了停运和停车熄火之外的其他状态,包括行驶、停车检查、田间作业等状态。运营时间和运营里程反映农机的使用率以及农机手的工作强度。

5个月农机作业轨迹数量的部分展示(统计10月份每天的作业车辆和轨迹个数)

val oct_stat =  sql(" select distinct  to_date(gps_time) as gps_t, count(gps_time) as num_trajectory ,count(distinct vme_id) as num_car, avg(speed) avg_speed from trajectory where month(gps_time)=10 group by to_date(gps_time) order by  gps_t")

//保存数据到本地
 oct_stat.repartition(1).write.mode("overwrite").format("csv").save("file:/home/hadoop/mydata/oct_stat")

1.运营时间与距离分析
10月日均运营时间分析(日均运营时间是指该日运营农机的运营时间总和与当日运营出租车的总和之比)

val oct_operation=  sql(" select a.gps_t,  day(a.gps_t) as day,a.num_trajectory, a.num_car, a.avg_speed,  a.num_trajectory*2/a.num_car/3600 as avg_day_operation_time,  a.avg_speed* a.num_trajectory*2/a.num_car/1000 as avg_day_operation_distance from (select distinct  to_date(gps_time) as gps_t, count(gps_time) as num_trajectory ,count(distinct vme_id) as num_car, avg(speed) avg_speed from trajectory where month(gps_time)=10  group by to_date(gps_time) order by  gps_t) as a")
//保存数据到本地
 oct_operation.repartition(1).write.mode("overwrite").format("csv").save("file:/home/hadoop/mydata/oct_operation")
image.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 注:本文所用时间为14量车的总时间单位为秒。表结构及名称 一、对数据的简单分析 1.总数据量的统计 2.查询有多少...
    至极L阅读 3,456评论 0 1
  • 遇见你,在我繁华多梦的季节,在桃花盛开的三月,在满天繁星的夜晚,在璀璨的年华里。 牵手,只是个小小的意外,就如在阳...
    唐小粥阅读 1,287评论 0 4
  • 看了很多东野圭吾小说迷对于《白夜行》、《恶意》、《嫌疑人X献身》、《解忧杂货铺》的各种读后感,使我对东野先生的悬疑...
    五日雨青山阅读 11,245评论 0 12
  • 每个女孩心里都有一个香奈儿,或许是一管香奈儿的42号色丝绒口红,或许是一款菱格链条包,又或者是一款经典小黑裙。TA...
    七天路过阅读 10,125评论 0 7