{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Interpolate (resample) on a lon/lat regular grid\n", "\n", "!!! FIXME: resampling to/from Gauss grids is currently broken" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:50.612678Z", "iopub.status.busy": "2025-01-13T11:34:50.611552Z", "iopub.status.idle": "2025-01-13T11:34:51.165307Z", "shell.execute_reply": "2025-01-13T11:34:51.164811Z" } }, "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:34:51.167535Z", "iopub.status.busy": "2025-01-13T11:34:51.167328Z", "iopub.status.idle": "2025-01-13T11:34:51.447203Z", "shell.execute_reply": "2025-01-13T11:34:51.446585Z" } }, "outputs": [], "source": [ "gauss = epygram.open(os.path.join(INPUTS_DIR, 'analysis.full-arpege.tl149-c24.fa'), 'r')\n", "lam = epygram.open(os.path.join(INPUTS_DIR, 'ICMSHAROM+0022'), 'r')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:51.449193Z", "iopub.status.busy": "2025-01-13T11:34:51.449039Z", "iopub.status.idle": "2025-01-13T11:34:51.512240Z", "shell.execute_reply": "2025-01-13T11:34:51.511836Z" } }, "outputs": [], "source": [ "fg = gauss.readfield('SURFTEMPERATURE')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:51.513963Z", "iopub.status.busy": "2025-01-13T11:34:51.513768Z", "iopub.status.idle": "2025-01-13T11:34:51.516082Z", "shell.execute_reply": "2025-01-13T11:34:51.515691Z" } }, "outputs": [], "source": [ "#fgl = fg.resample_on_regularll(dict(lonmin=-10, lonmax=15, latmin=35, latmax=55),\n", "# resolution_in_degrees=0.2,\n", "# reduce_data=False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:51.517778Z", "iopub.status.busy": "2025-01-13T11:34:51.517599Z", "iopub.status.idle": "2025-01-13T11:34:51.519618Z", "shell.execute_reply": "2025-01-13T11:34:51.519269Z" } }, "outputs": [], "source": [ "#fgl.geometry" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:51.521203Z", "iopub.status.busy": "2025-01-13T11:34:51.521025Z", "iopub.status.idle": "2025-01-13T11:34:51.523043Z", "shell.execute_reply": "2025-01-13T11:34:51.522677Z" } }, "outputs": [], "source": [ "#fig, ax = fgl.cartoplot()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:51.524654Z", "iopub.status.busy": "2025-01-13T11:34:51.524473Z", "iopub.status.idle": "2025-01-13T11:34:51.553599Z", "shell.execute_reply": "2025-01-13T11:34:51.553273Z" } }, "outputs": [], "source": [ "fl = lam.readfield('SURFTEMPERATURE')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:51.555105Z", "iopub.status.busy": "2025-01-13T11:34:51.554902Z", "iopub.status.idle": "2025-01-13T11:34:51.584037Z", "shell.execute_reply": "2025-01-13T11:34:51.583631Z" } }, "outputs": [], "source": [ "flr = fl.resample_on_regularll(dict(lonmin=-5, lonmax=15, latmin=40, latmax=50),\n", " resolution_in_degrees=0.5,\n", " reduce_data=False,\n", " subzone='CI')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:51.585760Z", "iopub.status.busy": "2025-01-13T11:34:51.585412Z", "iopub.status.idle": "2025-01-13T11:34:52.364267Z", "shell.execute_reply": "2025-01-13T11:34:52.363755Z" } }, "outputs": [], "source": [ "fig, ax = flr.cartoplot()" ] }, { "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 }