API Reference
This page is generated with mkdocstrings.
Top-Level Package
solarpandas
Top-level package exports and version metadata for solarpandas.
Modules:
-
accessors– -
base–Core data containers with site metadata for solar time series.
-
config–Configuration loading and runtime option access for solarpandas.
-
helpers–General helper functions shared across the solarpandas package.
-
iohelpers– -
logtools–Logging format helpers used by solarpandas logging setup.
-
mplstyles–Registration helpers and constants for bundled Matplotlib styles.
-
origin–Data origin integrations provided by solarpandas.
-
qcontrol–Public exports for quality-control test functions and utilities.
-
sample_data–Sample datasets bundled with solarpandas for demos and tests.
-
types–Public type aliases, validators, and QC flag extension types.
-
validate–Validation helpers and annotated domain types used by solarpandas.
Core Containers
base
Core data containers with site metadata for solar time series.
This module defines :class:SolarSeries and :class:SolarDataFrame, two pandas
subclasses that keep site-level metadata (latitude, longitude, elevation and
custom metadata) attached to the object through common pandas operations.
The module also provides top-level convenience readers for the custom CSV and
Parquet formats implemented by :class:SolarDataFrame.
Classes:
-
SolarDataFrame–Solar dataframe carrying site metadata.
-
SolarSeries–Solar data series carrying site metadata.
SolarDataFrame
SolarDataFrame(
*args,
latitude: Latitude,
longitude: Longitude,
elevation: Elevation = 0.0,
custom_metadata: dict | None = None,
**kwargs,
)
Bases: DataFrame
Solar dataframe carrying site metadata.
Parameters:
-
(latitudefloat) –Site latitude in decimal degrees. Must satisfy
-90 < lat < 90. -
(longitudefloat) –Site longitude in decimal degrees. Must satisfy
-180 <= lon < 180. -
(elevationfloat, default:0.0) –Site elevation in meters.
-
(custom_metadatadict or None, default:None) –Additional user metadata to keep together with the dataframe.
Notes
Metadata are propagated through the custom pandas constructors.
latitude, longitude and elevation are reserved metadata keys.
They are managed internally and cannot be provided in custom_metadata.
Methods:
-
as_pandas–Return a plain pandas DataFrame view of this object.
-
describe–Compute descriptive statistics as a plain pandas dataframe.
-
read_csv–Read a CSV file written by :meth:
to_csv. -
read_parquet–Read a Parquet file written by :meth:
to_parquet. -
replace_data–Create a copy with identical metadata and replaced data.
-
to_csv–Write dataframe and metadata to a CSV file.
-
to_parquet–Write dataframe and metadata to a Parquet file.
Attributes:
-
custom_metadata(dict) –dict : Additional user metadata attached to the object.
-
elevation(float) –float : Site elevation in meters above sea level.
-
latitude(float) –float : Site latitude in decimal degrees.
-
longitude(float) –float : Site longitude in decimal degrees.
Source code in src/solarpandas/base.py
custom_metadata
property
custom_metadata: dict
dict : Additional user metadata attached to the object.
as_pandas
Return a plain pandas DataFrame view of this object.
Returns:
-
DataFrame–Equivalent dataframe without solarpandas subclass semantics.
describe
Compute descriptive statistics as a plain pandas dataframe.
Returns:
-
DataFrame–Result of
pandas.DataFrame.describeon this dataset.
read_csv
classmethod
Read a CSV file written by :meth:to_csv.
Parameters:
-
(pathstr or Path) –Input file path.
-
(**kwargsAny, default:{}) –Additional keyword arguments passed to :func:
pandas.read_csv.
Returns:
-
SolarDataFrame–Parsed dataset with restored site metadata.
Examples:
>>> sdf.to_csv("data.csv")
>>> restored = SolarDataFrame.read_csv("data.csv")
>>> restored.latitude == sdf.latitude
True
Source code in src/solarpandas/base.py
read_parquet
classmethod
Read a Parquet file written by :meth:to_parquet.
Parameters:
Returns:
-
SolarDataFrame–Parsed dataset with restored site metadata.
Examples:
>>> sdf.to_parquet("data.parquet")
>>> restored = SolarDataFrame.read_parquet("data.parquet")
>>> restored.longitude == sdf.longitude
True
Source code in src/solarpandas/base.py
replace_data
Create a copy with identical metadata and replaced data.
Parameters:
-
(otherpandas.Series, pandas.DataFrame, sequence, or scalar number) –New data used to build the cloned object.
Returns:
-
Self–A new :class:
SolarDataFramepreserving metadata from the current object.
Source code in src/solarpandas/base.py
to_csv
Write dataframe and metadata to a CSV file.
The first output line stores a JSON document with metadata. Data values
are written from the second line onward using pandas.DataFrame.to_csv.
Parameters:
-
(pathstr or Path) –Destination path.
-
(**kwargsAny, default:{}) –Extra keyword arguments passed to
DataFrame.to_csv.
Source code in src/solarpandas/base.py
to_parquet
Write dataframe and metadata to a Parquet file.
Parameters:
-
(pathstr or Path) –Destination path.
-
(**kwargsAny, default:{}) –Extra keyword arguments passed to
pyarrow.parquet.write_table.
Notes
Metadata is stored in the Parquet schema metadata.
Source code in src/solarpandas/base.py
SolarSeries
SolarSeries(
*args,
latitude: Latitude,
longitude: Longitude,
elevation: Elevation = 0.0,
custom_metadata: dict | None = None,
**kwargs,
)
Bases: Series
Solar data series carrying site metadata.
Parameters:
-
(latitudefloat) –Site latitude in decimal degrees. Must satisfy
-90 < lat < 90. -
(longitudefloat) –Site longitude in decimal degrees. Must satisfy
-180 <= lon < 180. -
(elevationfloat, default:0.0) –Site elevation in meters.
-
(custom_metadatadict or None, default:None) –Additional user metadata to attach to the series.
Notes
Metadata are propagated through the custom pandas constructors.
latitude, longitude and elevation are reserved metadata keys.
They are managed internally and cannot be provided in custom_metadata.
Methods:
-
replace_data–Create a copy with identical site metadata and new data values.
Attributes:
-
custom_metadata(dict) –dict : Additional user metadata attached to the object.
-
elevation(float) –float : Site elevation in meters above sea level.
-
latitude(float) –float : Site latitude in decimal degrees.
-
longitude(float) –float : Site longitude in decimal degrees.
Source code in src/solarpandas/base.py
custom_metadata
property
custom_metadata: dict
dict : Additional user metadata attached to the object.
replace_data
Create a copy with identical site metadata and new data values.
Parameters:
-
(otherpandas.Series, pandas.DataFrame, sequence, or scalar number) –New data values.
Returns:
-
Self–A new :class:
SolarSeriespreserving index (when applicable) and metadata from the source object.
Source code in src/solarpandas/base.py
Accessors
solpos
Pandas accessors and caching helpers for solar-position computations.
Classes:
-
SolarPositionAccessor–Accessor to compute and expose solar-position variables.
Functions:
-
clear_cache–Clear the in-memory solar-position cache.
-
get_cache_info–Return cache statistics for solar-position computations.
SolarPositionAccessor
Accessor to compute and expose solar-position variables.
Notes
Cached properties use configuration options under solar-position:
algorithm, refraction and engine.
Examples:
>>> sdf.solpos.zenith # cached path using config defaults
>>> sdf.solpos.compute("psa", True, "numexpr").azimuth # one-off computation
Methods:
-
clear_cache–Clear the in-memory solar-position cache.
-
compute–Compute solar position without using the accessor cache.
-
get_cache_info–Return cache statistics for solar-position computations.
-
sunrise–Return sunrise in the selected coordinate system.
-
sunset–Return sunset in the selected coordinate system.
Attributes:
-
azimuth(SolarSeries) –Solar azimuth angle in degrees measured clockwise from north.
-
cosz(SolarSeries) –Cosine of the solar zenith angle.
-
ecf(SolarSeries) –Earth–Sun distance correction factor (dimensionless).
-
elevation(SolarSeries) –Solar elevation angle in degrees (complement of zenith:
90 - zenith). -
eth(SolarSeries) –Extraterrestrial horizontal irradiance in W m⁻².
-
etn(SolarSeries) –Extraterrestrial normal irradiance in W m⁻².
-
local_solar_time(SolarSeries) –Local Solar Time as a tz-aware datetime series.
-
lst(SolarSeries) –Alias for :attr:
local_solar_time. -
sza(SolarSeries) –Solar zenith angle in degrees. Alias for :attr:
zenith. -
true_solar_day(SolarSeries) –True Solar Time floored to the start of each solar day.
-
true_solar_time(SolarSeries) –True Solar Time as a tz-aware datetime series.
-
tsd(SolarSeries) –Alias for :attr:
true_solar_day. -
tst(SolarSeries) –Alias for :attr:
true_solar_time. -
zenith(SolarSeries) –Solar zenith angle in degrees at each timestamp.
Source code in src/solarpandas/accessors/solpos.py
azimuth
property
azimuth: SolarSeries
ecf
property
ecf: SolarSeries
Earth–Sun distance correction factor (dimensionless).
Returns:
-
SolarSeries–Ratio of mean to actual Earth–Sun distance squared.
elevation
property
elevation: SolarSeries
Solar elevation angle in degrees (complement of zenith: 90 - zenith).
Returns:
-
SolarSeries–Positive values indicate the sun is above the horizon.
eth
property
eth: SolarSeries
Extraterrestrial horizontal irradiance in W m⁻².
Returns:
-
SolarSeries–Instantaneous irradiance on a horizontal plane at the top of atmosphere.
etn
property
etn: SolarSeries
Extraterrestrial normal irradiance in W m⁻².
Returns:
-
SolarSeries–Irradiance on a surface perpendicular to the solar beam (
ISC * ecf).
local_solar_time
property
local_solar_time: SolarSeries
Local Solar Time as a tz-aware datetime series.
Computed by shifting the index by the longitude-based solar offset
(longitude * 4 minutes).
Returns:
true_solar_day
property
true_solar_day: SolarSeries
true_solar_time
property
true_solar_time: SolarSeries
True Solar Time as a tz-aware datetime series.
Returns:
-
SolarSeries–Timestamps re-expressed in True Solar Time (TST).
Examples:
zenith
property
zenith: SolarSeries
Solar zenith angle in degrees at each timestamp.
Returns:
-
SolarSeries–Values range from 0° (sun overhead) to 180° (sun below horizon).
Examples:
clear_cache
staticmethod
Clear the in-memory solar-position cache.
Notes
Use this when changing model options and forcing a full recomputation.
Source code in src/solarpandas/accessors/solpos.py
compute
Compute solar position without using the accessor cache.
Parameters:
-
(algorithmstr, default:"psa") –Solar-position algorithm accepted by
sunwhere. -
(refractionbool, default:True) –Whether to include atmospheric refraction corrections.
-
(enginestr, default:"numexpr") –Backend engine used by
sunwhere.
Returns:
-
Sunpos–sunwhereresult object containing angular and temporal variables.
Source code in src/solarpandas/accessors/solpos.py
get_cache_info
staticmethod
Return cache statistics for solar-position computations.
Returns:
Source code in src/solarpandas/accessors/solpos.py
sunrise
Return sunrise in the selected coordinate system.
Parameters:
Returns:
-
SolarSeries–Sunrise values aligned to the dataframe index.
Source code in src/solarpandas/accessors/solpos.py
sunset
Return sunset in the selected coordinate system.
Parameters:
Returns:
-
SolarSeries–Sunset values aligned to the dataframe index.
Source code in src/solarpandas/accessors/solpos.py
clear_cache
Clear the in-memory solar-position cache.
Notes
Use this when changing model options and forcing a full recomputation.
Examples:
Source code in src/solarpandas/accessors/solpos.py
get_cache_info
Return cache statistics for solar-position computations.
Returns:
Examples:
Source code in src/solarpandas/accessors/solpos.py
clearsky
Pandas accessors and caches for clear-sky irradiance estimations.
Classes:
-
BaseClearskyIrradianceAccessor–Base class providing cached clear-sky irradiance properties.
-
CDAIrradianceAccessor–Accessor for clear-day-analysis clear-sky irradiance products.
-
ClearskyIrradianceAccessor–Accessor for clear-sky irradiance variables (GHI, DNI, DIF, CSI).
-
LTAIrradianceAccessor–Accessor for long-term-average clear-sky irradiance products.
Functions:
-
clear_cache–Clear the in-memory clear-sky irradiance cache.
-
get_cache_info–Return cache statistics for clear-sky computations.
BaseClearskyIrradianceAccessor
Base class providing cached clear-sky irradiance properties.
Subclasses configure _atmosphere and _model to select the
atmosphere dataset and irradiance model used for computations.
Attributes:
-
ghi(SolarSeries) –Clear-sky global horizontal irradiance in W m⁻².
-
dni(SolarSeries) –Clear-sky direct normal irradiance in W m⁻².
-
dif(SolarSeries) –Clear-sky diffuse horizontal irradiance in W m⁻².
-
csi(SolarSeries) –Clear-sky index (ratio of measured to clear-sky GHI).
Methods:
-
clear_cache–Clear the in-memory clear-sky irradiance cache.
-
get_cache_info–Return cache statistics for clear-sky computations.
Source code in src/solarpandas/accessors/clearsky.py
clear_cache
staticmethod
get_cache_info
staticmethod
Return cache statistics for clear-sky computations.
Returns:
Source code in src/solarpandas/accessors/clearsky.py
CDAIrradianceAccessor
Bases: BaseClearskyIrradianceAccessor
Accessor for clear-day-analysis clear-sky irradiance products.
Examples:
Methods:
-
clear_cache–Clear the in-memory clear-sky irradiance cache.
-
get_cache_info–Return cache statistics for clear-sky computations.
Attributes:
-
csi(SolarSeries) –Clear-sky index (ratio of measured to modelled clear-sky GHI).
-
dif(SolarSeries) –Clear-sky diffuse horizontal irradiance in W m⁻².
-
dni(SolarSeries) –Clear-sky direct normal irradiance in W m⁻².
-
ghi(SolarSeries) –Clear-sky global horizontal irradiance in W m⁻².
Source code in src/solarpandas/accessors/clearsky.py
clear_cache
staticmethod
get_cache_info
staticmethod
Return cache statistics for clear-sky computations.
Returns:
Source code in src/solarpandas/accessors/clearsky.py
ClearskyIrradianceAccessor
Bases: BaseClearskyIrradianceAccessor
Accessor for clear-sky irradiance variables (GHI, DNI, DIF, CSI).
Notes
Cached properties use configuration options clearsky.model and
clearsky.atmosphere.
Examples:
Methods:
-
clear_cache–Clear the in-memory clear-sky irradiance cache.
-
compute–Compute clear-sky irradiance once without using cache.
-
get_cache_info–Return cache statistics for clear-sky computations.
Attributes:
-
csi(SolarSeries) –Clear-sky index (ratio of measured to modelled clear-sky GHI).
-
dif(SolarSeries) –Clear-sky diffuse horizontal irradiance in W m⁻².
-
dni(SolarSeries) –Clear-sky direct normal irradiance in W m⁻².
-
ghi(SolarSeries) –Clear-sky global horizontal irradiance in W m⁻².
Source code in src/solarpandas/accessors/clearsky.py
clear_cache
staticmethod
compute
compute(
atmosphere: Literal[
"merra2_daily",
"merra2_gee",
"merra2_lta",
"crs_soda",
"custom",
],
model: str = "SPARTA",
) -> SolarDataFrame
Compute clear-sky irradiance once without using cache.
Parameters:
-
(atmosphere(merra2_daily, merra2_gee, merra2_lta, crs_soda, custom), default:"merra2_daily") –Atmosphere dataset source.
-
(modelstr, default:"SPARTA") –Irradiance model name accepted by the selected atmosphere backend.
Returns:
-
SolarDataFrame–Dataframe with columns
ghi,dni,difandcsicomputed for the requested atmosphere and model.
Source code in src/solarpandas/accessors/clearsky.py
get_cache_info
staticmethod
Return cache statistics for clear-sky computations.
Returns:
Source code in src/solarpandas/accessors/clearsky.py
LTAIrradianceAccessor
Bases: BaseClearskyIrradianceAccessor
Accessor for long-term-average clear-sky irradiance products.
Examples:
Methods:
-
clear_cache–Clear the in-memory clear-sky irradiance cache.
-
get_cache_info–Return cache statistics for clear-sky computations.
Attributes:
-
csi(SolarSeries) –Clear-sky index (ratio of measured to modelled clear-sky GHI).
-
dif(SolarSeries) –Clear-sky diffuse horizontal irradiance in W m⁻².
-
dni(SolarSeries) –Clear-sky direct normal irradiance in W m⁻².
-
ghi(SolarSeries) –Clear-sky global horizontal irradiance in W m⁻².
Source code in src/solarpandas/accessors/clearsky.py
clear_cache
staticmethod
get_cache_info
staticmethod
Return cache statistics for clear-sky computations.
Returns:
Source code in src/solarpandas/accessors/clearsky.py
clear_cache
Clear the in-memory clear-sky irradiance cache.
Examples:
Source code in src/solarpandas/accessors/clearsky.py
get_cache_info
Return cache statistics for clear-sky computations.
Returns:
Examples:
>>> import solarpandas as sp
>>> info = sp.get_clearsky_cache_info()
>>> "current_size" in info
True
Source code in src/solarpandas/accessors/clearsky.py
qcontrol
Accessor API to run qcrad quality-control checks on solar data.
Classes:
-
HashableDF–Hashable wrapper for dataframe content used by the QC cache.
-
QualityControlAccessor–Accessor to run and query quality-control flags.
Functions:
-
clear_cache–Clear the in-memory quality-control cache.
-
get_cache_info–Return cache statistics for quality-control computations.
HashableDF
HashableDF(unhashable_df: SolarDataFrame | DataFrame)
Hashable wrapper for dataframe content used by the QC cache.
Source code in src/solarpandas/accessors/qcontrol.py
QualityControlAccessor
Accessor to run and query quality-control flags.
Examples:
Methods:
-
__getattr__–Access QC tests as attributes when names match columns.
-
__getitem__–Return one QC test series by its column name.
-
clear_cache–Clear the in-memory quality-control cache.
-
failed–Return a boolean mask where at least one selected test fails.
-
filter–Filter QC tests by component, explicit names, or pattern.
-
get_cache_info–Return cache statistics for quality-control computations.
-
heatmap–Render a QC pass/fail heatmap over time.
-
mask_failed–Mask original values where selected QC tests fail.
-
passed–Return a boolean mask where all selected tests pass or are neutral.
Attributes:
-
tests(SolarDataFrame) –Return the full QC test result dataframe.
Source code in src/solarpandas/accessors/qcontrol.py
__getattr__
__getattr__(name: str) -> SolarSeries
Access QC tests as attributes when names match columns.
Source code in src/solarpandas/accessors/qcontrol.py
clear_cache
staticmethod
Clear the in-memory quality-control cache.
Examples:
Source code in src/solarpandas/accessors/qcontrol.py
failed
failed(
component: Literal["ghi", "dni", "dif"] | None = None,
*,
tests: list[str] | None = None,
like: str | None = None,
regex: str | None = None,
) -> Series
Return a boolean mask where at least one selected test fails.
Parameters:
-
(component(ghi, dni, dif), default:"ghi") –Convenience selector for pre-defined test groups.
-
(testslist[str] or None, default:None) –Explicit test names.
-
(likestr or None, default:None) –Substring pattern forwarded to
DataFrame.filter. -
(regexstr or None, default:None) –Regex pattern forwarded to
DataFrame.filter.
Returns:
-
Series–Boolean series;
Truewhere at least one selected test flags a sample as failed.
Examples:
Source code in src/solarpandas/accessors/qcontrol.py
filter
filter(
component: Literal["ghi", "dni", "dif"] | None = None,
*,
tests: list[str] | None = None,
like: str | None = None,
regex: str | None = None,
) -> DataFrame
Filter QC tests by component, explicit names, or pattern.
Parameters:
-
(component(ghi, dni, dif), default:"ghi") –Convenience selector for pre-defined test groups.
-
(testslist[str] or None, default:None) –Explicit test names.
-
(likestr or None, default:None) –Substring pattern forwarded to
DataFrame.filter. -
(regexstr or None, default:None) –Regex pattern forwarded to
DataFrame.filter.
Returns:
-
DataFrame–Subset of QC test columns.
Source code in src/solarpandas/accessors/qcontrol.py
get_cache_info
staticmethod
Return cache statistics for quality-control computations.
Returns:
Examples:
Source code in src/solarpandas/accessors/qcontrol.py
heatmap
heatmap(
component: Literal["ghi", "dni", "dif"] | None = None,
*,
tests: list[str] | None = None,
like: str | None = None,
regex: str | None = None,
combined: bool = False,
**kwargs,
) -> Figure
Render a QC pass/fail heatmap over time.
Parameters:
-
(component(ghi, dni, dif), default:"ghi") –Convenience selector for pre-defined test groups.
-
(testslist[str] or None, default:None) –Explicit test names.
-
(likestr or None, default:None) –Substring pattern forwarded to
DataFrame.filter. -
(regexstr or None, default:None) –Regex pattern forwarded to
DataFrame.filter. -
(combinedbool, default:False) –If
True, encodes failure severity by component groups (1-component, 2-component, 3-component). -
(**kwargsAny, default:{}) –Extra keyword arguments forwarded to the underlying heatmap plotter.
Returns:
-
Figure–Figure containing the heatmap.
Examples:
Source code in src/solarpandas/accessors/qcontrol.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | |
mask_failed
mask_failed(
component: Literal["ghi", "dni", "dif"] | None = None,
*,
tests: list[str] | None = None,
like: str | None = None,
regex: str | None = None,
**kwargs,
) -> DataFrame
Mask original values where selected QC tests fail.
Parameters:
-
(component(ghi, dni, dif), default:"ghi") –Convenience selector for pre-defined test groups.
-
(testslist[str] or None, default:None) –Explicit test names.
-
(likestr or None, default:None) –Substring pattern forwarded to
DataFrame.filter. -
(regexstr or None, default:None) –Regex pattern forwarded to
DataFrame.filter. -
(**kwargsAny, default:{}) –Extra keyword arguments forwarded to
DataFrame.mask.
Returns:
-
DataFrame–Copy of the original data with failed timestamps set to
NaN(or to the value specified viaotherin**kwargs).
Examples:
Source code in src/solarpandas/accessors/qcontrol.py
passed
passed(
component: Literal["ghi", "dni", "dif"] | None = None,
*,
tests: list[str] | None = None,
like: str | None = None,
regex: str | None = None,
) -> Series
Return a boolean mask where all selected tests pass or are neutral.
Parameters:
-
(component(ghi, dni, dif), default:"ghi") –Convenience selector for pre-defined test groups.
-
(testslist[str] or None, default:None) –Explicit test names.
-
(likestr or None, default:None) –Substring pattern forwarded to
DataFrame.filter. -
(regexstr or None, default:None) –Regex pattern forwarded to
DataFrame.filter.
Returns:
-
Series–Boolean series;
Truewhere all selected tests pass or are not verifiable (neutral) for a given sample.
Examples:
Source code in src/solarpandas/accessors/qcontrol.py
clear_cache
Clear the in-memory quality-control cache.
Examples:
get_cache_info
Return cache statistics for quality-control computations.
Returns:
Examples:
Source code in src/solarpandas/accessors/qcontrol.py
qcflag
Accessor methods for working with quality-control flag series and plots.
Classes:
-
QCFlagAccessor–Accessor for Series with
QCFlagDtypedtype.
QCFlagAccessor
QCFlagAccessor(series: Series | SolarSeries)
Accessor for Series with QCFlagDtype dtype.
Examples:
>>> qc_series.flag.fails # True where flag == -1
>>> qc_series.flag.passes # True where flag == 1
>>> qc_series.flag.not_verifiable # True where flag == 0
>>> counts = qc_series.flag.counts()
>>> qc_series.flag.heatmap()
Methods:
-
counts–Count occurrences of each QC flag category.
-
heatmap–Plot a date-time heatmap of QC flag values.
-
pieplot–Plot a pie chart of the QC flag distribution.
-
plot–Plot QC results using the test-specific plotting function.
Attributes:
-
fails(Series | SolarSeries) –Boolean mask where QC flag equals
-1(failed). -
not_verifiable(Series | SolarSeries) –Boolean mask where QC flag equals
0(not verifiable). -
passes(Series | SolarSeries) –Boolean mask where QC flag equals
1(passed).
Source code in src/solarpandas/accessors/qcflag.py
not_verifiable
property
not_verifiable: Series | SolarSeries
Boolean mask where QC flag equals 0 (not verifiable).
counts
counts(skip_nighttime: bool = True, **kwargs) -> Series
Count occurrences of each QC flag category.
Parameters:
-
(skip_nighttimebool, default:True) –If
Trueand input isSolarSeries, counts only daytime points (solar zenith angle below 90 degrees). -
(**kwargsAny, default:{}) –Extra keyword arguments passed to
Series.value_counts.
Returns:
-
Series–Counts indexed by flag names.
Source code in src/solarpandas/accessors/qcflag.py
heatmap
Plot a date-time heatmap of QC flag values.
Displays a colour-encoded calendar grid with failed (red), not-verifiable (yellow) and passed (green) categories.
Examples:
Source code in src/solarpandas/accessors/qcflag.py
pieplot
pieplot(skip_nighttime: bool = True, **kwargs) -> None
Plot a pie chart of the QC flag distribution.
Parameters:
-
(skip_nighttimebool, default:True) –If
Trueand input is aSolarSeries, restrict counts to daytime points (solar zenith angle below 90°). -
(**kwargsAny, default:{}) –Extra keyword arguments passed to
Series.plot.pie.
Source code in src/solarpandas/accessors/qcflag.py
plot
plot(sdf: SolarDataFrame, **kwargs) -> None
Plot QC results using the test-specific plotting function.
Parameters:
-
(sdfSolarDataFrame) –Original data used as context for the plot.
-
(**kwargsAny, default:{}) –Extra keyword arguments forwarded to the test-specific plotter.
Source code in src/solarpandas/accessors/qcflag.py
solarplot
Plotting utilities and scales for solar data visualization.
Classes:
-
SolarPlotAccessor–Accessor with high-level plotting methods for solar time series.
SolarPlotAccessor
Accessor with high-level plotting methods for solar time series.
Methods:
-
diurnal–All-data compressed timeline removing nighttime gaps.
-
heatmap–Date-time heatmap of a single variable.
-
rollingday–Interactive day-by-day time series with keyboard/scroll navigation.
Examples:
>>> sdf.solarplot.diurnal(column="ghi")
>>> sdf.solarplot.heatmap(column="ghi", time_ref="tst")
>>> sdf.solarplot.rollingday("ghi", window_size=3)
Source code in src/solarpandas/accessors/solarplot.py
diurnal
diurnal(
column: str | list[str] | tuple[str, ...] | None = None,
max_sza: float = 95.0,
locator=None,
formatter=None,
**kwargs,
) -> Figure
Plot one or more variables on a compressed daytime-only timeline.
Parameters:
-
(columnstr, list[str], tuple[str, ...], or None, default:None) –Column(s) to plot for dataframe inputs. Ignored for series inputs.
-
(max_szafloat, default:95.0) –Maximum solar zenith angle used to define daytime samples.
-
(locatorAny, default:None) –Optional matplotlib date locator/formatter for x-axis ticks.
-
(formatterAny, default:None) –Optional matplotlib date locator/formatter for x-axis ticks.
-
(**kwargsAny, default:{}) –Extra keyword arguments forwarded to
Axes.plot.
Returns:
-
Figure–Figure containing the diurnal plot.
Examples:
>>> fig = sdf.solarplot.diurnal(column="ghi", color="gold", lw=1.5)
>>> fig = sdf.solarplot.diurnal(column=["ghi", "dni"], max_sza=90)
Source code in src/solarpandas/accessors/solarplot.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
heatmap
heatmap(
column: str | None = None,
time_ref: Literal["lst", "tst", "lat", "utc"] = "tst",
max_sza: float | None = 90.0,
colorbar: bool = True,
colorbar_title: str | None = None,
twilight_line: bool = False,
twilight_line_kwargs: dict | None = None,
aggfunc: str | Callable = "mean",
**kwargs,
) -> Figure
Render a date-time heatmap for a selected variable.
Parameters:
-
(columnstr or None, default:None) –Column to plot for dataframe inputs. Defaults to first column.
-
(time_ref(lst, tst, lat, utc), default:"lst") –Time reference used for the y-axis.
-
(max_szafloat or None, default:90.0) –Nighttime masking threshold. Use
Noneto disable masking. -
(colorbarbool, default:True) –Whether to add a colorbar.
-
(twilight_linebool, default:False) –Whether to overlay sunrise and sunset curves.
-
(aggfuncstr or Callable, default:"mean") –Aggregation function used in the date-time pivot table.
-
(**kwargsAny, default:{}) –Extra keyword arguments forwarded to
Axes.pcolormesh.
Returns:
-
Figure–Figure containing the heatmap.
Examples:
>>> fig = sdf.solarplot.heatmap(column="ghi")
>>> fig = sdf.solarplot.heatmap(column="dni", time_ref="utc", cmap="plasma")
Source code in src/solarpandas/accessors/solarplot.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | |
rolling
rolling(
column: str | list[str] | tuple[str, ...] | None = None,
step: int = 1,
window_size: int = 1,
max_sza: float = 95.0,
y_scale: Literal["per_day", "global"] = "per_day",
plot_kwargs: dict[str, dict] | None = None,
**kwargs,
) -> Figure
Plot a time series with a rolling window of a given size.
Parameters:
-
(columnstr, list[str], tuple[str, ...], or None, default:None) –Column(s) to plot for dataframe inputs. Ignored for series inputs. When
Noneall columns are shown. -
(stepint, default:1) –Number of days to navigate when using the left/right arrow keys or mouse scroll.
-
(window_sizeint, default:1) –Number of consecutive days shown in the plot area at once.
-
(max_szafloat, default:95.0) –Maximum solar zenith angle of the data to plot. Timestamps with SZA above this threshold are excluded.
-
(y_scale(per_day, 'global'), default:"per_day") –Y-axis scaling strategy.
"per_day"autoscales the y-axis to the data visible in the current window on every navigation step."global"fixes the y-axis to the range of the full dataset and keeps it constant while navigating. -
(plot_kwargsdict[str, dict] or None, default:None) –Per-column matplotlib keyword arguments. Keys are column names; values are dicts of kwargs forwarded to
Axes.plotfor that specific line. Columns absent from this dict inherit**kwargs. -
(**kwargsAny, default:{}) –Global keyword arguments forwarded to
Axes.plotfor every line. Per-column entries in plot_kwargs take precedence.
Returns:
-
Figure–Interactive figure. Use left/right arrow keys or mouse wheel to navigate between days.
Examples:
>>> fig = sdf.solarplot.rollingday(
... column=["ghi", "dni"],
... window_size=3,
... plot_kwargs={
... "ghi": {"color": "gold", "lw": 2.0},
... "dni": {"color": "tomato", "ls": "--"},
... },
... lw=1.0,
... )
>>> plt.show()
Source code in src/solarpandas/accessors/solarplot.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
param
Accessors to retrieve and manipulate parameter metadata in solar series.
Classes:
-
ParameterAccessor–Accessor for derived irradiance parameters used in QC workflows.
ParameterAccessor
Accessor for derived irradiance parameters used in QC workflows.
Examples:
Attributes:
-
K(SolarSeries) –Return diffuse fraction K derived from
dif / ghi. -
KT(SolarSeries) –Return the clearness index KT derived from
ghi / eth. -
Kn(SolarSeries) –Return normalized beam index Kn derived from
dni * cosz / eth.
Source code in src/solarpandas/accessors/param.py
K
property
K: SolarSeries
Return diffuse fraction K derived from dif / ghi.
Returns:
-
SolarSeries–Daytime-clipped K values in the range
[1e-3, 1.10].
KT
property
KT: SolarSeries
Return the clearness index KT derived from ghi / eth.
Returns:
-
SolarSeries–Daytime-clipped KT values in the range
[1e-3, 1.35].
Kn
property
Kn: SolarSeries
Return normalized beam index Kn derived from dni * cosz / eth.
Returns:
-
SolarSeries–Daytime-clipped Kn values in the range
[1e-3, 1.10].
pvirrad
Accessors to evaluate pv yield.
Classes:
-
PVAccessor–Accessor for PV yield evaluation.
PVAccessor
Accessor for PV yield evaluation.
Examples:
>>> sdf.pv.yield_dc(...)
>>> sdf.pv.yield_ac(...)
>>> sdf.pv.clipping_losses(...)
>>> sdf.pv.optimal_dc_to_ac_ratio(...)
Methods:
-
clipping_losses–Calculate the clipping losses of a PV system assuming the pvlib's PVWatts inverter model.
-
optimal_dc_to_ac_ratio–Calculate the optimal DC/AC ratio of a PV system.
-
poa_irradiance–Transposition of solar irradiance to the PV plane of array.
-
yield_ac–Calculate the AC power yield of a PV system.
-
yield_dc–Calculate the DC power yield of a PV system.
Source code in src/solarpandas/accessors/pvirrad.py
clipping_losses
clipping_losses(
dc_to_ac_ratio: ndarray[tuple[int]]
| float
| None = None,
time_series: bool = False,
units: Literal["W", "fraction"] = "fraction",
yield_dc_kwargs: dict | None = None,
inverter_effic: float = 0.96,
method: Literal["integral", "explicit"] = "integral",
integral_bins: ndarray[tuple[int]] | int = 200,
) -> float | Series | SolarDataFrame
Calculate the clipping losses of a PV system assuming the pvlib's PVWatts inverter model.
Parameters:
-
(dc_to_ac_rationdarray[tuple[int]] | float | None, default:None) –DC/AC ratio of the PV system. If None, a default range of values from 1.0 to 1.8 (inclusive) is used.
-
(time_seriesbool, default:False) –If True, returns the time series of clipping losses instead of the total value. If True,
dc_to_ac_ratiomust be a single value. -
(unitsLiteral['W', 'fraction'], default:'fraction') –Units for the output clipping losses. Options are "fraction" for the fraction of DC power yield lost due to clipping, and "W" for the average DC power lost due to clipping.
-
(yield_dc_kwargsdict | None, default:None) –Keyword arguments to be passed to the
yield_dcmethod. -
(inverter_efficfloat, default:0.96) –Inverter efficiency.
-
(methodLiteral['integral', 'explicit'], default:'integral') –Method to use for calculating clipping losses. Options are "integral" and "explicit".
-
(integral_binsndarray[tuple[int]] | int, default:200) –Number of bins to evaluate the integral for the integral method.
Returns:
-
float or Series or SolarDataFrame–If
time_seriesis True, a SolarDataFrame is returned with the time series of clipping losses, DC power and AC power. Otherwise, it returns clipping losses as a fraction of the total DC energy yield. Ifdc_to_ac_ratiois a single value, a float is returned. Ifdc_to_ac_ratiois an array-like, a pd.Series is returned with the DC/AC ratios as the index.
Notes
The explicit method is based on the Michelli et al. (doi:
10.1016/j.renene.2024.120317) approach:
where \(E_{DC}\) is the DC energy yield, \(\eta_{inv}\) is the inverter's nominal efficiency, \(E^{peak}_{AC} = \frac{E_{DC}}{\tau}\) is the AC energy yield at the inverter's peak power limit, and \(\tau\) is the DC/AC ratio.
The integral method evaluates clipping losses making explicit their relation with the probability
density function (PDF) of the DC power output, and so also to that of the plane-of-array (POA)
irradiance. Thus, it provides direct evidence of the impact of solar irradiance characteristics
on clipping losses.
Source code in src/solarpandas/accessors/pvirrad.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | |
optimal_dc_to_ac_ratio
optimal_dc_to_ac_ratio(
selling_price: float = 4e-05,
inverter_cost: float = 0.35,
inverter_payback: int = 10,
clipping_losses_kwargs: dict | None = None,
) -> tuple[float, Series]
Calculate the optimal DC/AC ratio of a PV system.
The optimal DC/AC ratio is the one that maximizes the net savings of the PV system, taking into account the cost of the inverter, its payback period, and the selling price of the electricity produced by the PV system. The net savings are calculated as the difference between the inverter savings and the cost of the inverter prorated over its payback period.
Parameters:
-
(selling_pricefloat, default:4e-05) –Selling price of the electricity produced by the PV system, in EUR/Wh. Default is 40e-6 EUR/Wh (i.e., 40 EUR/MWh).
-
(inverter_costfloat, default:0.35) –Cost of the inverter, in EUR/W. Default is 0.35 EUR/W, which is typical for a 350 kW+ string inverter used in commercial PV plants.
-
(inverter_paybackint, default:10) –Payback period for the inverter, in years. Default is 10 years.
-
(clipping_losses_kwargsdict | None, default:None) –Additional kwargs to be passed to the
clipping_lossesmethod. Seeclipping_lossesfor details.
Returns:
-
float and Series–The DC/AC ratio that maximizes the net savings and a pandas Series with the net savings (in EUR/year) for different DC/AC ratios.
Source code in src/solarpandas/accessors/pvirrad.py
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | |
poa_irradiance
poa_irradiance(
tracking: Literal[
"fixed", "fixed_optimal", "singleaxis", "dualaxis"
] = "singleaxis",
aoi_losses: bool = True,
tracking_kwargs: dict = None,
transposition_kwargs: dict = None,
) -> SolarDataFrame
Transposition of solar irradiance to the PV plane of array.
It requires ghi, dni and dif columns. The calculations are delegated to the pvlib library.
Parameters:
-
(trackingLiteral['fixed', 'fixed_optimal', 'singleaxis', 'dualaxis'], default:'singleaxis') –type of tracking system to use for calculating the plane-of-array (POA) irradiance. Options are: - "fixed": fixed tilt system, with the tilt and azimuth angles specified in
tracking_kwargsaspoa_tiltandpoa_azimuth, respectively. The tilt angle is the angle between the plane of the PV array and the horizontal plane, while the azimuth angle is the compass direction that the PV array faces (0° for north, 90° for east, 180° for south, and 270° for west). - "fixed_optimal": fixed tilt system with the optimal tilt angle calculated based on the latitude of the location. The optimal tilt angle is calculated using a simple empirical formula that provides a good approximation for many locations:poa_tilt = 0.87*latitudefor latitudes between -25° and 25°,poa_tilt = 0.76*latitude + 3.1for latitudes between -50° and 50°, and a fixed tilt of 40° for latitudes outside this range. The azimuth angle is set to 180° (south-facing) by default. - "singleaxis": single-axis tracking system, with the tracking parameters specified intracking_kwargsasaxis_tilt,axis_azimuth,max_angle,backtrack, andgcr. The single-axis tracking system rotates around a single axis to follow the sun's movement, which can increase the energy yield compared to a fixed tilt system. Theaxis_tiltis the angle of the rotation axis relative to the horizontal plane, while theaxis_azimuthis the compass direction of the rotation axis. Themax_angleis the maximum rotation angle of the tracker, whilebacktrackindicates whether to use backtracking to avoid shading between rows of panels. Thegcr(ground coverage ratio) is the ratio of the area covered by the PV panels to the total ground area. - "dualaxis": dual-axis tracking system, which can rotate around two axes to follow the sun's movement more accurately. In this case, the plane-of-array (POA) tilt and azimuth angles are calculated based on the solar zenith and azimuth angles, resulting in a POA that is always perpendicular to the sun's rays. This type of tracking system can provide the highest energy yield, but it is also more complex and expensive than fixed or single-axis tracking systems. The dual-axis tracking system is particularly beneficial in locations with high solar variability or for applications that require maximizing energy yield, such as in concentrated solar power (CSP) systems or for certain types of PV installations where space is limited and maximizing energy production is critical. -
(aoi_lossesbool, default:True) –whether to apply the Martin-Ruiz incidence angle modifier (IAM) correction to account for the reduction in effective irradiance on the PV modules at high angles of incidence. The IAM correction reduces the effective irradiance on the PV modules when the angle of incidence of the sunlight is large, which can occur during early morning, late afternoon, or in locations with high solar zenith angles. Applying the IAM correction can provide a more accurate estimation of the DC power output, especially for fixed tilt systems or for locations with high solar variability. The Martin-Ruiz model is a widely used empirical model for calculating the IAM and is based on measurements of the performance of PV modules at different angles of incidence.
-
(tracking_kwargsdict, default:None) –keyword arguments for the tracking system, such as
poa_tiltandpoa_azimuth, which must be provided for fixed tilt systems (tracking='fixed'), oraxis_tilt,axis_azimuth,max_angle,backtrack, andgcrfor single-axis tracking systems (tracking='single-axis'). The default values for the single-axis parameters areaxis_tilt=0.,axis_azimuth=180.,max_angle=60.,backtrack=True, andgcr=0.4, which correspond to a common single-axis tracking configuration with a horizontal rotation axis (sometimes referred to as HSAT --horizontal single-axis tracker--) and a ground coverage ratio of 0.4, which is typical for commercial PV installations. These default values can be overridden by providing the desired values intracking_kwargs. For dual-axis tracking systems (tracking='dual-axis'), no additional parameters are required as the POA tilt and azimuth are calculated based on the solar position. -
(transposition_kwargsdict, default:None) –keyword arguments to select the transposition model to be used to calculate the POA irradiance. It can affect the accuracy of the POA irradiance calculation, especially under certain sky conditions (e.g., cloudy vs. clear skies). The model is selected with the key
model, whose possible values areisotropic(the default),klucher,haydavies,reindl,king,perezandperez-driesse. Some of the model choices accept additional parameters to be passed also in transposition_kwargs, such as, "perez_model" if the selected model isperez, or "dni_extra" if the selected model is one ofhaydavies,reindl,perezorperez-driesse.
Returns:
-
SolarDataFrame–a new SolarDataFrame with the same index as the original but with the following columns: -
tilt: plane-of-array tilt angle (degrees) -azimuth: plane-of-array azimuth angle (degrees) -aoi: angle of incidence of the sunlight on the plane of array (degrees) -direct: direct component of the plane-of-array irradiance (W m-2) -sky_diffuse: sky diffuse component of the plane-of-array irradiance (W m-2) -ground_diffuse: ground diffuse component of the plane-of-array irradiance (W m-2) -diffuse: total diffuse component of the plane-of-array irradiance (W m-2) -global: total plane-of-array irradiance (W m-2)
Notes
For more details see the pvlib documentation for the get_total_irradiance function, which is used to perform
the transposition calculations, and the iam.martin_ruiz and iam.martin_ruiz_diffuse functions, which are used
to apply the incidence angle modifier (IAM) correction if aoi_losses is set to True.
https://pvlib-python.readthedocs.io/en/stable/reference/generated/pvlib.irradiance.get_total_irradiance.html#pvlib-irradiance-get-total-irradiance
Source code in src/solarpandas/accessors/pvirrad.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
yield_ac
yield_ac(
dc_to_ac_ratio: float = 1.0,
inverter_effic: float = 0.96,
yield_dc_kwargs: dict | None = None,
units: Literal["W", "Wh"] = "W",
full_output: bool = False,
) -> SolarSeries | SolarDataFrame
Calculate the AC power yield of a PV system.
For simplicity, the pvwatts inverter is assumed (see Notes below). For more precise simulation of
specific inverters, consider using the Sandia or ADR inverters included also in pvlib. Unfortunately,
they are not supported here.
Parameters:
-
(dc_to_ac_ratiofloat, default:1.0) –DC/AC ratio of the PV system, i.e., the ratio between the DC power capacity (the installed power of the PV modules) and the AC power capacity (the nominal power of the inverter). Hence, the size of the DC-to-AC inverter is defined with respect to the DC capacity using this ratio. It is an important design parameter in PV systems, as it determines how much of the DC power can be converted into AC power. A higher DC/AC ratio means that the inverter is "undersized" relative to the DC capacity, which can lead to clipping losses during periods of high irradiance. However, it can also reduce costs, as inverters are typically more expensive than PV modules. The optimal DC/AC ratio depends on various factors, including the cost of the inverter and modules, the expected irradiance levels, and the specific design goals of the PV system.
-
(inverter_efficfloat, default:0.96) –nominal efficiency of the inverter (between 0 and 1)
-
(yield_dc_kwargsdict | None, default:None) –Additional kwargs to be passed to the
yield_dcmethod. Seeyield_dcfor details. -
(unitsLiteral['W', 'Wh'], default:'W') –Units for the output power. Options are "W" for Watts (instantaneous power) and "Wh" for Watt-hours (energy).
-
(full_outputbool, default:False) –Include the outputs from
yield_dc. Default is False.
Returns:
-
SolarSeries or SolarDataFrame–a new SolarDataFrame with the same index as the original but with the following columns: -
pac: AC power output of the PV system in Watts - the output columns ofyield_dciffull_output=True.
Notes
The AC power output is calculated by applying the pvlib's pvwatts inverter model to the DC power output
obtained from the yield_dc method. Besides the input DC power, the pvwatts inverter requires the DC power
at which the inverter reaches its AC power limit and the nominal efficiency of the inverter. The former is
calculated based on the installed DC capacity and the specified DC/AC ratio. It represents an upper threshold
for the DC power input to the inverter. If the DC power input exceeds this threshold, the inverter will "clip"
the output power to its maximum AC power capacity.
Typically, however, what is known at design time is the nominal DC power capacity of the modules and the DC/AC
ratio is used to determine the nominal AC power capacity of the inverter (i.e., the maximum AC power output it
can deliver). For example, for a DC power capacity of 1000 Wp and a DC/AC ratio of 1.2, the nominal AC power
capacity of the inverter would be 833.3 W. These 833.3 W represent the maximum AC power output the inverter can
deliver, that is, greater values are "clipped". To achieve this behavior with the pvwatts inverter, the nomial
AC power of the inverter still has to be divided by the inverter efficiency. This is the approach used here.
Why is dc_to_ac_ratio typically greater than one (i.e., the inverter is undersized relative to the DC capacity)?
The main reason is cost. Inverters are typically more expensive than PV modules, and oversizing the inverter to
match the DC capacity would increase the overall system cost. By undersizing the inverter, the system can be more
cost-effective, even though it may result in some clipping losses (see clipping_losses) during periods of high
irradiance. The optimal DC/AC ratio (see optimal_dc_ac_ratio) depends on various factors, including the cost of
the inverter and modules, the expected irradiance levels, and the specific design goals of the PV system. Values
of dc_to_ac_ratio between 1.2 and 1.4 are common in commercial PV systems, as they provide a good balance between
cost and performance.
Source code in src/solarpandas/accessors/pvirrad.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
yield_dc
yield_dc(
p_dc_peak: float = 1.0,
dc_model: Literal["huld", "pvwatts"] = "huld",
dc_model_kwargs: dict | None = None,
temperature: Series | str | float | None = None,
wind_speed: Series | str | float | None = None,
poa_irradiance_kwargs: dict | None = None,
units: Literal["W", "Wh"] = "W",
full_output: bool = False,
) -> SolarSeries | SolarDataFrame
Calculate the DC power yield of a PV system.
Parameters:
-
(p_dc_peakfloat, default:1.0) –Installed peak capacity in Watts-peak. Default is 1 Wp.
-
(dc_modelstr, default:'huld') –Model to convert plane-of-array (POA) irradiance and cell temperature into DC power. Options are: - "pvwatts": the PVWatts model, which is a simple empirical model based on the performance of a large number of PV systems. It is widely used for its simplicity and reasonable accuracy for many applications. It estimates the DC power output based on the plane-of-array irradiance, the cell temperature, and the installed DC capacity, using a simple linear model with a temperature coefficient. - "huld": the Huld model, which is a more detailed empirical model that accounts for the non-linear effects of irradiance and temperature on the DC power output. It is based on the performance of a large number of PV systems and provides a more accurate estimation of the DC power output, especially under low irradiance and high temperature conditions. It requires more parameters than the PVWatts model, such as the cell type and the version of the model to use (e.g., "pvgis6" for the latest version). The Huld model is particularly useful for applications that require a more accurate estimation of the DC power output, such as performance ratio calculations or detailed energy yield assessments. The Faiman's cell temperature model is used. See
pvlib. -
(dc_model_kwargsdict, default:None) –Additional kwargs to be passed to the "dc_model". See
pvlib.pvsystem.pvwatts_dcandpvlib.pvarray.huldfor details. Fordc_model="huld", default valuescell_type="cSi"andk_version="pvgis6"are used. -
(temperaturepd.Series, str, float or None. Default is None., default:None) –Air temperature in deg C. If it is str, it should be a column name in the SolarDataFrame. If it is None, a default temperature value of 25 deg C is used.
-
(wind_speedpd.Series, str, float or None. Default is None., default:None) –Wind speed in m s-1. If it is str, it should be a column name in the SolarDataFrame. If it is None, a default wind speed value of 1 m s-1 is used.
-
(poa_irradiance_kwargsdict | None. Default is None., default:None) –Additional kwargs to be passed to the
poa_irradiancemethod. Seepoa_irradiancefor details. -
(unitsstr, default:'W') –Units for the output power. Options are "W" for Watts (instantaneous power) and "Wh" for Watt-hours (energy). If "Wh" is selected, the output power is multiplied by the time step inferred from the index of the SolarDataFrame, so it represents the energy produced during each time step. Default is "W".
-
(full_outputbool, default:False) –Include the outputs from
poa_irradiance. Default is False.
Returns:
-
SolarSeries or SolarDataFrame–a new SolarDataFrame with the same index as the original but with the following columns: -
pdc: DC power output of the PV system in Watts - the output columns ofpoa_irradianceiffull_output=True.
Source code in src/solarpandas/accessors/pvirrad.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
Quality Control
helpers
Shared helpers and data structures for quality-control modules.
Classes:
-
QCTest–Callable container that binds a QC test function and optional plotter.
Functions:
-
construct_flag_series–Wrap a QC result array as a
SolarSerieswith metadata preserved. -
construct_qcflag_array–Build QC flag values from boolean failed and passed masks.
QCTest
dataclass
QCTest(
name: str,
_test_func: Callable[[SolarDataFrame], ndarray[int8]],
_plot_func: Callable[
[SolarDataFrame, ndarray[int8]], Axes
]
| None = None,
)
Callable container that binds a QC test function and optional plotter.
Methods:
-
__call__–Run the test and return QC flags as a
SolarSeries. -
plot–Plot test diagnostics if a plotting function is available.
__call__
__call__(sdf: SolarDataFrame) -> SolarSeries
plot
plot(sdf: SolarDataFrame) -> Axes | None
Plot test diagnostics if a plotting function is available.
Source code in src/solarpandas/qcontrol/helpers.py
construct_flag_series
construct_flag_series(
sdf: SolarDataFrame | SolarSeries,
name: str,
test_result: ndarray,
) -> SolarSeries
Wrap a QC result array as a SolarSeries with metadata preserved.
Source code in src/solarpandas/qcontrol/helpers.py
construct_qcflag_array
Build QC flag values from boolean failed and passed masks.
Parameters:
-
(failedSeries) –Boolean series;
Truewhere the test fails. -
(passedSeries) –Boolean series;
Truewhere the test passes.
Returns:
-
ndarray–Int8 array with values
-1(failed),0(not verifiable) and1(passed).
Source code in src/solarpandas/qcontrol/helpers.py
qcrad
Registry of qcrad quality-control tests as reusable QCTest objects.
ppl
Physically possible limits (PPL) quality-control checks.
This module implements qcrad physically possible limit tests and plotting helpers for global, diffuse and direct irradiance components.
Functions:
-
plot_test–Render a standard PPL diagnostic density plot for one irradiance column.
-
plot_test_dif–Plot DIF PPL limits and flagged points against solar zenith angle.
-
plot_test_dni–Plot DNI PPL limits and flagged points against solar zenith angle.
-
plot_test_ghi–Plot GHI PPL limits and flagged points against solar zenith angle.
-
test_dif–Evaluate physically-possible limits test for DIF.
-
test_dni–Evaluate physically-possible limits test for DNI.
-
test_ghi–Evaluate physically-possible limits test for GHI.
plot_test
plot_test(
column: str, sdf: SolarDataFrame, **kwargs
) -> Axes
Render a standard PPL diagnostic density plot for one irradiance column.
Source code in src/solarpandas/qcontrol/ppl.py
plot_test_dif
plot_test_dif(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot DIF PPL limits and flagged points against solar zenith angle.
Source code in src/solarpandas/qcontrol/ppl.py
plot_test_dni
plot_test_dni(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot DNI PPL limits and flagged points against solar zenith angle.
Source code in src/solarpandas/qcontrol/ppl.py
plot_test_ghi
plot_test_ghi(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot GHI PPL limits and flagged points against solar zenith angle.
Source code in src/solarpandas/qcontrol/ppl.py
test_dif
test_dif(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate physically-possible limits test for DIF.
Source code in src/solarpandas/qcontrol/ppl.py
test_dni
test_dni(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate physically-possible limits test for DNI.
Source code in src/solarpandas/qcontrol/ppl.py
test_ghi
test_ghi(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate physically-possible limits test for GHI.
Source code in src/solarpandas/qcontrol/ppl.py
erl
Extremely rare limits (ERL) quality-control checks.
This module implements qcrad extremely rare limit tests and plotting helpers for global, diffuse and direct irradiance components.
Functions:
-
plot_test–Render a standard ERL diagnostic density plot for one irradiance column.
-
plot_test_dif–Plot DIF ERL limits and flagged points against solar zenith angle.
-
plot_test_dni–Plot DNI ERL limits and flagged points against solar zenith angle.
-
plot_test_ghi–Plot GHI ERL limits and flagged points against solar zenith angle.
-
test_dif–Evaluate extremely-rare-limits test for DIF.
-
test_dni–Evaluate extremely-rare-limits test for DNI.
-
test_ghi–Evaluate extremely-rare-limits test for GHI.
plot_test
plot_test(
column: str, sdf: SolarDataFrame, **kwargs
) -> Axes
Render a standard ERL diagnostic density plot for one irradiance column.
Source code in src/solarpandas/qcontrol/erl.py
plot_test_dif
plot_test_dif(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot DIF ERL limits and flagged points against solar zenith angle.
Source code in src/solarpandas/qcontrol/erl.py
plot_test_dni
plot_test_dni(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot DNI ERL limits and flagged points against solar zenith angle.
Source code in src/solarpandas/qcontrol/erl.py
plot_test_ghi
plot_test_ghi(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot GHI ERL limits and flagged points against solar zenith angle.
Source code in src/solarpandas/qcontrol/erl.py
test_dif
test_dif(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate extremely-rare-limits test for DIF.
Source code in src/solarpandas/qcontrol/erl.py
test_dni
test_dni(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate extremely-rare-limits test for DNI.
Source code in src/solarpandas/qcontrol/erl.py
test_ghi
test_ghi(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate extremely-rare-limits test for GHI.
Source code in src/solarpandas/qcontrol/erl.py
Kspace
Quality-control tests based on K-space consistency relationships.
Functions:
-
plot_test–Render a generic K-space QC diagnostic plot with density and flags.
-
plot_test_KT_erl–Plot KT against zenith with ERL threshold and flagged points.
-
plot_test_K_erl–Plot K against zenith with ERL threshold and flagged points.
-
plot_test_K_erl_clear–Plot K versus KT for ERL clear-sky consistency diagnostics.
-
plot_test_Kn_erl–Plot Kn versus KT for extremely-rare-limit diagnostics.
-
plot_test_Kn_ppl–Plot Kn versus KT for physically-possible-limit diagnostics.
-
test_KT_erl–Evaluate the extremely rare limits test for KT.
-
test_K_erl–Evaluate the extremely rare limits test for K.
-
test_K_erl_clear–Evaluate K clear-sky consistency test under ERL conditions.
-
test_Kn_erl–Evaluate the extremely rare limits test for Kn.
-
test_Kn_ppl–Evaluate the physically possible limits test for Kn.
plot_test
plot_test(
x: str, y: str, sdf: SolarDataFrame, **kwargs
) -> Axes
Render a generic K-space QC diagnostic plot with density and flags.
Source code in src/solarpandas/qcontrol/Kspace.py
plot_test_KT_erl
plot_test_KT_erl(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot KT against zenith with ERL threshold and flagged points.
Source code in src/solarpandas/qcontrol/Kspace.py
plot_test_K_erl
plot_test_K_erl(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot K against zenith with ERL threshold and flagged points.
Source code in src/solarpandas/qcontrol/Kspace.py
plot_test_K_erl_clear
plot_test_K_erl_clear(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot K versus KT for ERL clear-sky consistency diagnostics.
Source code in src/solarpandas/qcontrol/Kspace.py
plot_test_Kn_erl
plot_test_Kn_erl(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot Kn versus KT for extremely-rare-limit diagnostics.
Source code in src/solarpandas/qcontrol/Kspace.py
plot_test_Kn_ppl
plot_test_Kn_ppl(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot Kn versus KT for physically-possible-limit diagnostics.
Source code in src/solarpandas/qcontrol/Kspace.py
test_KT_erl
test_KT_erl(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate the extremely rare limits test for KT.
Source code in src/solarpandas/qcontrol/Kspace.py
test_K_erl
test_K_erl(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate the extremely rare limits test for K.
Source code in src/solarpandas/qcontrol/Kspace.py
test_K_erl_clear
test_K_erl_clear(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate K clear-sky consistency test under ERL conditions.
Source code in src/solarpandas/qcontrol/Kspace.py
test_Kn_erl
test_Kn_erl(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate the extremely rare limits test for Kn.
Source code in src/solarpandas/qcontrol/Kspace.py
test_Kn_ppl
test_Kn_ppl(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate the physically possible limits test for Kn.
Source code in src/solarpandas/qcontrol/Kspace.py
closure
Quality-control checks based on radiative closure consistency.
Functions:
-
plot_test_closure–Plot closure ratio diagnostics and flagged points versus zenith.
-
test_closure–Evaluate radiative closure consistency between GHI, DNI and DIF.
plot_test_closure
plot_test_closure(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot closure ratio diagnostics and flagged points versus zenith.
Source code in src/solarpandas/qcontrol/closure.py
test_closure
test_closure(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate radiative closure consistency between GHI, DNI and DIF.
Source code in src/solarpandas/qcontrol/closure.py
tracker
Quality-control checks related to tracker behavior and geometry.
Functions:
-
plot_test_trackeroff–Plot tracker-off diagnostics in KT-K space with flagged points.
-
test_trackeroff–Evaluate tracker-off condition test based on CDA ratios.
plot_test_trackeroff
plot_test_trackeroff(
sdf: SolarDataFrame, test: SolarSeries, **kwargs
) -> Axes
Plot tracker-off diagnostics in KT-K space with flagged points.
Source code in src/solarpandas/qcontrol/tracker.py
test_trackeroff
test_trackeroff(sdf: SolarDataFrame) -> ndarray[int8]
Evaluate tracker-off condition test based on CDA ratios.
Source code in src/solarpandas/qcontrol/tracker.py
timeshift
Quality-control tools to detect and analyze time-shift issues.
Functions:
-
check_timeshift–Visual check for AM/PM asymmetry to detect possible timestamp shifts.
check_timeshift
check_timeshift(
sdf: SolarDataFrame, column: str = "auto", **kwargs
) -> Figure
Visual check for AM/PM asymmetry to detect possible timestamp shifts.
Parameters:
-
(sdfSolarDataFrame) –Input data containing at least
dniorghi. -
(columnstr, default:"auto") –Variable to analyze.
"auto"prefersdniand falls back toghi. -
(**kwargsAny, default:{}) –Optional plotting arguments.
axandrcare supported.
Returns:
-
Figure–Figure with AM and PM density maps versus solar zenith angle.
Examples:
>>> from solarpandas.qcontrol import check_timeshift
>>> fig = check_timeshift(sdf, column="dni")
>>> fig is not None
True
Source code in src/solarpandas/qcontrol/timeshift.py
BSRN Origin
core
Core public API to inspect, fetch, and load BSRN datasets.
Classes:
-
LogicalRecord–Representation of one logical record block found in a BSRN file.
Functions:
-
clear_cache–Clear cached data files for a given site, year and logical record.
-
data_availability–Inspect the availability of BSRN data on the remote FTP server.
-
get_database_path–Get the path to the local BSRN database directory.
-
load_data–Load yearly BSRN data from cache or raw FTP files.
-
load_data_from_bsrn_files–Load and parse monthly BSRN
.dat.gzfiles from local FTP mirror. -
load_metadata–Load cached station metadata, optionally refreshing remote source.
-
parse_bsrn_file–Parse selected logical records from a BSRN
.dat.gzfile.
LogicalRecord
dataclass
LogicalRecord(
signature: str,
first_line: int,
last_line: int,
lines: list[str],
parser: Callable | None = None,
)
Representation of one logical record block found in a BSRN file.
Methods:
-
parse–Parse record lines with the associated logical-record parser.
parse
Parse record lines with the associated logical-record parser.
Source code in src/solarpandas/origin/bsrn/core.py
clear_cache
clear_cache(
site: Site | None = None,
year: Year | None = None,
logical_record: DataLogicalRecordName | None = None,
) -> None
Clear cached data files for a given site, year and logical record.
Parameters:
-
(siteSite or None, default:None) –Three-letter station code. If
None, all sites are included. -
(yearYear or None, default:None) –Year to clear. If
None, all years are included. -
(logical_recordDataLogicalRecordName or None, default:None) –Logical record to clear. If
None, all logical records are included.
Examples:
>>> from solarpandas.origin.bsrn import clear_cache
>>> clear_cache(site="car", year=2016, logical_record="LR0100")
Source code in src/solarpandas/origin/bsrn/core.py
data_availability
data_availability(
update: Literal["auto"] | bool = "auto",
as_year_table: bool = False,
fill_char: str = "#",
transposed: bool = False,
year_table_output: str | Path | None = None,
) -> dict[str, list[str]] | str
Inspect the availability of BSRN data on the remote FTP server.
This function connects to the BSRN FTP server and retrieves a list of
available data files for each site. The results are cached locally in a
JSON file to avoid unnecessary FTP connections. The cache is updated if it
is older than 7 days or if the update parameter is set to True.
Parameters:
-
(update(auto, bool), default:"auto") –Whether to refresh the local availability cache. With
"auto", the cache is refreshed when older than 7 days. -
(as_year_tablebool, default:False) –If
True, return a plain-text table with one row per site and one column per year (or transposed whentransposed=True). -
(fill_charstr, default:"#") –Character used to mark years with available data in the annual table. Must be a single character.
-
(transposedbool, default:False) –If
True, the year table is transposed: each row is a year in ascending order and each column is a site. Site acronyms are shown vertically in a three-row header. Has no effect whenas_year_tableisFalse. -
(year_table_outputstr or Path or None, default:None) –Optional output path to persist the annual table as a text file. The table is generated when this argument is provided, even if
as_year_tableisFalse.
Returns:
-
dict[str, list[str]] or str–Mapping from site acronym to list of available monthly files, or a yearly availability table when
as_year_tableisTrue.
Examples:
>>> from solarpandas.origin.bsrn import data_availability
>>> table = data_availability(update=False, as_year_table=True)
>>> isinstance(table, str)
True
Source code in src/solarpandas/origin/bsrn/core.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
get_database_path
Get the path to the local BSRN database directory.
This function retrieves the path from the global configuration. If the path is not set, it returns the default path.
Returns:
-
Path–Path to the local BSRN database directory.
Examples:
Source code in src/solarpandas/origin/bsrn/core.py
load_data
load_data(
site: Site,
years: Sequence[Year] | Year,
logical_record: Literal[
"LR0100", "LR0300", "LR0500"
] = "LR0100",
group: Literal["essential", "avg", "all"] = "essential",
) -> SolarDataFrame | None
Load yearly BSRN data from cache or raw FTP files.
Parameters:
-
(siteSite) –Three-letter BSRN station code.
-
(yearsYear or sequence of Year) –Year or list of years to retrieve.
-
(logical_record(LR0100, LR0300, LR0500), default:"LR0100") –Logical record to load and cache.
-
(group(essential, avg, all), default:"essential") –Variable group selection based on CF metadata tags.
Returns:
-
SolarDataFrame or None–Combined dataframe with harmonized metadata, or
Nonewhen no data could be retrieved.
Examples:
>>> from solarpandas.origin.bsrn import load_data
>>> sdf = load_data(site="car", years=2016)
>>> sdf is None or "ghi" in sdf.columns
True
Source code in src/solarpandas/origin/bsrn/core.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
load_data_from_bsrn_files
load_data_from_bsrn_files(
site: Site,
years: Sequence[Year] | Year,
months: Sequence[Month] | Month = range(1, 13),
filled: bool = True,
centered: bool = True,
include_metadata: Literal[False] = False,
extra_records: None = None,
) -> None | SolarDataFrame
load_data_from_bsrn_files(
site: Site,
years: Sequence[Year] | Year,
months: Sequence[Month] | Month = range(1, 13),
filled: bool = True,
centered: bool = True,
include_metadata: Literal[True] = True,
extra_records: None = None,
) -> None | tuple[SolarDataFrame, DataFrame]
load_data_from_bsrn_files(
site: Site,
years: Sequence[Year] | Year,
months: Sequence[Month] | Month = range(1, 13),
filled: bool = True,
centered: bool = True,
include_metadata: Literal[False] = False,
extra_records: list[Literal["LR0300", "LR0500"]] = ...,
) -> (
None | tuple[SolarDataFrame, dict[str, SolarDataFrame]]
)
load_data_from_bsrn_files(
site: Site,
years: Sequence[Year] | Year,
months: Sequence[Month] | Month = range(1, 13),
filled: bool = True,
centered: bool = True,
include_metadata: Literal[True] = True,
extra_records: list[Literal["LR0300", "LR0500"]] = ...,
) -> (
None
| tuple[
SolarDataFrame, DataFrame, dict[str, SolarDataFrame]
]
)
load_data_from_bsrn_files(
site: Site,
years: Sequence[Year] | Year,
months: Sequence[Month] | Month = range(1, 13),
filled: bool = True,
centered: bool = True,
include_metadata: bool = False,
extra_records: list[Literal["LR0300", "LR0500"]]
| None = None,
)
Load and parse monthly BSRN .dat.gz files from local FTP mirror.
Parameters:
-
(siteSite) –Three-letter station code.
-
(yearsYear or sequence of Year) –Years to load.
-
(monthsMonth or sequence of Month, default:``range(1, 13)``) –Months to load.
-
(filledbool, default:True) –If
True, reindex to dense 1-minute frequency. -
(centeredbool, default:True) –If
True, shift timestamps by 30 seconds to represent minute centers. -
(include_metadatabool, default:False) –Whether to include per-file metadata dataframe in output tuple.
-
(extra_recordslist[{LR0300, LR0500}] or None, default:None) –Additional logical records to parse and return.
Returns:
-
Various–Return type depends on
include_metadataandextra_recordsaccording to overload declarations above.
Source code in src/solarpandas/origin/bsrn/core.py
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | |
load_metadata
Load cached station metadata, optionally refreshing remote source.
Parameters:
-
(update(auto, bool), default:"auto") –If
True, force refresh from PANGAEA. If"auto", refresh when cache age is older than 7 days.
Returns:
Examples:
>>> from solarpandas.origin.bsrn import load_metadata
>>> meta = load_metadata(update=False)
>>> isinstance(meta, dict)
True
Source code in src/solarpandas/origin/bsrn/core.py
parse_bsrn_file
parse_bsrn_file(
path: Path,
check_remote_on_missing_file: bool = True,
logical_records: LogicalRecordName
| list[LogicalRecordName]
| None = None,
timeout: int = 30,
) -> dict[str, Any]
Parse selected logical records from a BSRN .dat.gz file.
Parameters:
-
(pathPath) –Local path to monthly BSRN file.
-
(check_remote_on_missing_filebool, default:True) –If
True, attempt remote FTP download when file is missing locally. -
(logical_recordsLogicalRecordName or list[LogicalRecordName] or None, default:None) –Records to parse. When
None, all supported records in file are parsed. -
(timeoutint, default:30) –FTP timeout in seconds for remote retrieval.
Returns:
Source code in src/solarpandas/origin/bsrn/core.py
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 | |
helpers
Helper utilities for parsing, downloading, and preparing BSRN resources.
Functions:
-
fetch_allsite_metadata_from_pangaea–Fetch and normalize BSRN station metadata from the PANGAEA catalog.
-
fetch_site_data_from_ftp–Download one BSRN monthly file from the FTP server.
-
get_file_age–Return file age in days.
-
inspect_data_availability–Inspect remote FTP availability for all BSRN station directories.
fetch_allsite_metadata_from_pangaea
Fetch and normalize BSRN station metadata from the PANGAEA catalog.
Returns:
Source code in src/solarpandas/origin/bsrn/helpers.py
fetch_site_data_from_ftp
fetch_site_data_from_ftp(
remote_fn: str,
local_path: str | Path,
user: str | None = None,
password: str | None = None,
timeout: int | None = None,
) -> None
Download one BSRN monthly file from the FTP server.
Parameters:
-
(remote_fnstr) –Remote filename (for example
cab0124.dat.gz). -
(local_pathstr or Path) –Local directory where the file will be stored.
-
(userstr or None, default:None) –FTP credentials. When omitted, credentials are read from
~/.netrc. -
(passwordstr or None, default:None) –FTP credentials. When omitted, credentials are read from
~/.netrc. -
(timeoutint or None, default:None) –FTP connection timeout in seconds.
Returns:
-
Path–Path to the downloaded local file.
Source code in src/solarpandas/origin/bsrn/helpers.py
get_file_age
Return file age in days.
Parameters:
-
(pathPath) –File path to inspect.
Returns:
-
float–Age in days, or
np.infwhen the file does not exist.
Source code in src/solarpandas/origin/bsrn/helpers.py
inspect_data_availability
inspect_data_availability(
user: str | None = None,
password: str | None = None,
timeout: int | None = 30,
) -> dict[str, list[str]]
Inspect remote FTP availability for all BSRN station directories.
Returns:
Source code in src/solarpandas/origin/bsrn/helpers.py
lr_parsers
Parsers for BSRN logical records and fixed-width monthly files.
Functions:
-
fortran_pattern_to_colspecs–Convert a compact Fortran-like pattern into fixed-width colspecs.
-
parse–Parse one fixed-width text line into typed values.
-
parse_logical_record_0001–Parse LR0001 block with basic station and quantity metadata.
-
parse_logical_record_0002–Parse LR0002 block with scientist and deputy contact information.
-
parse_logical_record_0003–Parse LR0003 free-text message block.
-
parse_logical_record_0004–Parse LR0004 station site metadata and horizon profile.
-
parse_logical_record_0005–Parse LR0005 radiosonde instrumentation metadata.
-
parse_logical_record_0006–Parse LR0006 ozone instrumentation metadata.
-
parse_logical_record_0007–Parse LR0007 station history metadata block.
-
parse_logical_record_0008–Parse LR0008 radiation instrument calibration metadata.
-
parse_logical_record_0009–Parse LR0009 quantity-to-instrument assignment metadata.
-
parse_logical_record_0100–Parse LR0100 block with basic radiation and meteorological measurements.
-
parse_logical_record_0300–Parse LR0300 block with reflected, upward and net radiation measurements.
-
parse_logical_record_0500–Parse LR0500 block with UV radiation measurements.
fortran_pattern_to_colspecs
fortran_pattern_to_colspecs(fortran_pattern: str)
Convert a compact Fortran-like pattern into fixed-width colspecs.
Parameters:
-
(fortran_patternstr) –Pattern expression using
A,I,FandXtokens.
Returns:
-
tuple[list[tuple[int, int]], list[Callable]]–Parsed column boundaries and per-column formatter callables.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse
parse(
txt: str,
fortran_pattern: str | None = None,
colspecs: list[tuple[int, int]] | None = None,
formatter: Callable | list[Callable] | None = None,
on_error: Literal["raise", "ignore"] = "raise",
default: Any = "undefined",
) -> list[Any]
Parse one fixed-width text line into typed values.
Parameters:
-
(txtstr) –Input line to parse.
-
(fortran_patternstr or None, default:None) –Fortran-like pattern used to infer
colspecs. -
(colspecslist[tuple[int, int]] or None, default:None) –Explicit fixed-width column boundaries.
-
(formatterCallable or list[Callable] or None, default:None) –Value formatter(s) for extracted fields.
-
(on_error('raise', ignore), default:"raise") –Error strategy while parsing or formatting values.
-
(defaultAny, default:"undefined") –Fallback value used when
on_error='ignore'.
Returns:
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0001
Parse LR0001 block with basic station and quantity metadata.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0002
Parse LR0002 block with scientist and deputy contact information.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0003
parse_logical_record_0004
Parse LR0004 station site metadata and horizon profile.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0005
Parse LR0005 radiosonde instrumentation metadata.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0006
Parse LR0006 ozone instrumentation metadata.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0007
Parse LR0007 station history metadata block.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0008
Parse LR0008 radiation instrument calibration metadata.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0009
Parse LR0009 quantity-to-instrument assignment metadata.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0100
Parse LR0100 block with basic radiation and meteorological measurements.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | |
parse_logical_record_0300
Parse LR0300 block with reflected, upward and net radiation measurements.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
parse_logical_record_0500
Parse LR0500 block with UV radiation measurements.
Source code in src/solarpandas/origin/bsrn/lr_parsers.py
utils
Low-level utility functions shared by BSRN readers and parsers.
Functions:
-
guess_time_resolution–Infer sampling step from a datetime index.
-
time_interpolation–Interpolate data in time over a target index.
guess_time_resolution
guess_time_resolution(df_or_series)
Infer sampling step from a datetime index.
Parameters:
Returns:
-
Timedelta or None–Inferred time step, or
Nonewhen no robust estimate is possible.
Notes
First attempts :func:pandas.infer_freq; if unavailable, falls back to the
minimum observed lag and validates that it can reconstruct the index.
Source code in src/solarpandas/origin/bsrn/utils.py
time_interpolation
time_interpolation(
data: DataFrame, new_index: DatetimeIndex
)
Interpolate data in time over a target index.
Parameters:
-
(dataDataFrame) –Input data indexed by timestamps.
-
(new_indexDatetimeIndex) –Target index to interpolate onto.
Returns:
-
DataFrame–Interpolated dataframe aligned to
new_index.
Source code in src/solarpandas/origin/bsrn/utils.py
types
Annotated type definitions used by the BSRN origin interface.
Types and Validation
annotated
Annotated domain types and validation entry points used by solarpandas.
Classes:
-
ValidaRange–Validator for numeric ranges using inclusive and exclusive bounds.
-
ValidaRegex–Validator for values constrained by a regular-expression pattern.
Functions:
-
validate_type–Validate a value against an
Annotatedtype alias.
ValidaRange
dataclass
ValidaRange(
le: float | None = None,
lt: float | None = None,
ge: float | None = None,
gt: float | None = None,
)
Validator for numeric ranges using inclusive and exclusive bounds.
Methods:
-
validate–Validate that a value can be cast to float and satisfies bounds.
validate
Validate that a value can be cast to float and satisfies bounds.
Source code in src/solarpandas/types/annotated.py
ValidaRegex
dataclass
ValidaRegex(pattern: str)
Validator for values constrained by a regular-expression pattern.
Methods:
-
validate–Validate a string value against the configured regex pattern.
validate
Validate a string value against the configured regex pattern.
Source code in src/solarpandas/types/annotated.py
validate_type
validate_type(value, annotated_type)
Validate a value against an Annotated type alias.
Parameters:
-
(valueAny) –Input value to validate.
-
(annotated_typeAny) –Type alias defined as
Annotated[base_type, Validator(...)].
Returns:
-
Any–Validated value, or
NonewhenvalueisNone.
Examples:
Source code in src/solarpandas/types/annotated.py
qcflag
Pandas extension dtype and array implementation for quality-control flags.
Classes:
-
QCFlagArray–ExtensionArray for QC flag values: -1, 0, 1 (or NA).
-
QCFlagDtype–Dtype for QC flag arrays.
-
QCFlagEnum–Enumeration of QC flag semantics used across the package.
QCFlagArray
Bases: ExtensionArray
ExtensionArray for QC flag values: -1, 0, 1 (or NA).
Internally stored as int8 with -128 as a sentinel for NA.
Properties
fails : ndarray[bool] True where the flag value is -1. passes : ndarray[bool] True where the flag value is 1. not_verifiable : ndarray[bool] True where the flag value is 0.
Examples:
values : np.ndarray of int8 Raw storage array. Use _from_sequence for public construction.
Attributes:
-
fails(ndarray) –Boolean mask: True where the flag is -1 (failed).
-
not_verifiable(ndarray) –Boolean mask: True where the flag is 0 (not verifiable).
-
passes(ndarray) –Boolean mask: True where the flag is 1 (passed).
Source code in src/solarpandas/types/qcflag.py
QCFlagDtype
Bases: ExtensionDtype
Dtype for QC flag arrays.
Valid values: -1 (fail), 0 (not verifiable), 1 (passed). NA is represented internally as -128.
Examples:
QCFlagEnum
Bases: IntEnum
Enumeration of QC flag semantics used across the package.
Values
FAILED : -1 Measurement failed the corresponding QC test. NOT_VERIFIABLE : 0 Measurement could not be verified by the test. PASSED : 1 Measurement passed the corresponding QC test.
Examples:
Methods:
-
values–Return all valid flag values as a list of ints.
validate
Validation helpers and annotated domain types used by solarpandas.
This module provides validator classes to validate strings and numeric values,
plus convenience Annotated aliases for common geospatial and SoDA inputs.
The helper :func:validate_type executes validator instances attached to an
annotated alias declared with the type statement.
Type Aliases:
-
Elevation–Surface elevation/altitude validator.
-
Latitude–Geographic latitude coordinate validator.
-
Longitude–Geographic longitude coordinate validator.
-
SodaStream–Available data streams from the SoDA service.
-
SodaTimeStep–Temporal resolution for SoDA API requests.
Classes:
-
ValidaChoices–Validator for a fixed set of string choices with fuzzy matching.
-
ValidaRange–Validator for numerical ranges.
-
ValidaRegex–Validator for string patterns using regular expressions.
Functions:
-
validate_type–Validate a value against an
Annotatedtype definition.
Elevation
Elevation = float
Latitude
Latitude = float
Longitude
Longitude = float
SodaStream
SodaStream = str
SodaTimeStep
SodaTimeStep = str
ValidaChoices
dataclass
Validator for a fixed set of string choices with fuzzy matching.
This validator performs case-insensitive matching against a list of allowed values. If an exact match (ignoring case) is not found, it attempts fuzzy matching to correct potential typos. A warning is issued when fuzzy matching is used.
Parameters:
-
(choiceslist[str]) –Allowed canonical values.
-
(parserCallable[[str], str] or None, default:None) –Optional callable applied after successful validation.
Notes
Matching is case-insensitive. If no direct case-insensitive match is found,
fuzzy matching is attempted with a 0.4 similarity cutoff. Returned values
are always canonical entries from choices.
Examples:
Methods:
-
validate–Validate a string against allowed canonical choices.
validate
Validate a string against allowed canonical choices.
Parameters:
-
(valuestr) –Value to validate.
Returns:
-
str–Canonical value from
choices.
Raises:
-
TypeError–If
valueis not a string. -
ValueError–If no close match is found.
Source code in src/solarpandas/validate.py
ValidaRange
dataclass
ValidaRange(
le: float | None = None,
lt: float | None = None,
ge: float | None = None,
gt: float | None = None,
parser: Callable[[float], float] | None = None,
)
Validator for numerical ranges.
Validates that numeric values fall within specified boundaries using inclusive (ge/le) or exclusive (gt/lt) comparisons. Multiple constraints can be combined to define precise ranges.
Parameters:
-
(lefloat or None, default:None) –Inclusive upper bound.
-
(ltfloat or None, default:None) –Exclusive upper bound.
-
(gefloat or None, default:None) –Inclusive lower bound.
-
(gtfloat or None, default:None) –Exclusive lower bound.
-
(parserCallable[[float], float] or None, default:None) –Optional callable applied after successful validation.
Notes
String inputs are converted to float before validation.
Examples:
Methods:
-
validate–Validate that a number falls within configured bounds.
validate
Validate that a number falls within configured bounds.
Parameters:
Returns:
-
float–Original or parsed value.
Raises:
-
TypeError–If
valuecannot be converted to float. -
ValueError–If
valueviolates any configured constraint.
Source code in src/solarpandas/validate.py
ValidaRegex
dataclass
Validator for string patterns using regular expressions.
This validator checks if a string matches a specified regex pattern. Optionally, a parser function can transform the validated string before returning it.
Parameters:
-
(patternstr) –Regex pattern to match. Use raw strings (for example
r"...") for patterns containing backslashes. -
(parserCallable[[str], str] or None, default:None) –Optional callable applied after successful validation.
Examples:
>>> validator = ValidaRegex(pattern=r"^[A-Z]{3}$", parser=str.upper)
>>> validator.validate("abc")
'ABC'
Methods:
-
validate–Validate a string against the configured regex pattern.
validate
Validate a string against the configured regex pattern.
Parameters:
-
(valuestr) –Value to validate.
Returns:
-
str–Original or parsed string when validation succeeds.
Raises:
-
TypeError–If
valueis not a string. -
ValueError–If
valuedoes not matchpattern.
Source code in src/solarpandas/validate.py
validate_type
validate_type(value: Any, annotated_type: Any) -> Any
Validate a value against an Annotated type definition.
This function is the main entry point for type validation. It extracts the
validator from an Annotated type alias and executes its validate method.
This enables declarative type validation using Python's type hints system.
Parameters:
-
(valueAny) –Value to validate.
-
(annotated_typeAny) –Alias defined as
Annotated[base_type, Validator(...)]using thetypestatement.
Returns:
-
Any–Validated value, possibly transformed by the validator. If
valueisNone,Noneis returned.
Raises:
-
TypeError–If
annotated_typeis not a validAnnotatedalias. -
ValueError–If validator checks fail.
Examples:
See Also
Latitude Longitude Elevation SodaTimeStep
Notes
The function expects aliases created with type (PEP 695), for example
type Latitude = Annotated[float, ValidaRange(...)].
Source code in src/solarpandas/validate.py
Utilities
config
Configuration loading and runtime option access for solarpandas.
This module initializes the user configuration file on first use, loads TOML content into an in-memory dictionary, and exposes helpers to query or override options during the current Python session.
Notes
The persistent config file is stored in the platform-specific user config
directory and is named config.toml.
Examples:
>>> from solarpandas.config import get_config_path, get_option, set_option
>>> config_path = get_config_path()
>>> email = get_option("crs_soda.user_email")
>>> set_option("solar-position.algorithm", "spa")
Functions:
-
get_config_path–Return the path of the user configuration file.
-
get_option–Retrieve the value of a specific configuration option.
-
load_config–Load configuration from a TOML file and optionally overwrite global state.
-
reset_config_file–Reset configuration to defaults by deleting and recreating the file.
-
save_config–Persist the in-memory configuration to a TOML file.
-
set_option–Temporarily update a global option for the current session.
-
show_config–Print all current global options to the console.
get_config_path
get_config_path() -> Path
Return the path of the user configuration file.
Returns:
-
Path–Absolute path to
config.tomlin the platform-specific user configuration directory.
Source code in src/solarpandas/config.py
get_option
Retrieve the value of a specific configuration option.
Options are organized in tables (sections) within the TOML file. This function uses dot notation to access nested values.
Parameters:
-
(namestr) –Option path in
<table>.<option>format (for example,"solar-position.algorithm"). -
(defaultAny, default:None) –Value returned when the table or option is missing.
Returns:
-
Any–Option value, or
defaultwhen missing. Options nameddata_dirare returned as :class:pathlib.Path.
Examples:
>>> from solarpandas.config import get_option
>>> algorithm = get_option("solar-position.algorithm")
>>> server = get_option("bsrn.server", default="ftp.bsrn.awi.de")
>>> data_dir = get_option("bsrn.data_dir") # returns a Path or None
Source code in src/solarpandas/config.py
load_config
Load configuration from a TOML file and optionally overwrite global state.
Parameters:
-
(pathPath or None, default:None) –Optional path to a TOML file. If
None, the default config path is used. -
(overwritebool, default:True) –If
True, replace_GLOBAL_CONFIGentirely. IfFalse, only missing top-level tables are inserted (shallow merge).
Returns:
Source code in src/solarpandas/config.py
reset_config_file
Reset configuration to defaults by deleting and recreating the file.
Notes
This operation updates the in-memory global configuration immediately.
Source code in src/solarpandas/config.py
save_config
Persist the in-memory configuration to a TOML file.
Parameters:
-
(pathPath or None, default:None) –Optional output path. When
None, the default location from :func:get_config_pathis used.
Notes
Path instances in values are converted to POSIX strings before writing.
Source code in src/solarpandas/config.py
set_option
Temporarily update a global option for the current session.
Modifies configuration values in memory only. Changes are lost when the Python session ends. To make persistent changes, edit the config.toml file directly.
Parameters:
-
(namestr) –Option path in
<table>.<option>format. -
(valueAny) –New value. For
data_diroptions,Pathis converted to string.
Examples:
>>> from solarpandas.config import set_option, get_option
>>> set_option("solar-position.algorithm", "nrel")
>>> get_option("solar-position.algorithm")
'nrel'
>>> from pathlib import Path
>>> set_option("bsrn.data_dir", Path("/tmp/bsrn-cache"))
Notes
Changes are session-local. Call :func:save_config to persist them.
Source code in src/solarpandas/config.py
show_config
Print all current global options to the console.
Notes
Uses :func:pprint.pprint for a compact formatted output.
Source code in src/solarpandas/config.py
helpers
General helper functions shared across the solarpandas package.
Functions:
-
infer_time_step–Infer the sampling time step from a datetime-like index.
-
normalize–Reindex data to have complete first and last calendar days.
infer_time_step
Infer the sampling time step from a datetime-like index.
Parameters:
Returns:
-
Timedelta or None–Inferred step. Returns
Noneif the time step cannot be inferred and no valid time differences are available.
Notes
The function first tries the index freq attribute and
:func:pandas.infer_freq. If that fails, it falls back to the smallest
observed lag in index.diff().
Source code in src/solarpandas/helpers.py
normalize
Reindex data to have complete first and last calendar days.
Parameters:
-
(df_or_sDataFrame or Series) –Input object indexed by timestamps.
-
(**kwargsAny, default:{}) –Extra keyword arguments forwarded to
DataFrame.reindexorSeries.reindex(for examplemethod='nearest'orfill_value=0).
Returns:
-
DataFrame or Series–Reindexed object spanning complete days from the first day start to the day after the last timestamp (left-inclusive).
Examples:
>>> import pandas as pd
>>> s = pd.Series([1, 2], index=pd.to_datetime(["2024-01-01 12:00", "2024-01-01 13:00"]))
>>> out = normalize(s)
>>> out.index.min().hour
0
Source code in src/solarpandas/helpers.py
logtools
Logging format helpers used by solarpandas logging setup.
Functions:
-
disable_logger–Disable logging for the solarpandas namespace.
-
enable_logger–Configure and enable package logging.
-
filtrar_logs–Create a filter function to suppress noisy namespaces.
-
get_message_format–Build a loguru format callable with level-aware styling.
disable_logger
enable_logger
enable_logger(
name: str | None = None,
with_mp: bool = False,
filtros: list[str] | None = None,
**kwargs,
)
Configure and enable package logging.
Parameters:
-
(namestr or None, default:None) –Logger namespace to enable explicitly. If
None, enables__main__. -
(with_mpbool, default:False) –Enable multi-process-friendly logging options.
-
(filtroslist[str] or None, default:None) –Prefixes to filter via :func:
filtrar_logs. -
(**kwargsAny, default:{}) –Extra keyword arguments forwarded to
logger.add.
Notes
Existing handlers are removed before installing the new one.
Examples:
Source code in src/solarpandas/logtools.py
filtrar_logs
Create a filter function to suppress noisy namespaces.
Parameters:
-
(filtroslist[str] or None, default:None) –Module name prefixes to filter. Matching records are only kept when severity is ERROR or higher.
Returns:
Source code in src/solarpandas/logtools.py
get_message_format
Build a loguru format callable with level-aware styling.
Parameters:
-
(with_mpbool, default:False) –If
True, include process name to help identify multi-process logs.
Returns:
Source code in src/solarpandas/logtools.py
mplstyles
Registration helpers and constants for bundled Matplotlib styles.
Functions:
-
register_mplstyles–Register bundled Matplotlib styles under the
solarpandas-*prefix.
register_mplstyles
Register bundled Matplotlib styles under the solarpandas-* prefix.
Notes
Calling this function multiple times is safe; style keys are overwritten with the same values.
Examples:
Source code in src/solarpandas/mplstyles/__init__.py
sample_data
Sample datasets bundled with solarpandas for demos and tests.
Functions:
-
load_carpentras_data–Load bundled Carpentras BSRN sample data.
load_carpentras_data
Load bundled Carpentras BSRN sample data.
Returns:
-
SolarDataFrame–Pre-packaged sample dataset stored in Parquet format.
Examples:
Notes
This helper is intended for demos, examples and quick local checks.