7
7
URL = 'https://power.larc.nasa.gov/api/temporal/hourly/point'
8
8
9
9
DEFAULT_PARAMETERS = [
10
- 'ALLSKY_SFC_SW_DNI' , 'ALLSKY_SFC_SW_DIFF' , 'ALLSKY_SFC_SW_DWN' ,
11
- 'T2M' , 'WS10M'
10
+ 'dni' , 'dhi' , 'ghi' , 'temp_air' , 'wind_speed'
12
11
]
13
12
14
13
VARIABLE_MAP = {
@@ -48,11 +47,11 @@ def get_nasa_power(latitude, longitude, start, end,
48
47
full list see [3]_. Note that the pvlib naming conventions can also be
49
48
used.
50
49
51
- * ``ALLSKY_SFC_SW_DWN``: Global Horizontal Irradiance (GHI) [Wm⁻²]
52
- * ``ALLSKY_SFC_SW_DIFF``: Diffuse Horizontal Irradiance (DHI) [Wm⁻²]
53
- * ``ALLSKY_SFC_SW_DNI``: Direct Normal Irradiance (DNI) [Wm⁻²]
54
- * ``T2M``: Air temperature at 2 m [C]
55
- * ``WS10M``: Wind speed at 10 m [m/s]
50
+ * Global Horizontal Irradiance (GHI) [Wm⁻²]
51
+ * Diffuse Horizontal Irradiance (DHI) [Wm⁻²]
52
+ * Direct Normal Irradiance (DNI) [Wm⁻²]
53
+ * Air temperature at 2 m [C]
54
+ * Wind speed at 10 m [m/s]
56
55
57
56
community: str, default 're'
58
57
Can be one of the following depending on which parameters are of
@@ -134,7 +133,6 @@ def get_nasa_power(latitude, longitude, start, end,
134
133
hourly_data = data ['properties' ]['parameter' ]
135
134
df = pd .DataFrame (hourly_data )
136
135
df .index = pd .to_datetime (df .index , format = '%Y%m%d%H' ).tz_localize ('UTC' )
137
- df = df .replace (- 999 , np .nan )
138
136
139
137
# Create metadata dictionary
140
138
meta = data ['header' ]
@@ -145,6 +143,9 @@ def get_nasa_power(latitude, longitude, start, end,
145
143
meta ['latitude' ] = data ['geometry' ]['coordinates' ][1 ]
146
144
meta ['altitude' ] = data ['geometry' ]['coordinates' ][2 ]
147
145
146
+ # Replace NaN values
147
+ df = df .replace (meta ['fill_value' ], np .nan )
148
+
148
149
# Rename according to pvlib convention
149
150
if map_variables :
150
151
df = df .rename (columns = VARIABLE_MAP )
0 commit comments