Repository navigation
Description
The table of parameter names in the docs is a bit dusty and doesn't perfectly reflect today's pvlib. To make it easier to figure out where the gaps are, here's a script that scans the package, finds the parameter names currently in use, and compares with that table:
import pvlib
import pandas as pd
from inspect import getmembers, isfunction, ismodule, signature
from collections import defaultdict
skip_modules = ['version', 'forecast', 'iotools', 'location', 'modelchain', 'tools']
def get_parameter_map():
"""
Find all parameter names used in public pvlib functions
"""
parameter_map = defaultdict(set) # map parameter names to functions that use them
for module_name, module in getmembers(pvlib, ismodule):
if module_name in skip_modules or module_name.startswith("_"):
continue
for function_name, function in getmembers(module, isfunction):
if function_name.startswith("_"):
continue
full_function_name = module_name + "." + function_name
parameter_names = signature(function).parameters.keys()
for parameter_name in parameter_names:
parameter_map[parameter_name].add(full_function_name)
return parameter_map
parameter_map = get_parameter_map()
# read the docs variable name table
url = 'https://raw.githubusercontent.com/pvlib/pvlib-python/master/pvlib/data/variables_style_rules.csv'
df = pd.read_csv(url, sep=';')
listed_names = set(df['variable'])
unlisted_names = set(parameter_map.keys()) - listed_names
print(unlisted_names)unlisted_names has over 300 elements. I think it makes sense to leave most of them out of the table, for example function-specific names like upper_line_length and u0, but a few of the unlisted ones are common enough to warrant inclusion, e.g. albedo. It also shows a few inconsistencies like delta_t vs deltaT and poa_irradiance vs poa_global.
An idea, maybe a bad one: once we've figured out which of the unlisted parameter names we don't want to include in the table, put them in an "ignore list" and create a CI check that performs the above scan to check for new parameter names that aren't in the table but maybe should be.
Activity
echedey-ls commentedon Jun 30, 2024
Add
fill_factorto the description list, via #2046.AdamRJensen commentedon Jul 5, 2024
I really dig this idea. Ensuring consistent naming is one place we're not doing great in and this would be a good help I think.
RDaxini commentedon Sep 11, 2024
I understand this PR is talking about updating the user guide Variables and Symbols page entries with what is used in pvlib, but after running the script I also found there are multiple duplicate parameter names in slightly different forms, e.g.
temp_modidentified by the script when we already havetemp_modulein the user guide. There are also inconsistencies between functions that refer to the same thing that may (or may not) already be defined in the user guide, e.g. DC power.Just with a quick scan of the print statement and comparing with what I recall is already in the user guide, I easily count >10 such instances.
Do you guys think it's worth a PR to unify these names? I think it would be worth it at least to make the function parameters consistent with what we already have in the user guide. I could review the list in more detail and make a start on this in a PR. Unifying parameter names that aren't already in the user guide could be a separate piece of work as that may require more discussion to reach a consensus on a name.
cwhanse commentedon Sep 11, 2024
It would be great to see a list of parameter name variants you found.
In the past, a deprecation process has been followed when a parameter name has changed. I don't think we want to rename in one large PR. We've done that in small bites.
#894 and probably other issues are relevant.
RDaxini commentedon Sep 11, 2024
It's a painstaking process cross checking everything (parameter map, user guide, function docstring) so the table below is incomplete, but it gives a few examples 😅
I'd certainly be happy to spend more time combing through the full list of terms/user guide/functions (and making changes) if we are agreed we want to do something about it haha.
I understand there may be some reasons for some of the differences (I haven't tracked every related issue / definition at this stage) but I did check most definitions at least, e.g. "current" is definitely the same as "photocurrent" in this case (not short-circuit current or anything else).
The table below is a summary of what I have found. I hope it helps.
Note this does not include terms that aren't in the user guide that potentially should be, just terms for which there is an overlap either between a function and the user guide, or between functions (with or without a user guide entry)
*not sure whether it's ac or dc, not obvious unless you dive into the references/source code, either way there's a still a duplicate somewhere
** series resistance at reference conditions
*** this
wind_speedis defined at a height of 10 metres whereas no height is specified in the user guidewind_speedThe starred points are a few examples of where terms require further clarification. Some definitions are even misleading (in my opinion) e.g.
voltageinpvsystem.scale_voltage_current_poweris not a voltage, it's a factor by which the voltage is scaled...There are also instances where two parameters have a similar meaning but have no overlap, e.g.
saturation_currentin the user guide andI_o_refinivtools.sdm.pvsyst_temperature_coefffor the saturation current at reference conditions. I think part of being consistent across the library involves synchronising parameters like this to have a consistent stem, where possible, although there may good reasons for exceptions to this. Taking this case just as an example, perhapssaturation_current_refandsaturation_currentwould be suitable, orI_oandI_o_ref.Ah of course, I had not thought about the required deprecation process but that does make sense. Good point, thanks for explaining.
AdamRJensen commentedon Sep 28, 2024
g_poa_effectiveis another naming convention forpoa_globalthat is used onceechedey-ls commentedon Jan 10, 2025
These are the most common parameter names unlisted in the glossary:
Details
A total of 469 unique unknown parameters were found. They make for a total of 983 ocurrences. The most common unknown parameters are: - map_variables: 26 - model: 20 - filename: 15 - start: 14 - end: 14 - gcr: 13 - url: 13 - times: 12 - x: 11 - delta_t: 11 - time: 10 - altitude: 9 - zenith: 9 - method: 9 - nNsVth: 9 - min_cos_zenith: 8 - max_zenith: 8 - temperature: 8 - numthreads: 8 - datetime_or_doy: 7 - axis_azimuth: 7 - julian_ephemeris_century: 7 - timeout: 7 - api_key: 7 - d2mutau: 6 - NsVbi: 6 - unixtime: 6 - coefficients: 6 - b: 5 - a: 5 - data: 5 - current: 5 - breakdown_factor: 5 - breakdown_voltage: 5 - breakdown_exp: 5 - atmos_refract: 5 - dayofyear: 5 - observer_latitude: 5 - irrad_ref: 5 - module_efficiency: 5 - return_components: 4 - xtol: 4 - v_dc: 4 - p_dc: 4 - voltage: 4 - axis_tilt: 4 - true_ecliptic_obliquity: 4 - lat: 4 - lon: 4 - height: 4 - pitch: 4 - station: 4 - coerce_year: 4 - alpha_sc: 4 - cells_in_series: 4 - temp_ref: 4 - wavelength: 4 - module_type: 4 - aod500: 3 - surface_type: 3 - normalize: 3 - inverter: 3 - model_perez: 3 - use_delta_kt_prime: 3 - location: 3 - name: 3 - weather: 3 - clearsky_index: 3 - slant_height: 3 - method_kwargs: 3 - i: 3 - how: 3 - horizon: 3 - declination: 3 - julian_day: 3 - jme: 3 - x0: 3 - x1: 3 - longitude_nutation: 3 - local_hour_angle: 3 - parallax_sun_right_ascension: 3 - elev: 3 - temp: 3 - sst: 3 - esd: 3 - u0: 3 - u1: 3 - noct: 3 - angle: 3 - number: 3 - npoints: 3 - vectorize: 3 - logical_records: 3 - fbuf: 3 - encoding: 3 - integrated: 3 - label: 3 - EgRef: 3 - coeff: 2 - aod380: 2 - alpha: 2 - lambda1: 2 - max_iterations: 2 - ozone: 2 - a_r: 2 - module: 2 - weight: 2 - ghi_clear: 2 - max_clearness_index: 2 - solar_position: 2 - system: 2 - clearsky_model: 2 - airmass_model: 2 - v: 2 - rsh: 2 - snowfall: 2 - threshold_snowfall: 2 - rainfall: 2 - cleaning_threshold: 2 - rain_accum_period: 2 - hourangle: 2 - equation_of_time: 2 - year: 2 - month: 2 - out: 2 - julian_ephemeris_millennium: 2 - earth_radius_vector: 2 - apparent_sun_longitude: 2 - geocentric_latitude: 2 - u: 2 - observer_elevation: 2 - xterm: 2 - equatorial_horizontal_parallax: 2 - geocentric_sun_declination: 2 - geocentric_sun_right_ascension: 2 - topocentric_sun_declination: 2 - topocentric_local_hour_angle: 2 - deltaT: 2 - u_c: 2 - u_v: 2 - alpha_absorption: 2 - emissivity: 2 - transmittance_absorptance: 2 - wind_fit_low: 2 - wind_fit_high: 2 - slope_azimuth: 2 - slope_tilt: 2 - max_rows: 2 - variable_map: 2 - email: 2 - outputformat: 2 - usehorizon: 2 - userhorizon: 2 - pvgis_format: 2 - time_resolution: 2 - variables: 2 - beta_voc: 2 - ivcurves: 2 - specs: 2 - const: 2 - maxiter: 2 - eps1: 2 - gamma_ref: 2 - mu_gamma: 2 - I_L_ref: 2 - I_o_ref: 2 - R_sh_ref: 2 - R_sh_0: 2 - R_s: 2 - R_sh_exp: 2 - e: 2 - sr: 2 - solar_elevation: 1 - surface_condition: 1 - color_coeff: 1 - wave_roughness_coeff: 1 - aod_bb: 1 - aod0: 1 - lambda0: 1 - aod1: 1 - aod2: 1 - lambda2: 1 - wind_speed_reference: 1 - height_reference: 1 - height_desired: 1 - exponent: 1 - linke_turbidity: 1 - perez_enhancement: 1 - filepath: 1 - interp_turbidity: 1 - apparent_elevation: 1 - aod700: 1 - measured: 1 - clearsky: 1 - infer_limits: 1 - window_length: 1 - mean_diff: 1 - max_diff: 1 - lower_line_length: 1 - upper_line_length: 1 - var_diff: 1 - slope_dev: 1 - asymmetry: 1 - n: 1 - K: 1 - L: 1 - c1: 1 - c2: 1 - theta_ref: 1 - iam_ref: 1 - upper: 1 - function: 1 - region: 1 - num: 1 - source_name: 1 - source_params: 1 - target_name: 1 - fix_n: 1 - measured_aoi: 1 - measured_iam: 1 - model_name: 1 - target_param: 1 - vtol: 1 - ac_power: 1 - dc_power: 1 - dc_voltage: 1 - dc_voltage_level: 1 - p_ac_0: 1 - p_nt: 1 - c: 1 - x_d: 1 - add: 1 - solar_constant: 1 - epoch_year: 1 - projection_ratio: 1 - full_output: 1 - max_clearsky_index: 1 - extra_radiation: 1 - clearness_index: 1 - max_airmass: 1 - calculate_gt_90: 1 - a_coeff: 1 - b_coeff: 1 - transmittance: 1 - clearsky_tolerance: 1 - zenith_threshold_for_zero_dni: 1 - zenith_threshold_for_clearsky_limit: 1 - daily_solar_zenith: 1 - global_diffuse_fraction: 1 - tmy_metadata: 1 - tmy_data: 1 - metadata: 1 - strategy: 1 - transposition_model: 1 - solar_position_method: 1 - k_a: 1 - k_d: 1 - tc_d: 1 - k_rs: 1 - k_rsh: 1 - eta: 1 - dict_output: 1 - temp_mod: 1 - k: 1 - cell_type: 1 - xdata: 1 - path: 1 - reference_irradiance: 1 - resistance: 1 - index: 1 - iam_model: 1 - pw: 1 - positions: 1 - cloud_speed: 1 - dt: 1 - coordinates: 1 - masking_angle: 1 - shaded_row_rotation: 1 - shaded_fraction: 1 - shaded_blocks: 1 - total_blocks: 1 - diode_voltage: 1 - gradients: 1 - voc: 1 - iph: 1 - isat: 1 - rs: 1 - gamma: 1 - poa_irradiance: 1 - initial_coverage: 1 - can_slide_coefficient: 1 - slide_amount_coefficient: 1 - snow_coverage: 1 - num_strings: 1 - snow_total: 1 - snow_events: 1 - lower_edge_height: 1 - string_factor: 1 - angle_of_repose: 1 - pm2_5: 1 - pm10: 1 - depo_veloc: 1 - soiling_loss_rate: 1 - grace_period: 1 - max_soiling: 1 - manual_wash_dates: 1 - initial_soiling: 1 - raw_spa_output: 1 - next_or_previous: 1 - lower_bound: 1 - upper_bound: 1 - attribute: 1 - value: 1 - thetime: 1 - target: 1 - attr: 1 - day: 1 - hour: 1 - minute: 1 - second: 1 - microsecond: 1 - julian_ephemeris_day: 1 - arr: 1 - heliocentric_longitude: 1 - heliocentric_latitude: 1 - x2: 1 - x3: 1 - x4: 1 - mean_ecliptic_obliquity: 1 - obliquity_nutation: 1 - geocentric_longitude: 1 - aberration_correction: 1 - julian_century: 1 - mean_sidereal_time: 1 - apparent_sidereal_time: 1 - observer_longitude: 1 - sun_right_ascension: 1 - yterm: 1 - local_pressure: 1 - local_temp: 1 - topocentric_elevation_angle_wo_atmosphere: 1 - topocentric_elevation_angle_without_atmosphere: 1 - atmospheric_refraction_correction: 1 - topocentric_elevation_angle: 1 - topocentric_astronomers_azimuth: 1 - sun_mean_longitude: 1 - loc_args: 1 - dates: 1 - module_temperature: 1 - ir_down: 1 - sky_view: 1 - noct_installed: 1 - module_height: 1 - wind_height: 1 - absorption: 1 - module_width: 1 - module_length: 1 - array_height: 1 - mount_standoff: 1 - unit_mass: 1 - u_const: 1 - du_wind: 1 - absorptance: 1 - djd: 1 - apparent_azimuth: 1 - max_angle: 1 - backtrack: 1 - cross_axis_tilt: 1 - tracker_theta: 1 - input_power: 1 - no_load_loss: 1 - load_loss: 1 - transformer_rating: 1 - iam: 1 - iam_front: 1 - iam_back: 1 - bifaciality: 1 - shade_factor: 1 - transmission_factor: 1 - rmad: 1 - fill_factor: 1 - fill_factor_reference: 1 - timestamps: 1 - pvrow_height: 1 - pvrow_width: 1 - n_pvrows: 1 - index_observed_pvrow: 1 - rho_front_pvrow: 1 - rho_back_pvrow: 1 - horizon_band_angle: 1 - pvarray: 1 - rotation: 1 - grid: 1 - trace_val: 1 - latitude_range: 1 - longitude_range: 1 - username: 1 - password: 1 - save_path: 1 - csvdata: 1 - raw_data: 1 - site: 1 - names: 1 - interval: 1 - attributes: 1 - leap_day: 1 - full_name: 1 - affiliation: 1 - raddatabase: 1 - components: 1 - pvcalculation: 1 - peakpower: 1 - pvtechchoice: 1 - mountingplace: 1 - loss: 1 - trackingtype: 1 - optimal_surface_tilt: 1 - optimalangles: 1 - startyear: 1 - endyear: 1 - roll_utc_offset: 1 - identifier: 1 - time_step: 1 - time_ref: 1 - verbose: 1 - server: 1 - source: 1 - spatial_resolution: 1 - true_dynamics: 1 - probability_of_exceedance: 1 - missing_data: 1 - timestamp_type: 1 - terrain_shading: 1 - duration: 1 - filetype: 1 - recolumn: 1 - v_mp_i_mp: 1 - vlim: 1 - ilim: 1 - celltype: 1 - gamma_pmp: 1 - dEgdT: 1 - init_guess: 1 - root_kwargs: 1 - rshexp: 1 - ee: 1 - e0: 1 - decimals: 1 - imax_limits: 1 - vmax_limits: 1 - voc_points: 1 - isc_points: 1 - mp_fit_order: 1 - wavelengths: 1 - standard: 1 - e_sun: 1 - e_ref: 1 - min_precipitable_water: 1 - max_precipitable_water: 1 - min_airmass_absolute: 1 - max_airmass_absolute: 1 - qe: 1 - ground_albedo: 1 - surface_pressure: 1 - relative_airmass: 1 - aerosol_turbidity_500nm: 1 - scattering_albedo_400nm: 1 - wavelength_variation_factor: 1 - aerosol_asymmetry_factor: 1Code (free of charge)
Edit to add: we can do an online spreadsheet, discuss whether they are appropriate for the glossary and/or fill the definitions there.
cwhanse commentedon Jan 10, 2025
@jsstein see @echedey-ls list of parameter names.