## 2014 IOPRAO ``` processed with pyrnet-0.2.16 ``` The PyrNet was setup for calibration at the DWD Lindenberg facility and the Falkenberg field from 2014-06-02 to 2014-07-18. Cross-calibration is done versus reference observations from the TROPOS MObile RaDiation ObseRvatory (MORDOR) station and BSRN measurement station at Lindeberg ([Wacker & Behrens 2022](https://doi.pangaea.de/10.1594/PANGAEA.946382)). As PyrNet stations are not clusterd on a sigle facility, but several kilometers apart, only clear sky screened reference data is used for calibration, as the sun position differences are negligible. ### Imports ```python #|dropcode import os import xarray as xr import pandas as pd import numpy as np import datetime as dt import matplotlib.pyplot as plt import jstyleson as json from pvlib import clearsky from pvlib.location import Location from pyrnet import pyrnet ``` ### Prepare PyrNet data For calibration preparation the PyrNet data is processed to level l1b using a calibration factor of **7 (uV W-1 m2)** for all pyranometers with the ```pyrnet process l1b``` tool. This is done to unify the conversion to sensor voltage during calibration and not run into valid_range limits for netcdf encoding. Here we generate the *calibration.json* file for the processing to l1b: ```python box_numbers = np.arange(1,101) calibrations = {f"{bn:03d}":[7,7] for bn in box_numbers} calibjson = {"2000-01-01": calibrations} with open("pyrnet_calib_prep.json","w") as txt: json.dump(calibjson, txt) ``` Within *pyrnet_config.json*: ``` {"file_calibration" : "pyrnet_calib_prep.json"} ``` **Workflow for preparation** 1. Prepare *pyrnet_config_calibration_prep.json* with contributors metadata and the dummy calibration config file. 1. ```$ pyrnet process l1a -c pyrnet_config.json raw_data/*.bin l1a/``` 1. ```$ pyrnet process l1b_network -c pyrnet_config.json l1a/*.nc l1b_network/``` ### Configuration Set local data paths and lookup metadata. ```python pf_mordor = "mordor/{date:%Y/%m/%Y-%m-%d}_Radiation.dat" pf_bsrn = "bsrn/{date:%Y-%m}_bsrn.tab" pf_pyrnet = "l1b_network/{date:%Y-%m-%d}_P1D_pyrnet_ioprao_n000l1bf1s.c01.nc" dates = pd.date_range("2014-06-04","2014-07-18") # period with lots of clear sky situations dates = pd.date_range("2014-06-06","2014-06-09") stations = np.arange(1,101) loc = Location(52.21, 14.122, altitude=125) # Lindenberg # lookup which box contains actually a pyranometer/ extra pyranometer mainmask = [] for box in stations: _, serials, _, _ = pyrnet.meta_lookup(dates[0],box=box) mainmask.append( True if len(serials[0])>0 else False ) ``` #### Load reference MORDOR data ```python #|dropcode #|dropout new = True for i,date in enumerate(dates): fname = pf_mordor.format(date=date) if not os.path.exists(fname): continue df = pd.read_csv( fname, header=0, skiprows=[0,2,3], date_format="ISO8601", na_values=["NAN"], parse_dates=[0], index_col=0 ) dst = df.to_xarray().rename({"TIMESTAMP":"time"}) # drop not needed variables keep_vars = ['TP2_Wm2'] # global shortwave irradiance drop_vars = [v for v in dst if v not in keep_vars] dst = dst.drop_vars(drop_vars) dst = dst.resample(time="1min").mean(skipna=True) cs = loc.get_clearsky(pd.to_datetime(dst.time.values),model='simplified_solis') try: cs_mask = clearsky.detect_clearsky( dst['TP2_Wm2'].values, cs['ghi'], times=pd.to_datetime(dst.time.values) ) except: cs_mask = np.zeros(dst.time.size).astype(bool) dst = dst.assign({"cs_mask":("time", cs_mask)}) # merge if new: ds = dst.copy() new = False else: ds = xr.concat((ds,dst),dim='time', data_vars='minimal', coords='minimal', compat='override') mordor = ds.copy() mordor = mordor.drop_duplicates("time", keep="last") mordor ```
<xarray.Dataset>
Dimensions: (time: 5719)
Coordinates:
* time (time) datetime64[ns] 2014-06-06 ... 2014-06-09T23:18:00
Data variables:
TP2_Wm2 (time) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... nan nan nan nan nan 0.0
cs_mask (time) bool False False False False ... False False False False<xarray.Dataset>
Dimensions: (time: 43200)
Coordinates:
* time (time) datetime64[ns] 2014-06-01 ... 2014-06-30T23:59:00
Data variables:
SWD (time) float64 1.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0
cs_mask (time) bool False False False False ... False False False False<xarray.Dataset>
Dimensions: (time: 3319, station: 43, maintenancetime: 1)
Coordinates:
* station (station) int64 1 5 6 8 15 16 20 ... 90 91 92 93 95 98 99
* maintenancetime (maintenancetime) datetime64[ns] 2014-06-11T23:59:59
* time (time) datetime64[ns] 2014-06-06T04:08:00 ... 2014-06-09...
Data variables:
ghi (time, station) float64 0.0003242 0.0003215 ... nan nan
szen (time, station) float64 79.99 79.99 79.99 ... 79.99 nan nan
Attributes: (12/31)
Conventions: CF-1.10, ACDD-1.3
title: TROPOS pyranometer network (PyrNet) observatio...
history: 2024-11-12T10:03:39: Merged level l1b by pyrne...
institution: Leibniz Institute for Tropospheric Research (T...
source: TROPOS pyranometer network (PyrNet)
references: https://doi.org/10.5194/amt-9-1153-2016
... ...
geospatial_lon_units: degE
time_coverage_start: 2014-06-06T00:00:00
time_coverage_end: 2014-06-06T23:59:59
time_coverage_duration: P0DT23H59M59S
time_coverage_resolution: P0DT0H0M1S
site: ['', '', '', '', '', '', '', '', '', '', '', '...