Reading tar or zip archive

We read a tar file containing 2 GRIB files. First we ensure the example file is available.

[1]:
import earthkit.data as ekd
ekd.download_example_file("test_gribs.tar")
[2]:
fs = ekd.from_source("file", "test_gribs.tar")

The files are extracted and stored in the earthkit-data cache:

[3]:
fs
[3]:
GribMultiFieldList(GRIBReader(/var/folders/93/w0p869rx17q98wxk83gn9ys40000gn/T/earthkit-data-cgr/file-9af8262b89dfdbfe50837dabc61dba7e88db69cc611021a1a361b2f2b4fae96f.d/test.grib),GRIBReader(/var/folders/93/w0p869rx17q98wxk83gn9ys40000gn/T/earthkit-data-cgr/file-9af8262b89dfdbfe50837dabc61dba7e88db69cc611021a1a361b2f2b4fae96f.d/test4.grib))

The resulting object behaves like any standard GRIB object:

[4]:
fs.ls()
[4]:
centre shortName typeOfLevel level dataDate dataTime stepRange dataType number gridType
0 ecmf 2t surface 0 20200513 1200 0 an 0 regular_ll
1 ecmf msl surface 0 20200513 1200 0 an 0 regular_ll
2 ecmf t isobaricInhPa 500 20070101 1200 0 an 0 regular_ll
3 ecmf z isobaricInhPa 500 20070101 1200 0 an 0 regular_ll
4 ecmf t isobaricInhPa 850 20070101 1200 0 an 0 regular_ll
5 ecmf z isobaricInhPa 850 20070101 1200 0 an 0 regular_ll
[5]:
a = fs.sel(level=500)
a.ls()
[5]:
centre shortName typeOfLevel level dataDate dataTime stepRange dataType number gridType
0 ecmf t isobaricInhPa 500 20070101 1200 0 an 0 regular_ll
1 ecmf z isobaricInhPa 500 20070101 1200 0 an 0 regular_ll