项目作者: ookuyan

项目描述 :
TÜBİTAK National Observatory (TUG) Meteorology Library
高级语言: Python
项目地址: git://github.com/ookuyan/tugmeteo.git
创建时间: 2019-05-27T20:46:40Z
项目社区:https://github.com/ookuyan/tugmeteo

开源协议:Apache License 2.0

下载


  1. %matplotlib inline

tugmeteo

TÜBİTAK National Observatory (TUG) Meteorology Library

A library where instant and historical meteorological data can be obtained.

Examples

  1. import matplotlib.pyplot as plt
  2. from tugmeteo import TugMeteo

Basic operations

  1. met = TugMeteo()
  1. met.get_last_meteo('T100')
  1. {'timestamp': '2020-01-21T23:20:41',
  2. 'telescope': 'T100',
  3. 'TEMPERATURE': -6.0,
  4. 'Inside Temperature': -4.2,
  5. 'HUMIDITY': 32.0,
  6. 'Inside Humidity': 59.0,
  7. 'PRESSURE': 750.4,
  8. 'WINDSPEED': 72.4,
  9. 'WINDDIR': 61.0,
  10. 'RAIN': 0.0,
  11. 'UV': 0.0,
  12. 'Solar Radiation': 0.0,
  13. 'Wind Chill': -17.9,
  14. 'Dew Point': -20.0,
  15. 'High Temperature': -5.5,
  16. 'Low Temperature': -13.4,
  17. 'High Humidity': 89.0,
  18. 'Low Humidity': 22.0,
  19. 'High Barometer': 751.5,
  20. 'Low Barometer': 743.1,
  21. 'High Wind': 143.0,
  22. 'Air Density': 0.978,
  23. 'Est. Cumulus Base': 1751.0}
  1. met.get_temperature()
  1. {'timestamp': '2020-01-21T23:20:42',
  2. 'info': 'Temperature',
  3. 'unit': 'C',
  4. 'RTT150': -6.4,
  5. 'T100': -6.0,
  6. 'T60': -6.6}

Getting meteo archive between ‘2020-01-18’ and ‘2020-01-22’ dates

  1. t = met.get_meteo_archives(telescope='T100', start_date='2020-01-18', end_date='2020-01-22')
  1. t


















































































































































































































Timestamp Temp Chill HIndex Humid Dewpt Wind HiWind WindDir Rain Barom Solar ET UV
0 2020-01-18 00:05:00 -4.5 -9.0 -4.5 78 -7.7 11 16 315 0.0 748.1 0 0.000 0.0
1 2020-01-18 00:10:00 -4.4 -8.5 -4.4 78 -7.7 10 13 315 0.0 748.1 0 0.000 0.0
2 2020-01-18 00:15:00 -4.6 -8.6 -4.6 79 -7.6 10 13 315 0.0 748.1 0 0.000 0.0
3 2020-01-18 00:20:00 -4.6 -8.6 -4.6 80 -7.5 10 13 315 0.0 748.3 0 0.000 0.0
4 2020-01-18 00:25:00 -4.4 -8.9 -4.4 79 -7.5 11 13 315 0.0 748.2 0 0.000 0.0
1136 2020-01-21 23:00:00 -6.4 -18.4 -6.4 31 -20.7 72 82 68 0.0 750.4 0 0.025 0.0
1137 2020-01-21 23:05:00 -6.2 -18.0 -6.2 33 -19.8 71 82 68 0.0 750.2 0 0.000 0.0
1138 2020-01-21 23:10:00 -6.2 -18.1 -6.2 33 -19.8 71 84 68 0.0 750.4 0 0.000 0.0
1139 2020-01-21 23:15:00 -6.2 -18.3 -6.2 32 -20.2 74 87 68 0.0 750.3 0 0.000 0.0
1140 2020-01-21 23:20:00 -6.0 -17.8 -6.0 32 -20.0 71 84 68 0.0 750.4 0 0.000 0.0

1141 rows × 14 columns


Plotting

  1. fig, ax = plt.subplots(figsize=(12, 9), dpi=72)
  2. ax.grid()
  3. ax.set_title('T100 - Weather Station')
  4. ax.set_xlabel('Dates')
  5. ax.set_ylabel('Barometer [mBar]')
  6. press, = ax.plot(t.Timestamp, t.Barom, 'k.', ms=2)
  7. ax1 = ax.twinx()
  8. ax1.set_ylabel('Temperature [C]')
  9. temp, = ax1.plot(t.Timestamp, t.Temp, 'r.', ms=1)
  10. ax.legend(handles=[press, temp], labels=['Pressure', 'Temperature'], loc='upper right')

png

  1. import numpy as np
  2. from scipy.stats import gaussian_kde
  3. temp = t.Temp
  4. bar = t.Barom
  5. xmin = temp.min()
  6. xmax = temp.max()
  7. ymin = bar.min()
  8. ymax = bar.max()
  9. X, Y = np.mgrid[xmin:xmax:100j, ymin:ymax:100j]
  10. positions = np.vstack([X.ravel(), Y.ravel()])
  11. values = np.vstack([temp, bar])
  12. kernel = gaussian_kde(values)
  13. Z = np.reshape(kernel(positions).T, X.shape)
  14. fig, ax = plt.subplots(figsize=(12, 9))
  15. # ax.grid()
  16. ax.set_title('Density Map Between 2020-01-18 and 2020-01-22', fontsize=17)
  17. ax.set_xlabel('Temperature [C]', fontsize=15)
  18. ax.set_ylabel('Barometer [mBar]', fontsize=15)
  19. ax.imshow(np.rot90(Z), cmap=plt.cm.gist_earth, extent=[xmin, xmax, ymin, ymax])
  20. ax.plot(temp, bar, 'k.', markersize=1)
  21. ax.set_xlim([xmin, xmax])
  22. ax.set_ylim([ymin, ymax])
  1. (742.4, 751.5)

png