{ "cells": [ { "cell_type": "markdown", "id": "329faade", "metadata": {}, "source": [ "# Model variable names" ] }, { "cell_type": "markdown", "id": "1bc8772e", "metadata": {}, "source": [ "`aeolus` provides functionality to store model-specific variable and coordinate names in one container, which can be passed to various functions." ] }, { "cell_type": "markdown", "id": "b87b12f9", "metadata": {}, "source": [ "The base class is called `Model` and is stored in the `base` submodule" ] }, { "cell_type": "code", "execution_count": 1, "id": "d7d8ef37", "metadata": {}, "outputs": [], "source": [ "from aeolus.model.base import Model" ] }, { "cell_type": "markdown", "id": "688dc770", "metadata": {}, "source": [ "It can be used to create custom `Model` classes for different datasets." ] }, { "cell_type": "markdown", "id": "49b6b31f", "metadata": {}, "source": [ "## Example" ] }, { "cell_type": "markdown", "id": "2a9f57f6", "metadata": {}, "source": [ "For example, for the LMD-G model, one can define the following." ] }, { "cell_type": "code", "execution_count": 2, "id": "56600799", "metadata": {}, "outputs": [], "source": [ "lmdg = Model(\n", " # Coordinates\n", " t=\"Time\",\n", " z=\"altitude\",\n", " y=\"latitude\",\n", " x=\"longitude\",\n", " # Variables\n", " u=\"u\",\n", " v=\"v\",\n", " w=\"w\",\n", " pres=\"p\",\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "id": "205bdaa4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'longitude'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lmdg.x" ] }, { "cell_type": "markdown", "id": "5bc987a8", "metadata": {}, "source": [ "## Unified Model" ] }, { "cell_type": "markdown", "id": "46a16a34", "metadata": {}, "source": [ "The standard container for the UK Met Office Unified Model is called `um` and can be imported from `aeolus.model`:" ] }, { "cell_type": "code", "execution_count": 4, "id": "9e1d48b4", "metadata": {}, "outputs": [], "source": [ "from aeolus.model import um" ] }, { "cell_type": "markdown", "id": "d5cc1a56", "metadata": {}, "source": [ "It does not amount to having the whole STASH table at hand, instead it contains names of commonly used variables and coordinates, which are useful in a specific project as shortcuts." ] }, { "cell_type": "code", "execution_count": 5, "id": "93194632", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('x_wind', 'y_wind', 'upward_air_velocity')" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "um.u, um.v, um.w" ] }, { "cell_type": "code", "execution_count": 6, "id": "0939e3fc", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('longitude', 'latitude', 'level_height')" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "um.x, um.y, um.z" ] }, { "cell_type": "markdown", "id": "46074c65", "metadata": {}, "source": [ "There is also a duplicate class that has STASH indices for the same variables:" ] }, { "cell_type": "code", "execution_count": 7, "id": "e3a50d7b", "metadata": {}, "outputs": [], "source": [ "from aeolus.model import um_stash" ] }, { "cell_type": "markdown", "id": "99dfb3df", "metadata": {}, "source": [ "It does not amount to having the whole STASH table, but it contains names of some commonly used variables and coordinates." ] }, { "cell_type": "code", "execution_count": 8, "id": "0cec2f37", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('m01s00i002', 'm01s00i003', 'm01s00i150')" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "um_stash.u, um_stash.v, um_stash.w" ] }, { "cell_type": "code", "execution_count": 9, "id": "fea64b85", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('longitude', 'latitude', 'level_height')" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "um_stash.x, um_stash.y, um_stash.z" ] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:aeolus_test]", "language": "python", "name": "conda-env-aeolus_test-py" }, "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.4" } }, "nbformat": 4, "nbformat_minor": 5 }