{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# How to create shapefiles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from nes import *\n",
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. From grids that have already been created"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Original path: /gpfs/scratch/bsc32/bsc32538/original_files/franco_interp.nc\n",
    "# Regular lat-lon grid from MONARCH\n",
    "grid_path = '/gpfs/projects/bsc32/models/NES_tutorial_data/franco_interp.nc'\n",
    "grid = open_netcdf(path=grid_path, info=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rank 000: Loading sconcno2 var (1/1)\n",
      "Rank 000: Loaded sconcno2 var ((25, 1, 115, 165))\n"
     ]
    }
   ],
   "source": [
    "grid.load()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "grid.to_shapefile(path='regular_shp', \n",
    "                  time=datetime.datetime(2019, 1, 1, 10, 0), \n",
    "                  lev=0, var_list=['sconcno2'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>geometry</th>\n",
       "      <th>sconcno2</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((-11.85000 33.85000, -11.75000 33.850...</td>\n",
       "      <td>0.000288</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-11.75000 33.85000, -11.65000 33.850...</td>\n",
       "      <td>0.000271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-11.65000 33.85000, -11.55000 33.850...</td>\n",
       "      <td>0.000258</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-11.55000 33.85000, -11.45000 33.850...</td>\n",
       "      <td>0.000254</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-11.45000 33.85000, -11.35000 33.850...</td>\n",
       "      <td>0.000262</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18970</th>\n",
       "      <td>POLYGON ((4.15000 45.25000, 4.25000 45.25000, ...</td>\n",
       "      <td>0.003521</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18971</th>\n",
       "      <td>POLYGON ((4.25000 45.25000, 4.35000 45.25000, ...</td>\n",
       "      <td>0.003924</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18972</th>\n",
       "      <td>POLYGON ((4.35000 45.25000, 4.45000 45.25000, ...</td>\n",
       "      <td>0.004454</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18973</th>\n",
       "      <td>POLYGON ((4.45000 45.25000, 4.55000 45.25000, ...</td>\n",
       "      <td>0.004619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18974</th>\n",
       "      <td>POLYGON ((4.55000 45.25000, 4.65000 45.25000, ...</td>\n",
       "      <td>0.004712</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>18975 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                geometry  sconcno2\n",
       "FID                                                               \n",
       "0      POLYGON ((-11.85000 33.85000, -11.75000 33.850...  0.000288\n",
       "1      POLYGON ((-11.75000 33.85000, -11.65000 33.850...  0.000271\n",
       "2      POLYGON ((-11.65000 33.85000, -11.55000 33.850...  0.000258\n",
       "3      POLYGON ((-11.55000 33.85000, -11.45000 33.850...  0.000254\n",
       "4      POLYGON ((-11.45000 33.85000, -11.35000 33.850...  0.000262\n",
       "...                                                  ...       ...\n",
       "18970  POLYGON ((4.15000 45.25000, 4.25000 45.25000, ...  0.003521\n",
       "18971  POLYGON ((4.25000 45.25000, 4.35000 45.25000, ...  0.003924\n",
       "18972  POLYGON ((4.35000 45.25000, 4.45000 45.25000, ...  0.004454\n",
       "18973  POLYGON ((4.45000 45.25000, 4.55000 45.25000, ...  0.004619\n",
       "18974  POLYGON ((4.55000 45.25000, 4.65000 45.25000, ...  0.004712\n",
       "\n",
       "[18975 rows x 2 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "grid.shapefile"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa530d47e50>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 5124 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "grid.shapefile.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa530d18d50>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAABJCAYAAAAT+XCfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAJF0lEQVR4nO3de4xcZRnH8e+vBeQSldJtsUDXRShEIFCxNo0RDOClAgGKwZAobSKxgCKXQBTSyCWGpJQS/hExFf5oIoIoKk0x0tp4CX9Q3GKLVYrFuEBLLUUEUy61tY9/nHfiuMx0Z9+ZM2eW/X2Szcw5877nvE9m9zx7zpl5H0UEZmZmozWh6gGYmdnY5ARiZmZZnEDMzCyLE4iZmWVxAjEzsyxOIGZmlmXEBCLpQElPStog6U+Sbk3rvy3paUnrJa2SdEST/ldL2pj6XlO3/hZJW1P/9ZLO7lxYZmZWNo30PRBJAg6JiJ2S9gceB64G/hwR/0ptrgJOiIjLh/U9CXgQmA38G/glcEVEbJZ0C7AzIpa2Oti+vr4YGBhotbmZmQHr1q17JSKmdHq7+43UIIoMszMt7p9+opY8kkOARpnow8ATEfEmgKTfAvOAJTmDHRgYYHBwMKermdm4Jen5MrY7YgJJO58IrAOOBe6OiLVp/W3AfOB14IwGXTcCt0maDLwFnA3UZ4ArJc1P666LiH822PdCYCFAf39/i2G908ANj2b3NTOr2tDic6oewju0dBM9Iv4TETOBo4DZ6dIUEbEoIqYD9wNXNuj3DHA7sJri8tUGYE96+R7gGGAmsA24s8m+l0XErIiYNWVKx8/AzMws06g+hRURrwG/AeYOe+mHwOe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kUTZJc4FvAudFxJtVj6dLVlAcVEmPY/WMZgVwsaT3SDoamAE82aBd3vErIvxT/EM1j+KAsAvYDjxW99oQ8CpFZcYtwAlp/b0U5XoBPkFRdGsDsBb4aNUxdSHmA4AfUHwC5CmK0seVx1VmzMO2NQT0VR1TF97n54AXgfXp53tVx9SFmCdTfPpqc3o8rOqY2oh3EfBX4Fngc3Xr2z5+eSoTMzPL4ktYZmaWxQnEzMyyOIGYmVkWJxAzM8viBGJmZlmcQMzMLIsTiJmZZfkvEP2xq89nzf8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "grid.shapefile[:10].plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. From grids created from scratch"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Regular lat-lon grid"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "lat_orig = 41.1\n",
    "lon_orig = 1.8\n",
    "inc_lat = 0.1\n",
    "inc_lon = 0.1\n",
    "n_lat = 50\n",
    "n_lon = 100\n",
    "regular_grid = create_nes(comm=None, info=False, projection='regular',\n",
    "                          lat_orig=lat_orig, lon_orig=lon_orig, inc_lat=inc_lat, inc_lon=inc_lon, \n",
    "                          n_lat=n_lat, n_lon=n_lon)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>geometry</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((1.80000 41.10000, 1.90000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((1.90000 41.10000, 2.00000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((2.00000 41.10000, 2.10000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((2.10000 41.10000, 2.20000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((2.20000 41.10000, 2.30000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9995</th>\n",
       "      <td>POLYGON ((11.30000 51.00000, 11.40000 51.00000...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9996</th>\n",
       "      <td>POLYGON ((11.40000 51.00000, 11.50000 51.00000...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>POLYGON ((11.50000 51.00000, 11.60000 51.00000...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9998</th>\n",
       "      <td>POLYGON ((11.60000 51.00000, 11.70000 51.00000...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9999</th>\n",
       "      <td>POLYGON ((11.70000 51.00000, 11.80000 51.00000...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10000 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               geometry\n",
       "FID                                                    \n",
       "0     POLYGON ((1.80000 41.10000, 1.90000 41.10000, ...\n",
       "1     POLYGON ((1.90000 41.10000, 2.00000 41.10000, ...\n",
       "2     POLYGON ((2.00000 41.10000, 2.10000 41.10000, ...\n",
       "3     POLYGON ((2.10000 41.10000, 2.20000 41.10000, ...\n",
       "4     POLYGON ((2.20000 41.10000, 2.30000 41.10000, ...\n",
       "...                                                 ...\n",
       "9995  POLYGON ((11.30000 51.00000, 11.40000 51.00000...\n",
       "9996  POLYGON ((11.40000 51.00000, 11.50000 51.00000...\n",
       "9997  POLYGON ((11.50000 51.00000, 11.60000 51.00000...\n",
       "9998  POLYGON ((11.60000 51.00000, 11.70000 51.00000...\n",
       "9999  POLYGON ((11.70000 51.00000, 11.80000 51.00000...\n",
       "\n",
       "[10000 rows x 1 columns]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "regular_grid.create_shapefile()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>geometry</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((1.80000 41.10000, 1.90000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((1.90000 41.10000, 2.00000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((2.00000 41.10000, 2.10000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((2.10000 41.10000, 2.20000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((2.20000 41.10000, 2.30000 41.10000, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9995</th>\n",
       "      <td>POLYGON ((11.30000 51.00000, 11.40000 51.00000...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9996</th>\n",
       "      <td>POLYGON ((11.40000 51.00000, 11.50000 51.00000...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>POLYGON ((11.50000 51.00000, 11.60000 51.00000...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9998</th>\n",
       "      <td>POLYGON ((11.60000 51.00000, 11.70000 51.00000...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9999</th>\n",
       "      <td>POLYGON ((11.70000 51.00000, 11.80000 51.00000...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10000 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               geometry\n",
       "FID                                                    \n",
       "0     POLYGON ((1.80000 41.10000, 1.90000 41.10000, ...\n",
       "1     POLYGON ((1.90000 41.10000, 2.00000 41.10000, ...\n",
       "2     POLYGON ((2.00000 41.10000, 2.10000 41.10000, ...\n",
       "3     POLYGON ((2.10000 41.10000, 2.20000 41.10000, ...\n",
       "4     POLYGON ((2.20000 41.10000, 2.30000 41.10000, ...\n",
       "...                                                 ...\n",
       "9995  POLYGON ((11.30000 51.00000, 11.40000 51.00000...\n",
       "9996  POLYGON ((11.40000 51.00000, 11.50000 51.00000...\n",
       "9997  POLYGON ((11.50000 51.00000, 11.60000 51.00000...\n",
       "9998  POLYGON ((11.60000 51.00000, 11.70000 51.00000...\n",
       "9999  POLYGON ((11.70000 51.00000, 11.80000 51.00000...\n",
       "\n",
       "[10000 rows x 1 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "regular_grid.shapefile"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa530cc80d0>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALgAAAD4CAYAAABfayyrAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKEElEQVR4nO3da4xcdRnH8e9PLiFgC9RtAWnjQgQTNVhxbRC8cIkECmlJjKYmjU0kNpBogAS1TZMmvkM03qKJaYSkCooYKRAEpQHR+KLItrZQAsglC9ZWtqDhEiOIPL44/yWTYbadnTlnZnj4fZLNzJw5p/Pv8N2zszt0H0UEZlm9Y9gLMGuSA7fUHLil5sAtNQduqR06yAcbGxuL8fHxQT6kvU1s3779uYhY2L59oIGPj48zOTk5yIe0twlJT3fa7pcolpoDt9QcuKXmwC01B26pOXBLzYFbag7cUhvoGz0HMr7uN8Nego24qWsumvMxPoNbag7cUnPglpoDt9QcuKXmwC01B26pOXBLzYFbag7cUnPglpoDt9QcuKXmwC01B26pOXBLzYFbag7cUuvqn6xJmgJeAv4HvBYRE5IWAL8ExoEp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Lulm0LJG2V9Hi5PHaWYy+Q9Fh5ftbVsZ45i4iR+gBOAE4v1+dRjSh8f9s+ZwN3DGAtU8DYAe5fTjV8S8AZwP0DWNMhwD+o3tho/DkBPgmcDuxu2XYtsK5cXwd8c5Z1PgmcDBwO7Gr/7ziIj5E7g0fEvojYUa6/RDWb88ThrmpWK4GfRmUbcIykExp+zPOAJyOin3eEuxYRfwT+2bZ5JbC5XN8MXNLh0GXAExHxVES8CtxUjhuokQu8laRx4MPA/R3u/pikXZLukvSBhpYQwN2Stkta2+H+E4G/tdzeQ/OfjKuAX8xy3yCeE4DjImIfVCckYFGHfYbx3LzJyPyr+naS3gn8GrgyIl5su3sH1Zfol8v0t1uBUxpYxlkRsVfSIqpZRI+WM9oby+xwTGM/d5V0OLCCzlOlB/WcdGugz81sRvIMLukwqrhvjIhb2u+PiBcj4uVy/U7gMEljda8jIvaWy2lgC9WX3VZ7gCUttxcDe+teR4sLgR0R8Wz7HYN6TopnZ16KlcvpDvsM+rnpaOQClyTgOuCRiPjOLPscX/ZD0jKqv8fzNa/jKEnzZq4D5wO723a7HfhC+WnKGcALM1+6G/J5Znl5MojnpMXtwJpyfQ1wW4d9HgBOkXRS+cqzqhw3WIP+rraL79o/TvWl7EFgZ/lYDlwGXFb2+TLwMNV35tuAMxtYx8nlz99VHmtD2d66DgE/ovppwUPARIPPy5FUwR7dsq3x54TqE2of8F+qs/KlwLuAe4DHy+WCsu+7gTtbjl1O9VOwJ2eev0F/+K16S23kXqKY1cmBW2oO3FJz4JaaA7fUHLil5sAttf8DFNoCfGlbfigAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "regular_grid.shapefile.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa530c84950>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAABNCAYAAACoqK8xAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAHR0lEQVR4nO3dXYhcdx3G8e9jElFJagtZJW/riGDVC6VxxdZUifXCmpTW1BR8aQuhkAtBUnyppjdeCfGmBBGpIZUiKfaiTXxJoqXQxlbaBLJtrGkXS9G0hgRDVGzRqzSPF+dE1rC7c3b2zIzz3+cDC+fM+Z+Z348Znv3PmTNnZJuIiCjXW4ZdQERE9FeCPiKicAn6iIjCJegjIgqXoI+IKFyCPiKicI2DXtISSc9LOliv3ybpRUkXJU3Mss86SU9KmqrH7mir8IiIaGbpPMbuAKaAK+r1k8CtwI/n2OcC8A3bz0laAUxKetz2S3M90MqVK93pdOZRWkTE4jY5OXne9thM2xoFvaS1wGbge8DXAWxP1dtm3c/2WeBsvfyGpClgDTBn0Hc6HY4fP96ktIiIACS9Otu2pjP63cA9wIoFFNEBrgGOzbJ9O7AdYHx8vNeHofOdQz3vGxExTKd2be7L/XY9Ri/pJuCc7cleH0TScuBR4G7br880xvYe2xO2J8bGZnz3ERERPWjyYewG4GZJp4CHgRsk7Wv6AJKWUYX8Q7b391RlRET0rGvQ295pe63tDvBF4Anbtze5c1UH8B8Apmzft6BKIyKiJz2fRy9pi6TTwHXAIUmP1bevlnS4HrYBuIPqXcCJ+m/TgquOiIjG5nN6JbaPAEfq5QPAgRnGnAE21cu/A2Y/LSciIvou34yNiChcgj4ionAJ+oiIwiXoIyIKl6CPiChcgj4ionAJ+oiIwiXoIyIKl6CPiChcgj4ionAJ+oiIwiXoIyIKl6CPiChcgj4ionAJ+oiIwiXoIyIKl6CPiChcgj4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YScupZnJ3z9CLZthl5M+d7dLzpTGfpgr66wdZW7906Xk38G3bb1aTvTJ06Xkp8FHgM8DbgWclHbX98oDLbFWXnlvNsFJn9Nuo3urZ9ivAn4EPDLmmBZG0jOpF8ZDt/TMMOQ2sm7a+lmo2MLIa9IykD1P9TsIttv82yPr6oUHPE8DDkk4BW4EfSfr8AEtsXcPX9m9s/8v2eaofOxr1D9679dxqhpUa9K9R/fdH0ruBq4E/DbWiBaiP0z0ATNm+b5ZhvwTurM++uRb4p+2zAyuyZU16ljQO7AfuGPXZHTTr2fZ7bXdsd4BHgK/a/vkAy2xVw9f2L4BPSloq6R3Ax/nfX7sbKQ17bjXDRvKbsfWF0jZSXdLzr8B3gWUAtu+XtJrqJwxXUR3S2GV731CKbYGk64GnqY7VXTpOdy8wDv/tWVTH9W4E/g1ss318COW2omHPe4EvAJcuaX3BI3y1wyY9Xzb+QeCg7UcGWGarmvYs6VtUs9yLwF7buwdfbTsavrZbzbCRDPqIiGiu1EM3ERFRS9BHRBQuQR8RUbgEfURE4RL0ERGFS9BHRBQuQR8RUbj/AFb0cpO21GVhAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "regular_grid.shapefile[:10].plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Rotated grid"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "centre_lat = 51\n",
    "centre_lon = 10\n",
    "west_boundary = -35\n",
    "south_boundary = -27\n",
    "inc_rlat = 0.2\n",
    "inc_rlon = 0.2\n",
    "rotated_grid = create_nes(comm=None, info=False, projection='rotated',\n",
    "                          centre_lat=centre_lat, centre_lon=centre_lon,\n",
    "                          west_boundary=west_boundary, south_boundary=south_boundary,\n",
    "                          inc_rlat=inc_rlat, inc_rlon=inc_rlon)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>geometry</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((-22.21497 16.22040, -22.05071 16.303...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-22.05071 16.30307, -21.88618 16.385...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-21.88618 16.38536, -21.72137 16.467...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-21.72137 16.46727, -21.55629 16.548...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-21.55629 16.54881, -21.39094 16.629...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95116</th>\n",
       "      <td>POLYGON ((87.25127 59.16191, 87.43401 59.01025...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95117</th>\n",
       "      <td>POLYGON ((87.43401 59.01025, 87.61561 58.85850...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95118</th>\n",
       "      <td>POLYGON ((87.61561 58.85850, 87.79608 58.70663...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95119</th>\n",
       "      <td>POLYGON ((87.79608 58.70663, 87.97545 58.55466...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95120</th>\n",
       "      <td>POLYGON ((87.97545 58.55466, 88.15372 58.40259...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>95121 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                geometry\n",
       "FID                                                     \n",
       "0      POLYGON ((-22.21497 16.22040, -22.05071 16.303...\n",
       "1      POLYGON ((-22.05071 16.30307, -21.88618 16.385...\n",
       "2      POLYGON ((-21.88618 16.38536, -21.72137 16.467...\n",
       "3      POLYGON ((-21.72137 16.46727, -21.55629 16.548...\n",
       "4      POLYGON ((-21.55629 16.54881, -21.39094 16.629...\n",
       "...                                                  ...\n",
       "95116  POLYGON ((87.25127 59.16191, 87.43401 59.01025...\n",
       "95117  POLYGON ((87.43401 59.01025, 87.61561 58.85850...\n",
       "95118  POLYGON ((87.61561 58.85850, 87.79608 58.70663...\n",
       "95119  POLYGON ((87.79608 58.70663, 87.97545 58.55466...\n",
       "95120  POLYGON ((87.97545 58.55466, 88.15372 58.40259...\n",
       "\n",
       "[95121 rows x 1 columns]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rotated_grid.create_shapefile()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>geometry</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((-22.21497 16.22040, -22.05071 16.303...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-22.05071 16.30307, -21.88618 16.385...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-21.88618 16.38536, -21.72137 16.467...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-21.72137 16.46727, -21.55629 16.548...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-21.55629 16.54881, -21.39094 16.629...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95116</th>\n",
       "      <td>POLYGON ((87.25127 59.16191, 87.43401 59.01025...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95117</th>\n",
       "      <td>POLYGON ((87.43401 59.01025, 87.61561 58.85850...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95118</th>\n",
       "      <td>POLYGON ((87.61561 58.85850, 87.79608 58.70663...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95119</th>\n",
       "      <td>POLYGON ((87.79608 58.70663, 87.97545 58.55466...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95120</th>\n",
       "      <td>POLYGON ((87.97545 58.55466, 88.15372 58.40259...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>95121 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                geometry\n",
       "FID                                                     \n",
       "0      POLYGON ((-22.21497 16.22040, -22.05071 16.303...\n",
       "1      POLYGON ((-22.05071 16.30307, -21.88618 16.385...\n",
       "2      POLYGON ((-21.88618 16.38536, -21.72137 16.467...\n",
       "3      POLYGON ((-21.72137 16.46727, -21.55629 16.548...\n",
       "4      POLYGON ((-21.55629 16.54881, -21.39094 16.629...\n",
       "...                                                  ...\n",
       "95116  POLYGON ((87.25127 59.16191, 87.43401 59.01025...\n",
       "95117  POLYGON ((87.43401 59.01025, 87.61561 58.85850...\n",
       "95118  POLYGON ((87.61561 58.85850, 87.79608 58.70663...\n",
       "95119  POLYGON ((87.79608 58.70663, 87.97545 58.55466...\n",
       "95120  POLYGON ((87.97545 58.55466, 88.15372 58.40259...\n",
       "\n",
       "[95121 rows x 1 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rotated_grid.shapefile"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa530c531d0>"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 70152 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "rotated_grid.shapefile.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa530c04050>"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 15356 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "rotated_grid.shapefile[:10].plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### LCC grid"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "lat_1 = 37\n",
    "lat_2 = 43\n",
    "lon_0 = -3\n",
    "lat_0 = 40\n",
    "nx = 100\n",
    "ny = 200\n",
    "inc_x = 4000\n",
    "inc_y = 4000\n",
    "x_0 = -807847.688\n",
    "y_0 = -797137.125\n",
    "lcc_grid = create_nes(comm=None, info=False, projection='lcc',\n",
    "                      lat_1=lat_1, lat_2=lat_2, lon_0=lon_0, lat_0=lat_0, \n",
    "                      nx=nx, ny=ny, inc_x=inc_x, inc_y=inc_y, x_0=x_0, y_0=y_0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>geometry</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((-11.58393 32.47507, -11.54169 32.478...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-11.54169 32.47851, -11.49944 32.481...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-11.49944 32.48192, -11.45719 32.485...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-11.45719 32.48533, -11.41494 32.488...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-11.41494 32.48871, -11.37268 32.492...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19995</th>\n",
       "      <td>POLYGON ((-8.03489 39.88059, -7.98792 39.88262...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19996</th>\n",
       "      <td>POLYGON ((-7.98792 39.88262, -7.94094 39.88464...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19997</th>\n",
       "      <td>POLYGON ((-7.94094 39.88464, -7.89397 39.88663...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19998</th>\n",
       "      <td>POLYGON ((-7.89397 39.88663, -7.84698 39.88860...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19999</th>\n",
       "      <td>POLYGON ((-7.84698 39.88860, -7.80000 39.89055...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20000 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                geometry\n",
       "FID                                                     \n",
       "0      POLYGON ((-11.58393 32.47507, -11.54169 32.478...\n",
       "1      POLYGON ((-11.54169 32.47851, -11.49944 32.481...\n",
       "2      POLYGON ((-11.49944 32.48192, -11.45719 32.485...\n",
       "3      POLYGON ((-11.45719 32.48533, -11.41494 32.488...\n",
       "4      POLYGON ((-11.41494 32.48871, -11.37268 32.492...\n",
       "...                                                  ...\n",
       "19995  POLYGON ((-8.03489 39.88059, -7.98792 39.88262...\n",
       "19996  POLYGON ((-7.98792 39.88262, -7.94094 39.88464...\n",
       "19997  POLYGON ((-7.94094 39.88464, -7.89397 39.88663...\n",
       "19998  POLYGON ((-7.89397 39.88663, -7.84698 39.88860...\n",
       "19999  POLYGON ((-7.84698 39.88860, -7.80000 39.89055...\n",
       "\n",
       "[20000 rows x 1 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lcc_grid.create_shapefile()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>geometry</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((-11.58393 32.47507, -11.54169 32.478...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-11.54169 32.47851, -11.49944 32.481...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-11.49944 32.48192, -11.45719 32.485...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-11.45719 32.48533, -11.41494 32.488...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-11.41494 32.48871, -11.37268 32.492...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19995</th>\n",
       "      <td>POLYGON ((-8.03489 39.88059, -7.98792 39.88262...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19996</th>\n",
       "      <td>POLYGON ((-7.98792 39.88262, -7.94094 39.88464...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19997</th>\n",
       "      <td>POLYGON ((-7.94094 39.88464, -7.89397 39.88663...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19998</th>\n",
       "      <td>POLYGON ((-7.89397 39.88663, -7.84698 39.88860...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19999</th>\n",
       "      <td>POLYGON ((-7.84698 39.88860, -7.80000 39.89055...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20000 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                geometry\n",
       "FID                                                     \n",
       "0      POLYGON ((-11.58393 32.47507, -11.54169 32.478...\n",
       "1      POLYGON ((-11.54169 32.47851, -11.49944 32.481...\n",
       "2      POLYGON ((-11.49944 32.48192, -11.45719 32.485...\n",
       "3      POLYGON ((-11.45719 32.48533, -11.41494 32.488...\n",
       "4      POLYGON ((-11.41494 32.48871, -11.37268 32.492...\n",
       "...                                                  ...\n",
       "19995  POLYGON ((-8.03489 39.88059, -7.98792 39.88262...\n",
       "19996  POLYGON ((-7.98792 39.88262, -7.94094 39.88464...\n",
       "19997  POLYGON ((-7.94094 39.88464, -7.89397 39.88663...\n",
       "19998  POLYGON ((-7.89397 39.88663, -7.84698 39.88860...\n",
       "19999  POLYGON ((-7.84698 39.88860, -7.80000 39.89055...\n",
       "\n",
       "[20000 rows x 1 columns]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lcc_grid.shapefile"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa52f9f63d0>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 39848 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "lcc_grid.shapefile.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa530b5e9d0>"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 7296 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "lcc_grid.shapefile[:10].plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Mercator grid"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "lat_ts = -1.5\n",
    "lon_0 = -18.0\n",
    "nx = 100\n",
    "ny = 50\n",
    "inc_x = 50000\n",
    "inc_y = 50000\n",
    "x_0 = -126017.5\n",
    "y_0 = -5407460.0\n",
    "mercator_grid = create_nes(comm=None, info=False, projection='mercator',\n",
    "                           lat_ts=lat_ts, lon_0=lon_0, nx=nx, ny=ny, \n",
    "                           inc_x=inc_x, inc_y=inc_y, x_0=x_0, y_0=y_0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>geometry</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((-19.13242 -43.82824, -18.68311 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-18.68311 -43.82824, -18.23380 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-18.23380 -43.82824, -17.78449 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-17.78449 -43.82824, -17.33518 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-17.33518 -43.82824, -16.88587 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4995</th>\n",
       "      <td>POLYGON ((23.55209 -25.82217, 24.00140 -25.822...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4996</th>\n",
       "      <td>POLYGON ((24.00140 -25.82217, 24.45071 -25.822...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4997</th>\n",
       "      <td>POLYGON ((24.45071 -25.82217, 24.90002 -25.822...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4998</th>\n",
       "      <td>POLYGON ((24.90002 -25.82217, 25.34933 -25.822...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4999</th>\n",
       "      <td>POLYGON ((25.34933 -25.82217, 25.79864 -25.822...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5000 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               geometry\n",
       "FID                                                    \n",
       "0     POLYGON ((-19.13242 -43.82824, -18.68311 -43.8...\n",
       "1     POLYGON ((-18.68311 -43.82824, -18.23380 -43.8...\n",
       "2     POLYGON ((-18.23380 -43.82824, -17.78449 -43.8...\n",
       "3     POLYGON ((-17.78449 -43.82824, -17.33518 -43.8...\n",
       "4     POLYGON ((-17.33518 -43.82824, -16.88587 -43.8...\n",
       "...                                                 ...\n",
       "4995  POLYGON ((23.55209 -25.82217, 24.00140 -25.822...\n",
       "4996  POLYGON ((24.00140 -25.82217, 24.45071 -25.822...\n",
       "4997  POLYGON ((24.45071 -25.82217, 24.90002 -25.822...\n",
       "4998  POLYGON ((24.90002 -25.82217, 25.34933 -25.822...\n",
       "4999  POLYGON ((25.34933 -25.82217, 25.79864 -25.822...\n",
       "\n",
       "[5000 rows x 1 columns]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mercator_grid.create_shapefile()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>geometry</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((-19.13242 -43.82824, -18.68311 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-18.68311 -43.82824, -18.23380 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-18.23380 -43.82824, -17.78449 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-17.78449 -43.82824, -17.33518 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-17.33518 -43.82824, -16.88587 -43.8...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4995</th>\n",
       "      <td>POLYGON ((23.55209 -25.82217, 24.00140 -25.822...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4996</th>\n",
       "      <td>POLYGON ((24.00140 -25.82217, 24.45071 -25.822...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4997</th>\n",
       "      <td>POLYGON ((24.45071 -25.82217, 24.90002 -25.822...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4998</th>\n",
       "      <td>POLYGON ((24.90002 -25.82217, 25.34933 -25.822...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4999</th>\n",
       "      <td>POLYGON ((25.34933 -25.82217, 25.79864 -25.822...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5000 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               geometry\n",
       "FID                                                    \n",
       "0     POLYGON ((-19.13242 -43.82824, -18.68311 -43.8...\n",
       "1     POLYGON ((-18.68311 -43.82824, -18.23380 -43.8...\n",
       "2     POLYGON ((-18.23380 -43.82824, -17.78449 -43.8...\n",
       "3     POLYGON ((-17.78449 -43.82824, -17.33518 -43.8...\n",
       "4     POLYGON ((-17.33518 -43.82824, -16.88587 -43.8...\n",
       "...                                                 ...\n",
       "4995  POLYGON ((23.55209 -25.82217, 24.00140 -25.822...\n",
       "4996  POLYGON ((24.00140 -25.82217, 24.45071 -25.822...\n",
       "4997  POLYGON ((24.45071 -25.82217, 24.90002 -25.822...\n",
       "4998  POLYGON ((24.90002 -25.82217, 25.34933 -25.822...\n",
       "4999  POLYGON ((25.34933 -25.82217, 25.79864 -25.822...\n",
       "\n",
       "[5000 rows x 1 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mercator_grid.shapefile"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa5312392d0>"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAADGCAYAAAA36PApAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKzklEQVR4nO3dYajd913H8ffHRvNgIirJ7NrkejNMh62WTi/FBzociza62ahjEJ+suAch0IGi4ppFVtgIVAoqqEMCDvcgtRSiW1gptBnD7UnXpVvXtUujSbtutXXrVrYIk4y0Xx/cf91JPOm9N//be3O/5/2CS8/5/c/5/3/n1+Td//3fc25TVUiSevqR9Z6AJOn1Y+QlqTEjL0mNGXlJaszIS1JjRl6SGts05slJ7gZ+B/gBcAb4w6r6bpJ54CRwanjow1W1f6n9bdmypebn58dMSZJmzqOPPvrtqto6bduoyAMPAQeq6nySvwQOAB8Ytp2pq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VXXLsG3m1gMgyW8DfwNcBXysqg6t85TWVJJ/Bn6dxd+0+E3gTuATwH3AHPB14D1VdfEPZ9tJ8qvA54CvAK8Mwx9k8br8TK3Hhom8JGnlNszlGknSyhl5SWrMyEtSY0Zekhoz8pLUmJGXpMaMvCQ1ZuQlqbH/BYN50AeobkGYAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mercator_grid.shapefile.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa52f9b1ed0>"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAABDCAYAAABp2fnbAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAH40lEQVR4nO3dX4xcZRnH8e8PV6nUG+O2QeyfWRNKSikhdNhqAmpMWxNJIDVBqqbGGKwGvTGSyp8bE0JCDNgrI1YCaSoBDUQr1tKkvSBGENytu/2LAXRbt1poATVppXbbx4s5S89uzzu7OzM7Z2f7+ySbzJz3vGeefTK7T95z5syjiMDMzKzIJWUHYGZmM5eLhJmZJblImJlZkouEmZkluUiYmVmSi4SZmSW1pEhIuktSSOrOnvdKGsh+BiWtTcz7gaSjuX0/nxu7R9Jrkv4i6XOtiNPMzKamq9kDSFoIrAaO5DbvB6oRMSLpo8CgpGcjYqTgEJsi4qFxx7waWAcsA64AdklaEhFnm43XzMwmr+kiAWwCNgLbRjdExKnc+Bxgqnfs3Qo8FRGngb9Jeg3oBV6sN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wY+BC1T3T8CXg8IvaWFGbb1MkH1FrxDs+GU26TkcpFRLwD/Ija+2IA2BMR28uLtD3qvDc6pkWz77g2M7MkryTMzCzJRcLMzJJcJMzMLMlFwszMklwkzMwsyUXCzMySXCTMzCzJRcLMzJL+D5tmy+hioWQyAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mercator_grid.shapefile[:10].plot()"
   ]
  }
 ],
 "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.7.4"
  },
  "vscode": {
   "interpreter": {
    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
