bsrn.dataset.BSRNDataset#

class bsrn.dataset.BSRNDataset(*, station_code, year, month, lr0100, lr0300=None, lr4000=None, metadata_lrs=<factory>, station_name=None, lat=None, lon=None, elev=None, resolution=None)[source]#

One monthly BSRN dataset: station identity and minute data.

Typical enrichment on the cached data() frame is solpos(), then clear_sky(), then qc_test() (each mutates that frame in place and returns it). Optional qc_mask() sets failed irradiance to NaN and can drop flag columns. average() replaces the cache with a coarser time series from pretty_average().

Parameters:
  • station_code (str) – Three-letter BSRN station code (must exist in BSRN_STATIONS).

  • year (int) – Four-digit measurement year.

  • month (int) – Measurement month (1–12).

  • lr0100 (LR0100) – Validated LR0100 logical record (minute radiation and met data). This is the source of truth; data() is derived from it.

  • lr0300 (LR0300 or None) – Validated LR0300 logical record (reflected / upward SW, LW, net radiation). Default None.

  • lr4000 (LR4000 or None) – Validated LR4000 logical record (pyrgeometer minute data). Default None.

  • metadata_lrs (dict) – Mapping for additional non-core logical records keyed by lr#### (for example 'lr0001'). Default empty dict.

  • station_name (str or None) – Resolved from BSRN_STATIONS when omitted.

  • lat (float or None) – Latitude (degrees); resolved from BSRN_STATIONS.

  • lon (float or None) – Longitude (degrees); resolved from BSRN_STATIONS.

  • elev (float or None) – Elevation (m above sea level); resolved from BSRN_STATIONS.

  • resolution (int or None) – Temporal resolution in minutes (e.g. 1, 2, 3, 5). Defaults to 1.

Raises:

ValueError – If station_code is not in BSRN_STATIONS or month is outside 1–12.

__init__(**data)#

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

Return type:

None

Methods

__init__(**data)

Create a new model by parsing and validating input data from keyword arguments.

average(freq[, alignment, aggfunc, ...])

Time-average the cached data() with explicit labeled windows.

clear_sky([model, mcclear_email])

Add clear-sky irradiance columns to the cached data() frame.

construct([_fields_set])

copy(*[, include, exclude, update, deep])

Returns a copy of the model.

data([include])

Minute-resolution DataFrame derived from lr0100.

dict(*[, include, exclude, by_alias, ...])

from_file(path[, include_lrs, strict])

Parse a BSRN .dat.gz station-to-archive file and return a fully validated BSRNDataset.

from_orm(obj)

get_lr(lr_code)

Return one logical record by code.

has_lr(lr_code)

Check whether one logical record exists on the dataset.

json(*[, include, exclude, by_alias, ...])

model_construct([_fields_set])

Creates a new instance of the Model class with validated data.

model_copy(*[, update, deep])

!!! abstract "Usage Documentation"

model_dump(*[, mode, include, exclude, ...])

!!! abstract "Usage Documentation"

model_dump_json(*[, indent, ensure_ascii, ...])

!!! abstract "Usage Documentation"

model_json_schema([by_alias, ref_template, ...])

Generates a JSON schema for a model class.

model_parametrized_name(params)

Compute the class name for parametrizations of generic classes.

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

model_rebuild(*[, force, raise_errors, ...])

Try to rebuild the pydantic-core schema for the model.

model_validate(obj, *[, strict, extra, ...])

Validate a pydantic model instance.

model_validate_json(json_data, *[, strict, ...])

!!! abstract "Usage Documentation"

model_validate_strings(obj, *[, strict, ...])

Validate the given object with string data against the Pydantic model.

parse_file(path, *[, content_type, ...])

parse_obj(obj)

parse_raw(b, *[, content_type, encoding, ...])

qc_mask([flag_remove])

Set irradiance values to NaN where QC flags fail; optionally drop flag columns.

qc_test([tests])

Run QC tests and add flag columns to the cached data() frame.

schema([by_alias, ref_template])

schema_json(*[, by_alias, ref_template])

solpos()

Add solar position and extraterrestrial irradiance columns to the cached data() frame.

update_forward_refs(**localns)

validate(value)

Attributes

model_computed_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

plot

Accessor for built-in plotting routines.

station_code

year

month

lr0100

lr0300

lr4000

metadata_lrs

station_name

lat

lon

elev

resolution