{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Interpolate (resample) on a different geometry" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:46.578222Z", "iopub.status.busy": "2025-01-13T11:34:46.577713Z", "iopub.status.idle": "2025-01-13T11:34:47.107301Z", "shell.execute_reply": "2025-01-13T11:34:47.106882Z" } }, "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:47.109457Z", "iopub.status.busy": "2025-01-13T11:34:47.109245Z", "iopub.status.idle": "2025-01-13T11:34:47.391508Z", "shell.execute_reply": "2025-01-13T11:34:47.391100Z" } }, "outputs": [], "source": [ "lam = epygram.open(os.path.join(INPUTS_DIR, 'ICMSHAROM+0022'), 'r')\n", "gauss = 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:47.393483Z", "iopub.status.busy": "2025-01-13T11:34:47.393340Z", "iopub.status.idle": "2025-01-13T11:34:47.483600Z", "shell.execute_reply": "2025-01-13T11:34:47.483225Z" } }, "outputs": [], "source": [ "fl = lam.readfield('SURFTEMPERATURE')\n", "fg = gauss.readfield('SURFTEMPERATURE')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:47.485401Z", "iopub.status.busy": "2025-01-13T11:34:47.485206Z", "iopub.status.idle": "2025-01-13T11:34:47.540412Z", "shell.execute_reply": "2025-01-13T11:34:47.540039Z" } }, "outputs": [], "source": [ "fgl = fg.resample(fl.geometry, reduce_data=False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:47.542288Z", "iopub.status.busy": "2025-01-13T11:34:47.542102Z", "iopub.status.idle": "2025-01-13T11:34:47.545583Z", "shell.execute_reply": "2025-01-13T11:34:47.545249Z" } }, "outputs": [], "source": [ "fgl.geometry" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:47.547323Z", "iopub.status.busy": "2025-01-13T11:34:47.547141Z", "iopub.status.idle": "2025-01-13T11:34:48.081232Z", "shell.execute_reply": "2025-01-13T11:34:48.080808Z" } }, "outputs": [], "source": [ "fig, ax = fl.cartoplot()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:48.083895Z", "iopub.status.busy": "2025-01-13T11:34:48.083661Z", "iopub.status.idle": "2025-01-13T11:34:48.388791Z", "shell.execute_reply": "2025-01-13T11:34:48.388391Z" } }, "outputs": [], "source": [ "fig, ax = fgl.cartoplot()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:48.390585Z", "iopub.status.busy": "2025-01-13T11:34:48.390364Z", "iopub.status.idle": "2025-01-13T11:34:48.455417Z", "shell.execute_reply": "2025-01-13T11:34:48.455035Z" } }, "outputs": [], "source": [ "fgl = fg.resample(fl.geometry, reduce_data=False, weighting='gauss')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2025-01-13T11:34:48.457406Z", "iopub.status.busy": "2025-01-13T11:34:48.457191Z", "iopub.status.idle": "2025-01-13T11:34:48.763039Z", "shell.execute_reply": "2025-01-13T11:34:48.762607Z" } }, "outputs": [], "source": [ "fig, ax = fgl.cartoplot()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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 }