Quickstart#

Welcome to PyDARTdiags! This guide will help you get started with the library, showing you how to import the modules, read observation sequence files, and perform basic operations. For more detailed information, refer to the User Guide.

import pydartdiags.obs_sequence.obs_sequence as obsq
from pydartdiags.stats import stats
from pydartdiags.matplots import matplots as mp

Specify an obs_sequence file to work with#

Note this example uses a small observation sequence file included with pyDARTdiags and uses the get_example_data function to retrieve it.

To use your own obs sequence file, simply remove the call to get_example_data and replace the value of datafile with the path to the file.

from pydartdiags.data import get_example_data
datafile = get_example_data("obs_seq.final.1000")

#### With your own obs seq:
# datafile = "my_obs_seq.final"

Read an obs_sequence file#

Read an observation sequence file into a DataFrame

obs_seq = obsq.ObsSequence(datafile)

Examine the DataFrame#

The ObsSequence object contains a Pandas DataFrame with all the observations and their associated metadata. You can access the DataFrame using the df attribute of the ObsSequence object. You can then use Pandas methods to explore the data, such as head() to view the first few rows.

obs_seq.df.head()
obs_num observation prior_ensemble_mean prior_ensemble_spread prior_ensemble_member_1 prior_ensemble_member_2 prior_ensemble_member_3 prior_ensemble_member_4 prior_ensemble_member_5 prior_ensemble_member_6 ... latitude vertical vert_unit type seconds days time obs_err_var bias sq_err
0 1 230.16 231.310652 0.405191 231.304725 231.562874 231.333915 231.297690 232.081416 231.051063 ... 0.012188 23950.0 pressure (Pa) ACARS_TEMPERATURE 75603 153005 2019-12-01 21:00:03 1.00 1.150652 1.324001
1 2 18.40 15.720527 0.630827 14.217207 15.558196 15.805599 16.594644 14.877743 16.334438 ... 0.012188 23950.0 pressure (Pa) ACARS_U_WIND_COMPONENT 75603 153005 2019-12-01 21:00:03 6.25 -2.679473 7.179578
2 3 1.60 -4.932073 0.825899 -5.270562 -5.955998 -4.209766 -5.105016 -4.669405 -4.365305 ... 0.012188 23950.0 pressure (Pa) ACARS_V_WIND_COMPONENT 75603 153005 2019-12-01 21:00:03 6.25 -6.532073 42.667980
3 4 264.16 264.060532 0.035584 264.107192 264.097270 264.073212 264.047718 264.074140 264.019895 ... 0.010389 56260.0 pressure (Pa) ACARS_TEMPERATURE 75603 153005 2019-12-01 21:00:03 1.00 -0.099468 0.009894
4 5 11.60 10.134115 0.063183 10.067956 10.078798 10.120263 10.084885 10.135112 10.140610 ... 0.010389 56260.0 pressure (Pa) ACARS_U_WIND_COMPONENT 75603 153005 2019-12-01 21:00:03 6.25 -1.465885 2.148818

5 rows × 180 columns

Find the number of assimilated (used) observations vs. possible observations by type

obs_seq.possible_vs_used()
type possible used
0 ACARS_TEMPERATURE 314 233
1 ACARS_U_WIND_COMPONENT 313 227
2 ACARS_V_WIND_COMPONENT 313 228
3 AIRCRAFT_TEMPERATURE 20 14
4 AIRCRAFT_U_WIND_COMPONENT 20 14
5 AIRCRAFT_V_WIND_COMPONENT 20 13

Examples#

The pyDARTdiags source comes with a set of examples in the examples directory. The examples are also available as notebooks in the Examples Gallery. The examples cover, Manipulating Observation Sequences, Visualizing Observation Sequences, and Diagnostics.