{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# How to create monthly observations datasets (Port Barcelona)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import nes\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from datetime import datetime, timedelta\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. Collect data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We have two dataframes: the first one gives us NO2 hourly data at some stations, and the second one gives us the locations of the stations"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### NO2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "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>NO2-UM</th>\n",
       "      <th>NO2-ZAL Prat</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Horario: UTC</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2017-01-01 00:00:00</th>\n",
       "      <td>64.64</td>\n",
       "      <td>49.08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 01:00:00</th>\n",
       "      <td>68.16</td>\n",
       "      <td>53.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 02:00:00</th>\n",
       "      <td>68.29</td>\n",
       "      <td>46.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 03:00:00</th>\n",
       "      <td>62.91</td>\n",
       "      <td>39.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 04:00:00</th>\n",
       "      <td>47.13</td>\n",
       "      <td>28.86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 13:00:00</th>\n",
       "      <td>35.38</td>\n",
       "      <td>24.96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 14:00:00</th>\n",
       "      <td>35.80</td>\n",
       "      <td>24.16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 15:00:00</th>\n",
       "      <td>29.10</td>\n",
       "      <td>25.79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 16:00:00</th>\n",
       "      <td>9.24</td>\n",
       "      <td>29.82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 17:00:00</th>\n",
       "      <td>12.76</td>\n",
       "      <td>28.66</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>43818 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                     NO2-UM  NO2-ZAL Prat\n",
       "Horario: UTC                             \n",
       "2017-01-01 00:00:00   64.64         49.08\n",
       "2017-01-01 01:00:00   68.16         53.00\n",
       "2017-01-01 02:00:00   68.29         46.75\n",
       "2017-01-01 03:00:00   62.91         39.65\n",
       "2017-01-01 04:00:00   47.13         28.86\n",
       "...                     ...           ...\n",
       "2021-12-31 13:00:00   35.38         24.96\n",
       "2021-12-31 14:00:00   35.80         24.16\n",
       "2021-12-31 15:00:00   29.10         25.79\n",
       "2021-12-31 16:00:00    9.24         29.82\n",
       "2021-12-31 17:00:00   12.76         28.66\n",
       "\n",
       "[43818 rows x 2 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "file_path = '/gpfs/projects/bsc32/models/NES_tutorial_data/Dades_Port_Barcelona_2017-2021_corr.xlsx'\n",
    "df_no2 = pd.read_excel(file_path, header=3, index_col='Horario: UTC').drop(columns=['SO2-UM', 'SO2-Darsena'])\n",
    "df_no2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can see above that the timesteps are slightly wrong (error of data provider), next we make sure that the microseconds are saved as 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "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>NO2-UM</th>\n",
       "      <th>NO2-ZAL Prat</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2017-01-01 00:00:00</th>\n",
       "      <td>64.64</td>\n",
       "      <td>49.08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 01:00:00</th>\n",
       "      <td>68.16</td>\n",
       "      <td>53.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 02:00:00</th>\n",
       "      <td>68.29</td>\n",
       "      <td>46.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 03:00:00</th>\n",
       "      <td>62.91</td>\n",
       "      <td>39.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 04:00:00</th>\n",
       "      <td>47.13</td>\n",
       "      <td>28.86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 13:00:00</th>\n",
       "      <td>35.38</td>\n",
       "      <td>24.96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 14:00:00</th>\n",
       "      <td>35.80</td>\n",
       "      <td>24.16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 15:00:00</th>\n",
       "      <td>29.10</td>\n",
       "      <td>25.79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 16:00:00</th>\n",
       "      <td>9.24</td>\n",
       "      <td>29.82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 17:00:00</th>\n",
       "      <td>12.76</td>\n",
       "      <td>28.66</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>43818 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                     NO2-UM  NO2-ZAL Prat\n",
       "2017-01-01 00:00:00   64.64         49.08\n",
       "2017-01-01 01:00:00   68.16         53.00\n",
       "2017-01-01 02:00:00   68.29         46.75\n",
       "2017-01-01 03:00:00   62.91         39.65\n",
       "2017-01-01 04:00:00   47.13         28.86\n",
       "...                     ...           ...\n",
       "2021-12-31 13:00:00   35.38         24.96\n",
       "2021-12-31 14:00:00   35.80         24.16\n",
       "2021-12-31 15:00:00   29.10         25.79\n",
       "2021-12-31 16:00:00    9.24         29.82\n",
       "2021-12-31 17:00:00   12.76         28.66\n",
       "\n",
       "[43818 rows x 2 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_no2.index = pd.Index([datetime(year=2017, month=1, day=1, minute=0, second=0, microsecond=0) \n",
    "                         + timedelta(hours=i) for i in range(len(df_no2))])\n",
    "df_no2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Stations information"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "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>station.code</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Unitat Mobil</td>\n",
       "      <td>41.373777</td>\n",
       "      <td>2.184514</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>ZAL Prat</td>\n",
       "      <td>41.317277</td>\n",
       "      <td>2.134501</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   station.code        lat       lon\n",
       "1  Unitat Mobil  41.373777  2.184514\n",
       "2      ZAL Prat  41.317277  2.134501"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path = '/gpfs/projects/bsc32/models/NES_tutorial_data/estaciones.csv'\n",
    "df_stations = pd.read_csv(path).drop(columns=['standardised_network_provided_area_classification']).iloc[1:]\n",
    "df_stations"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Create dataset with all timesteps"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Define coordinates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "times = df_no2.index.to_pydatetime()\n",
    "lat = df_stations['lat'][0:2].to_numpy()\n",
    "lon = df_stations['lon'][0:2].to_numpy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "nessy = nes.create_nes(comm=None, info=False, projection=None, parallel_method='X',\n",
    "                   lat=lat, lon=lon, times=times)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Add data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "variables = {'station_name': {'data': df_no2.iloc[:, 0:2].to_numpy(),\n",
    "                              'dimensions': ('station',),\n",
    "                              'dtype': str},\n",
    "             'sconcno2': {'data': df_no2.iloc[:, 0:2].to_numpy(),\n",
    "                          'dimensions': ('time', 'station',),\n",
    "                          'dtype': float}}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "nessy.variables = variables"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Write dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rank 000: Creating points_port_barcelona_no2.nc\n",
      "Rank 000: NetCDF ready to write\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=float64.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rank 000: Dimensions done\n",
      "Rank 000: Writing station_name var (1/2)\n",
      "Rank 000: Var station_name created (1/2)\n",
      "Rank 000: Filling station_name)\n",
      "Rank 000: Var station_name data (1/2)\n",
      "Rank 000: Var station_name completed (1/2)\n",
      "Rank 000: Writing sconcno2 var (2/2)\n",
      "Rank 000: Var sconcno2 created (2/2)\n",
      "Rank 000: Filling sconcno2)\n",
      "Rank 000: Var sconcno2 data (2/2)\n",
      "Rank 000: Var sconcno2 completed (2/2)\n"
     ]
    }
   ],
   "source": [
    "nessy.set_strlen(75)\n",
    "nessy.to_netcdf('points_port_barcelona_no2.nc', info=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. Create one dataset per month (Ready for Providentia)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Add columns with month and year"
   ]
  },
  {
   "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>NO2-UM</th>\n",
       "      <th>NO2-ZAL Prat</th>\n",
       "      <th>month</th>\n",
       "      <th>year</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2017-01-01 00:00:00</th>\n",
       "      <td>64.64</td>\n",
       "      <td>49.08</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 01:00:00</th>\n",
       "      <td>68.16</td>\n",
       "      <td>53.00</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 02:00:00</th>\n",
       "      <td>68.29</td>\n",
       "      <td>46.75</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 03:00:00</th>\n",
       "      <td>62.91</td>\n",
       "      <td>39.65</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-01-01 04:00:00</th>\n",
       "      <td>47.13</td>\n",
       "      <td>28.86</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 13:00:00</th>\n",
       "      <td>35.38</td>\n",
       "      <td>24.96</td>\n",
       "      <td>12</td>\n",
       "      <td>2021</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 14:00:00</th>\n",
       "      <td>35.80</td>\n",
       "      <td>24.16</td>\n",
       "      <td>12</td>\n",
       "      <td>2021</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 15:00:00</th>\n",
       "      <td>29.10</td>\n",
       "      <td>25.79</td>\n",
       "      <td>12</td>\n",
       "      <td>2021</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 16:00:00</th>\n",
       "      <td>9.24</td>\n",
       "      <td>29.82</td>\n",
       "      <td>12</td>\n",
       "      <td>2021</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-31 17:00:00</th>\n",
       "      <td>12.76</td>\n",
       "      <td>28.66</td>\n",
       "      <td>12</td>\n",
       "      <td>2021</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>43818 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                     NO2-UM  NO2-ZAL Prat  month  year\n",
       "2017-01-01 00:00:00   64.64         49.08      1  2017\n",
       "2017-01-01 01:00:00   68.16         53.00      1  2017\n",
       "2017-01-01 02:00:00   68.29         46.75      1  2017\n",
       "2017-01-01 03:00:00   62.91         39.65      1  2017\n",
       "2017-01-01 04:00:00   47.13         28.86      1  2017\n",
       "...                     ...           ...    ...   ...\n",
       "2021-12-31 13:00:00   35.38         24.96     12  2021\n",
       "2021-12-31 14:00:00   35.80         24.16     12  2021\n",
       "2021-12-31 15:00:00   29.10         25.79     12  2021\n",
       "2021-12-31 16:00:00    9.24         29.82     12  2021\n",
       "2021-12-31 17:00:00   12.76         28.66     12  2021\n",
       "\n",
       "[43818 rows x 4 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_no2['month'] = df_no2.index.month\n",
    "df_no2['year'] = df_no2.index.year\n",
    "df_no2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Iterate through each month\n",
    "\n",
    "Altitude is added (with NaNs) because Providentia cannot read observational networks without it"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201701.nc\n",
      "Done sconcno2_201702.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201703.nc\n",
      "Done sconcno2_201704.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201705.nc\n",
      "Done sconcno2_201706.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201707.nc\n",
      "Done sconcno2_201708.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201709.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201710.nc\n",
      "Done sconcno2_201711.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201712.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201801.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201802.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201803.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201804.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201805.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201806.nc"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Done sconcno2_201807.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201808.nc\n",
      "Done sconcno2_201809.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201810.nc\n",
      "Done sconcno2_201811.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201812.nc\n",
      "Done sconcno2_201901.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201902.nc\n",
      "Done sconcno2_201903.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201904.nc\n",
      "Done sconcno2_201905.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201906.nc\n",
      "Done sconcno2_201907.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201908.nc\n",
      "Done sconcno2_201909.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201910.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_201911.nc\n",
      "Done sconcno2_201912.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202001.nc\n",
      "Done sconcno2_202002.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202003.nc\n",
      "Done sconcno2_202004.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202005.nc\n",
      "Done sconcno2_202006.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202007.nc\n",
      "Done sconcno2_202008.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202009.nc\n",
      "Done sconcno2_202010.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202011.nc\n",
      "Done sconcno2_202012.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202101.nc\n",
      "Done sconcno2_202102.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202103.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202104.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202105.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202106.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202107.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202108.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202109.nc\n",
      "Done sconcno2_202110.nc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n",
      "/home/bsc/bsc032781/.local/lib/python3.9/site-packages/nes/nc_projections/points_nes.py:368: UserWarning: WARNING!!! Different data types for variable station_name. Input dtype=<class 'str'>. Data dtype=object.\n",
      "  warn(msg)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done sconcno2_202111.nc\n",
      "Done sconcno2_202112.nc\n"
     ]
    }
   ],
   "source": [
    "for (year, month), current in df_no2.groupby(['year', 'month']):\n",
    "\n",
    "    # Read time\n",
    "    times = current.index.to_pydatetime()\n",
    "    \n",
    "    # Fill altitude with nans\n",
    "    altitude = np.full(len(current.columns[2:4]), np.nan)\n",
    "  \n",
    "    # Read metadata\n",
    "    variables = {'station_name': {'data': current.columns[0:2].to_numpy(),\n",
    "                                  'dimensions': ('station',),\n",
    "                                  'dtype': str,\n",
    "                                  'standard_name': ''},\n",
    "                 'altitude': {'data': altitude,\n",
    "                              'dimensions': ('station',),\n",
    "                              'units': 'meters',\n",
    "                              'standard_name': 'altitude'},\n",
    "                 'sconcno2': {'data': current.iloc[:, 0:2].to_numpy(),\n",
    "                              'units': 'µg m-3',\n",
    "                              'dimensions': ('time', 'station',),\n",
    "                              'long_name': ''}\n",
    "               }\n",
    "    \n",
    "    # Create object\n",
    "    nessy = nes.create_nes(comm=None, info=False, projection=None, parallel_method='X',\n",
    "                           lat=lat, lon=lon, times=times)\n",
    "    \n",
    "    # Assign metadata\n",
    "    nessy.variables = variables\n",
    "    nessy.set_strlen(75)\n",
    "                \n",
    "    # Making directory\n",
    "    netcdf_path = 'port_barcelona/port-barcelona/hourly/sconcno2/'\n",
    "    if not os.path.exists(os.path.dirname(netcdf_path)):\n",
    "        os.makedirs(os.path.dirname(netcdf_path))\n",
    "        \n",
    "    # To run Providentia, this folder should be moved to:\n",
    "    # '/esarchive/obs/' as in '/esarchive/obs/port_barcelona/port-barcelona/hourly/sconcno2'\n",
    "    \n",
    "    # Save files\n",
    "    nessy.to_netcdf(netcdf_path + 'sconcno2_{0}{1}.nc'.format(year, str(month).zfill(2)))\n",
    "    \n",
    "    del nessy\n",
    "    print('Done sconcno2_{0}{1}.nc'.format(year, str(month).zfill(2)))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.16"
  },
  "vscode": {
   "interpreter": {
    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
