{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Aggregate fields as 4D (H2D + vertical + temporal)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:20.485886Z", "iopub.status.busy": "2025-01-13T11:32:20.484709Z", "iopub.status.idle": "2025-01-13T11:32:21.025955Z", "shell.execute_reply": "2025-01-13T11:32:21.025395Z" } }, "outputs": [], "source": [ "%matplotlib inline\n", "# for figures in notebook\n", "\n", "# import & initialize epygram\n", "import epygram\n", "epygram.init_env()\n", "\n", "# path to file\n", "import os\n", "INPUTS_DIR = os.path.join('..', 'inputs')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:21.028232Z", "iopub.status.busy": "2025-01-13T11:32:21.028035Z", "iopub.status.idle": "2025-01-13T11:32:21.355077Z", "shell.execute_reply": "2025-01-13T11:32:21.354581Z" } }, "outputs": [], "source": [ "paths = [os.path.join(INPUTS_DIR, 'grid.arome-forecast.guyane0025+00{:02}:00.grib'.format(i))\n", " for i in (0, 12, 24)]\n", "r = epygram.resources.meta_resource(paths, 'r', 'CL+MV')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:21.357141Z", "iopub.status.busy": "2025-01-13T11:32:21.356972Z", "iopub.status.idle": "2025-01-13T11:32:47.050573Z", "shell.execute_reply": "2025-01-13T11:32:47.050082Z" } }, "outputs": [], "source": [ "f = r.readfield({'shortName':'t', 'typeOfFirstFixedSurface':100}) # temperature on pressure levels" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:47.052777Z", "iopub.status.busy": "2025-01-13T11:32:47.052600Z", "iopub.status.idle": "2025-01-13T11:32:47.055574Z", "shell.execute_reply": "2025-01-13T11:32:47.055196Z" } }, "outputs": [], "source": [ "print(f.validity)\n", "print(f.getdata(d4=True).shape)\n", "print(f.geometry.vcoordinate.levels)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 2 }