{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Extract 0D field = Point, from a H2DField" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:54.081182Z", "iopub.status.busy": "2025-01-13T11:32:54.080682Z", "iopub.status.idle": "2025-01-13T11:32:54.617133Z", "shell.execute_reply": "2025-01-13T11:32:54.616447Z" } }, "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:54.619333Z", "iopub.status.busy": "2025-01-13T11:32:54.619140Z", "iopub.status.idle": "2025-01-13T11:32:54.768934Z", "shell.execute_reply": "2025-01-13T11:32:54.768318Z" } }, "outputs": [], "source": [ "r = epygram.open(os.path.join(INPUTS_DIR, 'ICMSHAROM+0022'), 'r')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:54.771057Z", "iopub.status.busy": "2025-01-13T11:32:54.770871Z", "iopub.status.idle": "2025-01-13T11:32:54.827538Z", "shell.execute_reply": "2025-01-13T11:32:54.827104Z" } }, "outputs": [], "source": [ "f = r.readfield('SURFTEMPERATURE')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:54.829272Z", "iopub.status.busy": "2025-01-13T11:32:54.829082Z", "iopub.status.idle": "2025-01-13T11:32:54.834052Z", "shell.execute_reply": "2025-01-13T11:32:54.833695Z" } }, "outputs": [], "source": [ "pt = f.extract_point(8, 45) # 8°E, 45°N\n", "print(type(pt))\n", "print(pt.data)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:32:54.835701Z", "iopub.status.busy": "2025-01-13T11:32:54.835522Z", "iopub.status.idle": "2025-01-13T11:32:54.838256Z", "shell.execute_reply": "2025-01-13T11:32:54.837918Z" } }, "outputs": [], "source": [ "val = f.getvalue_ll(8, 45) # 8°E, 45°N\n", "print(type(val))\n", "print(val)" ] }, { "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 }