diff --git a/nes/interpolation/vertical_interpolation.py b/nes/interpolation/vertical_interpolation.py index ebcb8f7b3a48d7c0709321530a08817a88d8df15..774edb76476b832ec81dbdf7fe424a5a9e7e1d64 100644 --- a/nes/interpolation/vertical_interpolation.py +++ b/nes/interpolation/vertical_interpolation.py @@ -199,4 +199,4 @@ def interpolate_vertical(self, new_levels, new_src_vertical=None, kind='linear', self.free_vars(self.vertical_var_name) self.vertical_var_name = None - return None + return self diff --git a/nes/nc_projections/default_nes.py b/nes/nc_projections/default_nes.py index aac531c4272abf692649944ce9aef7342becc72e..81ab079b25c2498664e2e21840c78b5c7097f91a 100644 --- a/nes/nc_projections/default_nes.py +++ b/nes/nc_projections/default_nes.py @@ -441,37 +441,7 @@ class Nes(object): return None - def set_lat_bnds(self, lat_bnds): - """ - Modify the original latitude bounds values with new ones. - - Parameters - ---------- - lat_bnds : list - List with the new latitude bounds information to be set. - """ - - self._lat_bnds = deepcopy(lat_bnds) - self.lat_bnds = deepcopy(lat_bnds) - - return None - - def set_lon_bnds(self, lon_bnds): - """ - Modify the original longitude bounds values with new ones. - - Parameters - ---------- - lon_bnds : list - List with the new longitude bounds information to be set. - """ - - self._lon_bnds = deepcopy(lon_bnds) - self.lon_bnds = deepcopy(lon_bnds) - - return None - - def create_bounds(self, coordinates, inc, spatial_nv=2, inverse=False): + def create_single_spatial_bounds(self, coordinates, inc, spatial_nv=2, inverse=False): """ Calculate the vertices coordinates. @@ -514,6 +484,27 @@ class Nes(object): return bounds + def create_spatial_bounds(self): + """ + Calculate longitude and latitude bounds and set them. + """ + + inc_lat = np.abs(np.mean(np.diff(self._lat['data']))) + lat_bnds = self.create_single_spatial_bounds(self._lat['data'], inc_lat, spatial_nv=2) + + self._lat_bnds = deepcopy(lat_bnds) + self.lat_bnds = lat_bnds[self.write_axis_limits['y_min']:self.write_axis_limits['y_max'], + :] + + inc_lon = np.abs(np.mean(np.diff(self._lon['data']))) + lon_bnds = self.create_single_spatial_bounds(self._lon['data'], inc_lon, spatial_nv=2) + + self._lon_bnds = deepcopy(lon_bnds) + self.lon_bnds = lon_bnds[self.write_axis_limits['x_min']:self.write_axis_limits['x_max'], + :] + + return None + def free_vars(self, var_list): """ Erase the selected variables from the variables information. @@ -1172,7 +1163,8 @@ class Nes(object): if 'time_bnds' in self.netcdf.variables.keys(): time = self.netcdf.variables['time'] nc_var = self.netcdf.variables['time_bnds'] - time_bnds = num2date(nc_var[:], self.__parse_time_unit(time.units), calendar=time.calendar).tolist() + time_bnds = num2date(nc_var[:], self.__parse_time_unit(time.units), + calendar=time.calendar).tolist() else: time_bnds = None else: @@ -1442,9 +1434,11 @@ class Nes(object): return None def to_dtype(self, data_type='float32'): + for var_name, var_info in self.variables.items(): if var_info['data'] is not None: self.variables[var_name]['data'] = self.variables[var_name]['data'].astype(data_type) + return None def concatenate(self, aux_nessy): @@ -1820,6 +1814,8 @@ class Nes(object): msg += 'Variable {0} was not loaded. It will not be written.'.format(var_name) warnings.warn(msg) + return None + def _create_centre_coordinates(self): """ Must be implemented on inner class. @@ -2062,6 +2058,7 @@ class Nes(object): new_nc.__to_grib2(path, grib_keys, grib_template_path, info=info) else: self.__to_grib2(path, grib_keys, grib_template_path, info=info) + return None def __gather_data_py_object(self): diff --git a/nes/nc_projections/latlon_nes.py b/nes/nc_projections/latlon_nes.py index d8f05eea59c29ad128353768563a93c8c429c27e..611dbfaff8c398091cb9438136dbe7e577da004b 100644 --- a/nes/nc_projections/latlon_nes.py +++ b/nes/nc_projections/latlon_nes.py @@ -45,6 +45,7 @@ class LatLonNes(Nes): avoid_last_hours : int Number of hours to remove from last time steps. """ + super(LatLonNes, self).__init__(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, parallel_method=parallel_method, balanced=balanced, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, @@ -91,9 +92,11 @@ class LatLonNes(Nes): Indicates the parallelization method that you want. Default: 'Y'. Accepted values: ['X', 'Y', 'T']. """ + new = LatLonNes(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, balanced=balanced, parallel_method=parallel_method, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, first_level=first_level, last_level=last_level) + return new def _create_dimensions(self, netcdf): @@ -179,8 +182,8 @@ class LatLonNes(Nes): inc_lat = np.abs(np.mean(np.diff(self.lat['data']))) # Get bounds - lat_bounds = self.create_bounds(self.lat['data'], inc_lat) - lon_bounds = self.create_bounds(self.lon['data'], inc_lon) + lat_bounds = self.create_single_spatial_bounds(self.lat['data'], inc_lat) + lon_bounds = self.create_single_spatial_bounds(self.lon['data'], inc_lon) # Get latitudes for grid edge left_edge_lat = np.append(lat_bounds.flatten()[::2], lat_bounds.flatten()[-1]) @@ -213,6 +216,7 @@ class LatLonNes(Nes): var : Variable netCDF4-python variable object. """ + var.grid_mapping = 'crs' return None @@ -250,4 +254,5 @@ class LatLonNes(Nes): info : bool Indicates if you want to print extra information during the process. """ + return super(LatLonNes, self).to_grib2(path, grib_keys, grib_template_path, info=info) diff --git a/nes/nc_projections/lcc_nes.py b/nes/nc_projections/lcc_nes.py index db92c9bee963994331e0123eac40cfd68da9363e..309767dc087104f966ffe7337bd603d57a220de4 100644 --- a/nes/nc_projections/lcc_nes.py +++ b/nes/nc_projections/lcc_nes.py @@ -3,6 +3,7 @@ import numpy as np from cfunits import Units from pyproj import Proj +from copy import deepcopy from .default_nes import Nes @@ -55,6 +56,7 @@ class LCCNes(Nes): avoid_last_hours : int Number of hours to remove from last time steps. """ + super(LCCNes, self).__init__(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, parallel_method=parallel_method, balanced=balanced, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, @@ -112,9 +114,11 @@ class LCCNes(Nes): Indicates the parallelization method that you want. Default: 'Y'. Accepted values: ['X', 'Y', 'T']. """ + new = LCCNes(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, balanced=balanced, parallel_method=parallel_method, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, first_level=first_level, last_level=last_level) + return new def get_projection_data(self, create_nes, **kwargs): @@ -151,6 +155,7 @@ class LCCNes(Nes): netcdf : Dataset NetCDF object. """ + super(LCCNes, self)._create_dimensions(netcdf) # Create y and x dimensions @@ -284,8 +289,8 @@ class LCCNes(Nes): inc_y = np.abs(np.mean(np.diff(self.y['data']))) # Get bounds for rotated coordinates - y_bounds = self.create_bounds(self.y['data'], inc_y) - x_bounds = self.create_bounds(self.x['data'], inc_x) + y_bounds = self.create_single_spatial_bounds(self.y['data'], inc_y) + x_bounds = self.create_single_spatial_bounds(self.x['data'], inc_x) # Get rotated latitudes for grid edge left_edge_y = np.append(y_bounds.flatten()[::2], y_bounds.flatten()[-1]) @@ -325,6 +330,29 @@ class LCCNes(Nes): return grid_edge_lat, grid_edge_lon + def create_spatial_bounds(self): + """ + Calculate longitude and latitude bounds and set them. + """ + + inc_lat = np.abs(np.mean(np.diff(self._lat['data']))) + lat_bnds = self.create_single_spatial_bounds(self._lat['data'], inc_lat, spatial_nv=4) + + self._lat_bnds = deepcopy(lat_bnds) + self.lat_bnds = lat_bnds[self.write_axis_limits['y_min']:self.write_axis_limits['y_max'], + self.write_axis_limits['x_min']:self.write_axis_limits['x_max'], + :] + + inc_lon = np.abs(np.mean(np.diff(self._lon['data']))) + lon_bnds = self.create_single_spatial_bounds(self._lon['data'], inc_lon, spatial_nv=4) + + self._lon_bnds = deepcopy(lon_bnds) + self.lon_bnds = lon_bnds[self.write_axis_limits['y_min']:self.write_axis_limits['y_max'], + self.write_axis_limits['x_min']:self.write_axis_limits['x_max'], + :] + + return None + @staticmethod def _set_var_crs(var): """ @@ -335,6 +363,7 @@ class LCCNes(Nes): var : Variable netCDF4-python variable object. """ + var.grid_mapping = 'Lambert_conformal' return None @@ -372,4 +401,5 @@ class LCCNes(Nes): info : bool Indicates if you want to print extra information during the process. """ + raise NotImplementedError("Grib2 format cannot be write in a Lambert Conformal Conic projection.") diff --git a/nes/nc_projections/mercator_nes.py b/nes/nc_projections/mercator_nes.py index 50e2a691da6f07a419d377796f4b4fb1ac310e77..43de48e8aad3254c26eb8c149e08eef0d63ed72c 100644 --- a/nes/nc_projections/mercator_nes.py +++ b/nes/nc_projections/mercator_nes.py @@ -3,6 +3,7 @@ import numpy as np from cfunits import Units from pyproj import Proj +from copy import deepcopy from nes.nc_projections.default_nes import Nes @@ -55,6 +56,7 @@ class MercatorNes(Nes): avoid_last_hours : int Number of hours to remove from last time steps. """ + super(MercatorNes, self).__init__(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, parallel_method=parallel_method, balanced=balanced, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, @@ -113,9 +115,11 @@ class MercatorNes(Nes): Indicates the parallelization method that you want. Default: 'Y'. Accepted values: ['X', 'Y', 'T']. """ + new = MercatorNes(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, balanced=balanced, parallel_method=parallel_method, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, first_level=first_level, last_level=last_level) + return new def get_projection_data(self, create_nes, **kwargs): @@ -280,8 +284,8 @@ class MercatorNes(Nes): inc_y = np.abs(np.mean(np.diff(self.y['data']))) # Get bounds for rotated coordinates - y_bounds = self.create_bounds(self.y['data'], inc_y) - x_bounds = self.create_bounds(self.x['data'], inc_x) + y_bounds = self.create_single_spatial_bounds(self.y['data'], inc_y) + x_bounds = self.create_single_spatial_bounds(self.x['data'], inc_x) # Get rotated latitudes for grid edge left_edge_y = np.append(y_bounds.flatten()[::2], y_bounds.flatten()[-1]) @@ -314,6 +318,29 @@ class MercatorNes(Nes): return grid_edge_lat, grid_edge_lon + def create_spatial_bounds(self): + """ + Calculate longitude and latitude bounds and set them. + """ + + inc_lat = np.abs(np.mean(np.diff(self._lat['data']))) + lat_bnds = self.create_single_spatial_bounds(self._lat['data'], inc_lat, spatial_nv=4) + + self._lat_bnds = deepcopy(lat_bnds) + self.lat_bnds = lat_bnds[self.write_axis_limits['y_min']:self.write_axis_limits['y_max'], + self.write_axis_limits['x_min']:self.write_axis_limits['x_max'], + :] + + inc_lon = np.abs(np.mean(np.diff(self._lon['data']))) + lon_bnds = self.create_single_spatial_bounds(self._lon['data'], inc_lon, spatial_nv=4) + + self._lon_bnds = deepcopy(lon_bnds) + self.lon_bnds = lon_bnds[self.write_axis_limits['y_min']:self.write_axis_limits['y_max'], + self.write_axis_limits['x_min']:self.write_axis_limits['x_max'], + :] + + return None + @staticmethod def _set_var_crs(var): """ @@ -324,6 +351,7 @@ class MercatorNes(Nes): var : Variable netCDF4-python variable object. """ + var.grid_mapping = 'mercator' return None @@ -360,4 +388,5 @@ class MercatorNes(Nes): info : bool Indicates if you want to print extra information during the process. """ + raise NotImplementedError("Grib2 format cannot be write in a Mercator projection.") diff --git a/nes/nc_projections/points_nes.py b/nes/nc_projections/points_nes.py index 8136d6ce487347364890926ab598b2fc6a6d4622..e7374c01ce3e133e1cb223c6332c29bd654b1d93 100644 --- a/nes/nc_projections/points_nes.py +++ b/nes/nc_projections/points_nes.py @@ -110,9 +110,11 @@ class PointsNes(Nes): Indicates the parallelization method that you want. Default: 'X'. accepted values: ['X', 'T']. """ + new = PointsNes(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, balanced=balanced, parallel_method=parallel_method, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, first_level=first_level, last_level=last_level) + return new def _create_dimensions(self, netcdf): @@ -481,6 +483,8 @@ class PointsNes(Nes): msg += "Variable {0} was not loaded. It will not be written.".format(var_name) warnings.warn(msg) + return None + def _gather_data(self): """ Gather all the variable data into the MPI rank 0 to perform a serial write. @@ -578,6 +582,13 @@ class PointsNes(Nes): return None + def create_spatial_bounds(self): + """ + Calculate longitude and latitude bounds and set them. + """ + + raise NotImplementedError("Spatial bounds cannot be created for points datasets.") + def to_grib2(self, path, grib_keys, grib_template_path, info=False): """ Write output file with grib2 format. @@ -593,6 +604,7 @@ class PointsNes(Nes): info : bool Indicates if you want to print extra information during the process. """ + raise NotImplementedError("Grib2 format cannot be write with point data.") def to_providentia(self, model_centre_lon, model_centre_lat, grid_edge_lon, grid_edge_lat): diff --git a/nes/nc_projections/points_nes_ghost.py b/nes/nc_projections/points_nes_ghost.py index b8fc489a115f35c23fb1b22593aa05039dbd759a..d5361ae2b3f79e019736ce2c45272b7fce082e26 100644 --- a/nes/nc_projections/points_nes_ghost.py +++ b/nes/nc_projections/points_nes_ghost.py @@ -120,9 +120,11 @@ class PointsNesGHOST(PointsNes): Indicates if you want to create the object from scratch (True) or through an existing file. """ + new = PointsNesGHOST(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, balanced=balanced, parallel_method=parallel_method, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, first_level=first_level, last_level=last_level) + return new def _create_dimensions(self, netcdf): @@ -231,12 +233,14 @@ class PointsNesGHOST(PointsNes): lon_bnds_var[:] = self._lon_bnds[:] def erase_flags(self): + first_time_idx = self.get_time_id(self.hours_start, first=True) last_time_idx = self.get_time_id(self.hours_end, first=False) t_len = last_time_idx - first_time_idx self._qa['data'] = np.empty((len(self._lon['data']), t_len, 0)) self._flag['data'] = np.empty((len(self._lon['data']), t_len, 0)) + return None def _get_coordinate_values(self, coordinate_info, coordinate_axis): @@ -468,6 +472,8 @@ class PointsNesGHOST(PointsNes): msg = 'WARNING!!! ' msg += 'Variable {0} was not loaded. It will not be written.'.format(var_name) warnings.warn(msg) + + return None def _gather_data(self): """ @@ -478,6 +484,7 @@ class PointsNesGHOST(PointsNes): data_list: dict Variables dictionary with all the data from all the ranks. """ + data_list = deepcopy(self.variables) for var_name, var_info in data_list.items(): try: diff --git a/nes/nc_projections/points_nes_providentia.py b/nes/nc_projections/points_nes_providentia.py index 347bf31626d0029ac6f989f5aedfc326e8e80027..011b1dc71972777082945b8ef4312169e3114a4f 100644 --- a/nes/nc_projections/points_nes_providentia.py +++ b/nes/nc_projections/points_nes_providentia.py @@ -160,11 +160,13 @@ class PointsNesProvidentia(PointsNes): grid_edge_lat : dict Grid edge latitudes dictionary with the portion of 'data' corresponding to the rank values. """ + new = PointsNesProvidentia(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, balanced=balanced, parallel_method=parallel_method, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, first_level=first_level, last_level=last_level, model_centre_lon=model_centre_lon, model_centre_lat=model_centre_lat, grid_edge_lon=grid_edge_lon, grid_edge_lat=grid_edge_lat) + return new def _create_dimensions(self, netcdf): @@ -490,7 +492,9 @@ class PointsNesProvidentia(PointsNes): msg = 'WARNING!!! ' msg += 'Variable {0} was not loaded. It will not be written.'.format(var_name) warnings.warn(msg) - + + return None + def _gather_data(self): """ Gather all the variable data into the MPI rank 0 to perform a serial write. diff --git a/nes/nc_projections/rotated_nes.py b/nes/nc_projections/rotated_nes.py index 697921e36855b89623d0305fafc9e4f718a2eddb..d87f7e528d8a07976b6d77d61dd7ba88f25a77fd 100644 --- a/nes/nc_projections/rotated_nes.py +++ b/nes/nc_projections/rotated_nes.py @@ -3,6 +3,7 @@ import numpy as np import math from cfunits import Units +from copy import deepcopy from .default_nes import Nes @@ -58,6 +59,7 @@ class RotatedNes(Nes): avoid_last_hours : int Number of hours to remove from last time steps. """ + super(RotatedNes, self).__init__(comm=comm, path=path, info=info, dataset=dataset, balanced=balanced, xarray=xarray, parallel_method=parallel_method, @@ -114,6 +116,7 @@ class RotatedNes(Nes): Indicates the parallelization method that you want. Default: 'Y'. Accepted values: ['X', 'Y', 'T']. """ + new = RotatedNes(comm=comm, path=path, info=info, dataset=dataset, xarray=xarray, balanced=balanced, parallel_method=parallel_method, avoid_first_hours=avoid_first_hours, avoid_last_hours=avoid_last_hours, first_level=first_level, last_level=last_level) @@ -152,6 +155,7 @@ class RotatedNes(Nes): netcdf : Dataset NetCDF object. """ + super(RotatedNes, self)._create_dimensions(netcdf) # Create rlat and rlon dimensions @@ -342,8 +346,8 @@ class RotatedNes(Nes): inc_rlat = np.abs(np.mean(np.diff(self.rlat['data']))) # Get bounds for rotated coordinates - rlat_bounds = self.create_bounds(self.rlat['data'], inc_rlat) - rlon_bounds = self.create_bounds(self.rlon['data'], inc_rlon) + rlat_bounds = self.create_single_spatial_bounds(self.rlat['data'], inc_rlat) + rlon_bounds = self.create_single_spatial_bounds(self.rlon['data'], inc_rlon) # Get rotated latitudes for grid edge left_edge_rlat = np.append(rlat_bounds.flatten()[::2], rlat_bounds.flatten()[-1]) @@ -370,6 +374,29 @@ class RotatedNes(Nes): return grid_edge_lat, grid_edge_lon + def create_spatial_bounds(self): + """ + Calculate longitude and latitude bounds and set them. + """ + + inc_lat = np.abs(np.mean(np.diff(self._lat['data']))) + lat_bnds = self.create_single_spatial_bounds(self._lat['data'], inc_lat, spatial_nv=4) + + self._lat_bnds = deepcopy(lat_bnds) + self.lat_bnds = lat_bnds[self.write_axis_limits['y_min']:self.write_axis_limits['y_max'], + self.write_axis_limits['x_min']:self.write_axis_limits['x_max'], + :] + + inc_lon = np.abs(np.mean(np.diff(self._lon['data']))) + lon_bnds = self.create_single_spatial_bounds(self._lon['data'], inc_lon, spatial_nv=4) + + self._lon_bnds = deepcopy(lon_bnds) + self.lon_bnds = lon_bnds[self.write_axis_limits['y_min']:self.write_axis_limits['y_max'], + self.write_axis_limits['x_min']:self.write_axis_limits['x_max'], + :] + + return None + @staticmethod def _set_var_crs(var): """ @@ -380,6 +407,7 @@ class RotatedNes(Nes): var : Variable netCDF4-python variable object. """ + var.grid_mapping = 'rotated_pole' return None @@ -416,4 +444,5 @@ class RotatedNes(Nes): info : bool Indicates if you want to print extra information during the process. """ + raise NotImplementedError("Grib2 format cannot be write in a Rotated pole projection.") diff --git a/tutorials/1.Introduction/1.1.Read_Write_Regular.ipynb b/tutorials/1.Introduction/1.1.Read_Write_Regular.ipynb index 8042212eed3d151c56a10fbbd1a3e796818dbec6..90d1d0cb6f733e4624976371a0694ab5918bb2e2 100644 --- a/tutorials/1.Introduction/1.1.Read_Write_Regular.ipynb +++ b/tutorials/1.Introduction/1.1.Read_Write_Regular.ipynb @@ -27,16 +27,6 @@ "nc_path_1 = '/gpfs/scratch/bsc32/bsc32538/mr_multiplyby/original_file/MONARCH_d01_2008123100.nc'" ] }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "# ERROR when files have lat_bnds, lon_bnds \n", - "#nc_path_1 = '/esarchive/exp/ecearth/a2vx/original_files/cmorfiles-fixed/CMIP/EC-Earth-Consortium/EC-Earth3-AerChem/historical/r4i1p1f1/Amon/ch4/gn/v20200609/ch4_Amon_EC-Earth3-AerChem_historical_r4i1p1f1_gn_185001-185012.nc'" - ] - }, { "cell_type": "markdown", "metadata": {}, diff --git a/tutorials/4.Interpolation/4.1.Vertical_Interpolation.ipynb b/tutorials/4.Interpolation/4.1.Vertical_Interpolation.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..435f3463ff05277fbf3f4b7b146a622f225136c2 --- /dev/null +++ b/tutorials/4.Interpolation/4.1.Vertical_Interpolation.ipynb @@ -0,0 +1,479 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# How to interpolate vertically" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from nes import *" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 1. Interpolation with vertical coordinate and variable to interpolate in one file" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1.1. Read dataset to interpolate" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "source_path = '/gpfs/scratch/bsc32/bsc32538/original_files/CAMS_MONARCH_d01_2022070412.nc'" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "source_grid = open_netcdf(path=source_path, info=True, avoid_first_hours=12, avoid_last_hours=73)\n", + "source_grid" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'data': masked_array(data=[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,\n", + " 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],\n", + " mask=False,\n", + " fill_value=999999,\n", + " dtype=int32),\n", + " 'dimensions': ('lm',),\n", + " 'units': '',\n", + " 'long_name': 'layer id'}" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "source_grid.lev" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "source_grid.keep_vars(['O3', 'mid_layer_height_agl'])" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank 000: Loading mid_layer_height_agl var (1/2)\n", + "Rank 000: Loaded mid_layer_height_agl var ((24, 24, 361, 467))\n", + "Rank 000: Loading O3 var (2/2)\n", + "Rank 000: Loaded O3 var ((24, 24, 361, 467))\n" + ] + } + ], + "source": [ + "source_grid.load()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1.2. Interpolate" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "level_list = [0.,50.,100.,250.,500.,750.,1000.,2000.,3000.,5000.]" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "source_grid.vertical_var_name = 'mid_layer_height_agl'" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\tO3 vertical interpolation\n", + "\t\tO3 time step 2022-07-05 00:00:00 (1/24))\n", + "\t\tO3 time step 2022-07-05 01:00:00 (2/24))\n", + "\t\tO3 time step 2022-07-05 02:00:00 (3/24))\n", + "\t\tO3 time step 2022-07-05 03:00:00 (4/24))\n", + "\t\tO3 time step 2022-07-05 04:00:00 (5/24))\n", + "\t\tO3 time step 2022-07-05 05:00:00 (6/24))\n", + "\t\tO3 time step 2022-07-05 06:00:00 (7/24))\n", + "\t\tO3 time step 2022-07-05 07:00:00 (8/24))\n", + "\t\tO3 time step 2022-07-05 08:00:00 (9/24))\n", + "\t\tO3 time step 2022-07-05 09:00:00 (10/24))\n", + "\t\tO3 time step 2022-07-05 10:00:00 (11/24))\n", + "\t\tO3 time step 2022-07-05 11:00:00 (12/24))\n", + "\t\tO3 time step 2022-07-05 12:00:00 (13/24))\n", + "\t\tO3 time step 2022-07-05 13:00:00 (14/24))\n", + "\t\tO3 time step 2022-07-05 14:00:00 (15/24))\n", + "\t\tO3 time step 2022-07-05 15:00:00 (16/24))\n", + "\t\tO3 time step 2022-07-05 16:00:00 (17/24))\n", + "\t\tO3 time step 2022-07-05 17:00:00 (18/24))\n", + "\t\tO3 time step 2022-07-05 18:00:00 (19/24))\n", + "\t\tO3 time step 2022-07-05 19:00:00 (20/24))\n", + "\t\tO3 time step 2022-07-05 20:00:00 (21/24))\n", + "\t\tO3 time step 2022-07-05 21:00:00 (22/24))\n", + "\t\tO3 time step 2022-07-05 22:00:00 (23/24))\n", + "\t\tO3 time step 2022-07-05 23:00:00 (24/24))\n" + ] + } + ], + "source": [ + "interpolated_source_grid = source_grid.interpolate_vertical(level_list, info=True, kind='linear', extrapolate=None)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "interpolated_source_grid" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'data': [0.0,\n", + " 50.0,\n", + " 100.0,\n", + " 250.0,\n", + " 500.0,\n", + " 750.0,\n", + " 1000.0,\n", + " 2000.0,\n", + " 3000.0,\n", + " 5000.0],\n", + " 'long_name': 'Mid-layer height above ground level',\n", + " 'standard_name': 'height_agl',\n", + " 'units': 'm',\n", + " 'coordinates': 'lon lat'}" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "interpolated_source_grid.lev" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 2. Interpolation with vertical coordinate in a separate file" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 2.1. Read data to interpolate (source)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "source_data = open_netcdf(path=source_path, info=True, avoid_first_hours=12, avoid_last_hours=73)\n", + "source_data" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "source_data.keep_vars(['O3'])" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank 000: Loading O3 var (1/1)\n", + "Rank 000: Loaded O3 var ((24, 24, 361, 467))\n" + ] + } + ], + "source": [ + "source_data.load()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 2.2. Read vertical levels (source)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "source_levels = open_netcdf(path=source_path, info=True, avoid_first_hours=12, avoid_last_hours=73)\n", + "source_levels" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "source_levels.keep_vars(['mid_layer_height_agl'])" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank 000: Loading mid_layer_height_agl var (1/1)\n", + "Rank 000: Loaded mid_layer_height_agl var ((24, 24, 361, 467))\n" + ] + } + ], + "source": [ + "source_levels.load()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 2.3. Interpolate" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\tO3 vertical interpolation\n", + "\t\tO3 time step 2022-07-05 00:00:00 (1/24))\n", + "\t\tO3 time step 2022-07-05 01:00:00 (2/24))\n", + "\t\tO3 time step 2022-07-05 02:00:00 (3/24))\n", + "\t\tO3 time step 2022-07-05 03:00:00 (4/24))\n", + "\t\tO3 time step 2022-07-05 04:00:00 (5/24))\n", + "\t\tO3 time step 2022-07-05 05:00:00 (6/24))\n", + "\t\tO3 time step 2022-07-05 06:00:00 (7/24))\n", + "\t\tO3 time step 2022-07-05 07:00:00 (8/24))\n", + "\t\tO3 time step 2022-07-05 08:00:00 (9/24))\n", + "\t\tO3 time step 2022-07-05 09:00:00 (10/24))\n", + "\t\tO3 time step 2022-07-05 10:00:00 (11/24))\n", + "\t\tO3 time step 2022-07-05 11:00:00 (12/24))\n", + "\t\tO3 time step 2022-07-05 12:00:00 (13/24))\n", + "\t\tO3 time step 2022-07-05 13:00:00 (14/24))\n", + "\t\tO3 time step 2022-07-05 14:00:00 (15/24))\n", + "\t\tO3 time step 2022-07-05 15:00:00 (16/24))\n", + "\t\tO3 time step 2022-07-05 16:00:00 (17/24))\n", + "\t\tO3 time step 2022-07-05 17:00:00 (18/24))\n", + "\t\tO3 time step 2022-07-05 18:00:00 (19/24))\n", + "\t\tO3 time step 2022-07-05 19:00:00 (20/24))\n", + "\t\tO3 time step 2022-07-05 20:00:00 (21/24))\n", + "\t\tO3 time step 2022-07-05 21:00:00 (22/24))\n", + "\t\tO3 time step 2022-07-05 22:00:00 (23/24))\n", + "\t\tO3 time step 2022-07-05 23:00:00 (24/24))\n" + ] + } + ], + "source": [ + "interpolated_source_grid = source_data.interpolate_vertical(level_list, new_src_vertical=source_levels,\n", + " info=True, kind='linear', extrapolate=None)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "interpolated_source_grid" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'data': [0.0,\n", + " 50.0,\n", + " 100.0,\n", + " 250.0,\n", + " 500.0,\n", + " 750.0,\n", + " 1000.0,\n", + " 2000.0,\n", + " 3000.0,\n", + " 5000.0],\n", + " 'long_name': 'Mid-layer height above ground level',\n", + " 'standard_name': 'height_agl',\n", + " 'units': 'm',\n", + " 'coordinates': 'lon lat'}" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "interpolated_source_grid.lev" + ] + } + ], + "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/tutorials/4.Interpolation/4.2.Horizontal_Interpolation.ipynb b/tutorials/4.Interpolation/4.2.Horizontal_Interpolation.ipynb index 210611c977e197a8a85f64f3a4b96f89059089bf..f1f44986341b3109b57225eaaf72c6405737c46d 100644 --- a/tutorials/4.Interpolation/4.2.Horizontal_Interpolation.ipynb +++ b/tutorials/4.Interpolation/4.2.Horizontal_Interpolation.ipynb @@ -20,7 +20,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 1. Read dataset to interpolate" + "## 1. Read data to interpolate" ] }, { diff --git a/tutorials/4.Interpolation/4.3.Providentia_Interpolation.ipynb b/tutorials/4.Interpolation/4.3.Providentia_Interpolation.ipynb index 683bba0e3fa998b0e1387d5db139897624dd597b..067c5f3f03409140b7cd37805176c6434cdf5ac0 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": [ - "# How to interpolate horizontally using Providentia format" + "# (Wrong) How to interpolate horizontally using Providentia format" ] }, { @@ -21,12 +21,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 1. Read dataset to interpolate" + "## 1. Read data to interpolate" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -41,7 +41,7 @@ { "data": { "text/plain": [ - "" + "" ] }, "execution_count": 3, @@ -239,7 +239,7 @@ { "data": { "text/plain": [ - "" + "" ] }, "execution_count": 8, @@ -248,7 +248,8 @@ } ], "source": [ - "dst_grid_path = '/gpfs/projects/bsc32/AC_cache/obs/ghost/EBAS/1.4/hourly/sconco3/sconco3_201804.nc'\n", + "#dst_grid_path = '/gpfs/projects/bsc32/AC_cache/obs/ghost/EBAS/1.4/hourly/sconco3/sconco3_201804.nc'\n", + "dst_grid_path = '/gpfs/projects/bsc32/AC_cache/recon/exp_interp/1.3.3/cams61_chimere_ph2-eu-000/hourly/sconco3/EBAS/sconco3_201804.nc'\n", "dst_grid = open_netcdf(path=dst_grid_path, info=True)\n", "dst_grid" ] @@ -261,54 +262,56 @@ { "data": { "text/plain": [ - "{'data': masked_array(data=[-64.24006 , -54.84846497, 47.76666641, 46.677778 ,\n", - " 48.721111 , 47.529167 , 47.05407 , 47.348056 ,\n", - " 47.973056 , 48.878611 , 48.106111 , 48.371111 ,\n", - " 48.334722 , 48.050833 , 47.838611 , 47.040277 ,\n", - " 47.06694444, 49.877778 , 50.629421 , 50.503333 ,\n", - " 41.695833 , 32.27000046, 80.05000305, 46.5475 ,\n", - " 46.813056 , 47.479722 , 47.049722 , 47.0675 ,\n", - " 47.18961391, -30.17254 , 16.86403 , 35.0381 ,\n", - " 49.73508444, 49.573394 , 49.066667 , 54.925556 ,\n", - " 52.802222 , 47.914722 , 53.166667 , 50.65 ,\n", - " 54.4368 , 47.80149841, 47.4165 , -70.666 ,\n", - " 54.746495 , 81.6 , 55.693588 , 72.58000183,\n", - " 56.290424 , 59.5 , 58.383333 , 39.54694 ,\n", - " 42.72056 , 39.87528 , 37.23722 , 43.43917 ,\n", - " 41.27417 , 42.31917 , 38.47278 , 39.08278 ,\n", - " 41.23889 , 41.39389 , 42.63472 , 37.05194 ,\n", - " 28.309 , 59.779167 , 60.53002 , 66.320278 ,\n", - " 67.97333333, 48.5 , 49.9 , 47.266667 ,\n", - " 43.616667 , 47.3 , 46.65 , 45. ,\n", - " 45.8 , 48.633333 , 42.936667 , 44.56944444,\n", + "{'data': masked_array(data=[-64.24006 , -54.84846497, -22.10333333, -31.66861111,\n", + " 47.76666641, 46.677778 , 48.721111 , 47.529167 ,\n", + " 47.05407 , 46.693611 , 47.348056 , 47.973056 ,\n", + " 48.878611 , 48.106111 , 48.371111 , 48.334722 ,\n", + " 48.050833 , 47.838611 , 47.040277 , 47.06694444,\n", + " 49.877778 , 50.629421 , 50.503333 , 41.695833 ,\n", + " 32.27000046, 80.05000305, 46.5475 , 46.813056 ,\n", + " 47.479722 , 47.049722 , 47.0675 , 47.18961391,\n", + " -30.17254 , 16.86403 , 35.0381 , 49.73508444,\n", + " 49.573394 , 49.066667 , 54.925556 , 52.802222 ,\n", + " 47.914722 , 53.166667 , 50.65 , 54.4368 ,\n", + " 47.80149841, 47.4165 , -70.666 , 54.746495 ,\n", + " 81.6 , 55.693588 , 72.58000183, 56.290424 ,\n", + " 59.5 , 58.383333 , 39.54694 , 42.72056 ,\n", + " 39.87528 , 37.23722 , 43.43917 , 41.27417 ,\n", + " 42.31917 , 38.47278 , 39.08278 , 41.23889 ,\n", + " 41.39389 , 42.63472 , 37.05194 , 28.309 ,\n", + " 59.779167 , 60.53002 , 66.320278 , 67.97333333,\n", + " 48.5 , 49.9 , 47.266667 , 43.616667 ,\n", + " 47.3 , 46.65 , 45. , 45.8 ,\n", + " 48.633333 , 42.936667 , 48.70861111, 44.56944444,\n", " 46.81472778, 45.772223 , 55.313056 , 54.443056 ,\n", " 50.596389 , 54.334444 , 57.734444 , 52.503889 ,\n", " 55.858611 , 53.398889 , 50.792778 , 52.293889 ,\n", " 51.781784 , 52.298333 , 55.79216 , 52.950556 ,\n", - " 51.778056 , 60.13922 , 51.149617 , 38.366667 ,\n", - " 35.316667 , 46.966667 , 46.91 , -0.20194 ,\n", - " 51.939722 , 53.32583 , 45.8 , 44.183333 ,\n", - " 37.571111 , 42.805462 , -69.005 , 39.0319 ,\n", - " 24.2883 , 24.466941 , 36.53833389, 33.293917 ,\n", - " 55.37611111, 56.161944 , 57.135278 , 36.0722 ,\n", - " 52.083333 , 53.333889 , 51.541111 , 52.3 ,\n", - " 51.974444 , 58.38853 , 65.833333 , 62.783333 ,\n", - " 78.90715 , 59. , 69.45 , 59.2 ,\n", - " 60.372386 , -72.0117 , 59.2 , -41.40819168,\n", - " -77.83200073, -45.0379982 , 51.814408 , 50.736444 ,\n", - " 54.753894 , 54.15 , 43.4 , 71.58616638,\n", - " 63.85 , 67.883333 , 57.394 , 57.1645 ,\n", - " 57.9525 , 56.0429 , 60.0858 , 57.816667 ,\n", - " 64.25 , 59.728 , 45.566667 , 46.428611 ,\n", - " 46.299444 , 48.933333 , 49.15 , 49.05 ,\n", - " 47.96 , 71.32301331, 40.12498 , 19.53623009,\n", - " -89.99694824, 41.05410004, 21.5731 , -34.35348 ],\n", + " 51.778056 , 60.13922 , -75.62 , 51.149617 ,\n", + " 38.366667 , 35.316667 , 46.966667 , 46.91 ,\n", + " -0.20194 , 51.939722 , 53.32583 , 45.8 ,\n", + " 44.183333 , 37.571111 , 35.5182 , 42.805462 ,\n", + " -69.005 , 39.0319 , 24.2883 , 24.466941 ,\n", + " 36.53833389, 33.293917 , 55.37611111, 56.161944 ,\n", + " 57.135278 , 41.536111 , 36.0722 , 52.083333 ,\n", + " 53.333889 , 51.541111 , 52.3 , 51.974444 ,\n", + " 58.38853 , 65.833333 , 62.783333 , 78.90715 ,\n", + " 59. , 69.45 , 59.2 , 60.372386 ,\n", + " -72.0117 , 59.2 , -41.40819168, -77.83200073,\n", + " -45.0379982 , 51.814408 , 50.736444 , 54.753894 ,\n", + " 54.15 , 43.4 , 71.58616638, 63.85 ,\n", + " 67.883333 , 57.394 , 57.1645 , 57.9525 ,\n", + " 56.0429 , 60.0858 , 57.816667 , 64.25 ,\n", + " 59.728 , 45.566667 , 46.428611 , 46.299444 ,\n", + " 48.933333 , 49.15 , 49.05 , 47.96 ,\n", + " 71.32301331, 40.12498 , 19.53623009, -89.99694824,\n", + " 41.05410004, 21.5731 , -34.35348 ],\n", " mask=False,\n", " fill_value=1e+20),\n", " 'dimensions': ('station',),\n", " 'standard_name': 'latitude',\n", - " 'long_name': 'latitude',\n", " 'units': 'decimal degrees North',\n", + " 'long_name': 'latitude',\n", " 'description': 'Geodetic latitude of measuring instrument, in decimal degrees North, following the stated horizontal datum.',\n", " 'axis': 'Y'}" ] @@ -330,9 +333,10 @@ { "data": { "text/plain": [ - "{'data': masked_array(data=[-5.66247800e+01, -6.83106918e+01, 1.67666664e+01,\n", - " 1.29722220e+01, 1.59422220e+01, 9.92666700e+00,\n", - " 1.29579400e+01, 1.58822220e+01, 1.30161110e+01,\n", + "{'data': masked_array(data=[-5.66247800e+01, -6.83106918e+01, -6.56008333e+01,\n", + " -6.38819444e+01, 1.67666664e+01, 1.29722220e+01,\n", + " 1.59422220e+01, 9.92666700e+00, 1.29579400e+01,\n", + " 1.39150000e+01, 1.58822220e+01, 1.30161110e+01,\n", " 1.50466670e+01, 1.59194440e+01, 1.55466670e+01,\n", " 1.67305560e+01, 1.66766670e+01, 1.44413890e+01,\n", " 1.43300000e+01, 1.54936111e+01, 5.20361100e+00,\n", @@ -356,42 +360,44 @@ " 7.13333300e+00, 4.63333300e+00, 4.08333300e+00,\n", " 1.83333000e-01, 6.83333300e+00, -7.50000000e-01,\n", " 6.46666700e+00, 2.06666700e+00, -4.50000000e-01,\n", - " 1.41944000e-01, 5.27897222e+00, 2.61000833e+00,\n", - " 2.96488600e+00, -3.20416700e+00, -7.87000000e+00,\n", - " -3.71305600e+00, -8.07500000e-01, -4.77444400e+00,\n", - " -3.03305600e+00, -3.20500000e+00, -1.75333300e+00,\n", - " 1.79444000e-01, 1.46305600e+00, -4.69146200e+00,\n", - " 2.92778000e-01, -3.24290000e+00, 1.12194400e+00,\n", - " 1.08223000e+00, -1.18531900e+00, -1.43822800e+00,\n", - " 2.30833330e+01, 2.56666670e+01, 1.95833330e+01,\n", - " 1.63200000e+01, 1.00318100e+02, -1.02444440e+01,\n", - " -9.89944000e+00, 8.63333300e+00, 1.07000000e+01,\n", - " 1.26597220e+01, 1.25656450e+01, 3.95905556e+01,\n", + " 1.41944000e-01, 2.15888889e+00, 5.27897222e+00,\n", + " 2.61000833e+00, 2.96488600e+00, -3.20416700e+00,\n", + " -7.87000000e+00, -3.71305600e+00, -8.07500000e-01,\n", + " -4.77444400e+00, -3.03305600e+00, -3.20500000e+00,\n", + " -1.75333300e+00, 1.79444000e-01, 1.46305600e+00,\n", + " -4.69146200e+00, 2.92778000e-01, -3.24290000e+00,\n", + " 1.12194400e+00, 1.08223000e+00, -1.18531900e+00,\n", + " -2.61800000e+01, -1.43822800e+00, 2.30833330e+01,\n", + " 2.56666670e+01, 1.95833330e+01, 1.63200000e+01,\n", + " 1.00318100e+02, -1.02444440e+01, -9.89944000e+00,\n", + " 8.63333300e+00, 1.07000000e+01, 1.26597220e+01,\n", + " 1.26305000e+01, 1.25656450e+01, 3.95905556e+01,\n", " 1.41822200e+02, 1.53983300e+02, 1.23010872e+02,\n", " 1.26330002e+02, 1.26163111e+02, 2.10305556e+01,\n", - " 2.11730560e+01, 2.59055560e+01, 1.42184000e+01,\n", - " 6.56666700e+00, 6.27722200e+00, 5.85361100e+00,\n", - " 4.50000000e+00, 4.92361100e+00, 8.25200000e+00,\n", - " 1.39166670e+01, 8.88333300e+00, 1.18866800e+01,\n", - " 1.15333330e+01, 3.00333330e+01, 5.20000000e+00,\n", - " 1.10781420e+01, 2.53510000e+00, 9.51666700e+00,\n", - " 1.74870804e+02, 1.66660004e+02, 1.69684006e+02,\n", - " 2.19724190e+01, 1.57395000e+01, 1.75342640e+01,\n", - " 2.20666670e+01, 2.19500000e+01, 1.28918823e+02,\n", - " 1.53333330e+01, 2.10666670e+01, 1.19140000e+01,\n", - " 1.47825000e+01, 1.24030000e+01, 1.31480000e+01,\n", - " 1.75052800e+01, 1.55666670e+01, 1.97666670e+01,\n", - " 1.54720000e+01, 1.48666670e+01, 1.50033330e+01,\n", - " 1.45386110e+01, 1.95833330e+01, 2.02833330e+01,\n", - " 2.22666670e+01, 1.78605560e+01, -1.56611465e+02,\n", - " -1.05236800e+02, -1.55576157e+02, -2.47999992e+01,\n", - " -1.24151001e+02, 1.03515700e+02, 1.84896800e+01],\n", + " 2.11730560e+01, 2.59055560e+01, 2.06938900e+01,\n", + " 1.42184000e+01, 6.56666700e+00, 6.27722200e+00,\n", + " 5.85361100e+00, 4.50000000e+00, 4.92361100e+00,\n", + " 8.25200000e+00, 1.39166670e+01, 8.88333300e+00,\n", + " 1.18866800e+01, 1.15333330e+01, 3.00333330e+01,\n", + " 5.20000000e+00, 1.10781420e+01, 2.53510000e+00,\n", + " 9.51666700e+00, 1.74870804e+02, 1.66660004e+02,\n", + " 1.69684006e+02, 2.19724190e+01, 1.57395000e+01,\n", + " 1.75342640e+01, 2.20666670e+01, 2.19500000e+01,\n", + " 1.28918823e+02, 1.53333330e+01, 2.10666670e+01,\n", + " 1.19140000e+01, 1.47825000e+01, 1.24030000e+01,\n", + " 1.31480000e+01, 1.75052800e+01, 1.55666670e+01,\n", + " 1.97666670e+01, 1.54720000e+01, 1.48666670e+01,\n", + " 1.50033330e+01, 1.45386110e+01, 1.95833330e+01,\n", + " 2.02833330e+01, 2.22666670e+01, 1.78605560e+01,\n", + " -1.56611465e+02, -1.05236800e+02, -1.55576157e+02,\n", + " -2.47999992e+01, -1.24151001e+02, 1.03515700e+02,\n", + " 1.84896800e+01],\n", " mask=False,\n", " fill_value=1e+20),\n", " 'dimensions': ('station',),\n", " 'standard_name': 'longitude',\n", - " 'long_name': 'longitude',\n", " 'units': 'decimal degrees East',\n", + " 'long_name': 'longitude',\n", " 'description': 'Geodetic longitude of measuring instrument, in decimal degrees East, following the stated horizontal datum.',\n", " 'axis': 'X'}" ] @@ -422,9 +428,7 @@ "source": [ "interpolated_source_grid = source_grid.interpolate_horizontal(dst_grid, weight_matrix_path=None, \n", " kind='NearestNeighbour', n_neighbours=4,\n", - " info=True, to_providentia=True)\n", - "# Bilinear to use n_neighbours (weighted average)\n", - "# n_neighbours = 1 for kind='NearestNeighbour'" + " info=True, to_providentia=True)" ] }, { @@ -444,48 +448,50 @@ { "data": { "text/plain": [ - "{'data': masked_array(data=[-64.24006 , -54.84846497, 47.76666641, 46.677778 ,\n", - " 48.721111 , 47.529167 , 47.05407 , 47.348056 ,\n", - " 47.973056 , 48.878611 , 48.106111 , 48.371111 ,\n", - " 48.334722 , 48.050833 , 47.838611 , 47.040277 ,\n", - " 47.06694444, 49.877778 , 50.629421 , 50.503333 ,\n", - " 41.695833 , 32.27000046, 80.05000305, 46.5475 ,\n", - " 46.813056 , 47.479722 , 47.049722 , 47.0675 ,\n", - " 47.18961391, -30.17254 , 16.86403 , 35.0381 ,\n", - " 49.73508444, 49.573394 , 49.066667 , 54.925556 ,\n", - " 52.802222 , 47.914722 , 53.166667 , 50.65 ,\n", - " 54.4368 , 47.80149841, 47.4165 , -70.666 ,\n", - " 54.746495 , 81.6 , 55.693588 , 72.58000183,\n", - " 56.290424 , 59.5 , 58.383333 , 39.54694 ,\n", - " 42.72056 , 39.87528 , 37.23722 , 43.43917 ,\n", - " 41.27417 , 42.31917 , 38.47278 , 39.08278 ,\n", - " 41.23889 , 41.39389 , 42.63472 , 37.05194 ,\n", - " 28.309 , 59.779167 , 60.53002 , 66.320278 ,\n", - " 67.97333333, 48.5 , 49.9 , 47.266667 ,\n", - " 43.616667 , 47.3 , 46.65 , 45. ,\n", - " 45.8 , 48.633333 , 42.936667 , 44.56944444,\n", + "{'data': masked_array(data=[-64.24006 , -54.84846497, -22.10333333, -31.66861111,\n", + " 47.76666641, 46.677778 , 48.721111 , 47.529167 ,\n", + " 47.05407 , 46.693611 , 47.348056 , 47.973056 ,\n", + " 48.878611 , 48.106111 , 48.371111 , 48.334722 ,\n", + " 48.050833 , 47.838611 , 47.040277 , 47.06694444,\n", + " 49.877778 , 50.629421 , 50.503333 , 41.695833 ,\n", + " 32.27000046, 80.05000305, 46.5475 , 46.813056 ,\n", + " 47.479722 , 47.049722 , 47.0675 , 47.18961391,\n", + " -30.17254 , 16.86403 , 35.0381 , 49.73508444,\n", + " 49.573394 , 49.066667 , 54.925556 , 52.802222 ,\n", + " 47.914722 , 53.166667 , 50.65 , 54.4368 ,\n", + " 47.80149841, 47.4165 , -70.666 , 54.746495 ,\n", + " 81.6 , 55.693588 , 72.58000183, 56.290424 ,\n", + " 59.5 , 58.383333 , 39.54694 , 42.72056 ,\n", + " 39.87528 , 37.23722 , 43.43917 , 41.27417 ,\n", + " 42.31917 , 38.47278 , 39.08278 , 41.23889 ,\n", + " 41.39389 , 42.63472 , 37.05194 , 28.309 ,\n", + " 59.779167 , 60.53002 , 66.320278 , 67.97333333,\n", + " 48.5 , 49.9 , 47.266667 , 43.616667 ,\n", + " 47.3 , 46.65 , 45. , 45.8 ,\n", + " 48.633333 , 42.936667 , 48.70861111, 44.56944444,\n", " 46.81472778, 45.772223 , 55.313056 , 54.443056 ,\n", " 50.596389 , 54.334444 , 57.734444 , 52.503889 ,\n", " 55.858611 , 53.398889 , 50.792778 , 52.293889 ,\n", " 51.781784 , 52.298333 , 55.79216 , 52.950556 ,\n", - " 51.778056 , 60.13922 , 51.149617 , 38.366667 ,\n", - " 35.316667 , 46.966667 , 46.91 , -0.20194 ,\n", - " 51.939722 , 53.32583 , 45.8 , 44.183333 ,\n", - " 37.571111 , 42.805462 , -69.005 , 39.0319 ,\n", - " 24.2883 , 24.466941 , 36.53833389, 33.293917 ,\n", - " 55.37611111, 56.161944 , 57.135278 , 36.0722 ,\n", - " 52.083333 , 53.333889 , 51.541111 , 52.3 ,\n", - " 51.974444 , 58.38853 , 65.833333 , 62.783333 ,\n", - " 78.90715 , 59. , 69.45 , 59.2 ,\n", - " 60.372386 , -72.0117 , 59.2 , -41.40819168,\n", - " -77.83200073, -45.0379982 , 51.814408 , 50.736444 ,\n", - " 54.753894 , 54.15 , 43.4 , 71.58616638,\n", - " 63.85 , 67.883333 , 57.394 , 57.1645 ,\n", - " 57.9525 , 56.0429 , 60.0858 , 57.816667 ,\n", - " 64.25 , 59.728 , 45.566667 , 46.428611 ,\n", - " 46.299444 , 48.933333 , 49.15 , 49.05 ,\n", - " 47.96 , 71.32301331, 40.12498 , 19.53623009,\n", - " -89.99694824, 41.05410004, 21.5731 , -34.35348 ],\n", + " 51.778056 , 60.13922 , -75.62 , 51.149617 ,\n", + " 38.366667 , 35.316667 , 46.966667 , 46.91 ,\n", + " -0.20194 , 51.939722 , 53.32583 , 45.8 ,\n", + " 44.183333 , 37.571111 , 35.5182 , 42.805462 ,\n", + " -69.005 , 39.0319 , 24.2883 , 24.466941 ,\n", + " 36.53833389, 33.293917 , 55.37611111, 56.161944 ,\n", + " 57.135278 , 41.536111 , 36.0722 , 52.083333 ,\n", + " 53.333889 , 51.541111 , 52.3 , 51.974444 ,\n", + " 58.38853 , 65.833333 , 62.783333 , 78.90715 ,\n", + " 59. , 69.45 , 59.2 , 60.372386 ,\n", + " -72.0117 , 59.2 , -41.40819168, -77.83200073,\n", + " -45.0379982 , 51.814408 , 50.736444 , 54.753894 ,\n", + " 54.15 , 43.4 , 71.58616638, 63.85 ,\n", + " 67.883333 , 57.394 , 57.1645 , 57.9525 ,\n", + " 56.0429 , 60.0858 , 57.816667 , 64.25 ,\n", + " 59.728 , 45.566667 , 46.428611 , 46.299444 ,\n", + " 48.933333 , 49.15 , 49.05 , 47.96 ,\n", + " 71.32301331, 40.12498 , 19.53623009, -89.99694824,\n", + " 41.05410004, 21.5731 , -34.35348 ],\n", " mask=False,\n", " fill_value=1e+20)}" ] @@ -507,9 +513,10 @@ { "data": { "text/plain": [ - "{'data': masked_array(data=[-5.66247800e+01, -6.83106918e+01, 1.67666664e+01,\n", - " 1.29722220e+01, 1.59422220e+01, 9.92666700e+00,\n", - " 1.29579400e+01, 1.58822220e+01, 1.30161110e+01,\n", + "{'data': masked_array(data=[-5.66247800e+01, -6.83106918e+01, -6.56008333e+01,\n", + " -6.38819444e+01, 1.67666664e+01, 1.29722220e+01,\n", + " 1.59422220e+01, 9.92666700e+00, 1.29579400e+01,\n", + " 1.39150000e+01, 1.58822220e+01, 1.30161110e+01,\n", " 1.50466670e+01, 1.59194440e+01, 1.55466670e+01,\n", " 1.67305560e+01, 1.66766670e+01, 1.44413890e+01,\n", " 1.43300000e+01, 1.54936111e+01, 5.20361100e+00,\n", @@ -533,36 +540,38 @@ " 7.13333300e+00, 4.63333300e+00, 4.08333300e+00,\n", " 1.83333000e-01, 6.83333300e+00, -7.50000000e-01,\n", " 6.46666700e+00, 2.06666700e+00, -4.50000000e-01,\n", - " 1.41944000e-01, 5.27897222e+00, 2.61000833e+00,\n", - " 2.96488600e+00, -3.20416700e+00, -7.87000000e+00,\n", - " -3.71305600e+00, -8.07500000e-01, -4.77444400e+00,\n", - " -3.03305600e+00, -3.20500000e+00, -1.75333300e+00,\n", - " 1.79444000e-01, 1.46305600e+00, -4.69146200e+00,\n", - " 2.92778000e-01, -3.24290000e+00, 1.12194400e+00,\n", - " 1.08223000e+00, -1.18531900e+00, -1.43822800e+00,\n", - " 2.30833330e+01, 2.56666670e+01, 1.95833330e+01,\n", - " 1.63200000e+01, 1.00318100e+02, -1.02444440e+01,\n", - " -9.89944000e+00, 8.63333300e+00, 1.07000000e+01,\n", - " 1.26597220e+01, 1.25656450e+01, 3.95905556e+01,\n", + " 1.41944000e-01, 2.15888889e+00, 5.27897222e+00,\n", + " 2.61000833e+00, 2.96488600e+00, -3.20416700e+00,\n", + " -7.87000000e+00, -3.71305600e+00, -8.07500000e-01,\n", + " -4.77444400e+00, -3.03305600e+00, -3.20500000e+00,\n", + " -1.75333300e+00, 1.79444000e-01, 1.46305600e+00,\n", + " -4.69146200e+00, 2.92778000e-01, -3.24290000e+00,\n", + " 1.12194400e+00, 1.08223000e+00, -1.18531900e+00,\n", + " -2.61800000e+01, -1.43822800e+00, 2.30833330e+01,\n", + " 2.56666670e+01, 1.95833330e+01, 1.63200000e+01,\n", + " 1.00318100e+02, -1.02444440e+01, -9.89944000e+00,\n", + " 8.63333300e+00, 1.07000000e+01, 1.26597220e+01,\n", + " 1.26305000e+01, 1.25656450e+01, 3.95905556e+01,\n", " 1.41822200e+02, 1.53983300e+02, 1.23010872e+02,\n", " 1.26330002e+02, 1.26163111e+02, 2.10305556e+01,\n", - " 2.11730560e+01, 2.59055560e+01, 1.42184000e+01,\n", - " 6.56666700e+00, 6.27722200e+00, 5.85361100e+00,\n", - " 4.50000000e+00, 4.92361100e+00, 8.25200000e+00,\n", - " 1.39166670e+01, 8.88333300e+00, 1.18866800e+01,\n", - " 1.15333330e+01, 3.00333330e+01, 5.20000000e+00,\n", - " 1.10781420e+01, 2.53510000e+00, 9.51666700e+00,\n", - " 1.74870804e+02, 1.66660004e+02, 1.69684006e+02,\n", - " 2.19724190e+01, 1.57395000e+01, 1.75342640e+01,\n", - " 2.20666670e+01, 2.19500000e+01, 1.28918823e+02,\n", - " 1.53333330e+01, 2.10666670e+01, 1.19140000e+01,\n", - " 1.47825000e+01, 1.24030000e+01, 1.31480000e+01,\n", - " 1.75052800e+01, 1.55666670e+01, 1.97666670e+01,\n", - " 1.54720000e+01, 1.48666670e+01, 1.50033330e+01,\n", - " 1.45386110e+01, 1.95833330e+01, 2.02833330e+01,\n", - " 2.22666670e+01, 1.78605560e+01, -1.56611465e+02,\n", - " -1.05236800e+02, -1.55576157e+02, -2.47999992e+01,\n", - " -1.24151001e+02, 1.03515700e+02, 1.84896800e+01],\n", + " 2.11730560e+01, 2.59055560e+01, 2.06938900e+01,\n", + " 1.42184000e+01, 6.56666700e+00, 6.27722200e+00,\n", + " 5.85361100e+00, 4.50000000e+00, 4.92361100e+00,\n", + " 8.25200000e+00, 1.39166670e+01, 8.88333300e+00,\n", + " 1.18866800e+01, 1.15333330e+01, 3.00333330e+01,\n", + " 5.20000000e+00, 1.10781420e+01, 2.53510000e+00,\n", + " 9.51666700e+00, 1.74870804e+02, 1.66660004e+02,\n", + " 1.69684006e+02, 2.19724190e+01, 1.57395000e+01,\n", + " 1.75342640e+01, 2.20666670e+01, 2.19500000e+01,\n", + " 1.28918823e+02, 1.53333330e+01, 2.10666670e+01,\n", + " 1.19140000e+01, 1.47825000e+01, 1.24030000e+01,\n", + " 1.31480000e+01, 1.75052800e+01, 1.55666670e+01,\n", + " 1.97666670e+01, 1.54720000e+01, 1.48666670e+01,\n", + " 1.50033330e+01, 1.45386110e+01, 1.95833330e+01,\n", + " 2.02833330e+01, 2.22666670e+01, 1.78605560e+01,\n", + " -1.56611465e+02, -1.05236800e+02, -1.55576157e+02,\n", + " -2.47999992e+01, -1.24151001e+02, 1.03515700e+02,\n", + " 1.84896800e+01],\n", " mask=False,\n", " fill_value=1e+20)}" ] @@ -598,7 +607,7 @@ { "data": { "text/plain": [ - "" + "" ] }, "execution_count": 15, @@ -618,18 +627,18 @@ { "data": { "text/plain": [ - "array([[53.66018016, 53.72655496, 39.71929631, ..., 47.05468596,\n", - " 37.49358847, 50.12492467],\n", - " [34.1650076 , 31.97673952, 34.79759123, ..., 36.49387169,\n", - " 42.42537702, 40.64690942],\n", - " [37.67649197, 45.37738756, 36.00924977, ..., 31.60124608,\n", - " 51.62883307, 45.24256593],\n", + "array([[53.66018016, 53.72655496, 53.72658317, ..., 43.57299226,\n", + " 47.24854741, 32.18078968],\n", + " [33.18998267, 31.79456739, 27.61967959, ..., 39.97857755,\n", + " 40.50389612, 37.44205106],\n", + " [39.16614765, 38.60188681, 33.58534075, ..., 46.94782439,\n", + " 42.2582876 , 44.41170698],\n", " ...,\n", - " [54.27077002, 51.7696408 , 54.57476229, ..., 48.37661813,\n", - " 48.5811417 , 44.59927676],\n", - " [46.13963498, 51.75067466, 42.5313685 , ..., 41.11072911,\n", - " 40.1266753 , 47.78749426],\n", - " [44.61186732, 41.83391773, 44.79468647, ..., 50.60927108,\n", + " [47.78859072, 53.85937227, 40.06637886, ..., 46.7489719 ,\n", + " 57.41357903, 39.15433177],\n", + " [52.09374241, 39.10817074, 44.6270592 , ..., 34.05485287,\n", + " 45.79934222, 46.92515764],\n", + " [47.54277469, 47.60884789, 38.51539661, ..., 50.60927108,\n", " 45.68748656, 45.30077914]])" ] }, @@ -646,12 +655,52 @@ "cell_type": "code", "execution_count": 17, "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "43.88671143497364" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "interpolated_source_grid.variables['sconco3']['data'][100, 100]" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "51.778056" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "interpolated_source_grid.lat['data'][100]" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/points_nes_providentia.py:579: UserWarning: WARNING!!! Providentia datasets cannot be written in parallel yet. Changing to serial mode.\n", + "/esarchive/scratch/avilanova/software/NES/nes/nc_projections/points_nes_providentia.py:581: UserWarning: WARNING!!! Providentia datasets cannot be written in parallel yet. Changing to serial mode.\n", " warnings.warn(msg)\n" ] } @@ -662,7 +711,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -1020,10 +1069,10 @@ " fill: currentColor;\n", "}\n", "
<xarray.Dataset>\n",
-       "Dimensions:                 (time: 720, station: 168, model_latitude: 211, model_longitude: 351, grid_edge: 1125)\n",
+       "Dimensions:                 (time: 720, station: 175, model_latitude: 211, model_longitude: 351, grid_edge: 1125)\n",
        "Coordinates:\n",
        "  * time                    (time) datetime64[ns] 2018-04-01 ... 2018-04-30T2...\n",
-       "  * station                 (station) float64 0.0 1.0 2.0 ... 165.0 166.0 167.0\n",
+       "  * station                 (station) float64 0.0 1.0 2.0 ... 172.0 173.0 174.0\n",
        "Dimensions without coordinates: model_latitude, model_longitude, grid_edge\n",
        "Data variables:\n",
        "    lat                     (station) float64 -64.24 -54.85 ... 21.57 -34.35\n",
@@ -1034,10 +1083,10 @@
        "    grid_edge_latitude      (grid_edge) float64 29.9 30.1 30.3 ... 29.9 29.9\n",
        "    sconco3                 (station, time) float64 ...\n",
        "Attributes:\n",
-       "    Conventions:  CF-1.7
  • Conventions :
    CF-1.7
  • " ], "text/plain": [ "\n", - "Dimensions: (time: 720, station: 168, model_latitude: 211, model_longitude: 351, grid_edge: 1125)\n", + "Dimensions: (time: 720, station: 175, model_latitude: 211, model_longitude: 351, grid_edge: 1125)\n", "Coordinates:\n", " * time (time) datetime64[ns] 2018-04-01 ... 2018-04-30T2...\n", - " * station (station) float64 0.0 1.0 2.0 ... 165.0 166.0 167.0\n", + " * station (station) float64 0.0 1.0 2.0 ... 172.0 173.0 174.0\n", "Dimensions without coordinates: model_latitude, model_longitude, grid_edge\n", "Data variables:\n", " lat (station) float64 ...\n", @@ -1151,7 +1205,7 @@ " Conventions: CF-1.7" ] }, - "execution_count": 18, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -1169,7 +1223,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -1178,7 +1232,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -1192,10 +1246,10 @@ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 20, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -1207,7 +1261,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -1227,7 +1281,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -1246,7 +1300,7 @@ " dtype=float32)" ] }, - "execution_count": 22, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -1257,7 +1311,47 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "38.09361" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tool_interpolated_grid.variables['sconco3']['data'][100, 100]" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "51.778056" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tool_interpolated_grid.lat['data'][100]" + ] + }, + { + "cell_type": "code", + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -1637,11 +1731,11 @@ " conventions: CF-1.7\n", " data_version: 1.0\n", " history: Thu Feb 11 10:19:01 2021: ncks -O --dfl_lvl 1 /gpfs/proje...\n", - " NCO: 4.7.2
  • title :
    Inverse distance weighting (4 neighbours) interpolated cams61_chimere_ph2 experiment data for the component sconco3 with reference to the measurement stations in the EBAS network in 2018-04.
    institution :
    Barcelona Supercomputing Center
    source :
    Experiment cams61_chimere_ph2
    creator_name :
    Dene R. Bowdalo
    creator_email :
    dene.bowdalo@bsc.es
    conventions :
    CF-1.7
    data_version :
    1.0
    history :
    Thu Feb 11 10:19:01 2021: ncks -O --dfl_lvl 1 /gpfs/projects/bsc32/AC_cache/recon/exp_interp/1.3.3/cams61_chimere_ph2-eu-000/hourly/sconco3/EBAS/sconco3_201804.nc /gpfs/projects/bsc32/AC_cache/recon/exp_interp/1.3.3/cams61_chimere_ph2-eu-000/hourly/sconco3/EBAS/sconco3_201804.nc
    NCO :
    4.7.2
  • " ], "text/plain": [ "\n", @@ -1803,7 +1897,7 @@ " NCO: 4.7.2" ] }, - "execution_count": 23, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } diff --git a/tutorials/5.Others/5.2.Add_Coordinates_Bounds.ipynb b/tutorials/5.Others/5.2.Add_Coordinates_Bounds.ipynb index 5b70186d28465713d58c475f85af2e62e4a51f77..8ad416722fb976d97e568d9771ba3e4c5692a503 100644 --- a/tutorials/5.Others/5.2.Add_Coordinates_Bounds.ipynb +++ b/tutorials/5.Others/5.2.Add_Coordinates_Bounds.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# How to add time bounds" + "# How to add coordinates bounds" ] }, { @@ -23,7 +23,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 1. Set time bounds" + "## 1. Set coordinates bounds" ] }, { @@ -42,26 +42,13 @@ "metadata": {}, "outputs": [], "source": [ - "inc_lat = np.abs(np.mean(np.diff(nessy.lat['data'])))\n", - "lat_bnds = nessy.create_bounds(nessy.lat['data'], inc_lat, spatial_nv=4)\n", - "nessy.set_lat_bnds(lat_bnds)" + "nessy.create_spatial_bounds()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, - "outputs": [], - "source": [ - "inc_lon = np.abs(np.mean(np.diff(nessy.lon['data'])))\n", - "lon_bnds = nessy.create_bounds(nessy.lon['data'], inc_lon, spatial_nv=4)\n", - "nessy.set_lon_bnds(lon_bnds)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, "outputs": [ { "name": "stdout", @@ -85,7 +72,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -145,7 +132,7 @@ " fill_value=1e+20)" ] }, - "execution_count": 7, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -156,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -216,7 +203,7 @@ " fill_value=1e+20)" ] }, - "execution_count": 8, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" }