{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Part 2: Verification of Derivative Function" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "_To run this script you need output from [Selecting and Reindexing of Area of Interest](../cutting_grid_window.ipynb)._" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In [Part 1: Deriving Derivatives on Triangular Grid](calculating_gradient.ipynb) we introduced a `derivative()` function to calculate derivatives on a triangular grid. Since it is difficult to tell with the naked eye whether our function did what we wanted it to do, we create an artificially generated field that has a constant gradient along one axis and remains constant along the other axis." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import xarray as xr" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Range of area of interest:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Max Plancks birthplace, Kiel, Schleswig-Holstein, Germany\n", "left_bound = 9.88\n", "right_bound = 10.38\n", "top_bound = 54.57\n", "bottom_bound = 54.07" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We import the `selected_indices`, hence the indices for `cells`, `vertices` and `edges`, just like the `new_grid` which contains the grid information of the area of interest." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (cell: 70, nv: 3, vertex: 50, ne: 6,\n", " edge: 119, no: 4, nc: 2,\n", " max_stored_decompositions: 4, two_grf: 2,\n", " cell_grf: 14, max_chdom: 1, edge_grf: 24,\n", " vert_grf: 13)\n", "Coordinates:\n", " clon (cell) float64 0.1804 0.1805 ... 0.174\n", " clat (cell) float64 0.9453 0.946 ... 0.9488\n", " vlon (vertex) float64 0.1815 0.1807 ... 0.1717\n", " vlat (vertex) float64 0.9456 0.9466 ... 0.9482\n", " elon (edge) float64 0.1811 0.1814 ... 0.1724\n", " elat (edge) float64 0.9461 0.9471 ... 0.9487\n", " * cell (cell) int64 4282376 4282377 ... 4283130\n", " * vertex (vertex) int32 2144929 2144932 ... 2145286\n", " * edge (edge) int32 6427302 6427311 ... 6428420\n", "Dimensions without coordinates: nv, ne, no, nc, max_stored_decompositions,\n", " two_grf, cell_grf, max_chdom, edge_grf, vert_grf\n", "Data variables: (12/91)\n", " clon_vertices (cell, nv) float64 0.1794 0.1802 ... 0.173\n", " clat_vertices (cell, nv) float64 0.9457 0.9446 ... 0.9492\n", " vlon_vertices (vertex, ne) float64 9.969e+36 ... 9.969e+36\n", " vlat_vertices (vertex, ne) float64 9.969e+36 ... 9.969e+36\n", " elon_vertices (edge, no) float64 0.1807 0.1805 ... 0.1728\n", " elat_vertices (edge, no) float64 0.9466 0.946 ... 0.9485\n", " ... ...\n", " edge_dual_normal_cartesian_x (edge) float64 -0.6706 -0.7373 ... -0.7362\n", " edge_dual_normal_cartesian_y (edge) float64 -0.5071 0.4974 ... 0.4973\n", " edge_dual_normal_cartesian_z (edge) float64 0.5414 0.4572 ... 0.4589\n", " cell_circumcenter_cartesian_x (cell) float64 0.576 0.5755 ... 0.5739\n", " cell_circumcenter_cartesian_y (cell) float64 0.105 0.105 ... 0.1003 0.1009\n", " cell_circumcenter_cartesian_z (cell) float64 0.8107 0.8111 ... 0.8127\n", "Attributes: (12/43)\n", " title: ICON grid description\n", " institution: Max Planck Institute for Meteorology/Deutscher ...\n", " source: git@git.mpimet.mpg.de:GridGenerator.git\n", " revision: d00fcac1f61fa16c686bfe51d1d8eddd09296cb5\n", " date: 20180529 at 222250\n", " user_name: Rene Redler (m300083)\n", " ... ...\n", " topography: modified SRTM30\n", " subcentre: 1\n", " number_of_grid_used: 15\n", " history: Thu Aug 16 11:05:44 2018: ncatted -O -a ICON_gr...\n", " ICON_grid_file_uri: http://icon-downloads.mpimet.mpg.de/grids/publi...\n", " NCO: netCDF Operators version 4.7.5 (Homepage = http...