Update nasa_power VARIABLE_MAP with additional parameters#2762
Update nasa_power VARIABLE_MAP with additional parameters#2762karlhillx wants to merge 3 commits into
Conversation
Hey @karlhillx! 🎉Thanks for opening your first pull request! We appreciate your If AI is used for any portion of this PR, you must vet the content |
|
Noted, confirmed, etc. The added entries (T2MDEW, T2MWET, TQV, RH2M) map directly to the NASA POWER API parameter names, with pvlib names chosen to match existing conventions in |
| 'T2M': 'temp_air', | ||
| 'WS2M': 'wind_speed_2m', | ||
| 'WS10M': 'wind_speed', | ||
| 'T2MDEW': 'dew_point', |
There was a problem hiding this comment.
| 'T2MDEW': 'dew_point', | |
| 'T2MDEW': 'temp_dew', |
| 'WS2M': 'wind_speed_2m', | ||
| 'WS10M': 'wind_speed', | ||
| 'T2MDEW': 'dew_point', | ||
| 'T2MWET': 'dew_frost_point', |
There was a problem hiding this comment.
| 'T2MWET': 'dew_frost_point', |
This isn't a standard pvlib term. A general recommendation is to see whether other iotools function maps a similar variable.
| 'WS10M': 'wind_speed', | ||
| 'T2MDEW': 'dew_point', | ||
| 'T2MWET': 'dew_frost_point', | ||
| 'TQV': 'precipitable_water', |
There was a problem hiding this comment.
Other pvlib iotools functions also convert the unit of this parameter. Do you know what unit this parameter is in, and if so, can you check if it matches the pvlib standard?
|
@karlhillx Is there a reason that you didn't include the other parameters listed in #2731? |
|
Thanks for the feedback. You are right that dew_point and dew_frost_point are not pvlib standard names. After checking all the other iotools modules, merra2, era5, tmy, epw, psm4, srml, and solcast all map dew point to temp_dew in degrees C. pvlib has no wet_bulb or frost_point variable anywhere. T2MDEW and T2MWET are the same physical measurement, temperature at 2m in degrees C, just different triggering thresholds. Mapping both to temp_dew is consistent with the rest of pvlib and keeps the units correct. Updated push incoming with the full set of missing parameters. |
|
PS unit bug fix needed NASA POWER returns PS in kPa for all communities (RE, SB, AG). Confirmed via live API call. pvlib.atmosphere.pres2alt expects Pa. At sea level, PS returns 101.325 kPa. Without conversion, pres2alt computes ~84,000 m instead of 0 m. Any downstream pressure-dependent calc (airmass, cell temp models, etc.) will be catastrophically wrong. Fix: add kPa to Pa conversion after column rename. Suggested patch: if map_variables:
df = df.rename(columns=VARIABLE_MAP)
# PS is returned in kPa; convert to Pa for pvlib compatibility
if 'pressure' in df.columns:
df['pressure'] = df['pressure'] * 1000Two minor improvements (optional):
|
Adds the following entries to VARIABLE_MAP in pvlib/iotools/nasa_power.py:
Closes #2731