Tutorials#
This section provides step-by-step tutorials for using bsrn for various tasks. These tutorials are provided as interactive Jupyter notebooks.
1.data_downloading — BSRN FTP credentials; list files with
get_bsrn_file_inventory(); optional FTP coverage heatmap via
plot_bsrn_availability(); download archives by
filename with download_bsrn_files() (other helpers such as
download_bsrn_stn() are also available).
2.quality_control — QIQ March LR0100 month: solpos()
and clear_sky() (REST2 example), then Part A
qc_test(), which delegates to
run_qc() and adds flag* columns for tier row counts;
Part B calls the same tests via individual low-level helpers (PPL, ERL, closure,
diffuse ratio, k / k-indices, tracker). §7 checks that Part A and Part B agree
per tier. §8 is the daily QC audit table (plot.table() on plot);
§9 is a faceted day plot (plot.daily(...)) before masking;
§10 applies qc_mask() and refreshes the audit table on the
masked series.
Quality control, step by step (QIQ March)
3.to_archive — Station-to-archive writing: bsrn.archive logical records and
get_bsrn_format(), rBSRN-style minute columns (year_month, rep(1, n)
via pd.Series([1] * n) for demo GHI/DHI, other LR0100 fields missing), LR4000 + LR4000CONST
in LR0003; comments show how to name output files in a real script; preview printed only (notebook
pre-rendered for Sphinx).
Writing a station-to-archive .dat file
4.time_averaging — Same preprocessing pipeline as tutorial 2 on QIQ August data,
then average() on a dataset copy and detailed use of
pretty_average() (floor / ceiling / center,
match_ceiling_labels, samples per interval).
Time Averaging of 1-min Data (floor / ceiling / center)
5.clear_sky_detection — McClear clear-sky columns via
add_clearsky_columns(), QC, Reno clear-sky screening with
reno_csd(), and matplotlib plots of GHI vs clear-sky with Reno masks
(QIQ September example). Other CSD algorithms are available through
detect_clearsky().
Clear Sky Detection Demo With McClear
6.cloud_enhancement_event — REST2 clear-sky (clear_sky()
with MERRA-2 via Hugging Face), QC (closure, diffuse ratio, tracker-off), and cloud
enhancement events via detect_cee() (methods
killinger, yang, gueymard).
Cloud Enhancement Event Detection with REST2
7.separation_modeling — QIQ 2024 full year: concatenate twelve monthly archives,
run_qc(), REST2 clear-sky via
add_clearsky_columns(), then Erbs, BRL, Engerer2, and Yang4
irradiance separation and plot_k_vs_kt() (k vs k_t).
QIQ 2024 full year: QC, REST2 clear-sky, and four separation models