diff --git a/.gitignore b/.gitignore index 695ff4b5c26c32a7ac8474a3eb79b412bf4de2d2..e5d46f5e2567228ab637f935c9d2dcdc3087f550 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ tests/test_bash_nord3v2-alba.cmd notebooks/.ipynb_checkpoints .ipynb_checkpoints nes/__pycache__ -nes/nc_projections/__pycache__ \ No newline at end of file +nes/nc_projections/__pycache__ +jupyter_notebooks \ No newline at end of file diff --git a/Jupyter_notebooks/Jupyter_bash_nord3v2.cmd b/Jupyter_notebooks/Jupyter_bash_nord3v2.cmd index 7b2fd04640aa2992d698f7e91096c94c676a4c83..e85ee59f905fc06300c118818690a3890e184b21 100644 --- a/Jupyter_notebooks/Jupyter_bash_nord3v2.cmd +++ b/Jupyter_notebooks/Jupyter_bash_nord3v2.cmd @@ -29,7 +29,8 @@ module load netcdf4-python/1.5.3-foss-2019b-Python-3.7.4 module load cfunits/1.8-foss-2019b-Python-3.7.4 module load xarray/0.19.0-foss-2019b-Python-3.7.4 -export PYTHONPATH=/gpfs/scratch/bsc32/bsc32538/NES_tests/NES:${PYTHONPATH} +# export PYTHONPATH=/gpfs/scratch/bsc32/bsc32538/NES_tests/NES:${PYTHONPATH} +export PYTHONPATH=/esarchive/scratch/avilanova/software/NES:${PYTHONPATH} # DON'T USE ADDRESS BELOW. # DO USE TOKEN BELOW diff --git a/Jupyter_notebooks/NES_create_netcdf_test.ipynb b/Jupyter_notebooks/NES_create_netcdf_test.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..188e4b21e641494213a19e4e2d9f98428b32d8b4 --- /dev/null +++ b/Jupyter_notebooks/NES_create_netcdf_test.ipynb @@ -0,0 +1,924 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from nes import *\n", + "import xarray as xr" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "lat_orig = 41.1\n", + "lon_orig = 1.8\n", + "inc_lat = 0.1\n", + "inc_lon = 0.1\n", + "n_lat = 10\n", + "n_lon = 10\n", + "regular_grid = create_nes(comm=None, info=False, projection='regular', create_nes=True,\n", + " lat_orig=lat_orig, lon_orig=lon_orig, inc_lat=inc_lat, inc_lon=inc_lon, \n", + " n_lat=n_lat, n_lon=n_lon)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank 000: Creating regular_grid.nc\n", + "Rank 000: NetCDF ready to write\n", + "Rank 000: Dimensions done\n" + ] + } + ], + "source": [ + "regular_grid.to_netcdf('regular_grid.nc', info=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.Dataset>\n",
+       "Dimensions:  (time: 1, lev: 1, lat: 10, lon: 10)\n",
+       "Coordinates:\n",
+       "  * time     (time) datetime64[ns] 1996-12-31\n",
+       "  * lev      (lev) float64 0.0\n",
+       "  * lat      (lat) float64 41.15 41.25 41.35 41.45 ... 41.75 41.85 41.95 42.05\n",
+       "  * lon      (lon) float64 1.85 1.95 2.05 2.15 2.25 2.35 2.45 2.55 2.65 2.75\n",
+       "Data variables:\n",
+       "    crs      |S1 b''\n",
+       "Attributes:\n",
+       "    Conventions:  CF-1.7
" + ], + "text/plain": [ + "\n", + "Dimensions: (time: 1, lev: 1, lat: 10, lon: 10)\n", + "Coordinates:\n", + " * time (time) datetime64[ns] 1996-12-31\n", + " * lev (lev) float64 0.0\n", + " * lat (lat) float64 41.15 41.25 41.35 41.45 ... 41.75 41.85 41.95 42.05\n", + " * lon (lon) float64 1.85 1.95 2.05 2.15 2.25 2.35 2.45 2.55 2.65 2.75\n", + "Data variables:\n", + " crs |S1 ...\n", + "Attributes:\n", + " Conventions: CF-1.7" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "xr.open_dataset('regular_grid.nc')" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "centre_lat = 51\n", + "centre_lon = 10\n", + "west_boundary = -35\n", + "south_boundary = -27\n", + "inc_rlat = 0.2\n", + "inc_rlon = 0.2\n", + "n_lat = 10\n", + "n_lon = 10\n", + "grid_north_pole_latitude = 90\n", + "grid_north_pole_longitude = 135\n", + "rotated_grid = create_nes(comm=None, info=False, projection='rotated', create_nes=True,\n", + " centre_lat=centre_lat, centre_lon=centre_lon,\n", + " west_boundary=west_boundary, south_boundary=south_boundary,\n", + " inc_rlat=inc_rlat, inc_rlon=inc_rlon, n_lat=n_lat, n_lon=n_lon, \n", + " grid_north_pole_latitude=grid_north_pole_latitude,\n", + " grid_north_pole_longitude=grid_north_pole_longitude)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank 000: Creating rotated_grid.nc\n", + "Rank 000: NetCDF ready to write\n", + "Rank 000: Dimensions done\n" + ] + } + ], + "source": [ + "rotated_grid.to_netcdf('rotated_grid.nc', info=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.Dataset>\n",
+       "Dimensions:       (time: 1, lev: 1, rlat: 10, rlon: 10)\n",
+       "Coordinates:\n",
+       "  * time          (time) datetime64[ns] 1996-12-31\n",
+       "  * lev           (lev) float64 0.0\n",
+       "  * rlat          (rlat) float64 -27.0 -26.8 -26.6 -26.4 ... -25.6 -25.4 -25.2\n",
+       "  * rlon          (rlon) float64 -35.0 -34.8 -34.6 -34.4 ... -33.6 -33.4 -33.2\n",
+       "Data variables:\n",
+       "    lat           (rlat, rlon) float64 -27.0 -26.8 -26.6 ... -25.6 -25.4 -25.2\n",
+       "    lon           (rlat, rlon) float64 -35.0 -34.8 -34.6 ... -33.6 -33.4 -33.2\n",
+       "    rotated_pole  |S1 b''\n",
+       "Attributes:\n",
+       "    Conventions:  CF-1.7
" + ], + "text/plain": [ + "\n", + "Dimensions: (time: 1, lev: 1, rlat: 10, rlon: 10)\n", + "Coordinates:\n", + " * time (time) datetime64[ns] 1996-12-31\n", + " * lev (lev) float64 0.0\n", + " * rlat (rlat) float64 -27.0 -26.8 -26.6 -26.4 ... -25.6 -25.4 -25.2\n", + " * rlon (rlon) float64 -35.0 -34.8 -34.6 -34.4 ... -33.6 -33.4 -33.2\n", + "Data variables:\n", + " lat (rlat, rlon) float64 ...\n", + " lon (rlat, rlon) float64 ...\n", + " rotated_pole |S1 ...\n", + "Attributes:\n", + " Conventions: CF-1.7" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "xr.open_dataset('rotated_grid.nc')" + ] + } + ], + "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" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Jupyter_notebooks/NES_simple_test.ipynb b/Jupyter_notebooks/NES_simple_test.ipynb index b0eca7fee0afad70b6d657a84995bcc5155959e4..badbd866ce4c13e650b9ae31734f9f605b449a84 100644 --- a/Jupyter_notebooks/NES_simple_test.ipynb +++ b/Jupyter_notebooks/NES_simple_test.ipynb @@ -32,8 +32,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 164 ms, sys: 120 ms, total: 284 ms\n", - "Wall time: 14.5 s\n" + "CPU times: user 181 ms, sys: 125 ms, total: 306 ms\n", + "Wall time: 16 s\n" ] } ], @@ -50,7 +50,7 @@ { "data": { "text/plain": [ - "" + "" ] }, "execution_count": 3, @@ -195,7 +195,7 @@ } ], "source": [ - "nessy.time\n" + "nessy.time" ] }, { @@ -341,8 +341,8 @@ "text": [ "Rank 000: Loading O3 var (1/1)\n", "Rank 000: Loaded O3 var ((109, 24, 361, 467))\n", - "CPU times: user 1.22 s, sys: 6.8 s, total: 8.02 s\n", - "Wall time: 41.7 s\n" + "CPU times: user 1.19 s, sys: 6.98 s, total: 8.17 s\n", + "Wall time: 40.8 s\n" ] } ], @@ -379,8 +379,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 1.13 s, sys: 601 ms, total: 1.73 s\n", - "Wall time: 14.4 s\n" + "CPU times: user 1.09 s, sys: 917 ms, total: 2.01 s\n", + "Wall time: 14.3 s\n" ] } ], @@ -405,8 +405,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 440 ms, sys: 80.1 ms, total: 520 ms\n", - "Wall time: 522 ms\n" + "CPU times: user 409 ms, sys: 81.9 ms, total: 491 ms\n", + "Wall time: 719 ms\n" ] } ], @@ -442,8 +442,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 43 ms, sys: 32.2 ms, total: 75.1 ms\n", - "Wall time: 693 ms\n" + "CPU times: user 45.4 ms, sys: 32.1 ms, total: 77.6 ms\n", + "Wall time: 723 ms\n" ] } ], diff --git a/jupyter_notebooks/jupyter_test_time_bnds.ipynb b/Jupyter_notebooks/NES_time_bnds_test.ipynb similarity index 87% rename from jupyter_notebooks/jupyter_test_time_bnds.ipynb rename to Jupyter_notebooks/NES_time_bnds_test.ipynb index 088acedf1afc08891386f4a5eb774a389947e2ac..caf5608bb3558abe74c990d0f7676221b8bcdb0a 100644 --- a/jupyter_notebooks/jupyter_test_time_bnds.ipynb +++ b/Jupyter_notebooks/NES_time_bnds_test.ipynb @@ -42,15 +42,7 @@ "cell_type": "code", "execution_count": 3, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'data': None, 'dimensions': (), 'grid_mapping_name': 'rotated_latitude_longitude', 'grid_north_pole_latitude': 39.0, 'grid_north_pole_longitude': -170.0} \n" - ] - } - ], + "outputs": [], "source": [ "test = \"/gpfs/scratch/bsc32/bsc32538/mr_multiplyby/OUT/stats_bnds/monarch/a45g/regional/daily_max/O3_all/O3_all-000_2021080300.nc\"\n", "nessy = open_netcdf(path=test, info=True)" @@ -89,7 +81,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:970: UserWarning: WARNING!!! Variable O3_all was not loaded. It will not be written.\n", + "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py:1136: UserWarning: WARNING!!! Variable O3_all was not loaded. It will not be written.\n", " warnings.warn(msg)\n" ] } @@ -636,14 +628,14 @@ " rotated_pole |S1 b''\n", "Attributes:\n", " Conventions: CF-1.7\n", - " comment: Generated on marenostrum4
    • time_bnds
      (time, time_nv)
      datetime64[ns]
      ...
      array([['2020-02-20T00:00:00.000000000', '2020-02-15T00:00:00.000000000']],\n",
      +       "      dtype='datetime64[ns]')
    • O3_all
      (time, lev, rlat, rlon)
      float32
      ...
      units :
      kg/m3
      long_name :
      TRACERS_044
      cell_methods :
      time: maximum (interval: 1hr)
      grid_mapping :
      rotated_pole
      [2282904 values with dtype=float32]
    • rotated_pole
      ()
      |S1
      ...
      grid_mapping_name :
      rotated_latitude_longitude
      grid_north_pole_latitude :
      39.0
      grid_north_pole_longitude :
      -170.0
      array(b'', dtype='|S1')
  • Conventions :
    CF-1.7
    comment :
    Generated on marenostrum4
  • " ], "text/plain": [ "\n", diff --git a/jupyter_notebooks/jupyter_bash_nord3v2.cmd b/jupyter_notebooks/jupyter_bash_nord3v2.cmd deleted file mode 100644 index 805ec0d96a6743021807a229247161077d8d9054..0000000000000000000000000000000000000000 --- a/jupyter_notebooks/jupyter_bash_nord3v2.cmd +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -#SBATCH --ntasks 1 -#SBATCH --time 03:00:00 -#SBATCH --job-name jupyter-notebook -#SBATCH --output logs/log_jupyter-notebook-%J.out -#SBATCH --error logs/log_jupyter-notebook-%J.err -#SBATCH --exclusive - -# get tunneling info -XDG_RUNTIME_DIR="" -port=$(shuf -i8000-9999 -n1) -node=$(hostname -s) -user=$(whoami) - -# print tunneling instructions jupyter-log -echo -e " - -MacOS or linux terminal command to create your ssh tunnel -ssh -N -L ${port}:${node}:${port} ${user}@nord4.bsc.es - -Use a Browser on your local machine to go to: -localhost:${port} (prefix w/ https:// if using password) -" - -# load modules or conda environments here -module load jupyterlab/3.0.9-foss-2019b-Python-3.7.4 -module load Python/3.7.4-GCCcore-8.3.0 -module load netcdf4-python/1.5.3-foss-2019b-Python-3.7.4 -module load cfunits/1.8-foss-2019b-Python-3.7.4 -module load xarray/0.19.0-foss-2019b-Python-3.7.4 - -export PYTHONPATH=/esarchive/scratch/avilanova/software/NES:${PYTHONPATH} - -# DON'T USE ADDRESS BELOW. -# DO USE TOKEN BELOW -jupyter-lab --no-browser --port=${port} --ip=${node} \ No newline at end of file diff --git a/jupyter_notebooks/jupyter_test_create_netcdf.ipynb b/jupyter_notebooks/jupyter_test_create_netcdf.ipynb deleted file mode 100644 index 911232c580ab13c20115d152f7b7752e753a765a..0000000000000000000000000000000000000000 --- a/jupyter_notebooks/jupyter_test_create_netcdf.ipynb +++ /dev/null @@ -1,129 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "from nes import *\n", - "import xarray as xr" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "'NoneType' object does not support item deletion", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 7\u001b[0m regular_grid = create_nes(comm=None, info=False, projection='regular', create_nes=True,\n\u001b[1;32m 8\u001b[0m \u001b[0mlat_orig\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlat_orig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlon_orig\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlon_orig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minc_lat\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0minc_lat\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minc_lon\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0minc_lon\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m n_lat=n_lat, n_lon=n_lon)\n\u001b[0m", - "\u001b[0;32m/esarchive/scratch/avilanova/software/NES/nes/create_nes.py\u001b[0m in \u001b[0;36mcreate_nes\u001b[0;34m(comm, info, projection, create_nes, **kwargs)\u001b[0m\n\u001b[1;32m 40\u001b[0m nessy = LatLonNes(comm=comm, dataset=None, xarray=None, info=info, parallel_method=None,\n\u001b[1;32m 41\u001b[0m \u001b[0mavoid_first_hours\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mavoid_last_hours\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfirst_level\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlast_level\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 42\u001b[0;31m create_nes=create_nes, **kwargs)\n\u001b[0m\u001b[1;32m 43\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 44\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mprojection\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'rotated'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/esarchive/scratch/avilanova/software/NES/nes/nc_projections/latlon_nes.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, comm, path, info, dataset, xarray, parallel_method, avoid_first_hours, avoid_last_hours, first_level, last_level, create_nes, **kwargs)\u001b[0m\n\u001b[1;32m 49\u001b[0m \u001b[0mavoid_first_hours\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mavoid_first_hours\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mavoid_last_hours\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mavoid_last_hours\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0mfirst_level\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfirst_level\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlast_level\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlast_level\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcreate_nes\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcreate_nes\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 51\u001b[0;31m **kwargs)\n\u001b[0m\u001b[1;32m 52\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 53\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcreate_nes\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, comm, path, info, dataset, xarray, parallel_method, avoid_first_hours, avoid_last_hours, first_level, last_level, create_nes, **kwargs)\u001b[0m\n\u001b[1;32m 130\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvariables\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 131\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 132\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_time\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__get_time\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcreate_nes\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 133\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_time_bnds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__get_time_bnds\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcreate_nes\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 134\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py\u001b[0m in \u001b[0;36m__get_time\u001b[0;34m(self, create_nes)\u001b[0m\n\u001b[1;32m 692\u001b[0m \u001b[0mtime\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 693\u001b[0m \u001b[0mtime\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcomm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbcast\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mroot\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 694\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfree_vars\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'time'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 695\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 696\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/esarchive/scratch/avilanova/software/NES/nes/nc_projections/default_nes.py\u001b[0m in \u001b[0;36mfree_vars\u001b[0;34m(self, var_list)\u001b[0m\n\u001b[1;32m 329\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 330\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mvar_name\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mvar_list\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 331\u001b[0;31m \u001b[0;32mdel\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvariables\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mvar_name\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 332\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 333\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mTypeError\u001b[0m: 'NoneType' object does not support item deletion" - ] - } - ], - "source": [ - "lat_orig = 41.1\n", - "lon_orig = 1.8\n", - "inc_lat = 0.1\n", - "inc_lon = 0.1\n", - "n_lat = 10\n", - "n_lon = 10\n", - "regular_grid = create_nes(comm=None, info=False, projection='regular', create_nes=True,\n", - " lat_orig=lat_orig, lon_orig=lon_orig, inc_lat=inc_lat, inc_lon=inc_lon, \n", - " n_lat=n_lat, n_lon=n_lon)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "regular_grid.to_netcdf('regular_grid.nc', info=True)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "xr.open_dataset('regular_grid.nc')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "centre_lat = 51\n", - "centre_lon = 10\n", - "west_boundary = -35\n", - "south_boundary = -27\n", - "inc_rlat = 0.2\n", - "inc_rlon = 0.2\n", - "n_lat = 10\n", - "n_lon = 10\n", - "grid_north_pole_latitude = 90\n", - "grid_north_pole_longitude = 135\n", - "rotated_grid = create_nes(comm=None, info=False, projection='rotated', create_nes=True,\n", - " centre_lat=centre_lat, centre_lon=centre_lon,\n", - " west_boundary=west_boundary, south_boundary=south_boundary,\n", - " inc_rlat=inc_rlat, inc_rlon=inc_rlon, n_lat=n_lat, n_lon=n_lon, \n", - " grid_north_pole_latitude=grid_north_pole_latitude,\n", - " grid_north_pole_longitude=grid_north_pole_longitude)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "rotated_grid.to_netcdf('rotated_grid.nc', info=True)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "xr.open_dataset('rotated_grid.nc')" - ] - } - ], - "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" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/jupyter_notebooks/nc_serial_test3_alba.nc b/jupyter_notebooks/nc_serial_test3_alba.nc deleted file mode 100644 index de4f352c0ae3c2cb6cbbf2f879215ffad5036091..0000000000000000000000000000000000000000 Binary files a/jupyter_notebooks/nc_serial_test3_alba.nc and /dev/null differ diff --git a/jupyter_notebooks/regular_grid.nc b/jupyter_notebooks/regular_grid.nc deleted file mode 100644 index 40b2f7e8f289b511e1ba344f5439f985c0d43b88..0000000000000000000000000000000000000000 Binary files a/jupyter_notebooks/regular_grid.nc and /dev/null differ diff --git a/jupyter_notebooks/rotated_grid.nc b/jupyter_notebooks/rotated_grid.nc deleted file mode 100644 index bfb2a3580c13208f7816904f1a1f3403a2d04546..0000000000000000000000000000000000000000 Binary files a/jupyter_notebooks/rotated_grid.nc and /dev/null differ