{ "cells": [ { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "## Using NetCDF data" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import earthkit.data as ekd\n", "ekd.download_example_file(\"test.nc\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "fs = ekd.from_source(\"file\", \"test.nc\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "earthkit.data.readers.netcdf.NetCDFFieldListReader" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(fs)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(fs)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "NetCDFField(t2m,)\n", "NetCDFField(msl,)\n" ] } ], "source": [ "for f in fs:\n", " print(f)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset> Size: 2kB\n",
"Dimensions: (longitude: 19, latitude: 11)\n",
"Coordinates:\n",
" * longitude (longitude) float64 152B -27.0 -23.0 -19.0 ... 37.0 41.0 45.0\n",
" * latitude (latitude) float64 88B 73.0 69.0 65.0 61.0 ... 41.0 37.0 33.0\n",
" number int32 4B ...\n",
" time datetime64[ns] 8B ...\n",
" step timedelta64[ns] 8B ...\n",
" surface int32 4B ...\n",
" valid_time datetime64[ns] 8B ...\n",
"Data variables:\n",
" t2m (latitude, longitude) float32 836B dask.array<chunksize=(11, 19), meta=np.ndarray>\n",
" msl (latitude, longitude) float32 836B dask.array<chunksize=(11, 19), meta=np.ndarray>\n",
"Attributes:\n",
" GRIB_edition: 1\n",
" GRIB_centre: ecmf\n",
" GRIB_centreDescription: European Centre for Medium-Range Weather Forecasts\n",
" GRIB_subCentre: 0\n",
" Conventions: CF-1.7\n",
" institution: European Centre for Medium-Range Weather Forecasts\n",
" history: GRIB to CDM+CF via cfgrib-0.9.5/ecCodes-2.17.0 w...