bsrn.dataset.BSRNDataset#

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

One monthly BSRN dataset: station identity + minute data.

单月 BSRN 数据集:站点标识 + 分钟级数据。

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().

常见流程为在缓存的 data() 帧上依次调用 solpos()clear_sky()qc_test() (均原地修改该帧并返回同一对象)。可选 qc_mask() 将未通过处辐照度置 NaN 并可删除标记列。average()pretty_average() 的结果替换缓存(较粗时间索引)。

Parameters:
  • station_code (str) – Three-letter BSRN station code (must exist in BSRN_STATIONS). 三位 BSRN 站点代码(须在 BSRN_STATIONS 中)。

  • year (int) – Four-digit measurement year. 四位测量年份。

  • month (int) – Measurement month (1–12). 测量月份(1–12)。

  • lr0100 (LR0100) – Validated LR0100 logical record (minute radiation and met data). This is the source of truth; data() is derived from it. 已校验的 LR0100 逻辑记录(分钟辐射与气象数据)。 为数据源;data() 由其派生。

  • lr0300 (LR0300 or None) – Validated LR0300 logical record (reflected / upward SW, LW, net radiation). Default None. 已校验的 LR0300 逻辑记录(反射/上行辐射)。

  • lr4000 (LR4000 or None) – Validated LR4000 logical record (pyrgeometer minute data). Default None. 已校验的 LR4000 逻辑记录(长波表分钟数据)。

  • station_name (str or None) – Resolved from BSRN_STATIONS when omitted. 省略时从 BSRN_STATIONS 解析。

  • lat (float or None) – Latitude (degrees); resolved from BSRN_STATIONS. 纬度(度);从 BSRN_STATIONS 解析。

  • lon (float or None) – Longitude (degrees); resolved from BSRN_STATIONS. 经度(度);从 BSRN_STATIONS 解析。

  • elev (float or None) – Elevation (m above sea level); resolved from BSRN_STATIONS. 海拔(米);从 BSRN_STATIONS 解析。

  • resolution (int or None) – Temporal resolution in minutes (e.g. 1, 2, 3, 5). Defaults to 1. 时间分辨率(分钟);默认 1

Raises:

ValueError – If station_code is not in BSRN_STATIONS, month is out of 1–12. station_code 不在 BSRN_STATIONSmonth 不在 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)

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

from_orm(obj)

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 initialise 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

station_name

lat

lon

elev

resolution