Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

earthkit-data: NetCDF

In this notebook you will see how to:

  • convert NetCDF to Xarray

  • convert NetCDF to a fieldlist

First we read some NetCDF from the remote samples with from_source(). The returned object provides some basic information but its primary goal is to convert the data into the required representation for further work. The actual data loading is deferred, as much as possible, until the data is converted into a given type.

import earthkit.data as ekd

d = ekd.from_source("sample", "era5_tquv_pl_subarea.nc")
d
d.available_types

Conversion to Xarray

The easiest way to work with NetCDF data is to convert it into Xarray.

d.to_xarray()

Conversion to fieldlist

When the data stucture allows it it is also possible to load NetCDF data into a fieldlist.

fl = d.to_fieldlist()
len(fl)
fl.head()
f = fl[0]
f