Skip to content

Commit bf56a9f

Browse files
committed
rename temperature to temp_air
1 parent f962ab4 commit bf56a9f

File tree

3 files changed

+27
-28
lines changed

3 files changed

+27
-28
lines changed

docs/sphinx/source/forecasts.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ similar field in the HRRR is named
4848
PVLIB-Python aims to simplify the access of the model fields relevant
4949
for solar power forecasts. Model data accessed with PVLIB-Python is
5050
returned as a pandas DataFrame with consistent column names:
51-
``temperature, wind_speed, total_clouds, low_clouds, mid_clouds,
51+
``temp_air, wind_speed, total_clouds, low_clouds, mid_clouds,
5252
high_clouds, dni, dhi, ghi``. To accomplish this, we use an
5353
object-oriented framework in which each weather model is represented by
5454
a class that inherits from a parent
@@ -112,7 +112,7 @@ problems.
112112
data = model.rename(data)
113113
114114
# convert temperature
115-
data['temperature'] = model.kelvin_to_celsius(data['temperature'])
115+
data['temp_air'] = model.kelvin_to_celsius(data['temp_air'])
116116
117117
# convert wind components to wind speed
118118
data['wind_speed'] = model.uv_to_speed(data)
@@ -375,8 +375,7 @@ for details.
375375
376376
# extract relevant data for model chain
377377
irradiance = fx_data[['ghi', 'dni', 'dhi']]
378-
weather = fx_data[['wind_speed', 'temperature']].rename(
379-
columns={'temperature': 'temp_air'})
378+
weather = fx_data[['wind_speed', 'temp_air']]
380379
mc.run_model(fx_data.index, irradiance=irradiance, weather=weather);
381380
382381
Now we plot a couple of modeling intermediates and the forecast power.

pvlib/forecast.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class ForecastModel(object):
9595
vert_level = 100000
9696

9797
units = {
98-
'temperature': 'C',
98+
'temp_air': 'C',
9999
'wind_speed': 'm/s',
100100
'ghi': 'W/m^2',
101101
'ghi_raw': 'W/m^2',
@@ -491,7 +491,7 @@ def __init__(self, resolution='half', set_type='best'):
491491
model = 'GFS {} Degree Forecast'.format(resolution)
492492

493493
self.variables = {
494-
'temperature': 'Temperature_surface',
494+
'temp_air': 'Temperature_surface',
495495
'wind_speed_gust': 'Wind_speed_gust_surface',
496496
'wind_speed_u': 'u-component_of_wind_isobaric',
497497
'wind_speed_v': 'v-component_of_wind_isobaric',
@@ -504,7 +504,7 @@ def __init__(self, resolution='half', set_type='best'):
504504
'ghi_raw': 'Downward_Short-Wave_Radiation_Flux_surface_Mixed_intervals_Average', }
505505

506506
self.output_variables = [
507-
'temperature',
507+
'temp_air',
508508
'wind_speed',
509509
'ghi',
510510
'dni',
@@ -534,7 +534,7 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
534534
Processed forecast data.
535535
"""
536536
data = super(GFS, self).process_data(data, **kwargs)
537-
data['temperature'] = self.kelvin_to_celsius(data['temperature'])
537+
data['temp_air'] = self.kelvin_to_celsius(data['temp_air'])
538538
data['wind_speed'] = self.uv_to_speed(data)
539539
data = data.join(self.cloud_cover_to_irradiance(data[cloud_cover]),
540540
how='outer')
@@ -579,7 +579,7 @@ def __init__(self, set_type='best'):
579579
model = 'GSD HRRR CONUS 3km surface'
580580

581581
self.variables = {
582-
'temperature': 'Temperature_surface',
582+
'temp_air': 'Temperature_surface',
583583
'wind_speed_gust': 'Wind_speed_gust_surface',
584584
'total_clouds': 'Total_cloud_cover_entire_atmosphere',
585585
'low_clouds': 'Low_cloud_cover_UnknownLevelType-214',
@@ -588,7 +588,7 @@ def __init__(self, set_type='best'):
588588
'ghi_raw': 'Downward_short-wave_radiation_flux_surface', }
589589

590590
self.output_variables = [
591-
'temperature',
591+
'temp_air',
592592
'wind_speed'
593593
'ghi_raw',
594594
'ghi',
@@ -620,7 +620,7 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
620620
"""
621621

622622
data = super(HRRR_ESRL, self).process_data(data, **kwargs)
623-
data['temperature'] = self.kelvin_to_celsius(data['temperature'])
623+
data['temp_air'] = self.kelvin_to_celsius(data['temp_air'])
624624
data['wind_speed'] = self.gust_to_speed(data)
625625
data = data.join(self.cloud_cover_to_irradiance(data[cloud_cover]),
626626
how='outer')
@@ -661,7 +661,7 @@ def __init__(self, set_type='best'):
661661
model = 'NAM CONUS 12km from CONDUIT'
662662

663663
self.variables = {
664-
'temperature': 'Temperature_surface',
664+
'temp_air': 'Temperature_surface',
665665
'wind_speed_gust': 'Wind_speed_gust_surface',
666666
'total_clouds': 'Total_cloud_cover_entire_atmosphere_single_layer',
667667
'low_clouds': 'Low_cloud_cover_low_cloud',
@@ -670,7 +670,7 @@ def __init__(self, set_type='best'):
670670
'ghi_raw': 'Downward_Short-Wave_Radiation_Flux_surface', }
671671

672672
self.output_variables = [
673-
'temperature',
673+
'temp_air',
674674
'wind_speed',
675675
'ghi',
676676
'dni',
@@ -701,7 +701,7 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
701701
"""
702702

703703
data = super(NAM, self).process_data(data, **kwargs)
704-
data['temperature'] = self.kelvin_to_celsius(data['temperature'])
704+
data['temp_air'] = self.kelvin_to_celsius(data['temp_air'])
705705
data['wind_speed'] = self.gust_to_speed(data)
706706
data = data.join(self.cloud_cover_to_irradiance(data[cloud_cover]),
707707
how='outer')
@@ -753,7 +753,7 @@ def __init__(self, set_type='best'):
753753
'condensation_height': 'Geopotential_height_adiabatic_condensation_lifted'}
754754

755755
self.output_variables = [
756-
'temperature',
756+
'temp_air',
757757
'wind_speed',
758758
'ghi',
759759
'dni',
@@ -784,8 +784,8 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
784784
"""
785785

786786
data = super(HRRR, self).process_data(data, **kwargs)
787-
data['temperature'] = self.isobaric_to_ambient_temperature(data)
788-
data['temperature'] = self.kelvin_to_celsius(data['temperature'])
787+
data['temp_air'] = self.isobaric_to_ambient_temperature(data)
788+
data['temp_air'] = self.kelvin_to_celsius(data['temp_air'])
789789
data['wind_speed'] = self.gust_to_speed(data)
790790
data = data.join(self.cloud_cover_to_irradiance(data[cloud_cover]),
791791
how='outer')
@@ -824,12 +824,12 @@ def __init__(self, set_type='best'):
824824
model_type = 'Forecast Products and Analyses'
825825
model = 'National Weather Service CONUS Forecast Grids (CONDUIT)'
826826
self.variables = {
827-
'temperature': 'Temperature_surface',
827+
'temp_air': 'Temperature_surface',
828828
'wind_speed': 'Wind_speed_surface',
829829
'wind_speed_gust': 'Wind_speed_gust_surface',
830830
'total_clouds': 'Total_cloud_cover_surface', }
831831
self.output_variables = [
832-
'temperature',
832+
'temp_air',
833833
'wind_speed',
834834
'ghi',
835835
'dni',
@@ -855,7 +855,7 @@ def process_data(self, data, **kwargs):
855855

856856
cloud_cover = 'total_clouds'
857857
data = super(NDFD, self).process_data(data, **kwargs)
858-
data['temperature'] = self.kelvin_to_celsius(data['temperature'])
858+
data['temp_air'] = self.kelvin_to_celsius(data['temp_air'])
859859
data = data.join(self.cloud_cover_to_irradiance(data[cloud_cover]),
860860
how='outer')
861861
return data.ix[:, self.output_variables]
@@ -902,14 +902,14 @@ def __init__(self, resolution='20', set_type='best'):
902902
model_type = 'Forecast Model Data'
903903
model = 'Rapid Refresh CONUS {}km'.format(resolution)
904904
self.variables = {
905-
'temperature': 'Temperature_surface',
905+
'temp_air': 'Temperature_surface',
906906
'wind_speed_gust': 'Wind_speed_gust_surface',
907907
'total_clouds': 'Total_cloud_cover_entire_atmosphere_single_layer',
908908
'low_clouds': 'Low_cloud_cover_low_cloud',
909909
'mid_clouds': 'Medium_cloud_cover_middle_cloud',
910910
'high_clouds': 'High_cloud_cover_high_cloud', }
911911
self.output_variables = [
912-
'temperature',
912+
'temp_air',
913913
'wind_speed',
914914
'ghi',
915915
'dni',
@@ -939,7 +939,7 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
939939
"""
940940

941941
data = super(RAP, self).process_data(data, **kwargs)
942-
data['temperature'] = self.kelvin_to_celsius(data['temperature'])
942+
data['temp_air'] = self.kelvin_to_celsius(data['temp_air'])
943943
data['wind_speed'] = self.gust_to_speed(data)
944944
data = data.join(self.cloud_cover_to_irradiance(data[cloud_cover]),
945945
how='outer')

pvlib/test/test_forecast.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
_end = _start + pd.Timedelta(days=1)
2929
_models = [GFS, NAM, HRRR, RAP, NDFD, HRRR_ESRL]
3030
_working_models = []
31-
_variables = ['temperature', 'wind_speed', 'total_clouds', 'low_clouds',
31+
_variables = ['temp_air', 'wind_speed', 'total_clouds', 'low_clouds',
3232
'mid_clouds', 'high_clouds', 'dni', 'dhi', 'ghi',]
33-
_nonnan_variables = ['temperature', 'wind_speed', 'total_clouds', 'dni',
33+
_nonnan_variables = ['temp_air', 'wind_speed', 'total_clouds', 'dni',
3434
'dhi', 'ghi',]
3535

3636
@requires_siphon
@@ -100,10 +100,10 @@ def test_full():
100100
@requires_siphon
101101
def test_temp_convert():
102102
amodel = _working_models[0]
103-
data = pd.DataFrame({'temperature': [273.15]})
104-
data['temperature'] = amodel.kelvin_to_celsius(data['temperature'])
103+
data = pd.DataFrame({'temp_air': [273.15]})
104+
data['temp_air'] = amodel.kelvin_to_celsius(data['temp_air'])
105105

106-
assert data['temperature'].values == 0.0
106+
assert data['temp_air'].values == 0.0
107107

108108
# @requires_siphon
109109
# def test_bounding_box():

0 commit comments

Comments
 (0)