{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Get the 3D Pressure field from a hybrid-pressure coordinate FA file (and its surface pressure)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:57.688447Z", "iopub.status.busy": "2025-01-13T11:34:57.687993Z", "iopub.status.idle": "2025-01-13T11:34:58.011864Z", "shell.execute_reply": "2025-01-13T11:34:58.011383Z" } }, "outputs": [], "source": [ "# import & initialize epygram\n", "import epygram\n", "from epygram.geometries.VGeometry import hybridP_coord_and_surfpressure_to_3D_pressure_field\n", "epygram.init_env()\n", "\n", "import os\n", "INPUTS_DIR = os.path.join('..', 'inputs')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:58.014095Z", "iopub.status.busy": "2025-01-13T11:34:58.013889Z", "iopub.status.idle": "2025-01-13T11:35:00.215419Z", "shell.execute_reply": "2025-01-13T11:35:00.214892Z" } }, "outputs": [], "source": [ "# open resource in read mode\n", "r = epygram.open(os.path.join(INPUTS_DIR, 'ICMSHAROM+0022'), 'r')\n", "surfP = r.readfield('SURFPRESSION')\n", "hybridP_geo = r.readfield('S058TEMPERATURE').geometry.vcoordinate" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:35:00.217429Z", "iopub.status.busy": "2025-01-13T11:35:00.217267Z", "iopub.status.idle": "2025-01-13T11:35:00.222110Z", "shell.execute_reply": "2025-01-13T11:35:00.221517Z" } }, "outputs": [], "source": [ "surfP.sp2gp() # field is spectral\n", "surfP.operation('exp') # and log(Ps)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:35:00.223665Z", "iopub.status.busy": "2025-01-13T11:35:00.223474Z", "iopub.status.idle": "2025-01-13T11:35:00.292131Z", "shell.execute_reply": "2025-01-13T11:35:00.291666Z" } }, "outputs": [], "source": [ "p3D = hybridP_coord_and_surfpressure_to_3D_pressure_field(hybridP_geo, surfP,\n", " vertical_mean='geometric')\n", "# in AROME, the computation of pressure at mass-levels is a geometric average of the surrounding flux-levels pressures" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:35:00.294135Z", "iopub.status.busy": "2025-01-13T11:35:00.293987Z", "iopub.status.idle": "2025-01-13T11:35:00.298665Z", "shell.execute_reply": "2025-01-13T11:35:00.298333Z" } }, "outputs": [], "source": [ "p3D.data.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": 1 }