From 9cf456714ee0bc7b28c5fb6daa753e488eca551d Mon Sep 17 00:00:00 2001 From: lkugler <lukas.kugler@gmail.com> Date: Sat, 27 May 2023 11:37:19 +0200 Subject: [PATCH] docs --- dartwrf/obs/obsseq.py | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/dartwrf/obs/obsseq.py b/dartwrf/obs/obsseq.py index 66c0777..4b22334 100755 --- a/dartwrf/obs/obsseq.py +++ b/dartwrf/obs/obsseq.py @@ -1,22 +1,30 @@ """Read, modify and save DART obs_seq.out/obs_seq.final files in DART format. Examples: - $ from dartwrf.obs.obsseq import ObsSeq - $ obs = ObsSeq('path/to/obs_seq.final') - - $ obs.df # pandas.DataFrame with all observations (rows) - - $ obs.df['observations'] # observation values (np.array) - $ obs.df['truth'] # truth values (np.array) - $ obs.df['prior ensemble spread'] # spread of prior ensemble (np.array) - $ obs.df['variance'] # observation error variances (np.array) - - $ obs.df.get_prior_Hx() # H(x_prior) for all ensemble members (np.array) - $ obs.df.get_posterior_Hx() # H(x_posterior) for all ensemble members (np.array) - - $ obs.df.get_lon_lat() # longitude and latitude of observations (pd.DataFrame) - - $ obs.to_dart('path/to/obs_seq.final') # write to file + >>> from dartwrf.obs.obsseq import ObsSeq + >>> osf = ObsSeq('path/to/obs_seq.final') + + pandas.DataFrame with all observations (rows) + >>> osf.df + observations truth prior ensemble mean posterior ensemble mean ... kind metadata time variance + 0 0.292800 0.289466 0.360284 0.330799 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + 1 0.292800 0.289466 0.398444 0.380152 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + 2 0.310016 0.289466 0.355061 0.369988 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + 3 0.297182 0.289466 0.305424 0.302489 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + 4 0.292800 0.293797 0.306238 0.303252 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + .. ... ... ... ... ... ... ... ... ... + 956 0.762274 0.796486 0.664451 0.833559 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + 957 0.525743 0.500751 0.534391 0.653267 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + 958 0.341627 0.348115 0.405534 0.447314 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + 959 0.826649 0.835491 0.374459 0.785951 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + 960 0.320477 0.343154 0.303468 0.325203 ... 262 [ visir\n, 180.000000000000 45.00000... (50400, 148864) 0.0009 + + [961 rows x 93 columns] + + >>> osf.df.get_prior_Hx() # H(x_prior) for all ensemble members (np.array) + >>> osf.df.get_posterior_Hx() # H(x_posterior) for all ensemble members (np.array) + + >>> osf.to_dart('path/to/obs_seq.final') # write to file Note: Can not create obs_seq from scratch, since it does not know which metadata is necessary for each observation type -- GitLab