{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f685678b-87d0-4ede-b908-1831e2461390",
   "metadata": {},
   "source": [
    "# How to create a fake network"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "eeb44561-b528-4b25-91fa-785b86a24f67",
   "metadata": {},
   "outputs": [],
   "source": [
    "import nes\n",
    "import numpy as np\n",
    "import os"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f6a3f5e7-d663-4e0e-aa2e-d820b8d86347",
   "metadata": {},
   "source": [
    "Function to create an empty array."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "d24d3e4a-d212-41ed-93a2-bb6fde334ecb",
   "metadata": {},
   "outputs": [],
   "source": [
    "def create_empty_array(shape):\n",
    "    empty_array = np.empty(shape)\n",
    "    empty_array[:] = np.nan\n",
    "    return empty_array"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "705fb851-d65d-45ef-bd61-15a80c87e9ef",
   "metadata": {},
   "source": [
    "This is where the network will be saved:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "e412b55a-f12c-4f54-a38f-b932ae207188",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "working_directory = os.getcwd()\n",
    "working_directory"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2c4f5b54-a088-4bef-ab79-ecb16dc50a67",
   "metadata": {},
   "source": [
    "## 1. Set Up information"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6e53f7e1-eb93-4275-9872-fbf6c76466e9",
   "metadata": {},
   "source": [
    "### Introduce the original network directory"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "b4181143-e151-4178-bf6b-b06596a0eb98",
   "metadata": {},
   "outputs": [],
   "source": [
    "path = \"/gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0c958071-0ca6-4d01-b356-20488aa38ed1",
   "metadata": {},
   "source": [
    "### Initialise the species, the original year and the fake network year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "240419bc-c1ff-4e2a-923f-ed732d374707",
   "metadata": {},
   "outputs": [],
   "source": [
    "species = ['sconco3','pm2p5','pm10','sconcno2','sconcco']\n",
    "og_year = 2005\n",
    "fake_year = 2026"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "00e087ec-6751-4cca-b2fd-4c1c50728151",
   "metadata": {},
   "source": [
    "## 2. Iterate through the loop"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "108d4fbc-4663-4783-98f2-fc8690f8f00b",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200501.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202601.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200502.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202602.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200503.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202603.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200504.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202604.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200505.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202605.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200506.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202606.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200507.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202607.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200508.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202608.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200509.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202609.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200510.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202610.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200511.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202611.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconco3/sconco3_200512.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconco3/sconco3_202612.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200501.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202601.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200502.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202602.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200503.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202603.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200504.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202604.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200505.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202605.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200506.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202606.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200507.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202607.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200508.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202608.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200509.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202609.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200510.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202610.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200511.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202611.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm2p5/pm2p5_200512.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm2p5/pm2p5_202612.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200501.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202601.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200502.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202602.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200503.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202603.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200504.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202604.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200505.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202605.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200506.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202606.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200507.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202607.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200508.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202608.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200509.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202609.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200510.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202610.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200511.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202611.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/pm10/pm10_200512.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/pm10/pm10_202612.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200501.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202601.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200502.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202602.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200503.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202603.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200504.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202604.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200505.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202605.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200506.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202606.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200507.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202607.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200508.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202608.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200509.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202609.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200510.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202610.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200511.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202611.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcno2/sconcno2_200512.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcno2/sconcno2_202612.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200501.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202601.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200502.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202602.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200503.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202603.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200504.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202604.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200505.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202605.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200506.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202606.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200507.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202607.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200508.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202608.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200509.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202609.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200510.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202610.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200511.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202611.nc\n",
      "\n",
      "Original: /gpfs/projects/bsc32/AC_cache/obs/ghost/GHOST/1.5/hourly/sconcco/sconcco_200512.nc\n",
      "Saved: /gpfs/scratch/bsc32/bsc032388/nes/tutorials/2.Creation/fake/GHOST_2005/hourly/sconcco/sconcco_202612.nc\n"
     ]
    }
   ],
   "source": [
    "for spec in species:\n",
    "    # get the species directory\n",
    "    spec_path = os.path.join(path,spec)\n",
    "    if os.path.isdir(spec_path):\n",
    "        for month in range(1,13):\n",
    "            str_month = str(month).zfill(2)\n",
    "\n",
    "            # get original nc file path\n",
    "            date_path = os.path.join(spec_path, f\"{spec}_{og_year}{str_month}.nc\")\n",
    "\n",
    "            print(f\"\\nOriginal: {date_path}\")\n",
    "\n",
    "            # load original nc file\n",
    "            ness_nc_file = nes.open_netcdf(path=date_path, info=False)\n",
    "            ness_nc_file.keep_vars([spec,\"station_name\",\"station_reference\"])\n",
    "            ness_nc_file.load()\n",
    "\n",
    "            # get the parameters data\n",
    "            lat = ness_nc_file.lat[\"data\"]\n",
    "            lon = ness_nc_file.lon[\"data\"]\n",
    "            times = ness_nc_file.time\n",
    "\n",
    "            # get the variables data\n",
    "            station_name_data = ness_nc_file.variables[\"station_name\"][\"data\"]\n",
    "            station_reference_data = ness_nc_file.variables[\"station_reference\"][\"data\"]\n",
    "\n",
    "            # get the variable data shape\n",
    "            species_shape = ness_nc_file.variables[spec][\"data\"].shape\n",
    "            \n",
    "            # initialize nes\n",
    "            nessy = nes.create_nes(comm=None, info=False, projection=None, parallel_method='X', lat=lat, lon=lon, times=times)\n",
    "            nessy.variables = {'station_name': {'data': station_name_data,\n",
    "                                            'dimensions': ('station',),\n",
    "                                            'dtype': str},\n",
    "                               'station_reference': {'data': station_reference_data,\n",
    "                                            'dimensions': ('station',),\n",
    "                                            'dtype': str},\n",
    "                                spec: {'data': create_empty_array(species_shape).T,\n",
    "                                            'dimensions': ('time', 'station',),\n",
    "                                            'dtype': float}}\n",
    "\n",
    "            # create the directory\n",
    "            netcdf_path = f'fake/GHOST_2005/hourly/{spec}/'\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/fake/GHOST_2005/hourly/species'\n",
    "\n",
    "            # get the file name\n",
    "            output_file = f'{spec}_{fake_year}{str_month}.nc'\n",
    "\n",
    "            # save nc file\n",
    "            nessy.set_strlen(75)\n",
    "            nessy.to_netcdf(os.path.join(netcdf_path,output_file), info=False) \n",
    "\n",
    "            print(f\"Saved: {os.path.join(working_directory,netcdf_path,output_file)}\")\n",
    "\n",
    "            del nessy"
   ]
  }
 ],
 "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.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
