{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Aggregate fields temporally (manually)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:13.888677Z", "iopub.status.busy": "2025-01-13T11:32:13.887391Z", "iopub.status.idle": "2025-01-13T11:32:14.413527Z", "shell.execute_reply": "2025-01-13T11:32:14.412923Z" } }, "outputs": [], "source": [ "# for figures in notebook\n", "%matplotlib inline\n", "# import & initialize epygram\n", "import epygram\n", "epygram.init_env()\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:14.415806Z", "iopub.status.busy": "2025-01-13T11:32:14.415586Z", "iopub.status.idle": "2025-01-13T11:32:14.741350Z", "shell.execute_reply": "2025-01-13T11:32:14.740872Z" } }, "outputs": [], "source": [ "r1 = epygram.open(os.path.join(INPUTS_DIR, 'grid.arome-forecast.guyane0025+0000:00.grib'), 'r')\n", "r2 = epygram.open(os.path.join(INPUTS_DIR, 'grid.arome-forecast.guyane0025+0012:00.grib'), 'r')\n", "r3 = epygram.open(os.path.join(INPUTS_DIR, 'grid.arome-forecast.guyane0025+0024:00.grib'), 'r')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:14.743401Z", "iopub.status.busy": "2025-01-13T11:32:14.743190Z", "iopub.status.idle": "2025-01-13T11:32:15.363378Z", "shell.execute_reply": "2025-01-13T11:32:15.362866Z" } }, "outputs": [], "source": [ "f1 = r1.readfield('shortName:2r')\n", "f2 = r2.readfield('shortName:2r')\n", "f3 = r3.readfield('shortName:2r')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:15.365384Z", "iopub.status.busy": "2025-01-13T11:32:15.365167Z", "iopub.status.idle": "2025-01-13T11:32:15.368936Z", "shell.execute_reply": "2025-01-13T11:32:15.368610Z" } }, "outputs": [], "source": [ "f1.extend(f2)\n", "f1.extend(f3)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:15.370626Z", "iopub.status.busy": "2025-01-13T11:32:15.370377Z", "iopub.status.idle": "2025-01-13T11:32:15.372846Z", "shell.execute_reply": "2025-01-13T11:32:15.372461Z" } }, "outputs": [], "source": [ "print(f1.validity)\n", "print(f1.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 }