Repository: pvlib/pvlib-python (python)

Issue:
Bug in dirint: pressure is not passed to disc
The dirint function fails to pass the input pressure to its internal disc function call. This effects disc's airmass calculation, which effects the disc dni calculation, which effects the dirint dni. I'll fix this soon.

Pull request:
fix dirint pressure bug
closes #212. 


Patch:
diff --git a/docs/sphinx/source/whatsnew/v0.4.0.txt b/docs/sphinx/source/whatsnew/v0.4.0.txt
index 4c1e292..d5adb58 100644
--- a/docs/sphinx/source/whatsnew/v0.4.0.txt
+++ b/docs/sphinx/source/whatsnew/v0.4.0.txt
@@ -27,6 +27,8 @@ Enhancements
 Bug fixes
 ~~~~~~~~~
 
+* dirint function yielded the wrong results for non-sea-level pressures.
+  Fixed. (:issue:`212`)
 
 
 Documentation
diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py
index aa6ac3f..fd4cf3e 100644
--- a/pvlib/irradiance.py
+++ b/pvlib/irradiance.py
@@ -1470,7 +1470,7 @@ def dirint(ghi, zenith, times, pressure=101325, use_delta_kt_prime=True,
 
     pvl_logger.debug('clearsky.dirint')
 
-    disc_out = disc(ghi, zenith, times)
+    disc_out = disc(ghi, zenith, times, pressure=pressure)
     kt = disc_out['kt']
 
     # Absolute Airmass, per the DISC model


Test patch:
diff --git a/pvlib/test/test_irradiance.py b/pvlib/test/test_irradiance.py
index 23d5d7f..67d3c24 100644
--- a/pvlib/test/test_irradiance.py
+++ b/pvlib/test/test_irradiance.py
@@ -208,7 +208,7 @@ def test_dirint_value():
     pressure = 93193.
     dirint_data = irradiance.dirint(ghi, zenith, times, pressure=pressure)
     assert_almost_equal(dirint_data.values,
-                        np.array([928.85, 688.26]), 1)
+                        np.array([ 888. ,  683.7]), 1)
 
 
 def test_dirint_nans():
@@ -220,7 +220,7 @@ def test_dirint_nans():
     dirint_data = irradiance.dirint(ghi, zenith, times, pressure=pressure,
                                     temp_dew=temp_dew)
     assert_almost_equal(dirint_data.values,
-                        np.array([np.nan, np.nan, np.nan, np.nan, 934.2]), 1)
+                        np.array([np.nan, np.nan, np.nan, np.nan, 893.1]), 1)
 
 
 def test_dirint_tdew():
@@ -231,7 +231,7 @@ def test_dirint_tdew():
     dirint_data = irradiance.dirint(ghi, zenith, times, pressure=pressure,
                                     temp_dew=10)
     assert_almost_equal(dirint_data.values,
-                        np.array([934.06, 640.67]), 1)
+                        np.array([892.9,  636.5]), 1)
 
 def test_dirint_no_delta_kt():
     times = pd.DatetimeIndex(['2014-06-24T12-0700','2014-06-24T18-0700'])
@@ -241,7 +241,7 @@ def test_dirint_no_delta_kt():
     dirint_data = irradiance.dirint(ghi, zenith, times, pressure=pressure,
                                     use_delta_kt_prime=False)
     assert_almost_equal(dirint_data.values,
-                        np.array([901.56, 674.87]), 1)
+                        np.array([861.9,  670.4]), 1)
 
 def test_dirint_coeffs():
     coeffs = irradiance._get_dirint_coeffs()