atmosphere.py
tutorialThis tutorial needs your help to make it better!
This tutorial has been tested against the following package versions:
It should work with other Python and Pandas versions. It requires pvlib > 0.3.0 and IPython > 3.0.
Authors:
In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
try:
import seaborn as sns
sns.set(rc={"figure.figsize": (12, 6)})
except ImportError:
print('We suggest you install seaborn using conda or pip and rerun this cell')
# built in python modules
import datetime
import logging
import os
import inspect
# python add-ons
import numpy as np
import pandas as pd
In [2]:
import pvlib
from pvlib.location import Location
In [3]:
tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
In [4]:
print(tus)
In [5]:
times = pd.date_range(start=datetime.datetime(2014,6,24), end=datetime.datetime(2014,6,25), freq='1Min', tz=tus.tz)
pyephem_ephem = pvlib.solarposition.get_solarposition(times, tus.latitude, tus.longitude, method='pyephem')
print(pyephem_ephem.head())
pyephem_ephem.plot()
Out[5]:
In [6]:
pvlib.atmosphere.relativeairmass(pyephem_ephem['zenith']).plot()
pvlib.atmosphere.relativeairmass(pyephem_ephem['apparent_zenith']).plot()
pvlib.atmosphere.relativeairmass(pyephem_ephem['zenith'], model='young1994').plot()
pvlib.atmosphere.relativeairmass(pyephem_ephem['zenith'], model='simple').plot()
plt.legend()
plt.ylim(0,100)
Out[6]:
In [7]:
plt.plot(pyephem_ephem['zenith'], pvlib.atmosphere.relativeairmass(pyephem_ephem['zenith'], model='simple'), label='simple')
plt.plot(pyephem_ephem['zenith'], pvlib.atmosphere.relativeairmass(pyephem_ephem['apparent_zenith']), label='default')
plt.xlim(0,100)
plt.ylim(0,100)
plt.legend()
Out[7]:
In [ ]: