{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Plot a section" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:31:45.792199Z", "iopub.status.busy": "2025-01-13T11:31:45.791700Z", "iopub.status.idle": "2025-01-13T11:31:46.310044Z", "shell.execute_reply": "2025-01-13T11:31:46.309496Z" } }, "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:31:46.312432Z", "iopub.status.busy": "2025-01-13T11:31:46.312191Z", "iopub.status.idle": "2025-01-13T11:31:46.452988Z", "shell.execute_reply": "2025-01-13T11:31:46.452437Z" } }, "outputs": [], "source": [ "r = epygram.resources.meta_resource(os.path.join(INPUTS_DIR, 'ICMSHAROM+0022'),\n", " 'r', 'CL')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:31:46.455236Z", "iopub.status.busy": "2025-01-13T11:31:46.455066Z", "iopub.status.idle": "2025-01-13T11:31:49.038661Z", "shell.execute_reply": "2025-01-13T11:31:49.038167Z" } }, "outputs": [], "source": [ "# CL implies GRIB2 nomenclature of fields\n", "f = r.readfield({'discipline':0, 'parameterCategory':0, 'parameterNumber':0, # temperature\n", " 'typeOfFirstFixedSurface':119}) # on model levels\n", "f.sp2gp()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:31:49.040794Z", "iopub.status.busy": "2025-01-13T11:31:49.040589Z", "iopub.status.idle": "2025-01-13T11:31:49.062689Z", "shell.execute_reply": "2025-01-13T11:31:49.062345Z" } }, "outputs": [], "source": [ "s = f.extractsection((8,45), (8,46), interpolation='linear')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:31:49.064455Z", "iopub.status.busy": "2025-01-13T11:31:49.064187Z", "iopub.status.idle": "2025-01-13T11:31:49.312017Z", "shell.execute_reply": "2025-01-13T11:31:49.311617Z" } }, "outputs": [], "source": [ "fig, ax = s.plotfield(title='Temperature on meridian 8°E', x_is='lat')" ] }, { "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 }