// Compiled by ClojureScript 1.9.562 {}
goog.provide('weathergen.twx');
goog.require('cljs.core');
goog.require('octet.core');
goog.require('octet.buffer');
weathergen.twx.buffer_size = (764);
weathergen.twx.color = octet.core.spec.call(null,new cljs.core.Keyword(null,"r","r",-471384190),octet.core.float$,new cljs.core.Keyword(null,"g","g",1738089905),octet.core.float$,new cljs.core.Keyword(null,"b","b",1482224470),octet.core.float$,new cljs.core.Keyword(null,"h","h",1109658740),octet.core.float$,new cljs.core.Keyword(null,"s","s",1705939918),octet.core.float$,new cljs.core.Keyword(null,"v","v",21465059),octet.core.float$,new cljs.core.Keyword(null,"X","X",1705996313),octet.core.float$,new cljs.core.Keyword(null,"Y","Y",-560717356),octet.core.float$,new cljs.core.Keyword(null,"Z","Z",459124588),octet.core.float$,new cljs.core.Keyword(null,"x","x",2099068185),octet.core.float$,new cljs.core.Keyword(null,"y","y",-1757859776),octet.core.float$,new cljs.core.Keyword(null,"L","L",-1038307519),octet.core.float$);
weathergen.twx.min_mid_max = (function weathergen$twx$min_mid_max(type){
return octet.core.spec.call(null,new cljs.core.Keyword(null,"min","min",444991522),type,new cljs.core.Keyword(null,"mid","mid",-2123385246),type,new cljs.core.Keyword(null,"max","max",61366548),type);
});
weathergen.twx.for_weather_types = (function weathergen$twx$for_weather_types(type){
return octet.core.spec.call(null,new cljs.core.Keyword(null,"sunny","sunny",1448267778),type,new cljs.core.Keyword(null,"fair","fair",1684139423),type,new cljs.core.Keyword(null,"poor","poor",1462482211),type,new cljs.core.Keyword(null,"inclement","inclement",-550669382),type);
});
weathergen.twx.condition_preset = octet.core.spec.call(null,new cljs.core.Keyword(null,"temp","temp",1791541284),weathergen.twx.min_mid_max.call(null,octet.core.int32),new cljs.core.Keyword(null,"pressure","pressure",505343747),weathergen.twx.min_mid_max.call(null,octet.core.int32),new cljs.core.Keyword(null,"wind-speed","wind-speed",-815617496),octet.core.spec.call(null,new cljs.core.Keyword(null,"min","min",444991522),octet.core.int32,new cljs.core.Keyword(null,"mid","mid",-2123385246),octet.core.int32,new cljs.core.Keyword(null,"max","max",61366548),octet.core.int32,new cljs.core.Keyword(null,"thresh","thresh",-1241229885),octet.core.int32),new cljs.core.Keyword(null,"stratus-base","stratus-base",-1631962478),octet.core.int32,new cljs.core.Keyword(null,"cumulus-base","cumulus-base",-578210868),octet.core.int32,new cljs.core.Keyword(null,"stratus-thick","stratus-thick",365371931),octet.core.int32,new cljs.core.Keyword(null,"contrail-base","contrail-base",1468366421),octet.core.int32,new cljs.core.Keyword(null,"last-tod","last-tod",-396006067),octet.core.int32,new cljs.core.Keyword(null,"fog-start-below-layer","fog-start-below-layer",-770862433),octet.core.float$,new cljs.core.Keyword(null,"fog-start-above-layer","fog-start-above-layer",439741482),octet.core.float$,new cljs.core.Keyword(null,"fog-end-below-layer","fog-end-below-layer",1550420314),octet.core.float$,new cljs.core.Keyword(null,"fog-end-above-layer","fog-end-above-layer",1358391533),octet.core.float$,new cljs.core.Keyword(null,"horizon-blend","horizon-blend",-1391946836),octet.core.float$,new cljs.core.Keyword(null,"sky-fog-level","sky-fog-level",1887146670),octet.core.float$,new cljs.core.Keyword(null,"sky-fog-start-elev","sky-fog-start-elev",747283504),octet.core.float$,new cljs.core.Keyword(null,"sky-fog-end-elev","sky-fog-end-elev",588752918),octet.core.float$,new cljs.core.Keyword(null,"earth-color","earth-color",-1971664003),weathergen.twx.color,new cljs.core.Keyword(null,"stratus-factor","stratus-factor",1081110154),weathergen.twx.for_weather_types.call(null,octet.core.float$),new cljs.core.Keyword(null,"haze-min","haze-min",1253474527),octet.core.float$,new cljs.core.Keyword(null,"cumulus-z","cumulus-z",429358063),octet.core.float$,new cljs.core.Keyword(null,"stratus-z","stratus-z",149877474),octet.core.float$,new cljs.core.Keyword(null,"contrail-low","contrail-low",-745449192),octet.core.float$,new cljs.core.Keyword(null,"contrail-high","contrail-high",-1235778798),octet.core.float$,new cljs.core.Keyword(null,"temperature","temperature",899018429),octet.core.float$);
weathergen.twx.twx = octet.core.spec.call(null,new cljs.core.Keyword(null,"version","version",425292698),octet.core.uint32,new cljs.core.Keyword(null,"last-check","last-check",-339535317),octet.core.int32,new cljs.core.Keyword(null,"basic-old-condition","basic-old-condition",1309887828),octet.core.int32,new cljs.core.Keyword(null,"basic-condition","basic-condition",-162264035),octet.core.int32,new cljs.core.Keyword(null,"basic-condition-counter","basic-condition-counter",-1441861875),octet.core.int32,new cljs.core.Keyword(null,"current-condition","current-condition",-566180811),weathergen.twx.condition_preset,new cljs.core.Keyword(null,"condition-change-interval","condition-change-interval",893701369),octet.core.int32,new cljs.core.Keyword(null,"model","model",331153215),octet.core.int32,new cljs.core.Keyword(null,"map-updates","map-updates",-1922486454),octet.core.int32,new cljs.core.Keyword(null,"interval","interval",1708495417),octet.core.spec.call(null,new cljs.core.Keyword(null,"min","min",444991522),octet.core.int32,new cljs.core.Keyword(null,"max","max",61366548),octet.core.int32),new cljs.core.Keyword(null,"wx-prob","wx-prob",-1460080674),weathergen.twx.for_weather_types.call(null,octet.core.float$),new cljs.core.Keyword(null,"wth-user-shift","wth-user-shift",-1886391343),octet.core.repeat.call(null,(5),octet.core.spec.call(null,new cljs.core.Keyword(null,"shift-time","shift-time",-2088311977),octet.core.uint32,new cljs.core.Keyword(null,"shift-old-condition","shift-old-condition",1640618544),octet.core.int32)),new cljs.core.Keyword(null,"wind-heading-model","wind-heading-model",1475180681),octet.core.int32,new cljs.core.Keyword(null,"wind-heading","wind-heading",248646220),octet.core.int32,new cljs.core.Keyword(null,"map-wind-heading","map-wind-heading",1215534522),octet.core.int32,new cljs.core.Keyword(null,"map-wind-speed","map-wind-speed",1879872886),octet.core.float$,new cljs.core.Keyword(null,"wth-wind","wth-wind",-1186913001),weathergen.twx.for_weather_types.call(null,octet.core.spec.call(null,new cljs.core.Keyword(null,"night-speed","night-speed",1787456793),octet.core.int32,new cljs.core.Keyword(null,"dawn-speed","dawn-speed",1917633958),octet.core.int32,new cljs.core.Keyword(null,"day-speed","day-speed",1891855632),octet.core.int32,new cljs.core.Keyword(null,"burst-interval","burst-interval",-1840121827),octet.core.int32,new cljs.core.Keyword(null,"burst-duration","burst-duration",1282991874),octet.core.int32,new cljs.core.Keyword(null,"burst-speed","burst-speed",1211039546),octet.core.int32,new cljs.core.Keyword(null,"burst-direction","burst-direction",1726705412),octet.core.int32)),new cljs.core.Keyword(null,"wth-turbuluence","wth-turbuluence",-213608889),octet.core.repeat.call(null,(6),octet.core.spec.call(null,new cljs.core.Keyword(null,"rot-x-wind","rot-x-wind",564373616),octet.core.int32,new cljs.core.Keyword(null,"rot-y-wind","rot-y-wind",1997488264),octet.core.int32,new cljs.core.Keyword(null,"rot-z-wind","rot-z-wind",135263615),octet.core.int32,new cljs.core.Keyword(null,"rot-x-rot","rot-x-rot",-516874998),octet.core.int32,new cljs.core.Keyword(null,"rot-y-rot","rot-y-rot",-118743002),octet.core.int32,new cljs.core.Keyword(null,"rot-z-rot","rot-z-rot",-1443514693),octet.core.int32)),new cljs.core.Keyword(null,"mech-layer","mech-layer",-218931489),octet.core.int32,new cljs.core.Keyword(null,"heat-layer","heat-layer",-453010931),octet.core.int32,new cljs.core.Keyword(null,"occurrence","occurrence",-1730809154),octet.core.int32,new cljs.core.Keyword(null,"duration","duration",1444101068),octet.core.int32,new cljs.core.Keyword(null,"fog-start","fog-start",-180274053),weathergen.twx.for_weather_types.call(null,octet.core.float$),new cljs.core.Keyword(null,"fog-end","fog-end",175288886),weathergen.twx.for_weather_types.call(null,octet.core.float$),new cljs.core.Keyword(null,"stratus-layer","stratus-layer",1850856816),weathergen.twx.for_weather_types.call(null,octet.core.int32),new cljs.core.Keyword(null,"stratus-thick","stratus-thick",365371931),weathergen.twx.for_weather_types.call(null,octet.core.int32),new cljs.core.Keyword(null,"cumulus-layer","cumulus-layer",928032071),weathergen.twx.for_weather_types.call(null,octet.core.int32),new cljs.core.Keyword(null,"contrail-layer","contrail-layer",-456651541),weathergen.twx.for_weather_types.call(null,octet.core.int32),new cljs.core.Keyword(null,"cumulus-density","cumulus-density",-212067170),octet.core.int32,new cljs.core.Keyword(null,"cumulus-size","cumulus-size",-954219270),octet.core.float$,new cljs.core.Keyword(null,"wth-temp","wth-temp",-1431587693),weathergen.twx.for_weather_types.call(null,octet.core.spec.call(null,new cljs.core.Keyword(null,"night","night",773755357),octet.core.int32,new cljs.core.Keyword(null,"dawn","dawn",65911168),octet.core.int32,new cljs.core.Keyword(null,"day","day",-274800446),octet.core.int32)),new cljs.core.Keyword(null,"wth-press","wth-press",212615827),weathergen.twx.for_weather_types.call(null,octet.core.spec.call(null,new cljs.core.Keyword(null,"night","night",773755357),octet.core.int32,new cljs.core.Keyword(null,"dawn","dawn",65911168),octet.core.int32,new cljs.core.Keyword(null,"day","day",-274800446),octet.core.int32)));
/**
 * Given a ByteBuffer (JVM) or a ArrayBuffer (CLJS) over the contents
 *   of a TWX file, returns a data structure with the parsed contents.
 */
weathergen.twx.parse = (function weathergen$twx$parse(data){
var _STAR_byte_order_STAR_38300 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{return octet.core.read.call(null,data,weathergen.twx.twx);
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_38300;
}});
weathergen.twx.current_condition_template = cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"stratus-z","stratus-z",149877474),new cljs.core.Keyword(null,"pressure","pressure",505343747),new cljs.core.Keyword(null,"temp","temp",1791541284),new cljs.core.Keyword(null,"wind-speed","wind-speed",-815617496),new cljs.core.Keyword(null,"fog-start-above-layer","fog-start-above-layer",439741482),new cljs.core.Keyword(null,"stratus-factor","stratus-factor",1081110154),new cljs.core.Keyword(null,"horizon-blend","horizon-blend",-1391946836),new cljs.core.Keyword(null,"cumulus-base","cumulus-base",-578210868),new cljs.core.Keyword(null,"fog-end-above-layer","fog-end-above-layer",1358391533),new cljs.core.Keyword(null,"last-tod","last-tod",-396006067),new cljs.core.Keyword(null,"sky-fog-level","sky-fog-level",1887146670),new cljs.core.Keyword(null,"cumulus-z","cumulus-z",429358063),new cljs.core.Keyword(null,"sky-fog-start-elev","sky-fog-start-elev",747283504),new cljs.core.Keyword(null,"stratus-base","stratus-base",-1631962478),new cljs.core.Keyword(null,"contrail-high","contrail-high",-1235778798),new cljs.core.Keyword(null,"contrail-base","contrail-base",1468366421),new cljs.core.Keyword(null,"sky-fog-end-elev","sky-fog-end-elev",588752918),new cljs.core.Keyword(null,"contrail-low","contrail-low",-745449192),new cljs.core.Keyword(null,"fog-end-below-layer","fog-end-below-layer",1550420314),new cljs.core.Keyword(null,"stratus-thick","stratus-thick",365371931),new cljs.core.Keyword(null,"temperature","temperature",899018429),new cljs.core.Keyword(null,"earth-color","earth-color",-1971664003),new cljs.core.Keyword(null,"haze-min","haze-min",1253474527),new cljs.core.Keyword(null,"fog-start-below-layer","fog-start-below-layer",-770862433)],[-35000.0,new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"min","min",444991522),(0),new cljs.core.Keyword(null,"mid","mid",-2123385246),(0),new cljs.core.Keyword(null,"max","max",61366548),(0)], null),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"min","min",444991522),(0),new cljs.core.Keyword(null,"mid","mid",-2123385246),(0),new cljs.core.Keyword(null,"max","max",61366548),(0)], null),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"min","min",444991522),(0),new cljs.core.Keyword(null,"mid","mid",-2123385246),(0),new cljs.core.Keyword(null,"max","max",61366548),(0),new cljs.core.Keyword(null,"thresh","thresh",-1241229885),(0)], null),6000.0,new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),1.0,new cljs.core.Keyword(null,"fair","fair",1684139423),0.0,new cljs.core.Keyword(null,"poor","poor",1462482211),0.0,new cljs.core.Keyword(null,"inclement","inclement",-550669382),0.0], null),0.5,(0),120000.0,(0),0.99,0.0,0.0,(35000),40000.0,(34000),0.0,34000.0,159232.16,(0),0.0,cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"y","y",-1757859776),new cljs.core.Keyword(null,"L","L",-1038307519),new cljs.core.Keyword(null,"r","r",-471384190),new cljs.core.Keyword(null,"v","v",21465059),new cljs.core.Keyword(null,"Z","Z",459124588),new cljs.core.Keyword(null,"s","s",1705939918),new cljs.core.Keyword(null,"g","g",1738089905),new cljs.core.Keyword(null,"h","h",1109658740),new cljs.core.Keyword(null,"Y","Y",-560717356),new cljs.core.Keyword(null,"b","b",1482224470),new cljs.core.Keyword(null,"X","X",1705996313),new cljs.core.Keyword(null,"x","x",2099068185)],[48995.688,0.0,0.54509807,0.0,5.003981E-39,2.832474E-16,0.63529414,0.0,0.0,0.76862746,1.4E-45,0.0]),0.0,3991.4685]);
weathergen.twx.twx_template = cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"cumulus-layer","cumulus-layer",928032071),new cljs.core.Keyword(null,"wth-turbuluence","wth-turbuluence",-213608889),new cljs.core.Keyword(null,"wind-heading-model","wind-heading-model",1475180681),new cljs.core.Keyword(null,"map-updates","map-updates",-1922486454),new cljs.core.Keyword(null,"contrail-layer","contrail-layer",-456651541),new cljs.core.Keyword(null,"last-check","last-check",-339535317),new cljs.core.Keyword(null,"wind-heading","wind-heading",248646220),new cljs.core.Keyword(null,"duration","duration",1444101068),new cljs.core.Keyword(null,"heat-layer","heat-layer",-453010931),new cljs.core.Keyword(null,"basic-condition-counter","basic-condition-counter",-1441861875),new cljs.core.Keyword(null,"stratus-layer","stratus-layer",1850856816),new cljs.core.Keyword(null,"wth-user-shift","wth-user-shift",-1886391343),new cljs.core.Keyword(null,"wth-temp","wth-temp",-1431587693),new cljs.core.Keyword(null,"wth-press","wth-press",212615827),new cljs.core.Keyword(null,"basic-old-condition","basic-old-condition",1309887828),new cljs.core.Keyword(null,"current-condition","current-condition",-566180811),new cljs.core.Keyword(null,"map-wind-speed","map-wind-speed",1879872886),new cljs.core.Keyword(null,"fog-end","fog-end",175288886),new cljs.core.Keyword(null,"wth-wind","wth-wind",-1186913001),new cljs.core.Keyword(null,"condition-change-interval","condition-change-interval",893701369),new cljs.core.Keyword(null,"interval","interval",1708495417),new cljs.core.Keyword(null,"cumulus-size","cumulus-size",-954219270),new cljs.core.Keyword(null,"map-wind-heading","map-wind-heading",1215534522),new cljs.core.Keyword(null,"version","version",425292698),new cljs.core.Keyword(null,"fog-start","fog-start",-180274053),new cljs.core.Keyword(null,"stratus-thick","stratus-thick",365371931),new cljs.core.Keyword(null,"basic-condition","basic-condition",-162264035),new cljs.core.Keyword(null,"cumulus-density","cumulus-density",-212067170),new cljs.core.Keyword(null,"occurrence","occurrence",-1730809154),new cljs.core.Keyword(null,"wx-prob","wx-prob",-1460080674),new cljs.core.Keyword(null,"mech-layer","mech-layer",-218931489),new cljs.core.Keyword(null,"model","model",331153215)],[new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),(0),new cljs.core.Keyword(null,"fair","fair",1684139423),(8000),new cljs.core.Keyword(null,"poor","poor",1462482211),(7500),new cljs.core.Keyword(null,"inclement","inclement",-550669382),(2000)], null),new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"rot-x-wind","rot-x-wind",564373616),(5),new cljs.core.Keyword(null,"rot-y-wind","rot-y-wind",1997488264),(7),new cljs.core.Keyword(null,"rot-z-wind","rot-z-wind",135263615),(3),new cljs.core.Keyword(null,"rot-x-rot","rot-x-rot",-516874998),(45),new cljs.core.Keyword(null,"rot-y-rot","rot-y-rot",-118743002),(134),new cljs.core.Keyword(null,"rot-z-rot","rot-z-rot",-1443514693),(240)], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"rot-x-wind","rot-x-wind",564373616),(3),new cljs.core.Keyword(null,"rot-y-wind","rot-y-wind",1997488264),(4),new cljs.core.Keyword(null,"rot-z-wind","rot-z-wind",135263615),(2),new cljs.core.Keyword(null,"rot-x-rot","rot-x-rot",-516874998),(45),new cljs.core.Keyword(null,"rot-y-rot","rot-y-rot",-118743002),(134),new cljs.core.Keyword(null,"rot-z-rot","rot-z-rot",-1443514693),(240)], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"rot-x-wind","rot-x-wind",564373616),(4),new cljs.core.Keyword(null,"rot-y-wind","rot-y-wind",1997488264),(5),new cljs.core.Keyword(null,"rot-z-wind","rot-z-wind",135263615),(2),new cljs.core.Keyword(null,"rot-x-rot","rot-x-rot",-516874998),(45),new cljs.core.Keyword(null,"rot-y-rot","rot-y-rot",-118743002),(134),new cljs.core.Keyword(null,"rot-z-rot","rot-z-rot",-1443514693),(240)], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"rot-x-wind","rot-x-wind",564373616),(1),new cljs.core.Keyword(null,"rot-y-wind","rot-y-wind",1997488264),(3),new cljs.core.Keyword(null,"rot-z-wind","rot-z-wind",135263615),(3),new cljs.core.Keyword(null,"rot-x-rot","rot-x-rot",-516874998),(45),new cljs.core.Keyword(null,"rot-y-rot","rot-y-rot",-118743002),(193),new cljs.core.Keyword(null,"rot-z-rot","rot-z-rot",-1443514693),(240)], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"rot-x-wind","rot-x-wind",564373616),(3),new cljs.core.Keyword(null,"rot-y-wind","rot-y-wind",1997488264),(4),new cljs.core.Keyword(null,"rot-z-wind","rot-z-wind",135263615),(4),new cljs.core.Keyword(null,"rot-x-rot","rot-x-rot",-516874998),(45),new cljs.core.Keyword(null,"rot-y-rot","rot-y-rot",-118743002),(193),new cljs.core.Keyword(null,"rot-z-rot","rot-z-rot",-1443514693),(240)], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"rot-x-wind","rot-x-wind",564373616),(1),new cljs.core.Keyword(null,"rot-y-wind","rot-y-wind",1997488264),(1),new cljs.core.Keyword(null,"rot-z-wind","rot-z-wind",135263615),(0),new cljs.core.Keyword(null,"rot-x-rot","rot-x-rot",-516874998),(45),new cljs.core.Keyword(null,"rot-y-rot","rot-y-rot",-118743002),(193),new cljs.core.Keyword(null,"rot-z-rot","rot-z-rot",-1443514693),(240)], null)], null),(1),(1),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),(34000),new cljs.core.Keyword(null,"fair","fair",1684139423),(28000),new cljs.core.Keyword(null,"poor","poor",1462482211),(25000),new cljs.core.Keyword(null,"inclement","inclement",-550669382),(20000)], null),(32400000),(0),(20),(1500),(0),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),(35000),new cljs.core.Keyword(null,"fair","fair",1684139423),(30000),new cljs.core.Keyword(null,"poor","poor",1462482211),(13300),new cljs.core.Keyword(null,"inclement","inclement",-550669382),(13300)], null),new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"shift-time","shift-time",-2088311977),(118800000),new cljs.core.Keyword(null,"shift-old-condition","shift-old-condition",1640618544),(1)], null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"shift-time","shift-time",-2088311977),(205200000),new cljs.core.Keyword(null,"shift-old-condition","shift-old-condition",1640618544),(1)], null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"shift-time","shift-time",-2088311977),(291600000),new cljs.core.Keyword(null,"shift-old-condition","shift-old-condition",1640618544),(1)], null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"shift-time","shift-time",-2088311977),(378000000),new cljs.core.Keyword(null,"shift-old-condition","shift-old-condition",1640618544),(1)], null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"shift-time","shift-time",-2088311977),(464400000),new cljs.core.Keyword(null,"shift-old-condition","shift-old-condition",1640618544),(1)], null)], null),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"night","night",773755357),(12),new cljs.core.Keyword(null,"dawn","dawn",65911168),(18),new cljs.core.Keyword(null,"day","day",-274800446),(30)], null),new cljs.core.Keyword(null,"fair","fair",1684139423),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"night","night",773755357),(12),new cljs.core.Keyword(null,"dawn","dawn",65911168),(18),new cljs.core.Keyword(null,"day","day",-274800446),(28)], null),new cljs.core.Keyword(null,"poor","poor",1462482211),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"night","night",773755357),(10),new cljs.core.Keyword(null,"dawn","dawn",65911168),(15),new cljs.core.Keyword(null,"day","day",-274800446),(25)], null),new cljs.core.Keyword(null,"inclement","inclement",-550669382),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"night","night",773755357),(9),new cljs.core.Keyword(null,"dawn","dawn",65911168),(14),new cljs.core.Keyword(null,"day","day",-274800446),(22)], null)], null),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"night","night",773755357),(1034),new cljs.core.Keyword(null,"dawn","dawn",65911168),(1036),new cljs.core.Keyword(null,"day","day",-274800446),(1040)], null),new cljs.core.Keyword(null,"fair","fair",1684139423),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"night","night",773755357),(1007),new cljs.core.Keyword(null,"dawn","dawn",65911168),(1009),new cljs.core.Keyword(null,"day","day",-274800446),(1013)], null),new cljs.core.Keyword(null,"poor","poor",1462482211),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"night","night",773755357),(989),new cljs.core.Keyword(null,"dawn","dawn",65911168),(991),new cljs.core.Keyword(null,"day","day",-274800446),(995)], null),new cljs.core.Keyword(null,"inclement","inclement",-550669382),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"night","night",773755357),(978),new cljs.core.Keyword(null,"dawn","dawn",65911168),(980),new cljs.core.Keyword(null,"day","day",-274800446),(994)], null)], null),(2),weathergen.twx.current_condition_template,45.0,new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),200000.0,new cljs.core.Keyword(null,"fair","fair",1684139423),159232.16,new cljs.core.Keyword(null,"poor","poor",1462482211),69889.87,new cljs.core.Keyword(null,"inclement","inclement",-550669382),24785.021], null),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),new cljs.core.PersistentArrayMap(null, 7, [new cljs.core.Keyword(null,"night-speed","night-speed",1787456793),(0),new cljs.core.Keyword(null,"dawn-speed","dawn-speed",1917633958),(2),new cljs.core.Keyword(null,"day-speed","day-speed",1891855632),(5),new cljs.core.Keyword(null,"burst-interval","burst-interval",-1840121827),(30),new cljs.core.Keyword(null,"burst-duration","burst-duration",1282991874),(5),new cljs.core.Keyword(null,"burst-speed","burst-speed",1211039546),(2),new cljs.core.Keyword(null,"burst-direction","burst-direction",1726705412),(10)], null),new cljs.core.Keyword(null,"fair","fair",1684139423),new cljs.core.PersistentArrayMap(null, 7, [new cljs.core.Keyword(null,"night-speed","night-speed",1787456793),(5),new cljs.core.Keyword(null,"dawn-speed","dawn-speed",1917633958),(10),new cljs.core.Keyword(null,"day-speed","day-speed",1891855632),(15),new cljs.core.Keyword(null,"burst-interval","burst-interval",-1840121827),(20),new cljs.core.Keyword(null,"burst-duration","burst-duration",1282991874),(10),new cljs.core.Keyword(null,"burst-speed","burst-speed",1211039546),(9),new cljs.core.Keyword(null,"burst-direction","burst-direction",1726705412),(20)], null),new cljs.core.Keyword(null,"poor","poor",1462482211),new cljs.core.PersistentArrayMap(null, 7, [new cljs.core.Keyword(null,"night-speed","night-speed",1787456793),(10),new cljs.core.Keyword(null,"dawn-speed","dawn-speed",1917633958),(15),new cljs.core.Keyword(null,"day-speed","day-speed",1891855632),(20),new cljs.core.Keyword(null,"burst-interval","burst-interval",-1840121827),(15),new cljs.core.Keyword(null,"burst-duration","burst-duration",1282991874),(10),new cljs.core.Keyword(null,"burst-speed","burst-speed",1211039546),(13),new cljs.core.Keyword(null,"burst-direction","burst-direction",1726705412),(30)], null),new cljs.core.Keyword(null,"inclement","inclement",-550669382),new cljs.core.PersistentArrayMap(null, 7, [new cljs.core.Keyword(null,"night-speed","night-speed",1787456793),(15),new cljs.core.Keyword(null,"dawn-speed","dawn-speed",1917633958),(20),new cljs.core.Keyword(null,"day-speed","day-speed",1891855632),(25),new cljs.core.Keyword(null,"burst-interval","burst-interval",-1840121827),(5),new cljs.core.Keyword(null,"burst-duration","burst-duration",1282991874),(5),new cljs.core.Keyword(null,"burst-speed","burst-speed",1211039546),(16),new cljs.core.Keyword(null,"burst-direction","burst-direction",1726705412),(30)], null)], null),(20293),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"min","min",444991522),(20000),new cljs.core.Keyword(null,"max","max",61366548),(25000)], null),0.98130846,(123),(2),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),8000.0,new cljs.core.Keyword(null,"fair","fair",1684139423),3991.4685,new cljs.core.Keyword(null,"poor","poor",1462482211),3000.0,new cljs.core.Keyword(null,"inclement","inclement",-550669382),3000.0], null),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),(0),new cljs.core.Keyword(null,"fair","fair",1684139423),(0),new cljs.core.Keyword(null,"poor","poor",1462482211),(2000),new cljs.core.Keyword(null,"inclement","inclement",-550669382),(7000)], null),(1),(1),(60),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),0.25,new cljs.core.Keyword(null,"fair","fair",1684139423),0.25,new cljs.core.Keyword(null,"poor","poor",1462482211),0.25,new cljs.core.Keyword(null,"inclement","inclement",-550669382),0.25], null),(500),(3)]);
/**
 * Converts from visibility to the fog-start value in the TWX.
 */
weathergen.twx.fog_start = (function weathergen$twx$fog_start(vis){
return ((Math.exp((vis * 0.1928564)) * 15.5286) + 2944.614);
});
/**
 * Converts from visibility the the fog-end value in the TWX.
 */
weathergen.twx.fog_end = (function weathergen$twx$fog_end(vis){
return cljs.core.long$.call(null,((vis * ((19690) / 3.0)) + (3100)));
});
/**
 * Applies f to each value of m, a map from weather types to values.
 */
weathergen.twx.per_weather_type = (function weathergen$twx$per_weather_type(f,m){
var map__38303 = m;
var map__38303__$1 = ((((!((map__38303 == null)))?((((map__38303.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38303.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38303):map__38303);
var sunny = cljs.core.get.call(null,map__38303__$1,new cljs.core.Keyword(null,"sunny","sunny",1448267778));
var fair = cljs.core.get.call(null,map__38303__$1,new cljs.core.Keyword(null,"fair","fair",1684139423));
var poor = cljs.core.get.call(null,map__38303__$1,new cljs.core.Keyword(null,"poor","poor",1462482211));
var inclement = cljs.core.get.call(null,map__38303__$1,new cljs.core.Keyword(null,"inclement","inclement",-550669382));
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),f.call(null,sunny),new cljs.core.Keyword(null,"fair","fair",1684139423),f.call(null,fair),new cljs.core.Keyword(null,"poor","poor",1462482211),f.call(null,poor),new cljs.core.Keyword(null,"inclement","inclement",-550669382),f.call(null,inclement)], null);
});
/**
 * Converts cloud configuration from the UI-based parameters format to
 *   the format in the TWX file. `direction` is the direction the weather
 *   pattern is moving.
 */
weathergen.twx.params__GT_twx = (function weathergen$twx$params__GT_twx(cloud_params,direction){
return cljs.core.assoc.call(null,cljs.core.assoc.call(null,weathergen.twx.twx_template,new cljs.core.Keyword(null,"model","model",331153215),(3),new cljs.core.Keyword(null,"map-updates","map-updates",-1922486454),(1),new cljs.core.Keyword(null,"map-wind-heading","map-wind-heading",1215534522),cljs.core.mod.call(null,(new cljs.core.Keyword(null,"heading","heading",-1312171873).cljs$core$IFn$_invoke$arity$1(direction) + (180)),(360)),new cljs.core.Keyword(null,"map-wind-speed","map-wind-speed",1879872886),new cljs.core.Keyword(null,"speed","speed",1257663751).cljs$core$IFn$_invoke$arity$1(direction)),new cljs.core.Keyword(null,"cumulus-density","cumulus-density",-212067170),cljs.core.long$.call(null,((((new cljs.core.Keyword(null,"cumulus-density","cumulus-density",-212067170).cljs$core$IFn$_invoke$arity$1(cloud_params) - (5)) / 45.0) * (12)) + (1))),new cljs.core.Keyword(null,"cumulus-size","cumulus-size",-954219270),new cljs.core.Keyword(null,"cumulus-size","cumulus-size",-954219270).cljs$core$IFn$_invoke$arity$1(cloud_params),new cljs.core.Keyword(null,"fog-start","fog-start",-180274053),weathergen.twx.per_weather_type.call(null,weathergen.twx.fog_start,new cljs.core.Keyword(null,"visibility","visibility",1338380893).cljs$core$IFn$_invoke$arity$1(cloud_params)),new cljs.core.Keyword(null,"fog-end","fog-end",175288886),weathergen.twx.per_weather_type.call(null,weathergen.twx.fog_end,new cljs.core.Keyword(null,"visibility","visibility",1338380893).cljs$core$IFn$_invoke$arity$1(cloud_params)),new cljs.core.Keyword(null,"stratus-layer","stratus-layer",1850856816),(function (){var map__38313 = cloud_params;
var map__38313__$1 = ((((!((map__38313 == null)))?((((map__38313.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38313.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38313):map__38313);
var stratus_base = cljs.core.get.call(null,map__38313__$1,new cljs.core.Keyword(null,"stratus-base","stratus-base",-1631962478));
var stratus_top = cljs.core.get.call(null,map__38313__$1,new cljs.core.Keyword(null,"stratus-top","stratus-top",784220574));
var map__38314 = stratus_base;
var map__38314__$1 = ((((!((map__38314 == null)))?((((map__38314.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38314.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38314):map__38314);
var sunny = cljs.core.get.call(null,map__38314__$1,new cljs.core.Keyword(null,"sunny","sunny",1448267778));
var fair = cljs.core.get.call(null,map__38314__$1,new cljs.core.Keyword(null,"fair","fair",1684139423));
var poor = cljs.core.get.call(null,map__38314__$1,new cljs.core.Keyword(null,"poor","poor",1462482211));
var inclement = cljs.core.get.call(null,map__38314__$1,new cljs.core.Keyword(null,"inclement","inclement",-550669382));
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),sunny,new cljs.core.Keyword(null,"fair","fair",1684139423),fair,new cljs.core.Keyword(null,"poor","poor",1462482211),stratus_top,new cljs.core.Keyword(null,"inclement","inclement",-550669382),stratus_top], null);
})(),new cljs.core.Keyword(null,"stratus-thick","stratus-thick",365371931),(function (){var map__38317 = cloud_params;
var map__38317__$1 = ((((!((map__38317 == null)))?((((map__38317.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38317.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38317):map__38317);
var stratus_base = cljs.core.get.call(null,map__38317__$1,new cljs.core.Keyword(null,"stratus-base","stratus-base",-1631962478));
var stratus_top = cljs.core.get.call(null,map__38317__$1,new cljs.core.Keyword(null,"stratus-top","stratus-top",784220574));
var map__38318 = stratus_base;
var map__38318__$1 = ((((!((map__38318 == null)))?((((map__38318.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38318.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38318):map__38318);
var sunny = cljs.core.get.call(null,map__38318__$1,new cljs.core.Keyword(null,"sunny","sunny",1448267778));
var fair = cljs.core.get.call(null,map__38318__$1,new cljs.core.Keyword(null,"fair","fair",1684139423));
var poor = cljs.core.get.call(null,map__38318__$1,new cljs.core.Keyword(null,"poor","poor",1462482211));
var inclement = cljs.core.get.call(null,map__38318__$1,new cljs.core.Keyword(null,"inclement","inclement",-550669382));
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"sunny","sunny",1448267778),(0),new cljs.core.Keyword(null,"fair","fair",1684139423),(0),new cljs.core.Keyword(null,"poor","poor",1462482211),(stratus_top - poor),new cljs.core.Keyword(null,"inclement","inclement",-550669382),(stratus_top - inclement)], null);
})(),new cljs.core.Keyword(null,"cumulus-layer","cumulus-layer",928032071),new cljs.core.Keyword(null,"cumulus-base","cumulus-base",-578210868).cljs$core$IFn$_invoke$arity$1(cloud_params),new cljs.core.Keyword(null,"contrail-layer","contrail-layer",-456651541),new cljs.core.Keyword(null,"contrails","contrails",1430581743).cljs$core$IFn$_invoke$arity$1(cloud_params));
});
/**
 * Given global weather parameters and weather direction, return a
 *   ByteBuffer (JVM) or an ArrayBuffer (CLJS) populated with the
 *   contents of a TWX file.
 */
weathergen.twx.get_twx = (function weathergen$twx$get_twx(cloud_params,direction){
var buf = octet.core.allocate.call(null,weathergen.twx.buffer_size);
var _STAR_byte_order_STAR_38322_38323 = octet.buffer._STAR_byte_order_STAR_;
octet.buffer._STAR_byte_order_STAR_ = new cljs.core.Keyword(null,"little-endian","little-endian",1877303413);

try{octet.core.write_BANG_.call(null,buf,weathergen.twx.params__GT_twx.call(null,cloud_params,direction),weathergen.twx.twx);
}finally {octet.buffer._STAR_byte_order_STAR_ = _STAR_byte_order_STAR_38322_38323;
}
return buf;
});
