From 14d71d5a38b54d3ec5f5208ba44ead173a502ce1 Mon Sep 17 00:00:00 2001 From: Alba Vilanova Cortezon Date: Thu, 1 Sep 2022 14:58:41 +0200 Subject: [PATCH] Move lat lon spatial nv dimension creation to default --- nes/nc_projections/default_nes.py | 4 ++++ nes/nc_projections/latlon_nes.py | 18 ------------------ nes/nc_projections/points_nes.py | 4 ---- .../4.3.Providentia_Interpolation.ipynb | 2 +- ...files.ipynb => 5.3.Create_Shapefiles.ipynb} | 0 5 files changed, 5 insertions(+), 23 deletions(-) rename tutorials/5.Others/{5.3.Shapefiles.ipynb => 5.3.Create_Shapefiles.ipynb} (100%) diff --git a/nes/nc_projections/default_nes.py b/nes/nc_projections/default_nes.py index 493a117..b42d9e7 100644 --- a/nes/nc_projections/default_nes.py +++ b/nes/nc_projections/default_nes.py @@ -1642,6 +1642,10 @@ class Nes(object): # Create time_nv (number of vertices) dimension if self._time_bnds is not None: netcdf.createDimension('time_nv', 2) + + # Create spatial_nv (number of vertices) dimension + if (self._lat_bnds is not None) and (self._lon_bnds is not None): + netcdf.createDimension('spatial_nv', 2) # Create lev, lon and lat dimensions netcdf.createDimension('lev', len(self.lev['data'])) diff --git a/nes/nc_projections/latlon_nes.py b/nes/nc_projections/latlon_nes.py index 611dbfa..e18d5f3 100644 --- a/nes/nc_projections/latlon_nes.py +++ b/nes/nc_projections/latlon_nes.py @@ -99,24 +99,6 @@ class LatLonNes(Nes): return new - def _create_dimensions(self, netcdf): - """ - Create 'spatial_nv' dimension and the super dimensions ('time', 'time_nv', 'lev', 'lat', 'lon'). - - Parameters - ---------- - netcdf : Dataset - NetCDF object. - """ - - super(LatLonNes, self)._create_dimensions(netcdf) - - # Create spatial_nv (number of vertices) dimension - if (self._lat_bnds is not None) and (self._lon_bnds is not None): - netcdf.createDimension('spatial_nv', 2) - - return None - def _create_centre_coordinates(self, **kwargs): """ Calculate centre latitudes and longitudes from grid details. diff --git a/nes/nc_projections/points_nes.py b/nes/nc_projections/points_nes.py index 1f4f5d7..f42934c 100644 --- a/nes/nc_projections/points_nes.py +++ b/nes/nc_projections/points_nes.py @@ -136,10 +136,6 @@ class PointsNes(Nes): if self._time_bnds is not None: netcdf.createDimension('time_nv', 2) - # Create spatial_nv (number of vertices) dimension - if (self._lat_bnds is not None) and (self._lon_bnds is not None): - netcdf.createDimension('spatial_nv', 2) - # Create station dimension # The number of longitudes is equal to the number of stations netcdf.createDimension('station', len(self._lon['data'])) diff --git a/tutorials/4.Interpolation/4.3.Providentia_Interpolation.ipynb b/tutorials/4.Interpolation/4.3.Providentia_Interpolation.ipynb index 43456b9..6618c68 100644 --- a/tutorials/4.Interpolation/4.3.Providentia_Interpolation.ipynb +++ b/tutorials/4.Interpolation/4.3.Providentia_Interpolation.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# (Wrong) How to interpolate horizontally using Providentia format" + "# How to interpolate horizontally using Providentia format" ] }, { diff --git a/tutorials/5.Others/5.3.Shapefiles.ipynb b/tutorials/5.Others/5.3.Create_Shapefiles.ipynb similarity index 100% rename from tutorials/5.Others/5.3.Shapefiles.ipynb rename to tutorials/5.Others/5.3.Create_Shapefiles.ipynb -- GitLab