Using ODB data¶
[1]:
import earthkit.data as ekd
ekd.download_example_file("test.odb")
ODB is a bespoke format developed at ECMWF to store observations. The following code reads some ODB data with from_source() from a file containing forecast and analysis departures:
[2]:
d = ekd.from_source("file", "test.odb")
d
[2]:
ODB file
| path | test.odb |
| size | 13 KiB |
| types | pandas |
to_pandas() converts data into a Pandas dataframe (uses pyodc under the hood):
[3]:
df = d.to_pandas()
df
[3]:
| lat | lon | fg_dep | an_dep | |
|---|---|---|---|---|
| 0 | 38.808998 | 4.292600 | 0.514543 | 0.513129 |
| 1 | 73.693100 | -3.416700 | -0.098977 | -0.123831 |
| 2 | 31.168501 | -29.865499 | 0.420131 | 0.389983 |
| 3 | 49.040798 | -19.877501 | -0.182703 | -0.124131 |
| 4 | 73.351097 | 40.176102 | 0.087687 | 0.149949 |
| ... | ... | ... | ... | ... |
| 712 | 45.798801 | -0.527100 | 0.103859 | 0.132765 |
| 713 | 73.788597 | -8.806200 | -0.069707 | -0.080577 |
| 714 | 60.162998 | -14.572900 | 0.138816 | 0.011107 |
| 715 | 53.455299 | -29.641600 | 0.082582 | 0.184872 |
| 716 | 40.669201 | 29.702101 | -0.023861 | -0.032721 |
717 rows × 4 columns
We can directly pass arguments to pyodc. E.g. columns specify a subset of the ODB columns we want to extract:
[4]:
df1 = d.to_pandas(odc_read_odb_kwargs={"columns": ("lat", "lon", "an_dep")})
df1
[4]:
| lat | lon | an_dep | |
|---|---|---|---|
| 0 | 38.808998 | 4.292600 | 0.513129 |
| 1 | 73.693100 | -3.416700 | -0.123831 |
| 2 | 31.168501 | -29.865499 | 0.389983 |
| 3 | 49.040798 | -19.877501 | -0.124131 |
| 4 | 73.351097 | 40.176102 | 0.149949 |
| ... | ... | ... | ... |
| 712 | 45.798801 | -0.527100 | 0.132765 |
| 713 | 73.788597 | -8.806200 | -0.080577 |
| 714 | 60.162998 | -14.572900 | 0.011107 |
| 715 | 53.455299 | -29.641600 | 0.184872 |
| 716 | 40.669201 | 29.702101 | -0.032721 |
717 rows × 3 columns
[ ]: