{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Recompute u/v from psi/khi (Arpege)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:14.945777Z", "iopub.status.busy": "2025-01-13T11:34:14.944551Z", "iopub.status.idle": "2025-01-13T11:34:15.475213Z", "shell.execute_reply": "2025-01-13T11:34:15.474822Z" } }, "outputs": [], "source": [ "# for figures in notebook\n", "%matplotlib inline\n", "\n", "# import & initialize epygram\n", "import epygram\n", "epygram.init_env()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:15.477234Z", "iopub.status.busy": "2025-01-13T11:34:15.477017Z", "iopub.status.idle": "2025-01-13T11:34:15.617723Z", "shell.execute_reply": "2025-01-13T11:34:15.617326Z" } }, "outputs": [], "source": [ "import os\n", "INPUTS_DIR = os.path.join('..', 'inputs')\n", "# open resource in read mode\n", "r = epygram.open(os.path.join(INPUTS_DIR, 'analysis.full-arpege.tl149-c24.fa'), 'r')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:15.619584Z", "iopub.status.busy": "2025-01-13T11:34:15.619385Z", "iopub.status.idle": "2025-01-13T11:34:15.739340Z", "shell.execute_reply": "2025-01-13T11:34:15.738871Z" } }, "outputs": [], "source": [ "psi = r.readfield('S050FONC.COURANT')\n", "khi = r.readfield('S050POT.VITESSE')\n", "# re-compute u/v from psi/khi\n", "uv = epygram.fields.psikhi2uv(psi, khi)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:15.741118Z", "iopub.status.busy": "2025-01-13T11:34:15.740958Z", "iopub.status.idle": "2025-01-13T11:34:16.927124Z", "shell.execute_reply": "2025-01-13T11:34:16.926719Z" } }, "outputs": [], "source": [ "fig, ax = uv.cartoplot(subsampling=5, vector_plot_method='quiver',\n", " components_are_projected_on='grid')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Be careful to projections of wind components !" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:16.931682Z", "iopub.status.busy": "2025-01-13T11:34:16.931526Z", "iopub.status.idle": "2025-01-13T11:34:17.695734Z", "shell.execute_reply": "2025-01-13T11:34:17.695244Z" } }, "outputs": [], "source": [ "# wrong projection:\n", "fig, ax = uv.cartoplot(subsampling=5, vector_plot_method='quiver',\n", " components_are_projected_on='lonlat')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# and stretched grids !" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:17.700219Z", "iopub.status.busy": "2025-01-13T11:34:17.700003Z", "iopub.status.idle": "2025-01-13T11:34:18.400171Z", "shell.execute_reply": "2025-01-13T11:34:18.399696Z" } }, "outputs": [], "source": [ "# map factor due to stretching:\n", "fig, ax = uv.cartoplot(subsampling=5, vector_plot_method='quiver',\n", " components_are_projected_on='grid',\n", " map_factor_correction=False)" ] }, { "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 }