{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Plotting wind: barbs, wind speed" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:31:05.262585Z", "iopub.status.busy": "2025-01-13T11:31:05.262096Z", "iopub.status.idle": "2025-01-13T11:31:05.800507Z", "shell.execute_reply": "2025-01-13T11:31:05.800005Z" } }, "outputs": [], "source": [ "%matplotlib inline\n", "# for figures in notebook\n", "\n", "# import & initialize epygram\n", "import epygram\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:31:05.802641Z", "iopub.status.busy": "2025-01-13T11:31:05.802394Z", "iopub.status.idle": "2025-01-13T11:31:05.948916Z", "shell.execute_reply": "2025-01-13T11:31:05.948217Z" } }, "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:31:05.951255Z", "iopub.status.busy": "2025-01-13T11:31:05.951049Z", "iopub.status.idle": "2025-01-13T11:31:06.010103Z", "shell.execute_reply": "2025-01-13T11:31:06.009674Z" } }, "outputs": [], "source": [ "u = r.readfield('CLSVENT.ZONAL')\n", "v = r.readfield('CLSVENT.MERIDIEN')\n", "uv = epygram.fields.make_vector_field(u,v)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:31:06.011861Z", "iopub.status.busy": "2025-01-13T11:31:06.011668Z", "iopub.status.idle": "2025-01-13T11:31:06.610992Z", "shell.execute_reply": "2025-01-13T11:31:06.610486Z" } }, "outputs": [], "source": [ "fig, ax = uv.cartoplot(subsampling=10, vector_plot_method='barbs', subzone='CI',\n", " # ! user got to know the very nature of the field he is plotting:\n", " components_are_projected_on='lonlat',\n", " map_factor_correction=False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:31:06.614397Z", "iopub.status.busy": "2025-01-13T11:31:06.614242Z", "iopub.status.idle": "2025-01-13T11:31:06.856559Z", "shell.execute_reply": "2025-01-13T11:31:06.856099Z" } }, "outputs": [], "source": [ "# or if you don't want wind speed:\n", "fig, ax = uv.cartoplot(subsampling=10, vector_plot_method='barbs', subzone='CI',\n", " # ! user got to know the very nature of the field he is plotting:\n", " components_are_projected_on='lonlat',\n", " plot_method=None)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:31:06.858783Z", "iopub.status.busy": "2025-01-13T11:31:06.858588Z", "iopub.status.idle": "2025-01-13T11:31:07.174218Z", "shell.execute_reply": "2025-01-13T11:31:07.173697Z" } }, "outputs": [], "source": [ "# or if you want to plot module only:\n", "ff = uv.to_module()\n", "fig, ax = ff.cartoplot(subzone='CI')" ] }, { "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 }