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

# 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/pvlib2/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)
2018-08-09 00:00:00-07:00 2018-08-16 00:00:00-07:00

GFS (0.5 deg)

In [3]:
from pvlib.forecast import GFS, HRRR_ESRL, NAM, NDFD, HRRR, RAP 
In [4]:
# GFS model, defaults to 0.5 degree resolution
fm = GFS()
In [5]:
# retrieve data
data = fm.get_data(latitude, longitude, start, end)
In [6]:
data
Out[6]:
Total_cloud_cover_convective_cloud Wind_speed_gust_surface Total_cloud_cover_middle_cloud_Mixed_intervals_Average Total_cloud_cover_high_cloud_Mixed_intervals_Average Temperature_surface Downward_Short-Wave_Radiation_Flux_surface_Mixed_intervals_Average Total_cloud_cover_entire_atmosphere_Mixed_intervals_Average Total_cloud_cover_boundary_layer_cloud_Mixed_intervals_Average Total_cloud_cover_low_cloud_Mixed_intervals_Average u-component_of_wind_isobaric v-component_of_wind_isobaric
2018-08-09 09:00:00-07:00 0.0 5.715220 39.0 97.0 300.038635 0.0 97.0 0.0 0.0 -0.439783 3.809314
2018-08-09 12:00:00-07:00 0.0 4.304677 61.0 98.0 298.638611 0.0 98.0 0.0 0.0 -1.883047 1.786572
2018-08-09 15:00:00-07:00 0.0 1.700000 19.0 99.0 305.569763 100.0 99.0 0.0 0.0 -0.179326 -1.160732
2018-08-09 18:00:00-07:00 0.0 1.766416 10.0 100.0 320.767487 365.0 100.0 0.0 0.0 -1.141008 -0.534443
2018-08-09 21:00:00-07:00 0.0 3.803955 3.0 100.0 321.914948 780.0 100.0 0.0 0.0 -2.367295 1.117080
2018-08-10 00:00:00-07:00 0.0 4.839374 2.0 100.0 309.660583 639.0 100.0 0.0 7.0 -4.172895 4.635974
2018-08-10 03:00:00-07:00 0.0 4.889844 1.0 100.0 300.765717 98.0 100.0 0.0 0.0 -3.702148 1.959949
2018-08-10 06:00:00-07:00 0.0 2.621375 1.0 99.0 298.734924 49.0 99.0 0.0 0.0 -1.568645 1.960842
2018-08-10 09:00:00-07:00 0.0 2.730036 7.0 39.0 297.765808 0.0 46.0 0.0 1.0 -2.061804 1.810159
2018-08-10 12:00:00-07:00 0.0 3.130075 21.0 53.0 297.183380 0.0 61.0 0.0 1.0 -2.382952 1.770305
2018-08-10 15:00:00-07:00 0.0 2.753887 1.0 93.0 305.612122 120.0 93.0 0.0 0.0 -2.364131 0.883418
2018-08-10 18:00:00-07:00 0.0 1.096645 1.0 96.0 323.912109 384.0 96.0 0.0 0.0 -0.762131 -0.493013
2018-08-10 21:00:00-07:00 0.0 1.435908 0.0 100.0 322.641449 850.0 100.0 0.0 11.0 0.521658 -1.584724
2018-08-11 00:00:00-07:00 0.0 1.801981 0.0 100.0 313.977600 696.0 100.0 0.0 14.0 2.399853 -0.982275
2018-08-11 03:00:00-07:00 0.0 3.163779 1.0 65.0 302.229401 116.0 66.0 0.0 0.0 3.205693 0.200100
2018-08-11 06:00:00-07:00 0.0 4.424421 0.0 83.0 300.893127 58.0 83.0 0.0 0.0 2.813052 -2.643242
2018-08-11 09:00:00-07:00 0.0 2.239661 0.0 100.0 299.341492 0.0 100.0 0.0 0.0 2.102734 -0.506802
2018-08-11 12:00:00-07:00 0.0 0.910834 0.0 100.0 297.772461 0.0 100.0 0.0 0.0 -0.339336 -0.783552
2018-08-11 15:00:00-07:00 0.0 1.724226 0.0 88.0 307.331635 110.0 88.0 0.0 0.0 0.319805 -1.349465
2018-08-11 18:00:00-07:00 0.0 2.551276 2.0 81.0 322.295105 389.0 81.0 0.0 0.0 -1.089751 -2.562175
2018-08-11 21:00:00-07:00 0.0 2.431749 1.0 92.0 324.604889 900.0 92.0 0.0 0.0 0.237634 -3.639753
2018-08-12 00:00:00-07:00 0.0 3.533952 1.0 94.0 313.946472 745.0 95.0 0.0 2.0 -0.586021 -3.830896
2018-08-12 03:00:00-07:00 73.0 5.745721 7.0 93.0 302.344086 83.0 96.0 0.0 51.0 0.103159 5.063750
2018-08-12 06:00:00-07:00 0.0 4.400000 13.0 96.0 300.121582 41.0 98.0 0.0 28.0 0.590303 3.697109
2018-08-12 09:00:00-07:00 0.0 2.031268 1.0 100.0 299.321564 0.0 100.0 0.0 0.0 -0.497507 1.808472
2018-08-12 12:00:00-07:00 0.0 1.622856 7.0 100.0 297.964691 0.0 100.0 0.0 0.0 -1.583899 0.217837
2018-08-12 15:00:00-07:00 0.0 4.232991 0.0 98.0 305.230225 110.0 98.0 0.0 0.0 -2.767295 0.556606
2018-08-12 18:00:00-07:00 0.0 5.482076 1.0 99.0 319.233856 373.0 99.0 0.0 0.0 -4.223706 1.556448
2018-08-12 21:00:00-07:00 0.0 3.520243 1.0 100.0 320.584778 840.0 100.0 0.0 17.0 -1.949231 2.018655
2018-08-13 00:00:00-07:00 0.0 2.533803 14.0 78.0 315.005310 702.0 83.0 0.0 21.0 -0.402651 1.397710
2018-08-13 03:00:00-07:00 0.0 1.929883 5.0 1.0 302.719299 124.0 8.0 0.0 1.0 1.953621 0.025042
2018-08-13 06:00:00-07:00 0.0 0.553319 3.0 0.0 300.482117 62.0 4.0 0.0 0.0 0.434063 -0.291292
2018-08-13 09:00:00-07:00 0.0 0.933802 0.0 0.0 298.812897 0.0 0.0 0.0 0.0 0.943799 0.229775
2018-08-13 12:00:00-07:00 0.0 1.082669 0.0 0.0 297.521545 0.0 0.0 0.0 0.0 -1.013611 -0.481719
2018-08-13 15:00:00-07:00 0.0 1.122410 0.0 8.0 308.692261 130.0 7.0 0.0 0.0 -0.673120 0.919268
2018-08-13 18:00:00-07:00 0.0 1.189101 0.0 6.0 324.976562 413.0 5.0 0.0 0.0 0.019458 -1.174990
2018-08-13 21:00:00-07:00 0.0 1.856442 0.0 1.0 326.910645 950.0 3.0 0.0 0.0 0.895701 -1.862810
2018-08-14 00:00:00-07:00 0.0 2.177454 16.0 2.0 314.865021 767.0 16.0 0.0 0.0 2.610271 -1.985769
2018-08-14 03:00:00-07:00 0.0 5.295177 9.0 2.0 304.146118 113.0 11.0 0.0 0.0 3.858083 -2.168022
2018-08-14 06:00:00-07:00 0.0 3.813969 41.0 3.0 303.807770 56.0 43.0 0.0 0.0 -3.479668 0.235786
2018-08-14 09:00:00-07:00 0.0 2.023495 1.0 2.0 300.122620 0.0 4.0 0.0 0.0 -0.724624 1.922969
2018-08-14 12:00:00-07:00 0.0 1.210834 1.0 1.0 298.319336 0.0 2.0 0.0 0.0 -0.729763 0.965642
2018-08-14 15:00:00-07:00 0.0 1.345964 0.0 0.0 308.628540 130.0 1.0 0.0 0.0 -1.251416 0.259319
2018-08-14 18:00:00-07:00 0.0 2.168860 0.0 0.0 324.404510 408.0 1.0 0.0 0.0 -0.564993 -1.919937
2018-08-14 21:00:00-07:00 0.0 3.214940 1.0 2.0 326.309570 950.0 2.0 0.0 0.0 1.492632 -3.740396
2018-08-15 00:00:00-07:00 0.0 3.483707 20.0 0.0 313.737579 753.0 20.0 0.0 0.0 0.936924 -2.716035
2018-08-15 03:00:00-07:00 0.0 2.888947 47.0 0.0 303.722351 42.0 47.0 0.0 0.0 2.806019 -0.109397
2018-08-15 06:00:00-07:00 0.0 4.436207 24.0 0.0 301.977295 21.0 25.0 0.0 0.0 4.300133 0.330762
2018-08-15 09:00:00-07:00 0.0 5.521409 14.0 41.0 300.111938 0.0 51.0 0.0 0.0 2.120156 4.223972
2018-08-15 12:00:00-07:00 0.0 3.029943 11.0 71.0 298.853943 0.0 76.0 0.0 0.0 0.820999 2.907007
2018-08-15 15:00:00-07:00 0.0 1.937729 54.0 48.0 304.253876 70.0 81.0 0.0 0.0 1.407324 1.463635
2018-08-15 18:00:00-07:00 0.0 2.588310 32.0 30.0 322.773743 359.0 52.0 0.0 0.0 1.540002 -2.288005
2018-08-15 21:00:00-07:00 0.0 2.654586 0.0 13.0 325.346924 950.0 14.0 0.0 0.0 2.246978 -3.460466
2018-08-16 00:00:00-07:00 0.0 4.035146 0.0 8.0 315.400024 813.0 8.0 0.0 0.0 2.003013 -4.993906
2018-08-16 03:00:00-07:00 0.0 6.012111 15.0 1.0 303.467957 108.0 16.0 0.0 0.0 4.268049 2.852856
2018-08-16 06:00:00-07:00 0.0 8.371322 NaN 33.0 301.240814 54.0 43.0 0.0 11.0 6.131931 NaN
In [7]:
data = fm.process_data(data)
In [8]:
data[['ghi', 'dni', 'dhi']].plot()
Out[8]:
<matplotlib.axes._subplots.AxesSubplot at 0x117d3d860>
In [9]:
cs = fm.location.get_clearsky(data.index)
In [10]:
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[10]:
<matplotlib.legend.Legend at 0x11b818400>
In [11]:
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[11]:
<matplotlib.legend.Legend at 0x11b8fad68>
In [12]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)
In [13]:
data
Out[13]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2018-08-09 09:00:00-07:00 26.888641 3.834616 221.519605 12.667699 213.375931 97.0 0.0 39.0 97.0
2018-08-09 12:00:00-07:00 25.488617 2.595709 345.194827 19.253380 326.860699 98.0 0.0 61.0 98.0
2018-08-09 15:00:00-07:00 32.419769 1.174503 272.396782 15.332687 260.311961 99.0 0.0 19.0 99.0
2018-08-09 18:00:00-07:00 47.617493 1.259972 57.910461 0.000000 57.910461 100.0 0.0 10.0 100.0
2018-08-09 21:00:00-07:00 48.764954 2.617624 0.000000 0.000000 0.000000 100.0 0.0 3.0 100.0
2018-08-10 00:00:00-07:00 36.510590 6.237412 0.000000 0.000000 0.000000 100.0 7.0 2.0 100.0
2018-08-10 03:00:00-07:00 27.615723 4.188950 0.000000 0.000000 0.000000 100.0 0.0 1.0 100.0
2018-08-10 06:00:00-07:00 25.584930 2.511085 1.764350 0.000000 1.764350 99.0 0.0 1.0 99.0
2018-08-10 09:00:00-07:00 24.615814 2.743668 418.970435 203.844109 288.229447 46.0 1.0 7.0 39.0
2018-08-10 12:00:00-07:00 24.033386 2.968575 572.892106 107.066170 471.088285 61.0 1.0 21.0 53.0
2018-08-10 15:00:00-07:00 32.462128 2.523795 301.235752 21.403320 284.409826 93.0 0.0 1.0 93.0
2018-08-10 18:00:00-07:00 50.762115 0.907692 60.988044 0.000000 60.988044 96.0 0.0 1.0 96.0
2018-08-10 21:00:00-07:00 49.491455 1.668376 0.000000 0.000000 0.000000 100.0 11.0 0.0 100.0
2018-08-11 00:00:00-07:00 40.827606 2.593099 0.000000 0.000000 0.000000 100.0 14.0 0.0 100.0
2018-08-11 03:00:00-07:00 29.079407 3.211932 0.000000 0.000000 0.000000 66.0 0.0 1.0 65.0
2018-08-11 06:00:00-07:00 27.743134 3.860050 2.007306 0.000000 2.007306 83.0 0.0 0.0 83.0
2018-08-11 09:00:00-07:00 26.191498 2.162947 208.538697 9.377919 202.538056 100.0 0.0 0.0 100.0
2018-08-11 12:00:00-07:00 24.622467 0.853875 331.651004 17.836193 314.717284 100.0 0.0 0.0 100.0
2018-08-11 15:00:00-07:00 34.181641 1.386842 324.920021 28.353480 302.689983 88.0 0.0 0.0 88.0
2018-08-11 18:00:00-07:00 49.145111 2.784295 75.229987 0.000000 75.229987 81.0 0.0 2.0 81.0
2018-08-11 21:00:00-07:00 51.454895 3.647502 0.000000 0.000000 0.000000 92.0 0.0 1.0 92.0
2018-08-12 00:00:00-07:00 40.796478 3.875459 0.000000 0.000000 0.000000 95.0 2.0 1.0 94.0
2018-08-12 03:00:00-07:00 29.194092 5.064800 0.000000 0.000000 0.000000 96.0 51.0 7.0 93.0
2018-08-12 06:00:00-07:00 26.971588 3.743938 1.384317 0.000000 1.384317 98.0 28.0 13.0 96.0
2018-08-12 09:00:00-07:00 26.171570 1.875655 207.885997 9.283648 201.959831 100.0 0.0 1.0 100.0
2018-08-12 12:00:00-07:00 24.814697 1.598809 331.038406 17.804632 314.161177 100.0 0.0 7.0 100.0
2018-08-12 15:00:00-07:00 32.080231 2.822717 274.641599 15.997900 262.133468 98.0 0.0 0.0 98.0
2018-08-12 18:00:00-07:00 46.083862 4.501358 55.434072 0.000000 55.434072 99.0 0.0 1.0 99.0
2018-08-12 21:00:00-07:00 47.434784 2.806148 0.000000 0.000000 0.000000 100.0 17.0 1.0 100.0
2018-08-13 00:00:00-07:00 41.855316 1.454552 0.000000 0.000000 0.000000 83.0 21.0 14.0 78.0
2018-08-13 03:00:00-07:00 29.569305 1.953781 0.000000 0.000000 0.000000 8.0 1.0 5.0 1.0
2018-08-13 06:00:00-07:00 27.332123 0.522744 3.226308 0.000000 3.226308 4.0 0.0 3.0 0.0
2018-08-13 09:00:00-07:00 25.662903 0.971367 592.080551 727.380481 128.882154 0.0 0.0 0.0 0.0
2018-08-13 12:00:00-07:00 24.371552 1.122257 944.030971 724.595958 258.288395 0.0 0.0 0.0 0.0
2018-08-13 15:00:00-07:00 35.542267 1.139361 719.641612 628.823994 229.396571 7.0 0.0 0.0 8.0
2018-08-13 18:00:00-07:00 51.826569 1.175151 147.106335 311.558877 74.231823 5.0 0.0 0.0 6.0
2018-08-13 21:00:00-07:00 53.760651 2.066964 0.000000 0.000000 0.000000 3.0 0.0 0.0 1.0
2018-08-14 00:00:00-07:00 41.715027 3.279755 0.000000 0.000000 0.000000 16.0 0.0 16.0 2.0
2018-08-14 03:00:00-07:00 30.996124 4.425509 0.000000 0.000000 0.000000 11.0 0.0 9.0 2.0
2018-08-14 06:00:00-07:00 30.657776 3.487647 2.057003 0.000000 2.057003 43.0 0.0 41.0 3.0
2018-08-14 09:00:00-07:00 26.972626 2.054967 574.841330 669.482804 149.555294 4.0 0.0 1.0 2.0
2018-08-14 12:00:00-07:00 25.169342 1.210380 929.945729 685.659657 282.132796 2.0 0.0 1.0 1.0
2018-08-14 15:00:00-07:00 35.478546 1.278002 746.348636 724.349553 183.300384 1.0 0.0 0.0 0.0
2018-08-14 18:00:00-07:00 51.254517 2.001343 147.574866 330.796547 71.298602 1.0 0.0 0.0 0.0
2018-08-14 21:00:00-07:00 53.159576 4.027221 0.000000 0.000000 0.000000 2.0 0.0 1.0 2.0
2018-08-15 00:00:00-07:00 40.587585 2.873095 0.000000 0.000000 0.000000 20.0 0.0 20.0 0.0
2018-08-15 03:00:00-07:00 30.572357 2.808151 0.000000 0.000000 0.000000 47.0 0.0 47.0 0.0
2018-08-15 06:00:00-07:00 28.827301 4.312836 2.043671 0.000000 2.043671 25.0 0.0 24.0 0.0
2018-08-15 09:00:00-07:00 26.961945 4.726204 393.262816 167.858691 286.895651 51.0 0.0 14.0 41.0
2018-08-15 12:00:00-07:00 25.703949 3.020716 475.798393 52.988643 425.820495 76.0 0.0 11.0 71.0
2018-08-15 15:00:00-07:00 31.103882 2.030465 354.388461 41.547414 322.191646 81.0 0.0 54.0 48.0
2018-08-15 18:00:00-07:00 49.623749 2.758002 95.973363 58.173741 82.756809 52.0 0.0 32.0 30.0
2018-08-15 21:00:00-07:00 52.196930 4.125983 0.000000 0.000000 0.000000 14.0 0.0 0.0 13.0
2018-08-16 00:00:00-07:00 42.250031 5.380628 0.000000 0.000000 0.000000 8.0 0.0 0.0 8.0
2018-08-16 03:00:00-07:00 30.317963 5.133716 0.000000 0.000000 0.000000 16.0 0.0 15.0 1.0
2018-08-16 06:00:00-07:00 28.090820 NaN 1.504735 0.000000 1.504735 43.0 11.0 NaN 33.0
In [14]:
data['temp_air'].plot()
plt.ylabel('temperature (%s)' % fm.units['temp_air'])
Out[14]:
Text(0,0.5,'temperature (C)')
In [15]:
cloud_vars = ['total_clouds', 'low_clouds', 'mid_clouds', 'high_clouds']
In [16]:
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[16]:
<matplotlib.legend.Legend at 0x11bdfb828>
In [17]:
total_cloud_cover = data['total_clouds']
In [18]:
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[18]:
Text(0.5,1,'GFS 0.5 deg')

GFS (0.25 deg)

In [19]:
# GFS model at 0.25 degree resolution
fm = GFS(resolution='quarter')
In [20]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)
In [21]:
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[21]:
<matplotlib.legend.Legend at 0x11c159908>
In [22]:
data
Out[22]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2018-08-09 09:00:00-07:00 32.350006 3.526885 213.725963 10.543999 206.947550 99.0 0.0 43.0 99.0
2018-08-09 12:00:00-07:00 30.962585 2.154427 339.013675 18.551720 321.347706 99.0 0.0 52.0 99.0
2018-08-09 15:00:00-07:00 33.355286 1.269586 267.430216 14.506850 255.996299 100.0 0.0 9.0 100.0
2018-08-09 18:00:00-07:00 44.461853 0.329029 58.985942 0.000000 58.985942 99.0 0.0 8.0 99.0
2018-08-09 21:00:00-07:00 49.564941 0.946093 0.000000 0.000000 0.000000 100.0 0.0 6.0 100.0
2018-08-10 00:00:00-07:00 39.085754 4.620260 0.000000 0.000000 0.000000 100.0 28.0 5.0 100.0
2018-08-10 03:00:00-07:00 34.050018 5.262214 0.000000 0.000000 0.000000 98.0 25.0 4.0 98.0
2018-08-10 06:00:00-07:00 32.084930 1.804075 1.989534 0.000000 1.989534 92.0 12.0 6.0 91.0
2018-08-10 09:00:00-07:00 30.601013 2.752651 488.898446 360.339527 257.784846 28.0 0.0 0.0 28.0
2018-08-10 12:00:00-07:00 29.501038 2.874946 566.721763 102.480617 469.278113 62.0 0.0 0.0 61.0
2018-08-10 15:00:00-07:00 33.362122 2.217285 306.186511 22.653817 288.377523 92.0 0.0 3.0 92.0
2018-08-10 18:00:00-07:00 44.762115 0.575741 62.042355 0.000000 62.042355 95.0 0.0 5.0 95.0
2018-08-10 21:00:00-07:00 50.079041 0.682719 0.000000 0.000000 0.000000 100.0 0.0 4.0 100.0
2018-08-11 00:00:00-07:00 43.853943 2.691154 0.000000 0.000000 0.000000 100.0 0.0 2.0 100.0
2018-08-11 03:00:00-07:00 36.353882 4.012574 0.000000 0.000000 0.000000 90.0 1.0 0.0 90.0
2018-08-11 06:00:00-07:00 33.884735 4.988318 1.695640 0.000000 1.695640 94.0 1.0 0.0 94.0
2018-08-11 09:00:00-07:00 32.252350 3.135557 208.538697 9.377919 202.538056 100.0 0.0 0.0 100.0
2018-08-11 12:00:00-07:00 31.022461 0.281934 331.651004 17.836193 314.717284 100.0 0.0 1.0 100.0
2018-08-11 15:00:00-07:00 34.615814 1.157843 290.378282 19.041442 275.449181 95.0 0.0 6.0 95.0
2018-08-11 18:00:00-07:00 45.245117 1.019026 62.837299 0.000000 62.837299 93.0 0.0 5.0 92.0
2018-08-11 21:00:00-07:00 48.554901 2.039836 0.000000 0.000000 0.000000 98.0 1.0 2.0 98.0
2018-08-12 00:00:00-07:00 42.496490 4.191007 0.000000 0.000000 0.000000 99.0 6.0 2.0 99.0
2018-08-12 03:00:00-07:00 37.094086 1.844232 0.000000 0.000000 0.000000 99.0 33.0 2.0 99.0
2018-08-12 06:00:00-07:00 33.746033 3.892732 1.359529 0.000000 1.359529 99.0 57.0 28.0 91.0
2018-08-12 09:00:00-07:00 31.717194 2.866729 207.885997 9.283648 201.959831 100.0 3.0 5.0 100.0
2018-08-12 12:00:00-07:00 30.814697 1.219028 331.038406 17.804632 314.161177 100.0 2.0 6.0 100.0
2018-08-12 15:00:00-07:00 34.180237 2.314258 264.805963 14.290535 253.632754 100.0 0.0 0.0 100.0
2018-08-12 18:00:00-07:00 44.215118 3.422779 54.423352 0.000000 54.423352 100.0 0.0 0.0 100.0
2018-08-12 21:00:00-07:00 49.482758 3.029381 0.000000 0.000000 0.000000 92.0 0.0 0.0 91.0
2018-08-13 00:00:00-07:00 44.360291 2.054639 0.000000 0.000000 0.000000 59.0 4.0 7.0 49.0
2018-08-13 03:00:00-07:00 37.307983 2.736902 0.000000 0.000000 0.000000 27.0 1.0 26.0 0.0
2018-08-13 06:00:00-07:00 35.432129 1.700486 2.537323 0.000000 2.537323 36.0 3.0 36.0 0.0
2018-08-13 09:00:00-07:00 33.469330 1.805740 503.564501 410.783886 241.975907 23.0 6.0 21.0 0.0
2018-08-13 12:00:00-07:00 32.371552 0.867148 815.170742 443.320393 395.621523 21.0 13.0 13.0 0.0
2018-08-13 15:00:00-07:00 36.442261 1.794981 734.343575 675.766267 207.501304 4.0 0.0 0.0 4.0
2018-08-13 18:00:00-07:00 47.808807 1.361059 150.071271 332.153918 72.379521 2.0 0.0 0.0 3.0
2018-08-13 21:00:00-07:00 51.309540 1.666227 0.000000 0.000000 0.000000 11.0 10.0 1.0 0.0
2018-08-14 00:00:00-07:00 45.244812 3.620042 0.000000 0.000000 0.000000 20.0 11.0 12.0 4.0
2018-08-14 03:00:00-07:00 38.147034 5.870223 0.000000 0.000000 0.000000 28.0 2.0 20.0 9.0
2018-08-14 06:00:00-07:00 35.957764 2.472818 1.741529 0.000000 1.741529 60.0 8.0 55.0 7.0
2018-08-14 09:00:00-07:00 33.482758 2.175942 555.660262 602.825724 172.717846 9.0 0.0 0.0 9.0
2018-08-14 12:00:00-07:00 32.169342 1.497109 899.324388 593.200752 338.866857 7.0 0.0 0.0 7.0
2018-08-14 15:00:00-07:00 36.261536 1.497609 746.348636 724.349553 183.300384 1.0 0.0 0.0 1.0
2018-08-14 18:00:00-07:00 48.791565 0.679219 147.574866 330.796547 71.298602 1.0 0.0 0.0 1.0
2018-08-14 21:00:00-07:00 51.485260 3.711489 0.000000 0.000000 0.000000 1.0 0.0 0.0 0.0
2018-08-15 00:00:00-07:00 44.555908 3.715527 0.000000 0.000000 0.000000 17.0 2.0 16.0 0.0
2018-08-15 03:00:00-07:00 38.379639 3.950938 0.000000 0.000000 0.000000 16.0 0.0 16.0 0.0
2018-08-15 06:00:00-07:00 35.419556 6.215336 2.297453 0.000000 2.297453 9.0 1.0 9.0 0.0
2018-08-15 09:00:00-07:00 33.092651 4.344903 511.800567 443.386311 230.839573 20.0 1.0 9.0 11.0
2018-08-15 12:00:00-07:00 31.599121 2.343946 585.815063 121.289913 471.416680 58.0 0.0 4.0 53.0
2018-08-15 15:00:00-07:00 35.455414 1.498288 568.443578 273.595587 356.422999 37.0 0.0 1.0 36.0
2018-08-15 18:00:00-07:00 45.769104 2.532945 127.070474 209.788671 79.408364 19.0 0.0 1.0 18.0
2018-08-15 21:00:00-07:00 50.096924 3.734906 0.000000 0.000000 0.000000 8.0 0.0 0.0 8.0
2018-08-16 00:00:00-07:00 45.028137 5.049751 0.000000 0.000000 0.000000 15.0 1.0 1.0 14.0
2018-08-16 03:00:00-07:00 37.824097 5.351292 0.000000 0.000000 0.000000 25.0 1.0 1.0 24.0
2018-08-16 06:00:00-07:00 34.390839 7.838322 1.504735 0.000000 1.504735 43.0 30.0 16.0 29.0

NAM

In [23]:
fm = NAM()
In [24]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)
In [25]:
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[25]:
<matplotlib.legend.Legend at 0x11c249a20>
In [26]:
data['ghi'].plot(linewidth=2, ls='-')
plt.ylabel('GHI W/m**2')
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')
Out[26]:
Text(0.5,0,'Forecast Time (US/Arizona)')
In [27]:
data
Out[27]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2018-08-09 07:00:00-07:00 26.357147 4.003387 60.663783 0.000000 60.663783 100.0 0.0 100.0 100.0
2018-08-09 08:00:00-07:00 25.942535 6.155919 137.876683 0.000000 137.876683 100.0 0.0 100.0 100.0
2018-08-09 09:00:00-07:00 24.926056 7.792250 209.829133 9.562738 203.681542 100.0 0.0 100.0 100.0
2018-08-09 10:00:00-07:00 24.616028 6.214286 269.178310 14.622069 257.589305 100.0 0.0 100.0 96.0
2018-08-09 11:00:00-07:00 24.240082 7.714826 467.269169 62.531214 411.109851 73.0 0.0 73.0 52.0
2018-08-09 12:00:00-07:00 23.319946 0.714286 672.797108 202.874606 479.608739 45.0 0.0 45.0 0.0
2018-08-09 13:00:00-07:00 22.729980 2.072016 919.019748 631.445906 318.308086 5.0 0.0 5.0 0.0
2018-08-09 14:00:00-07:00 26.629974 3.080600 851.516550 627.665799 289.525761 6.0 0.0 6.0 0.0
2018-08-09 15:00:00-07:00 30.969971 2.732291 664.755124 475.290490 290.143662 20.0 0.0 0.0 20.0
2018-08-09 16:00:00-07:00 35.159973 2.251325 523.566197 484.308692 215.040206 18.0 0.0 0.0 18.0
2018-08-09 17:00:00-07:00 39.489960 2.186648 361.138290 511.214471 129.932249 10.0 0.0 0.0 10.0
2018-08-09 18:00:00-07:00 42.509979 1.111566 157.930095 326.186606 77.547519 7.0 0.0 3.0 7.0
2018-08-09 19:00:00-07:00 44.409973 2.115601 3.429756 0.000000 3.429756 7.0 7.0 5.0 1.0
2018-08-09 20:00:00-07:00 45.659973 1.864534 0.000000 0.000000 0.000000 14.0 14.0 1.0 1.0
2018-08-09 21:00:00-07:00 45.039978 1.862972 0.000000 0.000000 0.000000 20.0 17.0 18.0 5.0
2018-08-09 22:00:00-07:00 44.079956 1.128355 0.000000 0.000000 0.000000 52.0 11.0 51.0 32.0
2018-08-09 23:00:00-07:00 39.309967 1.061944 0.000000 0.000000 0.000000 49.0 1.0 49.0 5.0
2018-08-10 00:00:00-07:00 38.749969 1.325294 0.000000 0.000000 0.000000 21.0 0.0 21.0 0.0
2018-08-10 01:00:00-07:00 35.109955 1.603835 0.000000 0.000000 0.000000 31.0 0.0 31.0 0.0
2018-08-10 02:00:00-07:00 31.639954 2.518545 0.000000 0.000000 0.000000 58.0 0.0 58.0 0.0
2018-08-10 03:00:00-07:00 29.909973 4.223814 0.000000 0.000000 0.000000 63.0 0.0 63.0 0.0
2018-08-10 04:00:00-07:00 28.289978 4.653861 0.000000 0.000000 0.000000 20.0 15.0 19.0 1.0
2018-08-10 05:00:00-07:00 27.039978 3.884426 0.000000 0.000000 0.000000 51.0 51.0 45.0 1.0
2018-08-10 06:00:00-07:00 25.922150 3.811134 2.632915 0.000000 2.632915 72.0 21.0 72.0 1.0
2018-08-10 07:00:00-07:00 25.560272 2.932979 85.488451 2.829510 84.774837 77.0 27.0 77.0 0.0
2018-08-10 08:00:00-07:00 25.620331 1.430654 137.157328 0.000000 137.157328 100.0 100.0 71.0 11.0
2018-08-10 09:00:00-07:00 23.729095 3.714286 267.459732 31.120124 247.499990 85.0 24.0 85.0 64.0
2018-08-10 10:00:00-07:00 22.567749 2.718107 308.496344 22.741511 290.503436 92.0 43.0 92.0 82.0
2018-08-10 11:00:00-07:00 22.519928 0.928925 322.189114 18.392123 305.695924 98.0 38.0 98.0 98.0
2018-08-10 12:00:00-07:00 22.331696 1.500000 332.248933 17.867005 315.260099 100.0 38.0 100.0 63.0
... ... ... ... ... ... ... ... ... ...
2018-08-10 17:00:00-07:00 36.659973 1.928571 375.610208 602.017082 104.955055 3.0 0.0 3.0 1.0
2018-08-10 18:00:00-07:00 39.039978 2.056290 157.984976 340.838288 75.020601 4.0 0.0 4.0 1.0
2018-08-10 19:00:00-07:00 41.229980 1.744879 2.451988 0.000000 2.451988 24.0 0.0 9.0 24.0
2018-08-10 20:00:00-07:00 39.819977 1.696497 0.000000 0.000000 0.000000 34.0 1.0 13.0 34.0
2018-08-10 21:00:00-07:00 42.989960 1.955291 0.000000 0.000000 0.000000 25.0 2.0 25.0 5.0
2018-08-10 22:00:00-07:00 41.959961 2.217545 0.000000 0.000000 0.000000 17.0 3.0 17.0 0.0
2018-08-10 23:00:00-07:00 40.269958 2.430727 0.000000 0.000000 0.000000 4.0 3.0 3.0 0.0
2018-08-11 00:00:00-07:00 37.729980 2.590689 0.000000 0.000000 0.000000 3.0 3.0 0.0 0.0
2018-08-11 01:00:00-07:00 34.189972 2.462128 0.000000 0.000000 0.000000 3.0 3.0 0.0 0.0
2018-08-11 02:00:00-07:00 30.869965 1.851640 0.000000 0.000000 0.000000 13.0 13.0 0.0 0.0
2018-08-11 03:00:00-07:00 29.589966 0.785714 0.000000 0.000000 0.000000 21.0 13.0 21.0 0.0
2018-08-11 04:00:00-07:00 28.639954 1.525487 0.000000 0.000000 0.000000 44.0 43.0 44.0 0.0
2018-08-11 05:00:00-07:00 27.948303 2.248971 0.000000 0.000000 0.000000 77.0 52.0 76.0 5.0
2018-08-11 06:00:00-07:00 26.674286 2.735286 2.545639 0.000000 2.545639 64.0 1.0 64.0 7.0
2018-08-11 09:00:00-07:00 25.611389 1.314215 220.157275 12.480181 212.171592 97.0 2.0 95.0 91.0
2018-08-11 12:00:00-07:00 24.133972 0.719705 393.243361 26.908412 367.696456 90.0 0.0 90.0 80.0
2018-08-11 15:00:00-07:00 30.369965 1.438256 754.224384 727.083899 184.167280 1.0 0.0 1.0 0.0
2018-08-11 18:00:00-07:00 40.279968 2.781685 152.684303 319.503638 75.901799 6.0 2.0 1.0 5.0
2018-08-11 21:00:00-07:00 44.459961 3.485963 0.000000 0.000000 0.000000 16.0 5.0 0.0 16.0
2018-08-12 00:00:00-07:00 39.429962 1.438324 0.000000 0.000000 0.000000 5.0 5.0 0.0 3.0
2018-08-12 03:00:00-07:00 29.809967 2.024885 0.000000 0.000000 0.000000 12.0 12.0 0.0 7.0
2018-08-12 06:00:00-07:00 27.379974 2.501742 3.317785 0.000000 3.317785 20.0 14.0 0.0 18.0
2018-08-12 09:00:00-07:00 24.627441 1.730331 593.960001 728.745298 128.769423 0.0 0.0 0.0 0.0
2018-08-12 12:00:00-07:00 22.660187 1.857143 945.824034 725.202562 258.395618 0.0 0.0 0.0 0.0
2018-08-12 15:00:00-07:00 30.899963 1.011965 751.670648 726.173991 183.903696 1.0 1.0 0.0 0.0
2018-08-12 18:00:00-07:00 42.349976 2.322240 155.495294 354.350491 71.461810 0.0 0.0 0.0 0.0
2018-08-12 21:00:00-07:00 45.139954 2.446207 0.000000 0.000000 0.000000 3.0 3.0 0.0 0.0
2018-08-13 00:00:00-07:00 39.509979 2.880893 0.000000 0.000000 0.000000 2.0 2.0 0.0 0.0
2018-08-13 03:00:00-07:00 30.559967 1.607040 0.000000 0.000000 0.000000 39.0 36.0 3.0 36.0
2018-08-13 06:00:00-07:00 22.173981 9.442879 1.159351 0.000000 1.159351 100.0 59.0 100.0 100.0

64 rows × 9 columns

NDFD

In [28]:
fm = NDFD()
In [29]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)
In [30]:
total_cloud_cover = data['total_clouds']
temp = data['temp_air']
wind = data['wind_speed']
In [31]:
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[31]:
(0, 100)
In [32]:
temp.plot(color='r', linewidth=2)
plt.ylabel('Temperature' + ' (%s)' % fm.units['temp_air'])
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')    
Out[32]:
Text(0.5,0,'Forecast Time (US/Arizona)')
In [33]:
wind.plot(color='r', linewidth=2)
plt.ylabel('Wind Speed' + ' (%s)' % fm.units['wind_speed'])
plt.xlabel('Forecast Time ('+str(data.index.tz)+')')   
Out[33]:
Text(0.5,0,'Forecast Time (US/Arizona)')
In [34]:
data
Out[34]:
temp_air wind_speed ghi dni dhi total_clouds
2018-08-09 07:00:00-07:00 26.649994 3.1 77.562979 0.000000 77.562979 85.0
2018-08-09 08:00:00-07:00 26.649994 3.1 194.209160 38.811933 176.386047 78.0
2018-08-09 09:00:00-07:00 26.149994 3.6 311.146630 60.012891 272.566186 74.0
2018-08-09 10:00:00-07:00 25.550018 3.1 384.155914 51.968840 342.966999 77.0
2018-08-09 11:00:00-07:00 24.950012 3.1 415.251628 39.826084 379.483799 82.0
2018-08-09 12:00:00-07:00 24.950012 3.1 431.731297 35.890511 397.554377 84.0
2018-08-09 13:00:00-07:00 24.450012 2.6 437.424918 37.698027 401.561760 83.0
2018-08-09 14:00:00-07:00 26.149994 2.1 425.315217 44.101260 385.828436 80.0
2018-08-09 15:00:00-07:00 28.350006 2.1 411.460505 70.480932 355.909289 71.0
2018-08-09 16:00:00-07:00 29.950012 2.1 323.152413 73.845794 276.109387 70.0
2018-08-09 17:00:00-07:00 31.149994 2.1 213.013653 67.551520 182.462250 69.0
2018-08-09 18:00:00-07:00 32.750000 2.1 91.250336 19.747485 86.383938 69.0
2018-08-09 19:00:00-07:00 33.350006 2.6 2.005033 0.000000 2.005033 68.0
2018-08-09 20:00:00-07:00 34.450012 3.1 0.000000 0.000000 0.000000 67.0
2018-08-09 21:00:00-07:00 34.950012 3.6 0.000000 0.000000 0.000000 66.0
2018-08-09 22:00:00-07:00 35.550018 3.6 0.000000 0.000000 0.000000 65.0
2018-08-09 23:00:00-07:00 35.550018 4.1 0.000000 0.000000 0.000000 69.0
2018-08-10 00:00:00-07:00 34.950012 3.6 0.000000 0.000000 0.000000 67.0
2018-08-10 01:00:00-07:00 34.450012 4.6 0.000000 0.000000 0.000000 69.0
2018-08-10 02:00:00-07:00 32.250000 4.1 0.000000 0.000000 0.000000 72.0
2018-08-10 03:00:00-07:00 29.950012 2.6 0.000000 0.000000 0.000000 76.0
2018-08-10 04:00:00-07:00 28.350006 2.6 0.000000 0.000000 0.000000 80.0
2018-08-10 05:00:00-07:00 27.750000 6.7 0.000000 0.000000 0.000000 83.0
2018-08-10 06:00:00-07:00 26.649994 1.5 2.214717 0.000000 2.214717 85.0
2018-08-10 07:00:00-07:00 26.149994 2.6 78.813676 0.000000 78.813676 83.0
2018-08-10 08:00:00-07:00 25.550018 2.1 188.101466 33.131471 172.942709 80.0
2018-08-10 09:00:00-07:00 24.950012 1.0 298.538862 50.699122 266.021595 77.0
2018-08-10 10:00:00-07:00 24.450012 1.5 403.270692 63.693459 352.876919 73.0
2018-08-10 11:00:00-07:00 23.850006 2.1 483.727505 72.207911 418.974849 70.0
2018-08-10 12:00:00-07:00 23.350006 2.1 529.699706 78.080212 455.457171 68.0
... ... ... ... ... ... ...
2018-08-10 20:00:00-07:00 32.250000 3.1 0.000000 0.000000 0.000000 63.0
2018-08-10 21:00:00-07:00 32.750000 3.1 0.000000 0.000000 0.000000 64.0
2018-08-10 22:00:00-07:00 32.750000 3.6 0.000000 0.000000 0.000000 64.0
2018-08-10 23:00:00-07:00 33.350006 4.1 0.000000 0.000000 0.000000 65.0
2018-08-11 00:00:00-07:00 32.750000 4.1 0.000000 0.000000 0.000000 65.0
2018-08-11 01:00:00-07:00 32.250000 3.6 0.000000 0.000000 0.000000 65.0
2018-08-11 02:00:00-07:00 30.550018 3.1 0.000000 0.000000 0.000000 66.0
2018-08-11 03:00:00-07:00 28.850006 2.6 0.000000 0.000000 0.000000 67.0
2018-08-11 04:00:00-07:00 27.750000 2.6 0.000000 0.000000 0.000000 68.0
2018-08-11 05:00:00-07:00 27.250000 3.1 0.000000 0.000000 0.000000 69.0
2018-08-11 06:00:00-07:00 26.149994 3.1 2.403973 0.000000 2.403973 69.0
2018-08-11 07:00:00-07:00 25.550018 3.1 93.186925 20.619096 88.026832 69.0
2018-08-11 08:00:00-07:00 25.550018 3.1 217.516521 71.270485 185.028637 68.0
2018-08-11 09:00:00-07:00 24.950012 3.1 332.470253 81.276886 280.463684 68.0
2018-08-11 10:00:00-07:00 24.450012 3.1 427.263477 81.179907 363.148297 68.0
2018-08-11 11:00:00-07:00 24.450012 3.1 500.105302 83.067462 425.728963 67.0
2018-08-11 12:00:00-07:00 23.850006 3.1 534.905676 81.723779 457.316942 67.0
2018-08-11 13:00:00-07:00 23.350006 2.6 540.269604 85.602412 459.102923 66.0
2018-08-11 15:00:00-07:00 26.649994 2.6 443.348804 97.784611 366.682531 64.0
2018-08-11 18:00:00-07:00 30.550018 2.6 96.917192 41.832341 86.864123 60.0
2018-08-11 21:00:00-07:00 32.750000 3.6 0.000000 0.000000 0.000000 60.0
2018-08-12 00:00:00-07:00 32.750000 3.6 0.000000 0.000000 0.000000 59.0
2018-08-12 03:00:00-07:00 29.450012 3.1 0.000000 0.000000 0.000000 55.0
2018-08-12 06:00:00-07:00 26.149994 3.6 2.574143 0.000000 2.574143 50.0
2018-08-12 09:00:00-07:00 24.950012 3.6 435.669663 241.038893 281.803803 41.0
2018-08-12 12:00:00-07:00 23.850006 3.6 749.092631 313.872611 451.568927 32.0
2018-08-12 15:00:00-07:00 27.750000 2.6 599.218071 321.150790 348.122869 32.0
2018-08-12 18:00:00-07:00 33.350006 3.6 124.162983 160.003488 86.218488 31.0
2018-08-12 21:00:00-07:00 36.149994 2.6 0.000000 0.000000 0.000000 31.0
2018-08-13 00:00:00-07:00 36.149994 2.1 0.000000 0.000000 0.000000 30.0

67 rows × 6 columns

RAP

In [35]:
fm = RAP(resolution=20)
In [36]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)
In [37]:
cloud_vars = ['total_clouds', 'high_clouds', 'mid_clouds', 'low_clouds']
In [38]:
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[38]:
<matplotlib.legend.Legend at 0x11c5f69e8>
In [39]:
data
Out[39]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2018-08-09 07:00:00-07:00 23.536316 3.790692 149.666221 242.114036 88.134485 21.0 0.0 21.0 6.0
2018-08-09 08:00:00-07:00 23.346283 1.901989 393.933386 651.306373 94.842214 0.0 0.0 0.0 0.0
2018-08-09 09:00:00-07:00 23.873749 3.825251 264.384702 29.234306 245.590866 86.0 0.0 81.0 86.0
2018-08-09 10:00:00-07:00 23.297119 2.458094 434.146148 85.327805 366.517935 67.0 0.0 67.0 63.0
2018-08-09 11:00:00-07:00 23.116699 2.082475 877.630289 699.591393 249.326864 2.0 0.0 2.0 0.0
2018-08-09 12:00:00-07:00 22.458923 2.466352 889.138197 546.599233 368.636315 10.0 0.0 10.0 0.0
2018-08-09 13:00:00-07:00 22.644470 1.141352 770.836754 350.235637 437.648068 29.0 0.0 4.0 29.0
2018-08-09 14:00:00-07:00 24.246063 1.403550 465.631542 62.573409 409.605422 73.0 0.0 18.0 73.0
2018-08-09 15:00:00-07:00 26.072235 1.981160 267.430216 14.506850 255.996299 100.0 0.0 91.0 100.0
2018-08-09 16:00:00-07:00 29.230164 1.836640 234.507848 17.436795 223.399840 93.0 0.0 86.0 93.0
2018-08-09 17:00:00-07:00 35.105408 2.627171 187.907782 35.431830 171.883093 79.0 0.0 79.0 47.0
2018-08-09 18:00:00-07:00 39.748260 3.269636 86.948412 9.966723 84.492300 73.0 0.0 73.0 60.0
2018-08-09 19:00:00-07:00 41.406555 2.760246 1.934965 0.000000 1.934965 71.0 0.0 64.0 71.0
2018-08-09 20:00:00-07:00 43.335022 3.109952 0.000000 0.000000 0.000000 71.0 0.0 71.0 48.0
2018-08-09 21:00:00-07:00 43.917542 3.240358 0.000000 0.000000 0.000000 4.0 0.0 4.0 0.0
2018-08-09 22:00:00-07:00 43.097748 2.198344 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2018-08-09 23:00:00-07:00 39.485199 1.942873 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0
2018-08-10 00:00:00-07:00 38.396027 2.048532 0.000000 0.000000 0.000000 4.0 4.0 0.0 0.0
2018-08-10 01:00:00-07:00 35.516907 1.357437 0.000000 0.000000 0.000000 23.0 0.0 2.0 23.0
2018-08-10 02:00:00-07:00 31.078979 0.910205 0.000000 0.000000 0.000000 88.0 16.0 43.0 88.0
2018-08-10 03:00:00-07:00 27.968964 1.401853 0.000000 0.000000 0.000000 97.0 27.0 88.0 96.0
2018-08-10 04:00:00-07:00 26.162781 3.004400 0.000000 0.000000 0.000000 100.0 32.0 67.0 100.0
2018-08-10 05:00:00-07:00 25.571991 2.757247 0.000000 0.000000 0.000000 100.0 2.0 65.0 100.0
2018-08-10 06:00:00-07:00 24.952301 2.246886 1.732181 0.000000 1.732181 100.0 0.0 71.0 100.0
2018-08-10 07:00:00-07:00 24.385529 2.879599 83.263519 0.000000 83.263519 79.0 16.0 79.0 74.0
2018-08-10 08:00:00-07:00 24.256256 1.319416 137.157328 0.000000 137.157328 100.0 0.0 100.0 92.0
2018-08-10 09:00:00-07:00 24.043060 1.159573 240.265496 18.967594 228.100111 92.0 0.0 92.0 88.0
2018-08-10 10:00:00-07:00 23.834473 1.075297 278.567589 16.263569 265.699979 98.0 0.0 82.0 98.0
2018-08-10 11:00:00-07:00 23.668060 1.030183 426.035185 44.038982 386.543098 80.0 9.0 64.0 80.0
2018-08-10 12:00:00-07:00 23.377533 1.543814 579.062392 111.805692 472.751999 60.0 0.0 52.0 60.0
2018-08-10 13:00:00-07:00 22.919708 1.549696 584.480356 116.741540 473.601549 59.0 0.0 58.0 57.0
2018-08-10 14:00:00-07:00 24.502106 1.247304 786.303244 487.628673 350.556416 17.0 6.0 13.0 16.0
2018-08-10 15:00:00-07:00 26.043365 1.220194 598.282325 312.269559 352.795897 33.0 9.0 8.0 33.0
2018-08-10 16:00:00-07:00 27.136292 2.161062 279.427323 39.906586 254.098968 81.0 10.0 38.0 81.0
2018-08-10 17:00:00-07:00 28.568481 1.992921 134.078096 0.000000 134.078096 100.0 0.0 4.0 100.0
2018-08-10 18:00:00-07:00 30.371094 2.139526 57.825098 0.000000 57.825098 99.0 0.0 61.0 99.0
2018-08-10 19:00:00-07:00 31.723419 2.670749 1.073471 0.000000 1.073471 97.0 0.0 49.0 97.0
2018-08-10 20:00:00-07:00 33.592712 3.344139 0.000000 0.000000 0.000000 44.0 0.0 25.0 44.0

HRRR

In [40]:
fm = HRRR()
In [41]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)
In [42]:
cloud_vars = ['total_clouds', 'high_clouds', 'mid_clouds', 'low_clouds']
In [43]:
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[43]:
<matplotlib.legend.Legend at 0x11c5a57f0>
In [44]:
data
Out[44]:
temp_air wind_speed ghi dni dhi total_clouds low_clouds mid_clouds high_clouds
2018-08-09 07:00:00-07:00 -8.303986 5.023098 132.344544 151.538733 93.831943 36.375 0.000 36.375 10.000
2018-08-09 08:00:00-07:00 -8.012756 2.413449 380.810457 582.589885 113.275087 5.125 0.000 5.125 3.250
2018-08-09 09:00:00-07:00 -5.676208 3.753068 599.511817 732.808963 128.411454 0.000 0.000 0.000 0.000
2018-08-09 10:00:00-07:00 -5.692413 2.792092 742.835945 658.061377 221.276594 5.250 0.000 5.250 0.000
2018-08-09 11:00:00-07:00 -5.134277 2.904991 848.731597 609.945690 300.939028 7.000 0.000 5.875 6.750
2018-08-09 12:00:00-07:00 -4.927277 2.152667 878.321188 522.664152 380.611608 11.750 0.000 11.750 0.000
2018-08-09 13:00:00-07:00 -6.651276 0.701012 844.928280 471.028777 396.825794 17.000 0.000 3.750 17.000
2018-08-09 14:00:00-07:00 -8.924896 0.675812 433.234532 47.283714 390.898290 78.625 0.000 35.125 78.625
2018-08-09 15:00:00-07:00 -7.917908 1.662220 267.430216 14.506850 255.996299 100.000 0.000 89.750 100.000
2018-08-09 16:00:00-07:00 -6.474915 1.687248 207.529063 9.307442 201.599812 100.000 0.000 95.750 100.000
2018-08-09 17:00:00-07:00 -4.073853 1.990831 135.185462 0.000000 135.185462 100.000 0.000 98.375 100.000
2018-08-09 18:00:00-07:00 -2.774719 2.742996 81.033276 0.000000 81.033276 78.500 0.000 78.500 77.500
2018-08-09 19:00:00-07:00 -1.761292 2.960564 1.786070 0.000000 1.786070 77.375 0.000 62.375 77.375
2018-08-09 20:00:00-07:00 1.885834 3.215884 0.000000 0.000000 0.000000 45.125 0.000 43.500 45.125
2018-08-09 21:00:00-07:00 1.999756 4.145582 0.000000 0.000000 0.000000 35.750 0.000 33.375 35.750
2018-08-09 22:00:00-07:00 NaN NaN 0.000000 0.000000 0.000000 6.125 0.000 6.125 2.250
2018-08-09 23:00:00-07:00 0.280396 1.791664 0.000000 0.000000 0.000000 6.125 0.000 5.000 6.125
2018-08-10 00:00:00-07:00 1.287201 2.451709 0.000000 0.000000 0.000000 0.000 0.000 0.000 0.000
2018-08-10 01:00:00-07:00 2.555939 1.575591 0.000000 0.000000 0.000000 9.125 9.125 7.500 0.000
2018-08-10 02:00:00-07:00 2.143677 2.600955 0.000000 0.000000 0.000000 8.000 8.000 5.625 5.000
2018-08-10 03:00:00-07:00 1.640533 2.785269 0.000000 0.000000 0.000000 21.500 8.875 3.625 21.500
2018-08-10 04:00:00-07:00 0.264893 2.531894 0.000000 0.000000 0.000000 28.875 28.875 3.250 17.375
2018-08-10 05:00:00-07:00 -4.513550 3.859525 0.000000 0.000000 0.000000 53.875 16.250 24.000 53.875
2018-08-10 06:00:00-07:00 -8.821838 4.690048 2.962648 0.000000 2.962648 61.750 12.375 32.625 61.750
2018-08-10 07:00:00-07:00 -12.989410 2.588892 117.888914 94.228813 94.124026 47.875 14.500 14.250 47.875
2018-08-10 08:00:00-07:00 -13.414337 1.983140 286.487363 219.791696 185.925307 41.375 4.750 8.250 41.375
2018-08-10 09:00:00-07:00 -14.408600 1.251553 459.276187 287.576292 274.831275 35.625 17.875 16.625 35.625
2018-08-10 10:00:00-07:00 -17.264099 4.448008 467.492837 116.033758 375.687825 60.125 21.875 31.375 60.125
2018-08-10 11:00:00-07:00 -16.325745 3.984222 612.092812 185.770214 445.502826 47.750 9.500 38.125 47.750
2018-08-10 12:00:00-07:00 -14.715729 2.973440 688.585865 223.659934 475.918914 42.250 1.000 18.625 42.250
2018-08-10 13:00:00-07:00 -16.259247 2.229414 639.171601 167.353737 480.222329 50.125 1.750 4.125 50.125
2018-08-10 14:00:00-07:00 -15.192413 1.448875 554.312781 127.171401 440.671936 57.375 1.375 1.625 57.375
2018-08-10 15:00:00-07:00 -13.072968 0.985974 584.667722 286.541951 359.406699 35.750 0.000 0.000 35.750
2018-08-10 16:00:00-07:00 -10.585114 1.717010 336.485691 89.083318 279.945302 66.125 0.375 0.000 66.125
2018-08-10 17:00:00-07:00 -8.197205 1.003414 194.772363 44.626557 174.709132 75.625 1.625 0.000 75.625
2018-08-10 18:00:00-07:00 -4.799957 1.992425 92.222111 25.109001 86.110261 66.375 1.625 0.000 66.375

HRRR (ESRL)

In [45]:
fm = HRRR_ESRL()
/Users/holmgren/git_repos/pvlib2/pvlib-python/pvlib/forecast.py:751: 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.')
In [46]:
# retrieve data
data = fm.get_processed_data(latitude, longitude, start, end)
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-46-f22942e4d8bd> in <module>()
      1 # retrieve data
----> 2 data = fm.get_processed_data(latitude, longitude, start, end)

~/git_repos/pvlib2/pvlib-python/pvlib/forecast.py in get_processed_data(self, *args, **kwargs)
    301             Processed forecast data
    302         """
--> 303         return self.process_data(self.get_data(*args, **kwargs), **kwargs)
    304 
    305     def rename(self, data, variables=None):

~/git_repos/pvlib2/pvlib-python/pvlib/forecast.py in get_data(self, latitude, longitude, start, end, vert_level, query_variables, close_netcdf_data)
    255         self.query.accept(self.data_format)
    256 
--> 257         self.netcdf_data = self.ncss.get_data(self.query)
    258 
    259         # might be better to go to xarray here so that we can handle

~/miniconda3/envs/pvlibfx36/lib/python3.6/site-packages/siphon/ncss.py in get_data(self, query)
    112 
    113         """
--> 114         resp = self.get_query(query)
    115         return response_handlers(resp, self.unit_handler)
    116 

~/miniconda3/envs/pvlibfx36/lib/python3.6/site-packages/siphon/http_util.py in get_query(self, query)
    377         """
    378         url = self._base[:-1] if self._base[-1] == '/' else self._base
--> 379         return self.get(url, query)
    380 
    381     def url_path(self, path):

~/miniconda3/envs/pvlibfx36/lib/python3.6/site-packages/siphon/http_util.py in get(self, path, params)
    461             raise requests.HTTPError('Error accessing {0}: {1:d} {2}'.format(resp.request.url,
    462                                                                              resp.status_code,
--> 463                                                                              text))
    464         return resp
    465 

HTTPError: Error accessing http://thredds-jumbo.unidata.ucar.edu/thredds/ncss/grid/grib/HRRR/CONUS_3km/surface/Best?var=Temperature_surface&var=Medium_cloud_cover_UnknownLevelType-224&var=Downward_short-wave_radiation_flux_surface&var=Low_cloud_cover_UnknownLevelType-214&var=High_cloud_cover_UnknownLevelType-234&var=Total_cloud_cover_entire_atmosphere&var=Wind_speed_gust_surface&time_start=2018-08-09T00%3A00%3A00-07%3A00&time_end=2018-08-16T00%3A00%3A00-07%3A00&longitude=-110.9&latitude=32.2&vertCoord=100000&accept=netcdf: 400 IllegalArgumentException: Index out of range=481
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 [48]:
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
mc.run_model(fx_data.index, weather=fx_data)
Out[48]:
ModelChain: 
  name: None
  orientation_strategy: south_at_latitude_tilt
  clearsky_model: ineichen
  transposition_model: haydavies
  solar_position_method: nrel_numpy
  airmass_model: kastenyoung1989
  dc_model: sapm
  ac_model: snlinverter
  aoi_model: sapm_aoi_loss
  spectral_model: sapm_spectral_loss
  temp_model: sapm_temp
  losses_model: no_extra_losses
In [49]:
mc.total_irrad.plot()
Out[49]:
<matplotlib.axes._subplots.AxesSubplot at 0x11ddedcc0>
In [50]:
mc.temps.plot()
Out[50]:
<matplotlib.axes._subplots.AxesSubplot at 0x11cf3d198>
In [51]:
mc.ac.plot()
Out[51]:
<matplotlib.axes._subplots.AxesSubplot at 0x11cced358>
In [ ]: