{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Aggregate fields temporally (via meta_resource)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:17.187045Z", "iopub.status.busy": "2025-01-13T11:32:17.186405Z", "iopub.status.idle": "2025-01-13T11:32:17.709153Z", "shell.execute_reply": "2025-01-13T11:32:17.708636Z" } }, "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:17.711305Z", "iopub.status.busy": "2025-01-13T11:32:17.711107Z", "iopub.status.idle": "2025-01-13T11:32:18.031581Z", "shell.execute_reply": "2025-01-13T11:32:18.031086Z" } }, "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', 'MV') # MV = Multi-Validities" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:18.033850Z", "iopub.status.busy": "2025-01-13T11:32:18.033634Z", "iopub.status.idle": "2025-01-13T11:32:18.653104Z", "shell.execute_reply": "2025-01-13T11:32:18.652497Z" } }, "outputs": [], "source": [ "f = r.readfield('shortName:2r')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:18.655098Z", "iopub.status.busy": "2025-01-13T11:32:18.654968Z", "iopub.status.idle": "2025-01-13T11:32:18.657363Z", "shell.execute_reply": "2025-01-13T11:32:18.657037Z" } }, "outputs": [], "source": [ "print(f.validity)\n", "print(f.getdata(d4=True).shape)" ] }, { "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 }