Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Latest commit

 

History

History
385 lines (312 loc) · 6.58 KB

README.md

File metadata and controls

385 lines (312 loc) · 6.58 KB
%matplotlib inline

tugmeteo

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

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

Examples

import matplotlib.pyplot as plt

from tugmeteo import TugMeteo

Basic operations

met = TugMeteo()
met.get_last_meteo('T100')
{'timestamp': '2020-01-21T23:20:41',
 'telescope': 'T100',
 'TEMPERATURE': -6.0,
 'Inside Temperature': -4.2,
 'HUMIDITY': 32.0,
 'Inside Humidity': 59.0,
 'PRESSURE': 750.4,
 'WINDSPEED': 72.4,
 'WINDDIR': 61.0,
 'RAIN': 0.0,
 'UV': 0.0,
 'Solar Radiation': 0.0,
 'Wind Chill': -17.9,
 'Dew Point': -20.0,
 'High Temperature': -5.5,
 'Low Temperature': -13.4,
 'High Humidity': 89.0,
 'Low Humidity': 22.0,
 'High Barometer': 751.5,
 'Low Barometer': 743.1,
 'High Wind': 143.0,
 'Air Density': 0.978,
 'Est. Cumulus Base': 1751.0}
met.get_temperature()
{'timestamp': '2020-01-21T23:20:42',
 'info': 'Temperature',
 'unit': 'C',
 'RTT150': -6.4,
 'T100': -6.0,
 'T60': -6.6}

Getting meteo archive between '2020-01-18' and '2020-01-22' dates

t = met.get_meteo_archives(telescope='T100', start_date='2020-01-18', end_date='2020-01-22')
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

fig, ax = plt.subplots(figsize=(12, 9), dpi=72)

ax.grid()

ax.set_title('T100 - Weather Station')
ax.set_xlabel('Dates')
ax.set_ylabel('Barometer [mBar]')

press, = ax.plot(t.Timestamp, t.Barom, 'k.', ms=2)

ax1 = ax.twinx()

ax1.set_ylabel('Temperature [C]')
temp, = ax1.plot(t.Timestamp, t.Temp, 'r.', ms=1)

ax.legend(handles=[press, temp], labels=['Pressure', 'Temperature'], loc='upper right')

png

import numpy as np
from scipy.stats import gaussian_kde

temp = t.Temp
bar = t.Barom

xmin = temp.min()
xmax = temp.max()
ymin = bar.min()
ymax = bar.max()

X, Y = np.mgrid[xmin:xmax:100j, ymin:ymax:100j]

positions = np.vstack([X.ravel(), Y.ravel()])
values = np.vstack([temp, bar])
kernel = gaussian_kde(values)

Z = np.reshape(kernel(positions).T, X.shape)

fig, ax = plt.subplots(figsize=(12, 9))

# ax.grid()
ax.set_title('Density Map Between 2020-01-18 and 2020-01-22', fontsize=17)
ax.set_xlabel('Temperature [C]', fontsize=15)
ax.set_ylabel('Barometer [mBar]', fontsize=15)

ax.imshow(np.rot90(Z), cmap=plt.cm.gist_earth, extent=[xmin, xmax, ymin, ymax])

ax.plot(temp, bar, 'k.', markersize=1)

ax.set_xlim([xmin, xmax])
ax.set_ylim([ymin, ymax])
(742.4, 751.5)

png