Contents

The script below puts arbitrary data into a CIF monitor file.

 1import numpy as np
 2import pandas as pd
 3
 4from pycif.utils.datastores.dump import dump_datastore, read_datastore
 5from pycif.utils.datastores.empty import init_empty
 6
 7# Initializes an empty datastore
 8ds = init_empty()
 9
10# Generate arbitrary data
11ds["date"] = pd.date_range("2019-01-01", "2019-02-01", freq="6h")
12ds.loc[:, "station"] = "JFJ"
13ds.loc[:, "network"] = "test"
14ds.loc[:, "parameter"] = "CH4"
15ds.loc[:, "lon"] = 7.99
16ds.loc[:, "lat"] = 46.55
17ds.loc[:, "alt"] = 3590
18ds.loc[:, "obs"] = np.random.normal(1900, 20, size=len(ds))
19ds.loc[:, "obserror"] = np.abs(np.random.normal(0, 20, size=len(ds)))
20ds.loc[:, "duration"] = 1
21
22# Dump the datastore
23dump_datastore(ds, "monitor.nc")
24
25# Checking the consistency of the datastore when reading
26ds2 = read_datastore("monitor.nc")