## 2014 IOPRAO ``` processed with pyrnet-0.2.16 ``` The PyrNet was setup for calibration in a dense array on the Melpitz measurement field from 2015-05-06 to 2015-05-11. Cross-calibration is done versus reference observations from the TROPOS MObile RaDiation ObseRvatory (MORDOR) station. ### Imports ```python #|dropcode from IPython.display import display, Latex 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 scipy.optimize import differential_evolution from pvlib import clearsky from pvlib.location import Location import pyrnet.pyrnet import pyrnet.utils ``` ### 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. > Before running this notebook, new absolute calibration factors have to be determined with calibration_melcol.ipynb ### 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.pyrnet.meta_lookup(dates[0],box=box) mainmask.append( True if len(serials[0])>0 else False ) ``` #### Load reference MORDOR data The reference data of MORDOR is loaded, and clearsky is detected on daily basis using solis_simple clearsky model and the pvlib.clearsky.detect_clearsky function. ```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: ['', '', '', '', '', '', '', '', '', '', '', '...