DarlingVanDamme

MongoDB import weather data

Mar 27th, 2014
139
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. settings.stationDef = [
  2. {name:"ID", type:"String", start:1,stop:11},
  3. {name:"Latitude",type:"Float",start:13,stop:20 },
  4. {name:"Longitude",type:"Float",start:22,stop:30 },
  5. {name:"Elevation",type:"Float",start:32,stop:37},
  6. {name:"State",type:"String",start:39,stop:40},
  7. {name:"Name",type:"String",start:42,stop:71},
  8. {name:"GSNFlag",type:"String",start:73,stop:75},
  9. {name:"HCNFlag",type:"String",start:77,stop:79},
  10. {name:"WMOID",type:"String",start:81,stop:85},
  11. {name:"Country", type:"String", start:1,stop:2}
  12. ];
  13.  
  14.  
  15. settings.weatherDefsSimple = [
  16. {name:"ID", type:"String", start:1,stop:11},
  17. {name:"Country", type:"String", start:1,stop:2},
  18. {name:"year",type:"Integer",start:12,stop:15 },
  19. {name:"month",type:"Integer",start:16,stop:17 },
  20. {name:"element",type:"String",start:18,stop:21 },
  21. {name:"V01",type:"Integer",start:22,stop:26},
  22. {name:"M01",type:"String" ,start:27,stop:27},
  23. {name:"Q01",type:"String" ,start:28,stop:28},
  24. {name:"S01",type:"String" ,start:29,stop:29},
  25. {name:"V02",type:"Integer",start:30,stop:34},
  26. {name:"M02",type:"String" ,start:35,stop:35},
  27. {name:"Q02",type:"String" ,start:36,stop:36},
  28. {name:"S02",type:"String" ,start:37,stop:37},
  29. {name:"V03",type:"Integer",start:38,stop:42},
  30. {name:"M03",type:"String" ,start:43,stop:43},
  31. {name:"Q03",type:"String" ,start:44,stop:44},
  32. {name:"S03",type:"String" ,start:45,stop:45},
  33. {name:"V04",type:"Integer",start:46,stop:50},
  34. {name:"M04",type:"String" ,start:51,stop:51},
  35. {name:"Q04",type:"String" ,start:52,stop:52},
  36. {name:"S04",type:"String" ,start:53,stop:53},
  37. {name:"V05",type:"Integer",start:54,stop:58},
  38. {name:"M05",type:"String" ,start:59,stop:59},
  39. {name:"Q05",type:"String" ,start:60,stop:60},
  40. {name:"S05",type:"String" ,start:61,stop:61},
  41. {name:"V06",type:"Integer",start:62,stop:66},
  42. {name:"M06",type:"String" ,start:67,stop:67},
  43. {name:"Q06",type:"String" ,start:68,stop:68},
  44. {name:"S06",type:"String" ,start:69,stop:69},
  45. {name:"V07",type:"Integer",start:70,stop:74},
  46. {name:"M07",type:"String" ,start:75,stop:75},
  47. {name:"Q07",type:"String" ,start:76,stop:76},
  48. {name:"S07",type:"String" ,start:77,stop:77},
  49. {name:"V08",type:"Integer",start:78,stop:82},
  50. {name:"M08",type:"String" ,start:83,stop:83},
  51. {name:"Q08",type:"String" ,start:84,stop:84},
  52. {name:"S08",type:"String" ,start:85,stop:85},
  53. {name:"V09",type:"Integer",start:86,stop:90},
  54. {name:"M09",type:"String" ,start:91,stop:91},
  55. {name:"Q09",type:"String" ,start:92,stop:92},
  56. {name:"S09",type:"String" ,start:93,stop:93},
  57. {name:"V10",type:"Integer",start:94,stop:98},
  58. {name:"M10",type:"String" ,start:99,stop:99},
  59. {name:"Q10",type:"String" ,start:100,stop:100},
  60. {name:"S10",type:"String" ,start:101,stop:101},
  61. {name:"V11",type:"Integer",start:102,stop:106},
  62. {name:"M11",type:"String" ,start:107,stop:107},
  63. {name:"Q11",type:"String" ,start:108,stop:108},
  64. {name:"S11",type:"String" ,start:109,stop:109},
  65. {name:"V12",type:"Integer",start:110,stop:114},
  66. {name:"M12",type:"String" ,start:115,stop:115},
  67. {name:"Q12",type:"String" ,start:116,stop:116},
  68. {name:"S12",type:"String" ,start:117,stop:117},
  69. {name:"V13",type:"Integer",start:118,stop:122},
  70. {name:"M13",type:"String" ,start:123,stop:123},
  71. {name:"Q13",type:"String" ,start:124,stop:124},
  72. {name:"S13",type:"String" ,start:125,stop:125},
  73. {name:"V14",type:"Integer",start:126,stop:130},
  74. {name:"M14",type:"String" ,start:131,stop:131},
  75. {name:"Q14",type:"String" ,start:132,stop:132},
  76. {name:"S14",type:"String" ,start:133,stop:133},
  77. {name:"V15",type:"Integer",start:134,stop:138},
  78. {name:"M15",type:"String" ,start:139,stop:139},
  79. {name:"Q15",type:"String" ,start:140,stop:140},
  80. {name:"S15",type:"String" ,start:141,stop:141},
  81. {name:"V16",type:"Integer",start:142,stop:146},
  82. {name:"M16",type:"String" ,start:147,stop:147},
  83. {name:"Q16",type:"String" ,start:148,stop:148},
  84. {name:"S16",type:"String" ,start:149,stop:149},
  85. {name:"V17",type:"Integer",start:150,stop:154},
  86. {name:"M17",type:"String" ,start:155,stop:155},
  87. {name:"Q17",type:"String" ,start:156,stop:156},
  88. {name:"S17",type:"String" ,start:157,stop:157},
  89. {name:"V18",type:"Integer",start:158,stop:162},
  90. {name:"M18",type:"String" ,start:163,stop:163},
  91. {name:"Q18",type:"String" ,start:164,stop:164},
  92. {name:"S18",type:"String" ,start:165,stop:165},
  93. {name:"V19",type:"Integer",start:166,stop:170},
  94. {name:"M19",type:"String" ,start:171,stop:171},
  95. {name:"Q19",type:"String" ,start:172,stop:172},
  96. {name:"S19",type:"String" ,start:173,stop:173},
  97. {name:"V20",type:"Integer",start:174,stop:178},
  98. {name:"M20",type:"String" ,start:179,stop:179},
  99. {name:"Q20",type:"String" ,start:180,stop:180},
  100. {name:"S20",type:"String" ,start:181,stop:181},
  101. {name:"V21",type:"Integer",start:182,stop:186},
  102. {name:"M21",type:"String" ,start:187,stop:187},
  103. {name:"Q21",type:"String" ,start:188,stop:188},
  104. {name:"S21",type:"String" ,start:189,stop:189},
  105. {name:"V22",type:"Integer",start:190,stop:194},
  106. {name:"M22",type:"String" ,start:195,stop:195},
  107. {name:"Q22",type:"String" ,start:196,stop:196},
  108. {name:"S22",type:"String" ,start:197,stop:197},
  109. {name:"V23",type:"Integer",start:198,stop:202},
  110. {name:"M23",type:"String" ,start:203,stop:203},
  111. {name:"Q23",type:"String" ,start:204,stop:204},
  112. {name:"S23",type:"String" ,start:205,stop:205},
  113. {name:"V24",type:"Integer",start:206,stop:210},
  114. {name:"M24",type:"String" ,start:211,stop:211},
  115. {name:"Q24",type:"String" ,start:212,stop:212},
  116. {name:"S24",type:"String" ,start:213,stop:213},
  117. {name:"V25",type:"Integer",start:214,stop:218},
  118. {name:"M25",type:"String" ,start:219,stop:219},
  119. {name:"Q25",type:"String" ,start:220,stop:220},
  120. {name:"S25",type:"String" ,start:221,stop:221},
  121. {name:"V26",type:"Integer",start:222,stop:226},
  122. {name:"M26",type:"String" ,start:227,stop:227},
  123. {name:"Q26",type:"String" ,start:228,stop:228},
  124. {name:"S26",type:"String" ,start:229,stop:229},
  125. {name:"V27",type:"Integer",start:230,stop:234},
  126. {name:"M27",type:"String" ,start:235,stop:235},
  127. {name:"Q27",type:"String" ,start:236,stop:236},
  128. {name:"S27",type:"String" ,start:237,stop:237},
  129. {name:"V28",type:"Integer",start:238,stop:242},
  130. {name:"M28",type:"String" ,start:243,stop:243},
  131. {name:"Q28",type:"String" ,start:244,stop:244},
  132. {name:"S28",type:"String" ,start:245,stop:245},
  133. {name:"V29",type:"Integer",start:246,stop:250},
  134. {name:"M29",type:"String" ,start:251,stop:251},
  135. {name:"Q29",type:"String" ,start:252,stop:252},
  136. {name:"S29",type:"String" ,start:253,stop:253},
  137. {name:"V30",type:"Integer",start:254,stop:258},
  138. {name:"M30",type:"String" ,start:259,stop:259},
  139. {name:"Q30",type:"String" ,start:260,stop:260},
  140. {name:"S30",type:"String" ,start:261,stop:261},
  141. {name:"V31",type:"Integer",start:262,stop:266},
  142. {name:"M31",type:"String" ,start:267,stop:267},
  143. {name:"Q31",type:"String" ,start:268,stop:268},
  144. {name:"S31",type:"String" ,start:269,stop:269}
  145. ];
  146.  
  147. settings.weatherDefs =
  148.  [ [ { "name" : "day", "type" : "fixed", "value" : 1 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 22, "stop" : 26 }, { "name" : "M", "type" : "String", "start" : 27, "stop" : 27 }, { "name" : "Q", "type" : "String", "start" : 28, "stop" : 28 }, { "name" : "S", "type" : "String", "start" : 29, "stop" : 29 } ],
  149.  [ { "name" : "day", "type" : "fixed", "value" : 2 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 30, "stop" : 34 }, { "name" : "M", "type" : "String", "start" : 35, "stop" : 35 }, { "name" : "Q", "type" : "String", "start" : 36, "stop" : 36 }, { "name" : "S", "type" : "String", "start" : 37, "stop" : 37 } ],
  150.  [ { "name" : "day", "type" : "fixed", "value" : 3 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 38, "stop" : 42 }, { "name" : "M", "type" : "String", "start" : 43, "stop" : 43 }, { "name" : "Q", "type" : "String", "start" : 44, "stop" : 44 }, { "name" : "S", "type" : "String", "start" : 45, "stop" : 45 } ],
  151.  [ { "name" : "day", "type" : "fixed", "value" : 4 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 46, "stop" : 50 }, { "name" : "M", "type" : "String", "start" : 51, "stop" : 51 }, { "name" : "Q", "type" : "String", "start" : 52, "stop" : 52 }, { "name" : "S", "type" : "String", "start" : 53, "stop" : 53 } ],
  152.  [ { "name" : "day", "type" : "fixed", "value" : 5 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 54, "stop" : 58 }, { "name" : "M", "type" : "String", "start" : 59, "stop" : 59 }, { "name" : "Q", "type" : "String", "start" : 60, "stop" : 60 }, { "name" : "S", "type" : "String", "start" : 61, "stop" : 61 } ],
  153.  [ { "name" : "day", "type" : "fixed", "value" : 6 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 62, "stop" : 66 }, { "name" : "M", "type" : "String", "start" : 67, "stop" : 67 }, { "name" : "Q", "type" : "String", "start" : 68, "stop" : 68 }, { "name" : "S", "type" : "String", "start" : 69, "stop" : 69 } ],
  154.  [ { "name" : "day", "type" : "fixed", "value" : 7 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 70, "stop" : 74 }, { "name" : "M", "type" : "String", "start" : 75, "stop" : 75 }, { "name" : "Q", "type" : "String", "start" : 76, "stop" : 76 }, { "name" : "S", "type" : "String", "start" : 77, "stop" : 77 } ],
  155.  [ { "name" : "day", "type" : "fixed", "value" : 8 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 78, "stop" : 82 }, { "name" : "M", "type" : "String", "start" : 83, "stop" : 83 }, { "name" : "Q", "type" : "String", "start" : 84, "stop" : 84 }, { "name" : "S", "type" : "String", "start" : 85, "stop" : 85 } ],
  156.  [ { "name" : "day", "type" : "fixed", "value" : 9 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 86, "stop" : 90 }, { "name" : "M", "type" : "String", "start" : 91, "stop" : 91 }, { "name" : "Q", "type" : "String", "start" : 92, "stop" : 92 }, { "name" : "S", "type" : "String", "start" : 93, "stop" : 93 } ],
  157.  [ { "name" : "day", "type" : "fixed", "value" : 10 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 94, "stop" : 98 }, { "name" : "M", "type" : "String", "start" : 99, "stop" : 99 }, { "name" : "Q", "type" : "String", "start" : 100, "stop" : 100 }, { "name" : "S", "type" : "String", "start" : 101, "stop" : 101 } ],
  158.  [ { "name" : "day", "type" : "fixed", "value" : 11 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 102, "stop" : 106 }, { "name" : "M", "type" : "String", "start" : 107, "stop" : 107 }, { "name" : "Q", "type" : "String", "start" : 108, "stop" : 108 }, { "name" : "S", "type" : "String", "start" : 109, "stop" : 109 } ],
  159.  [ { "name" : "day", "type" : "fixed", "value" : 12 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 110, "stop" : 114 }, { "name" : "M", "type" : "String", "start" : 115, "stop" : 115 }, { "name" : "Q", "type" : "String", "start" : 116, "stop" : 116 }, { "name" : "S", "type" : "String", "start" : 117, "stop" : 117 } ],
  160.  [ { "name" : "day", "type" : "fixed", "value" : 13 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 118, "stop" : 122 }, { "name" : "M", "type" : "String", "start" : 123, "stop" : 123 }, { "name" : "Q", "type" : "String", "start" : 124, "stop" : 124 }, { "name" : "S", "type" : "String", "start" : 125, "stop" : 125 } ],
  161.  [ { "name" : "day", "type" : "fixed", "value" : 14 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 126, "stop" : 130 }, { "name" : "M", "type" : "String", "start" : 131, "stop" : 131 }, { "name" : "Q", "type" : "String", "start" : 132, "stop" : 132 }, { "name" : "S", "type" : "String", "start" : 133, "stop" : 133 } ],
  162.  [ { "name" : "day", "type" : "fixed", "value" : 15 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 134, "stop" : 138 }, { "name" : "M", "type" : "String", "start" : 139, "stop" : 139 }, { "name" : "Q", "type" : "String", "start" : 140, "stop" : 140 }, { "name" : "S", "type" : "String", "start" : 141, "stop" : 141 } ],
  163.  [ { "name" : "day", "type" : "fixed", "value" : 16 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 142, "stop" : 146 }, { "name" : "M", "type" : "String", "start" : 147, "stop" : 147 }, { "name" : "Q", "type" : "String", "start" : 148, "stop" : 148 }, { "name" : "S", "type" : "String", "start" : 149, "stop" : 149 } ],
  164.  [ { "name" : "day", "type" : "fixed", "value" : 17 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 150, "stop" : 154 }, { "name" : "M", "type" : "String", "start" : 155, "stop" : 155 }, { "name" : "Q", "type" : "String", "start" : 156, "stop" : 156 }, { "name" : "S", "type" : "String", "start" : 157, "stop" : 157 } ],
  165.  [ { "name" : "day", "type" : "fixed", "value" : 18 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 158, "stop" : 162 }, { "name" : "M", "type" : "String", "start" : 163, "stop" : 163 }, { "name" : "Q", "type" : "String", "start" : 164, "stop" : 164 }, { "name" : "S", "type" : "String", "start" : 165, "stop" : 165 } ],
  166.  [ { "name" : "day", "type" : "fixed", "value" : 19 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 166, "stop" : 170 }, { "name" : "M", "type" : "String", "start" : 171, "stop" : 171 }, { "name" : "Q", "type" : "String", "start" : 172, "stop" : 172 }, { "name" : "S", "type" : "String", "start" : 173, "stop" : 173 } ],
  167.  [ { "name" : "day", "type" : "fixed", "value" : 20 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 174, "stop" : 178 }, { "name" : "M", "type" : "String", "start" : 179, "stop" : 179 }, { "name" : "Q", "type" : "String", "start" : 180, "stop" : 180 }, { "name" : "S", "type" : "String", "start" : 181, "stop" : 181 } ],
  168.  [ { "name" : "day", "type" : "fixed", "value" : 21 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 182, "stop" : 186 }, { "name" : "M", "type" : "String", "start" : 187, "stop" : 187 }, { "name" : "Q", "type" : "String", "start" : 188, "stop" : 188 }, { "name" : "S", "type" : "String", "start" : 189, "stop" : 189 } ],
  169.  [ { "name" : "day", "type" : "fixed", "value" : 22 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 190, "stop" : 194 }, { "name" : "M", "type" : "String", "start" : 195, "stop" : 195 }, { "name" : "Q", "type" : "String", "start" : 196, "stop" : 196 }, { "name" : "S", "type" : "String", "start" : 197, "stop" : 197 } ],
  170.  [ { "name" : "day", "type" : "fixed", "value" : 23 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 198, "stop" : 202 }, { "name" : "M", "type" : "String", "start" : 203, "stop" : 203 }, { "name" : "Q", "type" : "String", "start" : 204, "stop" : 204 }, { "name" : "S", "type" : "String", "start" : 205, "stop" : 205 } ],
  171.  [ { "name" : "day", "type" : "fixed", "value" : 24 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 206, "stop" : 210 }, { "name" : "M", "type" : "String", "start" : 211, "stop" : 211 }, { "name" : "Q", "type" : "String", "start" : 212, "stop" : 212 }, { "name" : "S", "type" : "String", "start" : 213, "stop" : 213 } ],
  172.  [ { "name" : "day", "type" : "fixed", "value" : 25 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 214, "stop" : 218 }, { "name" : "M", "type" : "String", "start" : 219, "stop" : 219 }, { "name" : "Q", "type" : "String", "start" : 220, "stop" : 220 }, { "name" : "S", "type" : "String", "start" : 221, "stop" : 221 } ],
  173.  [ { "name" : "day", "type" : "fixed", "value" : 26 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 222, "stop" : 226 }, { "name" : "M", "type" : "String", "start" : 227, "stop" : 227 }, { "name" : "Q", "type" : "String", "start" : 228, "stop" : 228 }, { "name" : "S", "type" : "String", "start" : 229, "stop" : 229 } ],
  174.  [ { "name" : "day", "type" : "fixed", "value" : 27 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 230, "stop" : 234 }, { "name" : "M", "type" : "String", "start" : 235, "stop" : 235 }, { "name" : "Q", "type" : "String", "start" : 236, "stop" : 236 }, { "name" : "S", "type" : "String", "start" : 237, "stop" : 237 } ],
  175.  [ { "name" : "day", "type" : "fixed", "value" : 28 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 238, "stop" : 242 }, { "name" : "M", "type" : "String", "start" : 243, "stop" : 243 }, { "name" : "Q", "type" : "String", "start" : 244, "stop" : 244 }, { "name" : "S", "type" : "String", "start" : 245, "stop" : 245 } ],
  176.  [ { "name" : "day", "type" : "fixed", "value" : 29 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 246, "stop" : 250 }, { "name" : "M", "type" : "String", "start" : 251, "stop" : 251 }, { "name" : "Q", "type" : "String", "start" : 252, "stop" : 252 }, { "name" : "S", "type" : "String", "start" : 253, "stop" : 253 } ],
  177.  [ { "name" : "day", "type" : "fixed", "value" : 30 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 254, "stop" : 258 }, { "name" : "M", "type" : "String", "start" : 259, "stop" : 259 }, { "name" : "Q", "type" : "String", "start" : 260, "stop" : 260 }, { "name" : "S", "type" : "String", "start" : 261, "stop" : 261 } ],
  178.  [ { "name" : "day", "type" : "fixed", "value" : 31 }, { "name" : "ID", "type" : "String", "start" : 1, "stop" : 11 }, { "name" : "Country", "type" : "String", "start" : 1, "stop" : 2 }, { "name" : "year", "type" : "Integer", "start" : 12, "stop" : 15 }, { "name" : "month", "type" : "Integer", "start" : 16, "stop" : 17 }, { "name" : "element", "type" : "String", "start" : 18, "stop" : 21 }, { "name" : "Value", "type" : "Integer", "start" : 262, "stop" : 266 }, { "name" : "M", "type" : "String", "start" : 267, "stop" : 267 }, { "name" : "Q", "type" : "String", "start" : 268, "stop" : 268 }, { "name" : "S", "type" : "String", "start" : 269, "stop" : 269 } ]
  179.  ]
  180.  
  181. function split(line, definition){
  182.     var result = new Object();
  183.     for (key in definition){
  184.         var column = definition[key];
  185.         if (column.type=="fixed"){
  186.             result[column.name] = column.value;
  187.         } else {
  188.             var s = line.substring(column.start-1,column.stop);
  189.             if (column.type=="Float"){
  190.                 result[column.name] =  parseFloat(s);
  191.             } else if (column.type=="Integer"){
  192.                 result[column.name] =  parseInt(s);
  193.             } else {
  194.                 result[column.name] =  s.trim();
  195.             }
  196.         }
  197.     }
  198.     return result;
  199. }
  200.  
  201.  
  202. function split(line, definitions){
  203.     var allResults = new Array();
  204.     for (var i in definitions){
  205.         var definition = definitions[i];
  206.         var result = new Object();
  207.         for (key in definition){
  208.             var column = definition[key];
  209.             if (column.type=="fixed"){
  210.                 result[column.name] = column.value;
  211.             } else {
  212.                 var s = line.substring(column.start-1,column.stop);
  213.                 if (column.type=="Float"){
  214.                     result[column.name] =  parseFloat(s);
  215.                 } else if (column.type=="Integer"){
  216.                     result[column.name] =  parseInt(s);
  217.                 } else {
  218.                     result[column.name] =  s.trim();
  219.                 }
  220.             }
  221.         }
  222.         allResults.push(result);
  223.     }
  224.     return allResults;
  225. }
  226.  
  227. function readFile(name,collection,definition){
  228.     var data = cat(name);
  229.     var all = new Array();
  230.     var lines = data.split("\n");
  231.     for(i=1;i<lines.length;i++){
  232.         var result = split(lines[i],definition);
  233.         all=all.concat(result);
  234.     }
  235.     collection.insert(all);
  236.     return all.length;
  237. }
  238.  
  239. var tel=0;
  240. db.stations.find({Country:"UK"}).forEach(function(entry){
  241.     tel++;
  242.     var file = "projects/mongo/weather/ghcnd_all/ghcnd_all/"+entry.ID+".dly";
  243.     var count = readFile(file,db.weather,definitions);
  244.     print(new Date()+" "+tel+" "+entry.ID+"   "+count);
  245. })
  246. db.weather.aggregate(
  247.     {$match:{"year":1994,element:"TMIN"}},
  248.     {$group:{_id:"$month",
  249.         Temp:{$avg:"$Value"}
  250.         }}
  251. )
  252.  
  253.  
  254. db.weather.aggregate(
  255.     {$match:{"Country":"BE","year":{$gt:1994},month:2, element:"TMIN"}},
  256.     {$group:{_id: {year:"$year",month:"$month"},
  257.         Temp:{$avg:"$Value"}
  258.         }},
  259.     {$sort:{_id:1}}
  260. )
RAW Paste Data