{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# How to make spatial joins"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from nes import *\n",
    "import geopandas as gpd\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "pd.options.mode.chained_assignment = None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "shapefile_path = '/gpfs/projects/bsc32/models/NES_tutorial_data/timezones_2021c/timezones_2021c.shp'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. From grids that have already been created"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Original path: /esarchive/exp/monarch/a4dd/original_files/000/2022111512/MONARCH_d01_2022111512.nc\n",
    "# Rotated grid from MONARCH\n",
    "original_path = '/gpfs/projects/bsc32/models/NES_tutorial_data/MONARCH_d01_2022111512.nc'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "grid = open_netcdf(original_path)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Spatial join"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2814: UserWarning: Shapefile does not exist. It will be created now.\n",
      "  warnings.warn(msg)\n"
     ]
    }
   ],
   "source": [
    "# Method can be centroid, nearest and intersection\n",
    "grid.spatial_join(shapefile_path, method='centroid')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "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>tzid</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 ((-22.21497 16.22040, -22.05072 16.303...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-22.05072 16.30307, -21.88617 16.385...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-21.88617 16.38537, -21.72137 16.467...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-21.72137 16.46728, -21.55630 16.548...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-21.55630 16.54881, -21.39093 16.629...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95116</th>\n",
       "      <td>POLYGON ((87.25128 59.16191, 87.43402 59.01026...</td>\n",
       "      <td>Asia/Tomsk</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95117</th>\n",
       "      <td>POLYGON ((87.43402 59.01025, 87.61560 58.85850...</td>\n",
       "      <td>Asia/Tomsk</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95118</th>\n",
       "      <td>POLYGON ((87.61560 58.85850, 87.79608 58.70663...</td>\n",
       "      <td>Asia/Tomsk</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95119</th>\n",
       "      <td>POLYGON ((87.79608 58.70663, 87.97543 58.55466...</td>\n",
       "      <td>Asia/Tomsk</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95120</th>\n",
       "      <td>POLYGON ((87.97543 58.55466, 88.15372 58.40260...</td>\n",
       "      <td>Asia/Krasnoyarsk</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>95121 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                geometry              tzid\n",
       "FID                                                                       \n",
       "0      POLYGON ((-22.21497 16.22040, -22.05072 16.303...               NaN\n",
       "1      POLYGON ((-22.05072 16.30307, -21.88617 16.385...               NaN\n",
       "2      POLYGON ((-21.88617 16.38537, -21.72137 16.467...               NaN\n",
       "3      POLYGON ((-21.72137 16.46728, -21.55630 16.548...               NaN\n",
       "4      POLYGON ((-21.55630 16.54881, -21.39093 16.629...               NaN\n",
       "...                                                  ...               ...\n",
       "95116  POLYGON ((87.25128 59.16191, 87.43402 59.01026...        Asia/Tomsk\n",
       "95117  POLYGON ((87.43402 59.01025, 87.61560 58.85850...        Asia/Tomsk\n",
       "95118  POLYGON ((87.61560 58.85850, 87.79608 58.70663...        Asia/Tomsk\n",
       "95119  POLYGON ((87.79608 58.70663, 87.97543 58.55466...        Asia/Tomsk\n",
       "95120  POLYGON ((87.97543 58.55466, 88.15372 58.40260...  Asia/Krasnoyarsk\n",
       "\n",
       "[95121 rows x 2 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "grid.shapefile"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Save timezones data as variable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "timezones = grid.shapefile['tzid'].values.reshape([grid.lat['data'].shape[0], grid.lon['data'].shape[-1]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "grid.variables['tz'] = {'data': timezones,}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable lmp was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable IM was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable JM was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable LM was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable IHRST was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable I_PAR_STA was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable J_PAR_STA was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NPHS was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NCLOD was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NHEAT was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NPREC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NRDLW was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NRDSW was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NSRFC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable AVGMAXLEN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable MDRMINout was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable MDRMAXout was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable MDIMINout was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable MDIMAXout was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable IDAT was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable DXH was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SG1 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SG2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable DSG1 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable DSG2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SGML1 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SGML2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SLDPTH was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ISLTYP was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable IVGTYP was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NCFRCV was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NCFRST was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable FIS was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable GLAT was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable GLON was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable PD was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable VLAT was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable VLON was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ACPREC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable CUPREC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable MIXHT was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable PBLH was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable RLWTOA was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable RSWIN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable U10 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable USTAR was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable V10 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable RMOL was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable T2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable relative_humidity_2m was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable T was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable U was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable V was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SH2O was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SMC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable STC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable AERO_ACPREC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable AERO_CUPREC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable AERO_DEPDRY was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable AERO_OPT_R was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable DRE_SW_TOA was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable DRE_SW_SFC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable DRE_LW_TOA was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable DRE_LW_SFC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ENG_SW_SFC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ADRYDEP was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable WETDEP was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable PH_NO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable HSUM was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable POLR was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_optical_depth_dim was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_optical_depth was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable satellite_AOD_dim was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable satellite_AOD was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_loading_dim was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_loading was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable clear_sky_AOD_dim was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable clear_sky_AOD was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable layer_thickness was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable mid_layer_pressure was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable interface_pressure was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable relative_humidity was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable mid_layer_height was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable mid_layer_height_agl was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable air_density was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable dry_pm10_mass was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable dry_pm2p5_mass was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable QC was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable QR was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable QS was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable QG was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_dust_001 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_dust_002 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_dust_003 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_dust_004 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_dust_005 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_dust_006 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_dust_007 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_dust_008 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_ssa_001 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_ssa_002 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_ssa_003 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_ssa_004 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_ssa_005 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_ssa_006 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_ssa_007 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_ssa_008 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_om_001 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_om_002 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_om_003 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_om_004 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_om_005 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_om_006 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_bc_001 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_bc_002 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_so4_001 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_no3_001 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_no3_002 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_no3_003 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_nh4_001 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_unsp_001 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_unsp_002 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_unsp_003 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_unsp_004 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aero_unsp_005 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NO was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable O3 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NO3 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable N2O5 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable HNO3 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable HONO was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable PNA was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable H2O2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NTR was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ROOH was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable FORM was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ALD2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ALDX was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable PAR was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable CO was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable MEPX was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable MEOH was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable FACD was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable PAN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable PACD was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable AACD was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable PANX was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable OLE was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ETH was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable IOLE was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable TOL was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable CRES was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable OPEN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable MGLY was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable XYL was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ISOP was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ISPD was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable TERP was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SULF was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ETOH was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ETHA was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable CL2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable HOCL was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable FMCL was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable HCL was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable BENZENE was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SESQ was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable NH3 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable DMS was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SOAP_I was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SOAP_T was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SOAP_F was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SOAP_A was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable O was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable O1D was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable OH was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable HO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable XO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable XO2N was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable MEO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable HCO3 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable C2O3 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable CXO3 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ROR was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable TO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable TOLRO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable CRO was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable XYLRO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable ISOPRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable TRPRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SULRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable CL was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable CLO was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable TOLNRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable TOLHRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable XYLNRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable XYLHRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable BENZRO2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable BNZNRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable BNZHRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable SESQRXN was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_dim was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_DUST_1 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_DUST_2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_DUST_3 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_DUST_4 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_DUST_5 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_DUST_6 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_DUST_7 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_DUST_8 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_SALT_total was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_OM_total was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_BC_total was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_SO4_total was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_NO3_total was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_NH4_total was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_UNSPC_1 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_UNSPC_2 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_UNSPC_3 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_UNSPC_4 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n",
      "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:2353: UserWarning: WARNING!!! Variable aerosol_extinction_UNSPC_5 was not loaded. It will not be written.\n",
      "  warnings.warn(msg)\n"
     ]
    }
   ],
   "source": [
    "grid.to_netcdf('grid_with_tz.nc')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "grid_with_tz = open_netcdf('grid_with_tz.nc')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "grid_with_tz.keep_vars('tz')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "grid_with_tz.load()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'data': array([[[['nan', 'nan', 'nan', ..., 'Asia/Riyadh', 'Asia/Riyadh',\n",
       "           'Asia/Aden'],\n",
       "          ['nan', 'nan', 'nan', ..., 'Asia/Riyadh', 'Asia/Riyadh',\n",
       "           'Asia/Riyadh'],\n",
       "          ['nan', 'nan', 'nan', ..., 'Asia/Riyadh', 'Asia/Riyadh',\n",
       "           'Asia/Riyadh'],\n",
       "          ...,\n",
       "          ['America/Pangnirtung', 'America/Pangnirtung',\n",
       "           'America/Pangnirtung', ..., 'Asia/Tomsk', 'Asia/Tomsk',\n",
       "           'Asia/Tomsk'],\n",
       "          ['America/Pangnirtung', 'America/Pangnirtung',\n",
       "           'America/Pangnirtung', ..., 'Asia/Tomsk', 'Asia/Tomsk',\n",
       "           'Asia/Tomsk'],\n",
       "          ['America/Toronto', 'America/Iqaluit', 'America/Pangnirtung',\n",
       "           ..., 'Asia/Tomsk', 'Asia/Tomsk', 'Asia/Krasnoyarsk']]]],\n",
       "       dtype=object),\n",
       " 'dimensions': ('rlat', 'rlon', 'strlen'),\n",
       " 'grid_mapping': 'rotated_pole',\n",
       " 'coordinates': 'lat lon'}"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "grid_with_tz.variables['tz']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Add ozone data of last timestep"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "grid.keep_vars('O3')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "grid.load()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "grid.shapefile['O3'] = grid.variables['O3']['data'][-1, -1, :].ravel()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "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>tzid</th>\n",
       "      <th>O3</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FID</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>POLYGON ((-22.21497 16.22040, -22.05072 16.303...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.025778</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-22.05072 16.30307, -21.88617 16.385...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.025487</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-21.88617 16.38537, -21.72137 16.467...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.025579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-21.72137 16.46728, -21.55630 16.548...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.025752</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-21.55630 16.54881, -21.39093 16.629...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.025959</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95116</th>\n",
       "      <td>POLYGON ((87.25128 59.16191, 87.43402 59.01026...</td>\n",
       "      <td>Asia/Tomsk</td>\n",
       "      <td>0.032334</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95117</th>\n",
       "      <td>POLYGON ((87.43402 59.01025, 87.61560 58.85850...</td>\n",
       "      <td>Asia/Tomsk</td>\n",
       "      <td>0.032313</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95118</th>\n",
       "      <td>POLYGON ((87.61560 58.85850, 87.79608 58.70663...</td>\n",
       "      <td>Asia/Tomsk</td>\n",
       "      <td>0.032317</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95119</th>\n",
       "      <td>POLYGON ((87.79608 58.70663, 87.97543 58.55466...</td>\n",
       "      <td>Asia/Tomsk</td>\n",
       "      <td>0.032341</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95120</th>\n",
       "      <td>POLYGON ((87.97543 58.55466, 88.15372 58.40260...</td>\n",
       "      <td>Asia/Krasnoyarsk</td>\n",
       "      <td>0.032367</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>95121 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                geometry              tzid  \\\n",
       "FID                                                                          \n",
       "0      POLYGON ((-22.21497 16.22040, -22.05072 16.303...               NaN   \n",
       "1      POLYGON ((-22.05072 16.30307, -21.88617 16.385...               NaN   \n",
       "2      POLYGON ((-21.88617 16.38537, -21.72137 16.467...               NaN   \n",
       "3      POLYGON ((-21.72137 16.46728, -21.55630 16.548...               NaN   \n",
       "4      POLYGON ((-21.55630 16.54881, -21.39093 16.629...               NaN   \n",
       "...                                                  ...               ...   \n",
       "95116  POLYGON ((87.25128 59.16191, 87.43402 59.01026...        Asia/Tomsk   \n",
       "95117  POLYGON ((87.43402 59.01025, 87.61560 58.85850...        Asia/Tomsk   \n",
       "95118  POLYGON ((87.61560 58.85850, 87.79608 58.70663...        Asia/Tomsk   \n",
       "95119  POLYGON ((87.79608 58.70663, 87.97543 58.55466...        Asia/Tomsk   \n",
       "95120  POLYGON ((87.97543 58.55466, 88.15372 58.40260...  Asia/Krasnoyarsk   \n",
       "\n",
       "             O3  \n",
       "FID              \n",
       "0      0.025778  \n",
       "1      0.025487  \n",
       "2      0.025579  \n",
       "3      0.025752  \n",
       "4      0.025959  \n",
       "...         ...  \n",
       "95116  0.032334  \n",
       "95117  0.032313  \n",
       "95118  0.032317  \n",
       "95119  0.032341  \n",
       "95120  0.032367  \n",
       "\n",
       "[95121 rows x 3 columns]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "grid.shapefile"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot timezones in grid domain"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 472556 characters]\n",
      "text/plain": [
       "<Figure size 1440x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots(1, figsize=(20, 7))\n",
    "\n",
    "gdf_grid = grid.shapefile\n",
    "gdf_grid.plot(ax=ax, column='tzid', cmap='seismic', legend=True, legend_kwds={'ncol': 5})\n",
    "leg = ax.get_legend()\n",
    "leg.set_bbox_to_anchor((1.05, -0.05))\n",
    "\n",
    "ax.margins(0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot ozone for available timezones in grid domain"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 311288 characters]\n",
      "text/plain": [
       "<Figure size 1440x504 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots(1, figsize=(20, 7))\n",
    "\n",
    "gdf_grid = grid.shapefile.dropna()\n",
    "gdf_grid.plot(ax=ax, column='O3', cmap='jet', legend=True)\n",
    "\n",
    "ax.margins(0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot ozone in Spain, Portugal and France"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 130588 characters]\n",
      "text/plain": [
       "<Figure size 1440x504 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots(1, figsize=(20, 7))\n",
    "\n",
    "gdf_grid = grid.shapefile[grid.shapefile['tzid'].isin(['Europe/Madrid', 'Europe/Lisbon', 'Europe/Paris'])]\n",
    "gdf_grid.plot(ax=ax, column='O3', cmap='jet', legend=True)\n",
    "\n",
    "ax.set_xlim([-11, 11])\n",
    "ax.set_ylim([35, 52])\n",
    "ax.margins(0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. With new grid"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "projection = 'regular'\n",
    "lat_orig = 35\n",
    "lon_orig = -11\n",
    "inc_lat = 0.2\n",
    "inc_lon = 0.2\n",
    "n_lat = 100\n",
    "n_lon = 150"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Spatial join"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Method can be centroid, nearest and intersection\n",
    "regular_grid = from_shapefile(shapefile_path, method='centroid', projection=projection, \n",
    "                              lat_orig=lat_orig, lon_orig=lon_orig, \n",
    "                              inc_lat=inc_lat, inc_lon=inc_lon, \n",
    "                              n_lat=n_lat, n_lon=n_lon)"
   ]
  },
  {
   "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",
       "      <th>tzid</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.00000 35.00000, -10.80000 35.000...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>POLYGON ((-10.80000 35.00000, -10.60000 35.000...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>POLYGON ((-10.60000 35.00000, -10.40000 35.000...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>POLYGON ((-10.40000 35.00000, -10.20000 35.000...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>POLYGON ((-10.20000 35.00000, -10.00000 35.000...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14995</th>\n",
       "      <td>POLYGON ((18.00000 54.80000, 18.20000 54.80000...</td>\n",
       "      <td>Europe/Warsaw</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14996</th>\n",
       "      <td>POLYGON ((18.20000 54.80000, 18.40000 54.80000...</td>\n",
       "      <td>Europe/Warsaw</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14997</th>\n",
       "      <td>POLYGON ((18.40000 54.80000, 18.60000 54.80000...</td>\n",
       "      <td>Europe/Warsaw</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14998</th>\n",
       "      <td>POLYGON ((18.60000 54.80000, 18.80000 54.80000...</td>\n",
       "      <td>Europe/Warsaw</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14999</th>\n",
       "      <td>POLYGON ((18.80000 54.80000, 19.00000 54.80000...</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>15000 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                geometry           tzid\n",
       "FID                                                                    \n",
       "0      POLYGON ((-11.00000 35.00000, -10.80000 35.000...            NaN\n",
       "1      POLYGON ((-10.80000 35.00000, -10.60000 35.000...            NaN\n",
       "2      POLYGON ((-10.60000 35.00000, -10.40000 35.000...            NaN\n",
       "3      POLYGON ((-10.40000 35.00000, -10.20000 35.000...            NaN\n",
       "4      POLYGON ((-10.20000 35.00000, -10.00000 35.000...            NaN\n",
       "...                                                  ...            ...\n",
       "14995  POLYGON ((18.00000 54.80000, 18.20000 54.80000...  Europe/Warsaw\n",
       "14996  POLYGON ((18.20000 54.80000, 18.40000 54.80000...  Europe/Warsaw\n",
       "14997  POLYGON ((18.40000 54.80000, 18.60000 54.80000...  Europe/Warsaw\n",
       "14998  POLYGON ((18.60000 54.80000, 18.80000 54.80000...  Europe/Warsaw\n",
       "14999  POLYGON ((18.80000 54.80000, 19.00000 54.80000...            NaN\n",
       "\n",
       "[15000 rows x 2 columns]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "regular_grid.shapefile"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot timezones in Spain, Portugal and France"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12872 characters]\n",
      "text/plain": [
       "<Figure size 1440x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots(1, figsize=(20, 7))\n",
    "\n",
    "gdf_grid = regular_grid.shapefile[regular_grid.shapefile['tzid'].isin(['Europe/Madrid', \n",
    "                                                                       'Europe/Lisbon', \n",
    "                                                                       'Europe/Paris'])]\n",
    "gdf_grid.plot(ax=ax, column='tzid', cmap='viridis', legend=True)\n",
    "\n",
    "ax.set_xlim([-11, 11])\n",
    "ax.set_ylim([35, 52])\n",
    "ax.margins(0)"
   ]
  }
 ],
 "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
}
