Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. ```python
  2. %matplotlib inline
  3. import matplotlib
  4. import numpy as np
  5. import pandas as pd
  6. import os
  7. import matplotlib.pylab as plt
  8. ```
  9.  
  10.  
  11. ```python
  12. files = [f for f in os.listdir("/sw/apps/nasa") if f.endswith('csv')]
  13. ```
  14.  
  15.  
  16. ```python
  17. frames = []
  18. idx = 0
  19. for f in files:
  20. print(f)
  21. frames.append(pd.read_csv("/sw/apps/nasa/{}".format(f), header=None, names=["position","unixepoc","sdate", "stime", "metric", "val"]))
  22. frames[idx] = frames[idx].assign(timestamp=lambda x: x.sdate+" "+x.stime)
  23. frames[idx].timestamp = pd.to_datetime(frames[idx].timestamp)
  24. frames[idx] = frames[idx].drop(['sdate','stime','position','unixepoc','val'], axis=1)
  25. frames[idx] = frames[idx].set_index(['timestamp'])
  26. frames[idx].sort_index(inplace=True)
  27. idx += 1
  28. ```
  29.  
  30. barometric pressure.csv
  31. humidity.csv
  32. solar radiation.csv
  33. sunrise.csv
  34. sunset.csv
  35. temperature.csv
  36. wind direction in degrees.csv
  37. wind speed.csv
  38.  
  39.  
  40. ## Barometric Pressure
  41.  
  42.  
  43. ```python
  44. frames[0].metric.plot(figsize=(16,5))
  45. ```
  46.  
  47.  
  48.  
  49.  
  50. <matplotlib.axes._subplots.AxesSubplot at 0x11c9a3198>
  51.  
  52.  
  53.  
  54.  
  55. ![png](output_4_1.png)
  56.  
  57.  
  58. ## Humidity
  59.  
  60.  
  61. ```python
  62. frames[1].metric.plot(figsize=(16,5))
  63. ```
  64.  
  65.  
  66.  
  67.  
  68. <matplotlib.axes._subplots.AxesSubplot at 0x1193dca90>
  69.  
  70.  
  71.  
  72.  
  73. ![png](output_6_1.png)
  74.  
  75.  
  76. ## Solar Radiation
  77.  
  78.  
  79. ```python
  80. frames[2].metric.plot(figsize=(16,5))
  81. ```
  82.  
  83.  
  84.  
  85.  
  86. <matplotlib.axes._subplots.AxesSubplot at 0x1193f6278>
  87.  
  88.  
  89.  
  90.  
  91. ![png](output_8_1.png)
  92.  
  93.  
  94. ## Sunrise
  95.  
  96.  
  97. ```python
  98. frames[3].metric.plot(figsize=(16,5))
  99. ```
  100.  
  101.  
  102.  
  103.  
  104. <matplotlib.axes._subplots.AxesSubplot at 0x11d7ec940>
  105.  
  106.  
  107.  
  108.  
  109. ![png](output_10_1.png)
  110.  
  111.  
  112. ## Sunset
  113.  
  114.  
  115. ```python
  116. frames[4].metric.plot(figsize=(16,5))
  117. ```
  118.  
  119.  
  120.  
  121.  
  122. <matplotlib.axes._subplots.AxesSubplot at 0x11d7885f8>
  123.  
  124.  
  125.  
  126.  
  127. ![png](output_12_1.png)
  128.  
  129.  
  130. ## Temperature
  131.  
  132.  
  133. ```python
  134. frames[5][frames[5].index.month==12].plot(figsize=(16,5))
  135. ```
  136.  
  137.  
  138.  
  139.  
  140. <matplotlib.axes._subplots.AxesSubplot at 0x12379cda0>
  141.  
  142.  
  143.  
  144.  
  145. ![png](output_14_1.png)
  146.  
  147.  
  148.  
  149. ```python
  150. frames[5][frames[5].index.month==12].metric.describe()
  151. ```
  152.  
  153.  
  154.  
  155.  
  156. count 8164.000000
  157. mean 47.608893
  158. std 4.994597
  159. min 34.000000
  160. 25% 45.000000
  161. 50% 47.000000
  162. 75% 50.000000
  163. max 62.000000
  164. Name: metric, dtype: float64
  165.  
  166.  
  167.  
  168.  
  169. ```python
  170. frames[5].metric.plot(figsize=(16,5))
  171. ```
  172.  
  173.  
  174.  
  175.  
  176. <matplotlib.axes._subplots.AxesSubplot at 0x11d17a550>
  177.  
  178.  
  179.  
  180.  
  181. ![png](output_16_1.png)
  182.  
  183.  
  184. ## Wind Direction
  185.  
  186.  
  187. ```python
  188. frames[6].metric.plot(figsize=(16,5))
  189. ```
  190.  
  191.  
  192.  
  193.  
  194. <matplotlib.axes._subplots.AxesSubplot at 0x11d0c6cf8>
  195.  
  196.  
  197.  
  198.  
  199. ![png](output_18_1.png)
  200.  
  201.  
  202. ## Wind Speed
  203.  
  204.  
  205. ```python
  206. frames[7].metric.plot(figsize=(16,5))
  207. ```
  208.  
  209.  
  210.  
  211.  
  212. <matplotlib.axes._subplots.AxesSubplot at 0x11d7aec88>
  213.  
  214.  
  215.  
  216.  
  217. ![png](output_20_1.png)
  218.  
  219.  
  220.  
  221. ```python
  222.  
  223. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement