Renaming circlebot -> advisorycircular.
This commit is contained in:
parent
fcbb023a5e
commit
579a180d51
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "circlebot",
|
"name": "advisorycircular",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
(ns lemondronor.circlebot
|
(ns lemondronor.advisorycircular
|
||||||
(:require
|
(:require
|
||||||
["commander" :as commander]
|
["commander" :as commander]
|
||||||
["fs" :as fs]
|
["fs" :as fs]
|
||||||
@ -166,7 +166,8 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn ac-desc [ac]
|
(defn ac-desc [ac]
|
||||||
(str (:icao ac) " " (:lat ac) " " (:lon ac)
|
(str (:icao ac) " " "http://tar1090.adsbexchange.com/?icao=" (:icao ac)
|
||||||
|
" " (:lat ac) " " (:lon ac)
|
||||||
" #" (:registration ac) " " (:alt ac) " " (:curviness ac) " "
|
" #" (:registration ac) " " (:alt ac) " " (:curviness ac) " "
|
||||||
(:normalized-curviness ac)))
|
(:normalized-curviness ac)))
|
||||||
|
|
||||||
@ -476,43 +477,48 @@
|
|||||||
(:distance airport-properties)
|
(:distance airport-properties)
|
||||||
(:minimum-airport-distance-km config)
|
(:minimum-airport-distance-km config)
|
||||||
(:label airport-properties)
|
(:label airport-properties)
|
||||||
())
|
()))
|
||||||
(do
|
(let [alts (map :alt recent-positions)
|
||||||
(p/let [coarse (pelias/reverse (:pelias config) lat lon {:layers "coarse"})]
|
min-alt (apply min alts)
|
||||||
(let [coarse (first (:features coarse))]
|
max-alt (apply max alts)
|
||||||
(log-info "%s: Reverse geocode: %s" icao (:properties coarse))
|
ratio (/ max-alt min-alt)]
|
||||||
;; Note that if we're over the ocean we get null :(
|
(log-info "%s: ratio of min alt to max alt: %s [%s - %s]" icao (.toFixed (/ max-alt min-alt) 1) min-alt max-alt))
|
||||||
(p/then (p/all [(screenshot (:icao ac) lat lon)
|
(do
|
||||||
(p/let [nearby (landmark config lat lon)
|
(p/let [coarse (pelias/reverse (:pelias config) lat lon {:layers "coarse"})]
|
||||||
_ (log-info "WOOO %s" nearby)
|
(let [coarse (first (:features coarse))]
|
||||||
sqb (if-let [sqb-path (:basestation-sqb config)]
|
(log-info "%s: Reverse geocode: %s" icao (:properties coarse))
|
||||||
(get-basestation-sqb-record icao sqb-path))]
|
;; Note that if we're over the ocean we get null :(
|
||||||
(let [description (generate-description ac sqb coarse nearby)]
|
(p/then (p/all [(screenshot (:icao ac) lat lon)
|
||||||
(log-info "Description: %s" description)
|
(p/let [nearby (landmark config lat lon)
|
||||||
description))])
|
_ (log-info "WOOO %s" nearby)
|
||||||
(fn [[image-path description]]
|
sqb (if-let [sqb-path (:basestation-sqb config)]
|
||||||
(if (or (nil? coarse)
|
(get-basestation-sqb-record icao sqb-path))]
|
||||||
;; TODO: Filter using the layer hierarchy; we want
|
(let [description (generate-description ac sqb coarse nearby)]
|
||||||
;; anything smaller than "region" (state).
|
(log-info "Description: %s" description)
|
||||||
(= (get-in coarse [:properties :name]) "California"))
|
description))])
|
||||||
(log-info "%s: Filtering out because it is outside Los Angeles County" (:icao ac))
|
(fn [[image-path description]]
|
||||||
(if (and image-path description)
|
(if (or (nil? coarse)
|
||||||
(do
|
;; TODO: Filter using the layer hierarchy; we want
|
||||||
(if (get-in config [:twitter :enabled?])
|
;; anything smaller than "region" (state).
|
||||||
(twitter/tweet (twitter/twit (:twitter config))
|
(= (get-in coarse [:properties :name]) "California"))
|
||||||
description
|
(log-info "%s: Filtering out because it is outside Los Angeles County" (:icao ac))
|
||||||
[image-path]
|
(if (and image-path description)
|
||||||
lat
|
(do
|
||||||
lon)
|
(if (get-in config [:twitter :enabled?])
|
||||||
(log-warn "Skipping tweeting"))
|
(twitter/tweet (twitter/twit (:twitter config))
|
||||||
(let [path (str (.toFixed (/ now 1000) 0) "-" icao "-recent" ".geojson")]
|
description
|
||||||
(util/write-file
|
[image-path]
|
||||||
path
|
lat
|
||||||
(.stringify
|
lon)
|
||||||
js/JSON
|
(log-warn "Skipping tweeting"))
|
||||||
(clj->js (track->geojson older-positions recent-positions icao centroid)))
|
(let [path (str (.toFixed (/ now 1000) 0) "-" icao "-recent" ".geojson")]
|
||||||
{})))
|
(util/write-file
|
||||||
(log-warn "Skipping tweet %s %s" image-path description)))))))))))
|
path
|
||||||
|
(.stringify
|
||||||
|
js/JSON
|
||||||
|
(clj->js (track->geojson older-positions recent-positions icao centroid)))
|
||||||
|
{})))
|
||||||
|
(log-warn "Skipping tweet %s %s" image-path description))))))))))
|
||||||
|
|
||||||
|
|
||||||
(defn process-potential-circles [acs config now]
|
(defn process-potential-circles [acs config now]
|
||||||
@ -530,7 +536,7 @@
|
|||||||
;; This is how many degrees of turning we need to see over
|
;; This is how many degrees of turning we need to see over
|
||||||
;; max-history-age-ms ms to consider it a potential circling
|
;; max-history-age-ms ms to consider it a potential circling
|
||||||
;; aircraft.
|
;; aircraft.
|
||||||
:curviness-threshold-degrees 1440
|
:curviness-threshold-degrees (* 2 360)
|
||||||
;; If the centroid of the aircraft's positions is less than this
|
;; If the centroid of the aircraft's positions is less than this
|
||||||
;; close to an airport, then it's probably just doing flight
|
;; close to an airport, then it's probably just doing flight
|
||||||
;; training.
|
;; training.
|
Loading…
Reference in New Issue
Block a user