Skip to content

Commit 0cf7b93

Browse files
committed
Address review comments: move unit conversion note to Notes section, simplify inline comments
- Move unit conversion documentation from map_variables param description to a dedicated Notes section in the docstring - Simplify pressure conversion comment (remove specific function list) - Simplify TQV conversion comment (remove specific function reference)
1 parent ff1fe1f commit 0cf7b93

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

pvlib/iotools/nasa_power.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,19 @@ def get_nasa_power(latitude, longitude, start, end,
8282
include a site elevation with the request.
8383
map_variables: bool, default True
8484
When true, renames columns of the Dataframe to pvlib variable names
85-
where applicable. See variable :const:`VARIABLE_MAP`. Note that the
86-
following unit conversions are applied after renaming: pressure is
87-
converted from kPa to Pa, and precipitable water is converted from
88-
kg/m\u00b2 (mm) to cm.
85+
where applicable. See variable :const:`VARIABLE_MAP`.
8986
9087
Raises
9188
------
9289
requests.HTTPError
9390
Raises an error when an incorrect request is made.
9491
92+
Notes
93+
-----
94+
The following unit conversions are applied after renaming:
95+
pressure is converted from kPa to Pa, and precipitable water
96+
is converted from kg/m\u00b2 (mm) to cm.
97+
9598
Returns
9699
-------
97100
data : pd.DataFrame
@@ -160,13 +163,10 @@ def get_nasa_power(latitude, longitude, start, end,
160163
# Rename according to pvlib convention
161164
if map_variables:
162165
df = df.rename(columns=VARIABLE_MAP)
163-
# NASA POWER returns PS in kPa; pvlib convention is Pa.
164-
# Conversion required for pvlib.atmosphere.pres2alt, alt2pres,
165-
# get_absolute_airmass, and other pressure-dependent functions.
166+
# PS is returned in kPa; convert to Pa for pvlib compatibility.
166167
if 'pressure' in df.columns:
167168
df['pressure'] = df['pressure'] * 1000
168-
# NASA POWER returns TQV in kg/m^2 (=mm); pvlib convention is cm.
169-
# Required for pvlib.atmosphere.kasten96_lt and other clear-sky models.
169+
# TQV is returned in kg/m^2 (=mm); convert to cm for pvlib compatibility.
170170
if 'precipitable_water' in df.columns:
171171
df['precipitable_water'] = df['precipitable_water'] / 10
172172

0 commit comments

Comments
 (0)