Forecast Tutorial

This tutorial will walk through forecast data from Unidata forecast model data using the forecast.py module within pvlib.

Table of contents:

  1. Setup
  2. Intialize and Test Each Forecast Model

This tutorial has been tested against the following package versions:

  • Python 3.5.2
  • IPython 5.0.0
  • pandas 0.18.0
  • matplotlib 1.5.1
  • netcdf4 1.2.1
  • siphon 0.4.0

It should work with other Python and Pandas versions. It requires pvlib >= 0.3.0 and IPython >= 3.0.

Authors:

  • Derek Groenendyk (@moonraker), University of Arizona, November 2015
  • Will Holmgren (@wholmgren), University of Arizona, November 2015, January 2016, April 2016, July 2016

Setup


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 os

# python add-ons
import numpy as np
import pandas as pd
try:
    import netCDF4
    from netCDF4 import num2date
except ImportError:
    print('We suggest you install netCDF4 using conda rerun this cell')

# for accessing UNIDATA THREDD servers
from siphon.catalog import TDSCatalog
from siphon.ncss import NCSS

import pvlib
from pvlib.forecast import GFS, HRRR_ESRL, NAM, NDFD, HRRR, RAP


/Users/holmgren/git_repos/pvlib-python/pvlib/forecast.py:22: UserWarning: The forecast module algorithms and features are highly experimental. The API may change, the functionality may be consolidated into an io module, or the module may be separated into its own package.
  'module, or the module may be separated into its own package.')

In [2]:
# Choose a location and time.
# Tucson, AZ
latitude = 32.2
longitude = -110.9 
tz = 'US/Arizona'

start = pd.Timestamp(datetime.date.today(), tz=tz) # today's date
end = start + pd.Timedelta(days=7) # 7 days from today
print(start, end)


2016-07-27 00:00:00-07:00 2016-08-03 00:00:00-07:00

GFS (0.5 deg)


In [4]:
from pvlib.forecast import GFS, HRRR_ESRL, NAM, NDFD, HRRR, RAP

In [5]:
# GFS model, defaults to 0.5 degree resolution
fm = GFS()

In [6]:
# retrieve data
data = fm.get_data(latitude, longitude, start, end)

In [7]:
data


Out[7]:
Downward_Short-Wave_Radiation_Flux_surface_Mixed_intervals_Average Temperature_surface Total_cloud_cover_boundary_layer_cloud_Mixed_intervals_Average Total_cloud_cover_convective_cloud Total_cloud_cover_entire_atmosphere_Mixed_intervals_Average Total_cloud_cover_high_cloud_Mixed_intervals_Average Total_cloud_cover_low_cloud_Mixed_intervals_Average Total_cloud_cover_middle_cloud_Mixed_intervals_Average Wind_speed_gust_surface u-component_of_wind_isobaric v-component_of_wind_isobaric
2016-07-27 09:00:00-07:00 0.0 301.600006 0.0 0.0 20.0 17.0 0.0 7.0 1.0 -0.78 0.61
2016-07-27 12:00:00-07:00 0.0 300.600006 0.0 0.0 25.0 22.0 0.0 6.0 3.2 0.51 3.19
2016-07-27 15:00:00-07:00 70.0 305.500000 0.0 0.0 99.0 96.0 0.0 77.0 1.8 1.45 0.39
2016-07-27 18:00:00-07:00 377.0 319.200012 0.0 0.0 68.0 64.0 0.0 44.0 4.2 1.96 -3.74
2016-07-27 21:00:00-07:00 960.0 322.200012 0.0 0.0 25.0 25.0 0.0 0.0 5.6 3.02 -5.07
2016-07-28 00:00:00-07:00 835.0 316.600006 0.0 0.0 20.0 20.0 0.0 0.0 5.1 1.58 -5.09
2016-07-28 03:00:00-07:00 151.0 305.399994 0.0 31.0 22.0 21.0 0.0 1.0 3.0 1.36 -2.70
2016-07-28 06:00:00-07:00 75.0 303.200012 0.0 0.0 44.0 43.0 0.0 0.0 3.7 -3.36 -1.62
2016-07-28 09:00:00-07:00 0.0 301.399994 0.0 0.0 66.0 66.0 0.0 0.0 2.0 -1.52 1.35
2016-07-28 12:00:00-07:00 0.0 299.899994 0.0 0.0 68.0 68.0 0.0 0.0 1.5 -0.53 1.41
2016-07-28 15:00:00-07:00 150.0 308.399994 0.0 0.0 57.0 57.0 0.0 0.0 2.2 -1.87 0.20
2016-07-28 18:00:00-07:00 425.0 321.000000 0.0 0.0 30.0 30.0 0.0 0.0 4.4 -2.96 -1.27
2016-07-28 21:00:00-07:00 970.0 325.100006 0.0 0.0 2.0 0.0 0.0 2.0 4.8 -3.13 -0.77
2016-07-29 00:00:00-07:00 729.0 316.000000 0.0 0.0 25.0 0.0 0.0 25.0 5.1 -2.16 -2.39
2016-07-29 03:00:00-07:00 145.0 306.000000 0.0 0.0 6.0 0.0 0.0 6.0 3.8 -1.22 -3.61
2016-07-29 06:00:00-07:00 72.0 303.600006 0.0 0.0 3.0 0.0 0.0 3.0 3.1 -3.11 0.18
2016-07-29 09:00:00-07:00 0.0 301.500000 0.0 0.0 0.0 0.0 0.0 0.0 2.4 -2.28 0.64
2016-07-29 12:00:00-07:00 0.0 299.500000 0.0 0.0 0.0 0.0 0.0 0.0 1.9 -1.85 -0.34
2016-07-29 15:00:00-07:00 150.0 310.100006 0.0 0.0 1.0 0.0 0.0 0.0 2.9 -2.18 1.22
2016-07-29 18:00:00-07:00 434.0 323.899994 0.0 0.0 1.0 1.0 0.0 0.0 2.2 -1.77 -0.30
2016-07-29 21:00:00-07:00 980.0 327.600006 0.0 0.0 1.0 0.0 0.0 0.0 3.8 -1.77 -1.27
2016-07-30 00:00:00-07:00 850.0 319.600006 0.0 0.0 2.0 0.0 0.0 2.0 3.5 -2.35 -1.92
2016-07-30 03:00:00-07:00 152.0 307.299988 0.0 0.0 1.0 1.0 0.0 0.0 3.8 -3.33 -1.84
2016-07-30 06:00:00-07:00 76.0 306.299988 0.0 0.0 35.0 32.0 0.0 24.0 3.0 -2.45 0.20
2016-07-30 09:00:00-07:00 0.0 303.700012 0.0 0.0 99.0 99.0 0.0 14.0 2.7 -1.12 2.16
2016-07-30 12:00:00-07:00 0.0 302.100006 0.0 0.0 100.0 100.0 0.0 53.0 6.3 2.46 4.45
2016-07-30 15:00:00-07:00 140.0 308.299988 0.0 0.0 58.0 58.0 0.0 0.0 2.5 1.98 1.71
2016-07-30 18:00:00-07:00 418.0 321.600006 0.0 0.0 34.0 34.0 0.0 0.0 1.5 1.41 -0.75
2016-07-30 21:00:00-07:00 960.0 323.899994 0.0 0.0 23.0 23.0 0.0 0.0 2.5 2.47 -3.51
2016-07-31 00:00:00-07:00 669.0 312.000000 0.0 0.0 59.0 54.0 4.0 34.0 5.4 5.26 -1.74
2016-07-31 03:00:00-07:00 95.0 305.899994 0.0 0.0 50.0 48.0 2.0 23.0 8.0 5.72 0.71
2016-07-31 06:00:00-07:00 48.0 302.399994 0.0 0.0 56.0 55.0 1.0 29.0 6.0 3.28 4.39
2016-07-31 09:00:00-07:00 0.0 301.200012 0.0 0.0 100.0 100.0 0.0 7.0 5.8 2.63 3.15
2016-07-31 12:00:00-07:00 0.0 299.899994 0.0 0.0 100.0 100.0 0.0 5.0 2.7 2.09 0.64
2016-07-31 15:00:00-07:00 90.0 303.799988 0.0 0.0 99.0 99.0 0.0 1.0 3.6 2.17 -2.59
2016-07-31 18:00:00-07:00 348.0 315.799988 0.0 0.0 97.0 97.0 0.0 0.0 3.4 1.56 -3.25
2016-07-31 21:00:00-07:00 940.0 321.200012 0.0 0.0 70.0 70.0 0.0 0.0 2.8 1.99 -3.70
2016-08-01 00:00:00-07:00 772.0 313.299988 0.0 0.0 82.0 82.0 2.0 0.0 3.5 1.89 -2.24
2016-08-01 03:00:00-07:00 88.0 305.399994 0.0 0.0 100.0 100.0 6.0 2.0 5.3 3.94 -0.23
2016-08-01 06:00:00-07:00 44.0 303.100006 0.0 0.0 99.0 99.0 3.0 1.0 5.8 2.77 -2.10
2016-08-01 09:00:00-07:00 0.0 301.600006 0.0 0.0 100.0 100.0 0.0 0.0 2.9 2.03 -1.31
2016-08-01 12:00:00-07:00 0.0 300.399994 0.0 0.0 100.0 100.0 0.0 0.0 1.5 1.37 -0.72
2016-08-01 15:00:00-07:00 100.0 305.200012 0.0 0.0 100.0 100.0 0.0 0.0 4.4 2.19 -3.48
2016-08-01 18:00:00-07:00 343.0 317.000000 0.0 0.0 99.0 99.0 0.0 0.0 1.5 1.06 -2.31
2016-08-01 21:00:00-07:00 900.0 322.000000 0.0 0.0 96.0 96.0 0.0 0.0 1.5 1.32 -1.75
2016-08-02 00:00:00-07:00 746.0 313.299988 0.0 0.0 97.0 97.0 1.0 1.0 3.3 3.64 -2.27
2016-08-02 03:00:00-07:00 94.0 305.000000 0.0 0.0 100.0 100.0 3.0 0.0 5.2 3.90 -2.40
2016-08-02 06:00:00-07:00 47.0 303.600006 0.0 0.0 100.0 100.0 2.0 0.0 1.9 1.89 0.18
2016-08-02 09:00:00-07:00 0.0 302.000000 0.0 0.0 100.0 100.0 0.0 0.0 3.2 2.48 -0.87
2016-08-02 12:00:00-07:00 0.0 300.600006 0.0 0.0 100.0 100.0 0.0 0.0 0.4 0.30 -0.20
2016-08-02 15:00:00-07:00 90.0 306.000000 0.0 0.0 100.0 100.0 0.0 0.0 2.6 1.03 -2.05
2016-08-02 18:00:00-07:00 359.0 318.299988 0.0 0.0 99.0 99.0 0.0 0.0 2.0 1.10 -2.92
2016-08-02 21:00:00-07:00 930.0 322.700012 0.0 0.0 86.0 86.0 0.0 0.0 1.6 1.49 -1.49
2016-08-03 00:00:00-07:00 750.0 313.899994 0.0 0.0 90.0 90.0 10.0 1.0 2.4 2.84 -1.87
2016-08-03 03:00:00-07:00 97.0 305.299988 0.0 0.0 100.0 100.0 2.0 0.0 5.5 3.59 -3.36
2016-08-03 06:00:00-07:00 49.0 303.399994 0.0 0.0 100.0 100.0 1.0 0.0 3.8 0.77 -2.32

In [8]:
data = fm.process_data(data)

In [9]:
data[['ghi', 'dni', 'dhi']].plot()


Out[9]:
<matplotlib.axes._subplots.AxesSubplot at 0x1159067f0>

In [10]:
cs = fm.location.get_clearsky(data.index)

In [11]:
fig, ax = plt.subplots()
cs['ghi'].plot(ax=ax, label='ineichen')
data['ghi'].plot(ax=ax, label='gfs+liujordan')
ax.set_ylabel('ghi')
ax.legend()


Out[11]:
<matplotlib.legend.Legend at 0x115b3b438>

In [12]:
fig, ax = plt.subplots()
cs['dni'].plot(ax=ax, label='ineichen')
data['dni'].plot(ax=ax, label='gfs+liujordan')
ax.set_ylabel('ghi')
ax.legend()


Out[12]:
<matplotlib.legend.Legend at 0x1033a1fd0>

In [13]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)

In [14]:
data


Out[14]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2016-07-27 09:00:00-07:00 28.450012 0.990202 548.587787 502.227154 216.961676 20.0 0.0 7.0 17.0
2016-07-27 12:00:00-07:00 27.450012 3.230511 816.331724 418.898830 411.426625 25.0 0.0 6.0 22.0
2016-07-27 15:00:00-07:00 32.350006 1.501533 283.790254 16.471511 270.478981 99.0 0.0 77.0 96.0
2016-07-27 18:00:00-07:00 46.050018 4.222464 121.211075 63.614451 103.558867 68.0 0.0 44.0 64.0
2016-07-27 21:00:00-07:00 49.050018 5.901297 0.000000 0.000000 0.000000 25.0 0.0 0.0 25.0
2016-07-28 00:00:00-07:00 43.450012 5.329587 0.000000 0.000000 0.000000 20.0 0.0 0.0 20.0
2016-07-28 03:00:00-07:00 32.250000 3.023177 0.000000 0.000000 0.000000 22.0 0.0 1.0 21.0
2016-07-28 06:00:00-07:00 30.050018 3.730147 26.708513 56.339306 22.939529 44.0 0.0 0.0 43.0
2016-07-28 09:00:00-07:00 28.250000 2.032954 359.055341 97.910661 294.532069 66.0 0.0 0.0 66.0
2016-07-28 12:00:00-07:00 26.750000 1.506320 543.173757 80.878427 465.073260 68.0 0.0 0.0 68.0
2016-07-28 15:00:00-07:00 35.250000 1.880665 500.073846 139.622548 387.411664 57.0 0.0 0.0 57.0
2016-07-28 18:00:00-07:00 47.850006 3.220947 172.984831 294.293426 91.916640 30.0 0.0 0.0 30.0
2016-07-28 21:00:00-07:00 51.950012 3.223321 0.000000 0.000000 0.000000 2.0 0.0 2.0 0.0
2016-07-29 00:00:00-07:00 42.850006 3.221444 0.000000 0.000000 0.000000 25.0 0.0 25.0 0.0
2016-07-29 03:00:00-07:00 32.850006 3.810577 0.000000 0.000000 0.000000 6.0 0.0 6.0 0.0
2016-07-29 06:00:00-07:00 30.450012 3.115205 35.389974 205.636670 22.071713 3.0 0.0 3.0 0.0
2016-07-29 09:00:00-07:00 28.350006 2.368122 627.065713 777.980844 115.405156 0.0 0.0 0.0 0.0
2016-07-29 12:00:00-07:00 26.350006 1.880984 972.105901 751.801227 246.859102 0.0 0.0 0.0 0.0
2016-07-29 15:00:00-07:00 36.950012 2.498159 787.537299 761.928667 173.719320 1.0 0.0 0.0 0.0
2016-07-29 18:00:00-07:00 50.750000 1.795244 211.095144 554.304339 59.567124 1.0 0.0 0.0 1.0
2016-07-29 21:00:00-07:00 54.450012 2.178486 0.000000 0.000000 0.000000 1.0 0.0 0.0 0.0
2016-07-30 00:00:00-07:00 46.450012 3.034617 0.000000 0.000000 0.000000 2.0 0.0 2.0 0.0
2016-07-30 03:00:00-07:00 34.149994 3.804537 0.000000 0.000000 0.000000 1.0 0.0 0.0 1.0
2016-07-30 06:00:00-07:00 33.149994 2.458150 26.886766 81.091160 21.808893 35.0 0.0 24.0 32.0
2016-07-30 09:00:00-07:00 30.550018 2.433105 222.920298 12.180688 214.925633 99.0 0.0 14.0 99.0
2016-07-30 12:00:00-07:00 28.950012 5.084692 339.763235 18.356744 322.073372 100.0 0.0 53.0 100.0
2016-07-30 15:00:00-07:00 35.149994 2.616200 492.742372 133.536646 385.344882 58.0 0.0 0.0 58.0
2016-07-30 18:00:00-07:00 48.450012 1.597060 163.581654 257.741276 93.686328 34.0 0.0 0.0 34.0
2016-07-30 21:00:00-07:00 50.750000 4.291969 0.000000 0.000000 0.000000 23.0 0.0 0.0 23.0
2016-07-31 00:00:00-07:00 38.850006 5.540325 0.000000 0.000000 0.000000 59.0 4.0 34.0 54.0
2016-07-31 03:00:00-07:00 32.750000 5.763896 0.000000 0.000000 0.000000 50.0 2.0 23.0 48.0
2016-07-31 06:00:00-07:00 29.250000 5.480009 21.332658 9.027948 20.786836 56.0 1.0 29.0 55.0
2016-07-31 09:00:00-07:00 28.050018 4.103584 218.234978 11.054507 210.994422 100.0 0.0 7.0 100.0
2016-07-31 12:00:00-07:00 26.750000 2.185795 339.278618 18.330290 321.633356 100.0 0.0 5.0 100.0
2016-07-31 15:00:00-07:00 30.649994 3.378905 281.308542 16.266367 268.249307 99.0 0.0 1.0 99.0
2016-07-31 18:00:00-07:00 42.649994 3.605010 76.644518 0.000000 76.644518 97.0 0.0 0.0 97.0
2016-07-31 21:00:00-07:00 48.050018 4.201202 0.000000 0.000000 0.000000 70.0 0.0 0.0 70.0
2016-08-01 00:00:00-07:00 40.149994 2.930819 0.000000 0.000000 0.000000 82.0 2.0 0.0 82.0
2016-08-01 03:00:00-07:00 32.250000 3.946707 0.000000 0.000000 0.000000 100.0 6.0 2.0 100.0
2016-08-01 06:00:00-07:00 29.950012 3.476047 11.517338 0.000000 11.517338 99.0 3.0 1.0 99.0
2016-08-01 09:00:00-07:00 28.450012 2.415988 217.610458 10.969046 210.440868 100.0 0.0 0.0 100.0
2016-08-01 12:00:00-07:00 27.250000 1.547676 338.782902 18.303375 321.183270 100.0 0.0 0.0 100.0
2016-08-01 15:00:00-07:00 32.050018 4.111752 275.514945 15.356925 263.208588 100.0 0.0 0.0 100.0
2016-08-01 18:00:00-07:00 43.850006 2.541594 73.008288 0.000000 73.008288 99.0 0.0 0.0 99.0
2016-08-01 21:00:00-07:00 48.850006 2.192008 0.000000 0.000000 0.000000 96.0 0.0 0.0 96.0
2016-08-02 00:00:00-07:00 40.149994 4.289814 0.000000 0.000000 0.000000 97.0 1.0 1.0 97.0
2016-08-02 03:00:00-07:00 31.850006 4.579301 0.000000 0.000000 0.000000 100.0 3.0 0.0 100.0
2016-08-02 06:00:00-07:00 30.450012 1.898552 10.885338 0.000000 10.885338 100.0 2.0 0.0 100.0
2016-08-02 09:00:00-07:00 28.850006 2.628174 216.982276 10.882675 209.884165 100.0 0.0 0.0 100.0
2016-08-02 12:00:00-07:00 27.450012 0.360555 338.275777 18.275978 320.722835 100.0 0.0 0.0 100.0
2016-08-02 15:00:00-07:00 32.850006 2.294210 274.827593 15.300263 262.590277 100.0 0.0 0.0 100.0
2016-08-02 18:00:00-07:00 45.149994 3.120321 72.042375 0.000000 72.042375 99.0 0.0 0.0 99.0
2016-08-02 21:00:00-07:00 49.550018 2.107178 0.000000 0.000000 0.000000 86.0 0.0 0.0 86.0
2016-08-03 00:00:00-07:00 40.750000 3.400368 0.000000 0.000000 0.000000 90.0 10.0 1.0 90.0
2016-08-03 03:00:00-07:00 32.149994 4.917082 0.000000 0.000000 0.000000 100.0 2.0 0.0 100.0
2016-08-03 06:00:00-07:00 30.250000 2.444443 10.474240 0.000000 10.474240 100.0 1.0 0.0 100.0

In [15]:
data['temp_air'].plot()
plt.ylabel('temperature (%s)' % fm.units['temp_air'])


Out[15]:
<matplotlib.text.Text at 0x1033c0eb8>

In [16]:
cloud_vars = ['total_clouds', 'low_clouds', 'mid_clouds', 'high_clouds']

In [17]:
for varname in cloud_vars:
    data[varname].plot()
plt.ylabel('Cloud cover' + ' %')
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')
plt.title('GFS 0.5 deg')
plt.legend(bbox_to_anchor=(1.18,1.0))


Out[17]:
<matplotlib.legend.Legend at 0x1033eb080>

In [18]:
total_cloud_cover = data['total_clouds']

In [19]:
total_cloud_cover.plot(color='r', linewidth=2)
plt.ylabel('Total cloud cover' + ' (%s)' % fm.units['total_clouds'])
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')
plt.title('GFS 0.5 deg')


Out[19]:
<matplotlib.text.Text at 0x115b8acc0>

GFS (0.25 deg)


In [20]:
# GFS model at 0.25 degree resolution
fm = GFS(resolution='quarter')

In [22]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)

In [23]:
for varname in cloud_vars:
    data[varname].plot(ls='-', linewidth=2)
plt.ylabel('Cloud cover' + ' %')
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')
plt.title('GFS 0.25 deg')
plt.legend(bbox_to_anchor=(1.18,1.0))


Out[23]:
<matplotlib.legend.Legend at 0x1021bcc18>

In [24]:
data


Out[24]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2016-07-27 09:00:00-07:00 29.550018 0.997246 593.672839 649.421406 164.852746 9.0 0.0 5.0 6.0
2016-07-27 12:00:00-07:00 29.750000 1.371787 721.296120 250.902795 478.774983 40.0 0.0 38.0 6.0
2016-07-27 15:00:00-07:00 32.550018 1.530555 278.615953 15.616103 265.995968 100.0 0.0 100.0 88.0
2016-07-27 18:00:00-07:00 47.649994 3.052212 108.503470 31.012757 99.897821 77.0 0.0 57.0 68.0
2016-07-27 21:00:00-07:00 49.850006 4.948626 0.000000 0.000000 0.000000 66.0 0.0 0.0 66.0
2016-07-28 00:00:00-07:00 44.550018 4.666926 0.000000 0.000000 0.000000 44.0 0.0 0.0 44.0
2016-07-28 03:00:00-07:00 33.550018 2.514617 0.000000 0.000000 0.000000 33.0 1.0 0.0 33.0
2016-07-28 06:00:00-07:00 31.250000 2.960828 30.598827 113.618747 22.997966 28.0 0.0 0.0 27.0
2016-07-28 09:00:00-07:00 29.149994 1.416616 551.159407 515.370371 211.529558 19.0 0.0 0.0 19.0
2016-07-28 12:00:00-07:00 27.550018 2.625052 695.028812 217.769141 484.739384 44.0 0.0 0.0 44.0
2016-07-28 15:00:00-07:00 36.850006 1.325632 438.110713 81.856367 372.060371 69.0 0.0 0.0 69.0
2016-07-28 18:00:00-07:00 50.850006 1.566269 166.000965 255.351855 95.659900 35.0 0.0 0.0 35.0
2016-07-28 21:00:00-07:00 54.350006 1.883667 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2016-07-29 00:00:00-07:00 45.350006 0.755910 0.000000 0.000000 0.000000 24.0 0.0 24.0 0.0
2016-07-29 03:00:00-07:00 33.850006 0.816333 0.000000 0.000000 0.000000 14.0 0.0 14.0 0.0
2016-07-29 06:00:00-07:00 31.750000 4.014000 34.451534 189.993006 22.146451 7.0 0.0 7.0 0.0
2016-07-29 09:00:00-07:00 29.649994 3.881907 622.989782 763.902754 120.588070 1.0 0.0 0.0 1.0
2016-07-29 12:00:00-07:00 28.050018 3.598013 826.776057 434.105737 408.003401 23.0 0.0 0.0 23.0
2016-07-29 15:00:00-07:00 37.450012 3.013254 406.253506 60.719977 357.336836 75.0 0.0 0.0 75.0
2016-07-29 18:00:00-07:00 50.250000 1.642011 117.180639 57.612326 101.431382 69.0 0.0 0.0 69.0
2016-07-29 21:00:00-07:00 58.649994 0.411096 0.000000 0.000000 0.000000 2.0 0.0 0.0 3.0
2016-07-30 00:00:00-07:00 47.550018 0.304138 0.000000 0.000000 0.000000 6.0 0.0 5.0 1.0
2016-07-30 03:00:00-07:00 35.250000 2.304886 0.000000 0.000000 0.000000 2.0 0.0 2.0 0.0
2016-07-30 06:00:00-07:00 34.950012 4.414397 28.470389 106.213471 21.819375 28.0 0.0 27.0 16.0
2016-07-30 09:00:00-07:00 31.250000 3.230015 226.984748 13.280513 218.268225 98.0 0.0 17.0 97.0
2016-07-30 12:00:00-07:00 28.750000 3.515921 440.721457 36.952525 405.111379 84.0 0.0 9.0 84.0
2016-07-30 15:00:00-07:00 34.850006 2.670749 415.627731 67.079282 361.678896 73.0 0.0 0.0 73.0
2016-07-30 18:00:00-07:00 47.350006 1.818378 100.794859 19.790863 95.427892 80.0 0.0 0.0 80.0
2016-07-30 21:00:00-07:00 50.950012 3.121874 0.000000 0.000000 0.000000 82.0 0.0 0.0 82.0
2016-07-31 00:00:00-07:00 43.750000 5.778001 0.000000 0.000000 0.000000 77.0 2.0 2.0 76.0
2016-07-31 03:00:00-07:00 35.050018 7.638567 0.000000 0.000000 0.000000 30.0 20.0 4.0 2.0
2016-07-31 06:00:00-07:00 30.550018 5.865867 19.588479 0.000000 19.588479 64.0 25.0 15.0 36.0
2016-07-31 09:00:00-07:00 29.050018 3.377129 218.234978 11.054507 210.994422 100.0 0.0 13.0 100.0
2016-07-31 12:00:00-07:00 28.050018 4.253293 339.278618 18.330290 321.633356 100.0 0.0 7.0 100.0
2016-07-31 15:00:00-07:00 31.350006 4.744945 276.179490 15.411908 263.806246 100.0 0.0 1.0 100.0
2016-07-31 18:00:00-07:00 41.750000 3.827819 75.296237 0.000000 75.296237 98.0 0.0 0.0 98.0
2016-07-31 21:00:00-07:00 46.250000 4.666990 0.000000 0.000000 0.000000 95.0 0.0 0.0 95.0
2016-08-01 00:00:00-07:00 42.050018 2.807650 0.000000 0.000000 0.000000 90.0 0.0 0.0 90.0
2016-08-01 03:00:00-07:00 33.149994 2.438709 0.000000 0.000000 0.000000 99.0 0.0 0.0 99.0
2016-08-01 06:00:00-07:00 30.750000 3.357157 11.517338 0.000000 11.517338 99.0 0.0 0.0 99.0
2016-08-01 09:00:00-07:00 29.050018 2.067293 229.734462 14.266428 220.409637 97.0 0.0 0.0 97.0
2016-08-01 12:00:00-07:00 27.850006 1.895521 351.366250 19.695637 332.427886 98.0 0.0 0.0 98.0
2016-08-01 15:00:00-07:00 34.149994 2.507369 280.631656 16.211345 267.640605 99.0 0.0 0.0 99.0
2016-08-01 18:00:00-07:00 45.250000 2.475884 75.670578 0.000000 75.670578 97.0 0.0 0.0 97.0
2016-08-01 21:00:00-07:00 49.149994 3.118926 0.000000 0.000000 0.000000 91.0 0.0 0.0 91.0
2016-08-02 00:00:00-07:00 42.750000 3.664315 0.000000 0.000000 0.000000 91.0 0.0 0.0 91.0
2016-08-02 03:00:00-07:00 33.750000 3.891041 0.000000 0.000000 0.000000 98.0 1.0 0.0 98.0
2016-08-02 06:00:00-07:00 31.649994 4.358394 11.693964 0.000000 11.693964 96.0 1.0 0.0 96.0
2016-08-02 09:00:00-07:00 29.649994 2.584956 289.516360 41.058552 262.736352 82.0 0.0 0.0 82.0
2016-08-02 12:00:00-07:00 28.250000 2.030665 401.098449 27.615695 374.575289 90.0 0.0 0.0 90.0
2016-08-02 15:00:00-07:00 34.850006 1.974361 295.243375 19.055234 280.002792 96.0 0.0 0.0 96.0
2016-08-02 18:00:00-07:00 46.450012 2.540315 95.686012 14.732494 91.794387 81.0 0.0 0.0 81.0
2016-08-02 21:00:00-07:00 49.649994 3.815403 0.000000 0.000000 0.000000 65.0 0.0 0.0 65.0
2016-08-03 00:00:00-07:00 43.450012 4.780136 0.000000 0.000000 0.000000 62.0 0.0 0.0 62.0
2016-08-03 03:00:00-07:00 34.149994 4.030013 0.000000 0.000000 0.000000 92.0 2.0 1.0 91.0
2016-08-03 06:00:00-07:00 31.950012 2.984527 11.446848 0.000000 11.446848 95.0 11.0 6.0 94.0

NAM


In [25]:
fm = NAM()

In [26]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)

In [27]:
for varname in cloud_vars:
    data[varname].plot(ls='-', linewidth=2)
plt.ylabel('Cloud cover' + ' %')
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')
plt.title('NAM')
plt.legend(bbox_to_anchor=(1.18,1.0))


Out[27]:
<matplotlib.legend.Legend at 0x1200ab7f0>

In [28]:
data['ghi'].plot(linewidth=2, ls='-')
plt.ylabel('GHI W/m**2')
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')


Out[28]:
<matplotlib.text.Text at 0x115b7f908>

In [29]:
data


Out[29]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2016-07-27 09:00:00-07:00 29.048981 2.065518 220.696231 11.387513 213.176931 100.0 0.0 100.0 100.0
2016-07-27 12:00:00-07:00 27.885406 1.924674 341.153560 18.433557 323.335794 100.0 0.0 100.0 100.0
2016-07-27 15:00:00-07:00 33.920807 0.736886 278.615953 15.616103 265.995968 100.0 0.0 100.0 100.0
2016-07-27 18:00:00-07:00 45.455719 1.573460 76.028455 0.000000 76.028455 100.0 0.0 100.0 100.0
2016-07-27 21:00:00-07:00 48.816315 2.790556 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2016-07-28 00:00:00-07:00 43.666168 2.557873 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2016-07-28 03:00:00-07:00 33.442780 1.299019 0.000000 0.000000 0.000000 86.0 0.0 86.0 0.0
2016-07-28 06:00:00-07:00 31.789703 4.696262 13.092408 0.000000 13.092408 100.0 0.0 100.0 2.0
2016-07-28 09:00:00-07:00 28.937897 1.318510 579.770598 607.401084 179.492370 12.0 0.0 10.0 2.0
2016-07-28 12:00:00-07:00 25.317047 1.569927 973.429728 752.724436 246.559103 0.0 0.0 0.0 0.0
2016-07-28 15:00:00-07:00 35.683014 0.743108 794.398445 779.384573 165.508854 0.0 0.0 0.0 0.0
2016-07-28 18:00:00-07:00 47.316315 1.569387 214.888003 569.239362 58.081220 0.0 0.0 0.0 0.0
2016-07-28 21:00:00-07:00 50.154938 1.840050 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2016-07-29 00:00:00-07:00 43.524567 2.323340 0.000000 0.000000 0.000000 86.0 2.0 86.0 0.0
2016-07-29 03:00:00-07:00 35.545319 3.337080 0.000000 0.000000 0.000000 82.0 0.0 76.0 6.0
2016-07-29 06:00:00-07:00 30.270905 4.577746 36.093803 217.404108 22.013413 0.0 0.0 0.0 0.0
2016-07-29 09:00:00-07:00 27.307281 1.002360 627.065713 777.980844 115.405156 0.0 0.0 0.0 0.0
2016-07-29 12:00:00-07:00 25.261871 0.942670 972.105901 751.801227 246.859102 0.0 0.0 0.0 0.0
2016-07-29 15:00:00-07:00 35.809479 1.184753 792.689787 778.307094 165.677170 0.0 0.0 0.0 0.0
2016-07-29 18:00:00-07:00 46.793365 1.876681 212.476241 564.333085 58.206702 0.0 0.0 0.0 0.0
2016-07-29 21:00:00-07:00 49.652985 2.710755 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2016-07-30 00:00:00-07:00 43.799469 3.875378 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2016-07-30 03:00:00-07:00 34.189606 4.853367 0.000000 0.000000 0.000000 100.0 0.0 0.0 100.0
2016-07-30 06:00:00-07:00 29.794586 8.133935 19.421121 0.000000 19.421121 68.0 0.0 26.0 54.0
2016-07-30 09:00:00-07:00 27.307770 1.480417 251.371544 21.289887 237.398154 92.0 0.0 84.0 34.0
2016-07-30 12:00:00-07:00 26.548737 1.117122 339.763235 18.356744 322.073372 100.0 2.0 100.0 100.0
2016-07-30 15:00:00-07:00 31.415680 2.503182 276.821541 15.465265 264.383527 100.0 8.0 100.0 72.0
2016-07-30 18:00:00-07:00 42.943268 1.972205 204.529580 519.833649 63.558979 4.0 4.0 0.0 2.0
2016-07-30 21:00:00-07:00 46.683502 2.484282 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2016-07-31 00:00:00-07:00 41.405914 3.400338 0.000000 0.000000 0.000000 2.0 2.0 0.0 0.0
2016-07-31 03:00:00-07:00 31.817535 3.584235 0.000000 0.000000 0.000000 18.0 0.0 0.0 18.0
2016-07-31 06:00:00-07:00 29.439362 3.342473 11.739670 0.000000 11.739670 100.0 0.0 100.0 100.0

NDFD


In [30]:
fm = NDFD()

In [31]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)

In [33]:
total_cloud_cover = data['total_clouds']
temp = data['temp_air']
wind = data['wind_speed']

In [34]:
total_cloud_cover.plot(color='r', linewidth=2)
plt.ylabel('Total cloud cover' + ' (%s)' % fm.units['total_clouds'])
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')
plt.title('NDFD')
plt.ylim(0,100)


Out[34]:
(0, 100)

In [36]:
temp.plot(color='r', linewidth=2)
plt.ylabel('Temperature' + ' (%s)' % fm.units['temp_air'])
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')


Out[36]:
<matplotlib.text.Text at 0x11fd852b0>

In [37]:
wind.plot(color='r', linewidth=2)
plt.ylabel('Wind Speed' + ' (%s)' % fm.units['wind_speed'])
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')


Out[37]:
<matplotlib.text.Text at 0x120c31908>

In [38]:
data


Out[38]:
temp_air wind_speed ghi dni dhi total_clouds
2016-07-27 07:00:00-07:00 30.050018 2.0 143.988387 143.163497 104.222554 52.0
2016-07-27 08:00:00-07:00 28.750000 1.6 285.328219 177.281221 200.331021 52.0
2016-07-27 09:00:00-07:00 27.649994 1.6 417.431165 177.522093 300.211375 52.0
2016-07-27 10:00:00-07:00 27.350006 1.6 526.891322 170.772024 388.904615 52.0
2016-07-27 11:00:00-07:00 27.750000 1.6 497.912275 75.299590 429.202244 70.0
2016-07-27 12:00:00-07:00 27.750000 3.2 721.296120 250.902795 478.774983 40.0
2016-07-27 13:00:00-07:00 27.149994 3.2 721.328643 250.899698 478.800746 40.0
2016-07-27 14:00:00-07:00 28.950012 2.8 676.149456 255.156679 443.295855 40.0
2016-07-27 15:00:00-07:00 31.350006 2.8 589.073746 262.865948 376.641482 40.0
2016-07-27 16:00:00-07:00 33.550018 3.2 466.677299 270.995730 287.715326 40.0
2016-07-27 17:00:00-07:00 34.850006 3.6 318.902919 269.042086 189.925817 40.0
2016-07-27 18:00:00-07:00 36.050018 4.0 167.805647 257.806962 96.267467 35.0
2016-07-27 19:00:00-07:00 37.950012 4.8 29.679606 91.101791 23.446353 35.0
2016-07-27 20:00:00-07:00 39.649994 5.2 0.000000 0.000000 0.000000 35.0
2016-07-27 21:00:00-07:00 39.649994 5.6 0.000000 0.000000 0.000000 35.0
2016-07-27 22:00:00-07:00 40.050018 6.4 0.000000 0.000000 0.000000 35.0

RAP


In [39]:
fm = RAP(resolution=20)

In [40]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)

In [41]:
cloud_vars = ['total_clouds', 'high_clouds', 'mid_clouds', 'low_clouds']

In [42]:
for varname in cloud_vars:
    data[varname].plot(ls='-', linewidth=2)
plt.ylabel('Cloud cover' + ' %')
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')
plt.title('RAP')
plt.legend(bbox_to_anchor=(1.18,1.0))


Out[42]:
<matplotlib.legend.Legend at 0x11eab10b8>

In [43]:
data


Out[43]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2016-07-27 07:00:00-07:00 25.910797 2.757028 107.230023 27.943152 99.468388 78.0 0.0 50.0 78.0
2016-07-27 08:00:00-07:00 26.073883 1.539441 195.678263 31.685784 180.486564 84.0 14.0 48.0 84.0
2016-07-27 09:00:00-07:00 27.034576 2.107574 409.233831 164.283273 300.755780 54.0 14.0 40.0 54.0
2016-07-27 10:00:00-07:00 26.773590 1.335156 526.891322 170.772024 388.904615 52.0 0.0 52.0 14.0
2016-07-27 11:00:00-07:00 26.523590 1.463499 604.803516 164.680864 454.534075 52.0 0.0 52.0 6.0
2016-07-27 12:00:00-07:00 26.114655 1.602453 556.567655 88.828571 470.706490 66.0 0.0 66.0 0.0
2016-07-27 13:00:00-07:00 26.664703 1.682302 632.624638 148.998629 488.597664 54.0 8.0 54.0 0.0
2016-07-27 14:00:00-07:00 27.111481 2.301865 806.810775 486.540430 362.798523 18.0 6.0 18.0 0.0
2016-07-27 15:00:00-07:00 29.348053 2.814540 609.770902 299.440687 367.781160 36.0 8.0 36.0 12.0
2016-07-27 16:00:00-07:00 31.296783 1.871677 614.248207 722.774692 136.937420 4.0 0.0 0.0 4.0
2016-07-27 17:00:00-07:00 33.649567 1.497542 430.949886 735.454018 78.377803 0.0 0.0 0.0 0.0
2016-07-27 18:00:00-07:00 39.268219 2.356843 217.224161 574.021875 57.940332 0.0 0.0 0.0 0.0
2016-07-27 19:00:00-07:00 47.596832 2.994697 38.420206 227.816862 22.832806 0.0 0.0 0.0 0.0
2016-07-27 20:00:00-07:00 50.105133 3.858923 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2016-07-27 21:00:00-07:00 50.725739 4.150520 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2016-07-27 22:00:00-07:00 49.348785 4.529186 0.000000 0.000000 0.000000 56.0 10.0 0.0 38.0
2016-07-27 23:00:00-07:00 46.227203 3.376060 0.000000 0.000000 0.000000 100.0 20.0 4.0 92.0
2016-07-28 00:00:00-07:00 30.860748 5.303871 0.000000 0.000000 0.000000 88.0 0.0 4.0 88.0
2016-07-28 01:00:00-07:00 30.734528 4.183763 0.000000 0.000000 0.000000 40.0 0.0 0.0 18.0
2016-07-28 02:00:00-07:00 29.974518 1.817368 0.000000 0.000000 0.000000 46.0 0.0 0.0 30.0
2016-07-28 03:00:00-07:00 28.855621 2.098346 0.000000 0.000000 0.000000 56.0 0.0 0.0 56.0
2016-07-28 04:00:00-07:00 28.253815 2.246564 0.000000 0.000000 0.000000 50.0 0.0 0.0 50.0
2016-07-28 05:00:00-07:00 27.891266 2.013862 0.000000 0.000000 0.000000 52.0 0.0 0.0 52.0
2016-07-28 06:00:00-07:00 27.999176 1.833351 27.194802 63.186314 22.967768 42.0 0.0 0.0 42.0
2016-07-28 07:00:00-07:00 26.984283 2.792719 181.767920 344.285565 86.765968 24.0 0.0 0.0 24.0
2016-07-28 08:00:00-07:00 26.877350 1.740562 401.131780 603.481897 112.729062 10.0 0.0 0.0 10.0
2016-07-28 09:00:00-07:00 27.360260 1.053696 555.246730 529.261416 206.462662 18.0 0.0 0.0 18.0
2016-07-28 10:00:00-07:00 27.060944 1.228584 784.062655 746.253192 181.912738 2.0 0.0 0.0 2.0
2016-07-28 11:00:00-07:00 25.735260 1.553703 912.237618 764.545024 215.358549 0.0 0.0 0.0 0.0
2016-07-28 12:00:00-07:00 25.558746 1.259921 973.429728 752.724436 246.559103 0.0 0.0 0.0 0.0
2016-07-28 13:00:00-07:00 25.644684 1.470278 973.446199 752.720904 246.568021 0.0 0.0 0.0 0.0
2016-07-28 14:00:00-07:00 28.757477 0.992960 912.271953 764.539141 215.374994 0.0 0.0 0.0 0.0
2016-07-28 15:00:00-07:00 32.626862 1.784865 794.398445 779.384573 165.508854 0.0 0.0 0.0 0.0

HRRR


In [44]:
fm = HRRR()

In [46]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)

In [47]:
cloud_vars = ['total_clouds', 'high_clouds', 'mid_clouds', 'low_clouds']

In [48]:
for varname in cloud_vars:
    data[varname].plot(ls='-', linewidth=2)
plt.ylabel('Cloud cover' + ' %')
plt.xlabel('Forecast Time (' + str(data.index.tz) + ')')
plt.title('HRRR')
plt.legend(bbox_to_anchor=(1.18,1.0))


Out[48]:
<matplotlib.legend.Legend at 0x12124b8d0>

In [49]:
data


Out[49]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2016-07-27 07:00:00-07:00 -8.788116 3.683798 111.471370 37.599771 101.027463 75.000 0.000 18.875 75.000
2016-07-27 08:00:00-07:00 -8.513641 2.235231 238.752264 84.727200 198.129943 68.625 15.750 28.875 68.625
2016-07-27 09:00:00-07:00 -6.579926 1.586132 492.743765 330.711074 274.371607 33.625 15.750 33.625 31.625
2016-07-27 10:00:00-07:00 -6.916046 0.887758 449.936938 90.649614 376.690504 66.875 0.250 66.875 0.000
2016-07-27 11:00:00-07:00 -4.685425 1.578304 761.428845 420.144848 378.051384 25.625 0.000 25.625 0.000
2016-07-27 12:00:00-07:00 -6.816193 1.174678 525.681075 70.693705 457.348963 70.875 4.000 70.875 0.000
2016-07-27 13:00:00-07:00 -7.108551 1.560096 620.744725 138.037424 487.313213 55.875 8.750 55.875 0.000
2016-07-27 14:00:00-07:00 -9.462189 1.620842 809.037931 489.789234 362.060851 17.625 0.000 17.625 0.000
2016-07-27 15:00:00-07:00 -5.107452 2.782871 673.155994 451.408810 308.354862 23.750 7.375 23.750 0.000
2016-07-27 16:00:00-07:00 -2.124542 1.865137 622.959017 754.123038 124.946200 1.875 0.250 0.000 1.875
2016-07-27 17:00:00-07:00 0.754883 1.796860 427.098229 719.050038 82.390113 1.375 0.375 1.375 0.000
2016-07-27 18:00:00-07:00 4.102264 2.246583 217.224161 574.021875 57.940332 0.000 0.000 0.000 0.000
2016-07-27 19:00:00-07:00 8.565674 2.841491 38.420206 227.816862 22.832806 0.000 0.000 0.000 0.000
2016-07-27 20:00:00-07:00 9.335693 3.910746 0.000000 0.000000 0.000000 0.000 0.000 0.000 0.000
2016-07-27 21:00:00-07:00 11.624084 4.460042 0.000000 0.000000 0.000000 0.000 0.000 0.000 0.000
2016-07-27 22:00:00-07:00 14.837433 5.001012 0.000000 0.000000 0.000000 11.125 0.125 0.000 0.000
2016-07-27 23:00:00-07:00 14.662415 5.200049 0.000000 0.000000 0.000000 34.125 3.750 4.250 8.250
2016-07-28 00:00:00-07:00 18.115845 4.136905 0.000000 0.000000 0.000000 81.375 4.125 6.125 60.000
2016-07-28 01:00:00-07:00 1.913818 11.852090 0.000000 0.000000 0.000000 98.875 0.000 7.875 98.875
2016-07-28 02:00:00-07:00 12.629303 9.709138 0.000000 0.000000 0.000000 83.125 2.250 35.000 83.125
2016-07-28 03:00:00-07:00 14.147736 2.727995 0.000000 0.000000 0.000000 33.875 0.500 22.750 33.875
2016-07-28 04:00:00-07:00 5.271881 9.792562 0.000000 0.000000 0.000000 63.750 4.500 40.750 63.750
2016-07-28 05:00:00-07:00 -0.759430 6.252571 0.000000 0.000000 0.000000 59.375 2.500 27.625 59.375
2016-07-28 06:00:00-07:00 -4.579681 3.104227 24.003528 20.095883 22.659155 55.125 0.000 20.625 55.125
2016-07-28 07:00:00-07:00 2.053741 1.961879 132.072478 101.153444 104.160258 59.500 0.250 0.875 59.500
2016-07-28 08:00:00-07:00 -5.461853 2.519691 308.758856 242.220677 193.002109 43.125 0.000 4.625 43.125
2016-07-28 09:00:00-07:00 -0.750641 3.682376 431.094366 202.764092 297.472525 48.375 0.000 0.000 48.375
2016-07-28 10:00:00-07:00 -2.924988 2.174952 404.542958 59.282226 356.708272 75.500 0.000 0.000 75.500
2016-07-28 11:00:00-07:00 -0.212585 3.385307 559.429680 120.980946 449.156137 59.500 0.250 0.625 59.500
2016-07-28 12:00:00-07:00 -1.329895 2.542055 650.737721 167.600006 488.894269 51.000 0.000 0.500 51.000
2016-07-28 13:00:00-07:00 0.535156 2.597037 629.393766 146.573966 487.852038 54.375 0.000 0.500 54.375

HRRR (ESRL)


In [50]:
fm = HRRR_ESRL()


/Users/holmgren/git_repos/pvlib-python/pvlib/forecast.py:742: UserWarning: HRRR_ESRL is an experimental model and is not always available.
  warnings.warn('HRRR_ESRL is an experimental model and is not always available.')
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-50-2164a2bcd853> in <module>()
----> 1 fm = HRRR_ESRL()

/Users/holmgren/git_repos/pvlib-python/pvlib/forecast.py in __init__(self, set_type)
    766             'high_clouds',]
    767 
--> 768         super(HRRR_ESRL, self).__init__(model_type, model, set_type)
    769 
    770     def process_data(self, data, cloud_cover='total_clouds', **kwargs):

/Users/holmgren/git_repos/pvlib-python/pvlib/forecast.py in __init__(self, model_type, model_name, set_type)
    137 
    138         self.datasets_list = list(self.model.datasets.keys())
--> 139         self.set_dataset()
    140 
    141     def __repr__(self):

/Users/holmgren/git_repos/pvlib-python/pvlib/forecast.py in set_dataset(self)
    158 
    159         self.access_url = self.dataset.access_urls[self.access_url_key]
--> 160         self.ncss = NCSS(self.access_url)
    161         self.query = self.ncss.query()
    162 

/Users/holmgren/miniconda3/envs/pvlib35fx/lib/python3.5/site-packages/siphon/http_util.py in __init__(self, url)
    351         self._base = url
    352         self._session = create_http_session()
--> 353         self._get_metadata()
    354 
    355     def get_query(self, query):

/Users/holmgren/miniconda3/envs/pvlib35fx/lib/python3.5/site-packages/siphon/ncss.py in _get_metadata(self)
     52     def _get_metadata(self):
     53         # Need to use .content here to avoid decode problems
---> 54         meta_xml = self.get_path('dataset.xml').content
     55         root = ET.fromstring(meta_xml)
     56         self.metadata = NCSSDataset(root)

/Users/holmgren/miniconda3/envs/pvlib35fx/lib/python3.5/site-packages/siphon/http_util.py in get_path(self, path, query)
    420         '''
    421 
--> 422         return self.get(self.url_path(path), query)
    423 
    424     def get(self, path, params=None):

/Users/holmgren/miniconda3/envs/pvlib35fx/lib/python3.5/site-packages/siphon/http_util.py in get(self, path, params)
    457             raise requests.HTTPError('Error accessing %s: %d %s' % (resp.request.url,
    458                                                                     resp.status_code,
--> 459                                                                     text))
    460         return resp
    461 

HTTPError: Error accessing http://thredds-jumbo.unidata.ucar.edu/thredds/ncss/grib/HRRR/CONUS_3km/surface/Best/dataset.xml: 404 Not Found

In [51]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-51-e61ac5005c42> in <module>()
      1 # retrieve data
----> 2 data = fm.get_query_data(latitude, longitude, start, end)

AttributeError: 'HRRR' object has no attribute 'get_query_data'

In [ ]:
cloud_vars = ['total_clouds','high_clouds','mid_clouds','low_clouds']

In [ ]:
for varname in cloud_vars:
    data[varname].plot(ls='-', linewidth=2)
plt.ylabel('Cloud cover' + ' %')
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')
plt.title('HRRR_ESRL')
plt.legend(bbox_to_anchor=(1.18,1.0))

In [ ]:
data['ghi'].plot(linewidth=2, ls='-')
plt.ylabel('GHI W/m**2')
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')

Quick power calculation


In [54]:
from pvlib.pvsystem import PVSystem, retrieve_sam
from pvlib.modelchain import ModelChain

sandia_modules = retrieve_sam('SandiaMod')
sapm_inverters = retrieve_sam('cecinverter')
module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
inverter = sapm_inverters['ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_']

system = PVSystem(module_parameters=module,
                  inverter_parameters=inverter)

# fx is a common abbreviation for forecast
fx_model = GFS()
fx_data = fx_model.get_processed_data(latitude, longitude, start, end)

# use a ModelChain object to calculate modeling intermediates
mc = ModelChain(system, fx_model.location,
                orientation_strategy='south_at_latitude_tilt')

# extract relevant data for model chain
irradiance = fx_data[['ghi', 'dni', 'dhi']]
weather = fx_data[['wind_speed', 'temp_air']]
mc.run_model(fx_data.index, irradiance=irradiance, weather=weather)


Out[54]:
ModelChain for: PVSystem with tilt:32.2 and azimuth: 180 with Module: None and Inverter: None orientation_startegy: south_at_latitude_tilt clearsky_model: ineichen transposition_model: haydavies solar_position_method: nrel_numpy airmass_model: kastenyoung1989

In [55]:
mc.total_irrad.plot()


Out[55]:
<matplotlib.axes._subplots.AxesSubplot at 0x11ea96e80>

In [56]:
mc.temps.plot()


Out[56]:
<matplotlib.axes._subplots.AxesSubplot at 0x11fe57ef0>

In [57]:
mc.ac.plot()


Out[57]:
<matplotlib.axes._subplots.AxesSubplot at 0x115be75f8>

In [ ]: