## 2013 HOPE ``` processed with pyrnet-0.2.16 ``` The PyrNet was setup for calibration during HOPE-Melpitz on the Melpitz measurement field. Cross-calibration is done versus reference observations from the TROPOS MObile RaDiation ObseRvatory (MORDOR) station. ### 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 import pyrnet.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/CR1000_Radiation_corrected.dat" pf_pyrnet = "l1b_network/{date:%Y-%m-%d}_P1D_pyrnet_hope-melpitz_n000l1bf1s.c01.nc" loc = Location(51.525175, 12.91648, altitude=90) # Melpitz stations = np.arange(1,101) # 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 ```python #|dropcode #|dropout df = pd.read_csv( pf_mordor, 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') cs_mask = clearsky.detect_clearsky( dst['TP2_Wm2'].values, cs['ghi'], times=pd.to_datetime(dst.time.values) ) dst = dst.assign({"cs_mask":("time", cs_mask)}) mordor = dst.copy() mordor = mordor.drop_duplicates("time", keep="last") mordor ```
<xarray.Dataset>
Dimensions: (time: 11394)
Coordinates:
* time (time) datetime64[ns] 2013-09-19T12:47:00 ... 2013-09-27T10:40:00
Data variables:
TP2_Wm2 (time) float64 597.0 713.0 762.6 764.3 ... 401.6 482.4 577.5 646.0
cs_mask (time) bool False False False False ... False False False False<xarray.Dataset>
Dimensions: (station: 50, maintenancetime: 4, time: 5299)
Coordinates:
* station (station) int64 2 7 14 16 18 22 23 ... 89 90 92 95 96 100
* maintenancetime (maintenancetime) datetime64[ns] 2013-09-19T11:55:00 ......
* time (time) datetime64[ns] 2013-09-19T05:59:00 ... 2013-09-27...
Data variables:
ghi (time, station) float64 0.0001123 nan ... 0.0005218
szen (time, station) float64 79.97 79.97 79.97 ... 79.96 79.96
Attributes: (12/31)
Conventions: CF-1.10, ACDD-1.3
title: TROPOS pyranometer network (PyrNet) observatio...
history: 2024-11-13T10:53:01: 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: 2013-09-19T00:00:00
time_coverage_end: 2013-09-19T23:59:59
time_coverage_duration: P0DT23H59M59S
time_coverage_resolution: P0DT0H0M1S
site: ['', '', '', '', '', '', '', '', '', '', '', '...