diff --git a/nes/nc_projections/default_nes.py b/nes/nc_projections/default_nes.py index 81ab079b25c2498664e2e21840c78b5c7097f91a..aca209c9ff1625af3254d1290a410ef261feb7fc 100644 --- a/nes/nc_projections/default_nes.py +++ b/nes/nc_projections/default_nes.py @@ -10,6 +10,8 @@ from netCDF4 import Dataset, num2date, date2num from mpi4py import MPI from cfunits import Units from numpy.ma.core import MaskError +import geopandas as gpd +from shapely.geometry import Polygon from copy import deepcopy import datetime from ..interpolation import vertical_interpolation @@ -2061,6 +2063,55 @@ class Nes(object): return None + def to_shapefile(self, path): + """ + Write output file with shapefile format. + + Parameters + ---------- + path : str + Path to the output file. + """ + + if self._lat_bnds is None or self._lon_bnds is None: + self.create_spatial_bounds() + + # Reshape arrays to create geometry + aux_shape = (self.lat_bnds.shape[0], self.lon_bnds.shape[0], 4) + lon_bnds_aux = np.empty(aux_shape) + lon_bnds_aux[:, :, 0] = self.lon_bnds[np.newaxis, :, 0] + lon_bnds_aux[:, :, 1] = self.lon_bnds[np.newaxis, :, 1] + lon_bnds_aux[:, :, 2] = self.lon_bnds[np.newaxis, :, 1] + lon_bnds_aux[:, :, 3] = self.lon_bnds[np.newaxis, :, 0] + + lon_bnds = lon_bnds_aux + del lon_bnds_aux + + lat_bnds_aux = np.empty(aux_shape) + lat_bnds_aux[:, :, 0] = self.lat_bnds[:, np.newaxis, 0] + lat_bnds_aux[:, :, 1] = self.lat_bnds[:, np.newaxis, 0] + lat_bnds_aux[:, :, 2] = self.lat_bnds[:, np.newaxis, 1] + lat_bnds_aux[:, :, 3] = self.lat_bnds[:, np.newaxis, 1] + + lat_bnds = lat_bnds_aux + del lat_bnds_aux + + aux_b_lats = lat_bnds.reshape((lat_bnds.shape[0] * lat_bnds.shape[1], lat_bnds.shape[2])) + aux_b_lons = lon_bnds.reshape((lon_bnds.shape[0] * lon_bnds.shape[1], lon_bnds.shape[2])) + + # Create dataframe cointaining all polygons + geometry = [] + for i in range(aux_b_lons.shape[0]): + geometry.append(Polygon([(aux_b_lons[i, 0], aux_b_lats[i, 0]), + (aux_b_lons[i, 1], aux_b_lats[i, 1]), + (aux_b_lons[i, 2], aux_b_lats[i, 2]), + (aux_b_lons[i, 3], aux_b_lats[i, 3]), + (aux_b_lons[i, 0], aux_b_lats[i, 0])])) + gdf = gpd.GeoDataFrame(index=range(aux_b_lons.shape[0]), geometry=geometry, crs="EPSG:4326") + gdf.to_file(path) + + return None + def __gather_data_py_object(self): """ Gather all the variable data into the MPI rank 0 to perform a serial write. diff --git a/nes/nc_projections/lcc_nes.py b/nes/nc_projections/lcc_nes.py index 309767dc087104f966ffe7337bd603d57a220de4..f6605a6f08c60acb3a0508a25a2945452909d8ca 100644 --- a/nes/nc_projections/lcc_nes.py +++ b/nes/nc_projections/lcc_nes.py @@ -4,6 +4,8 @@ import numpy as np from cfunits import Units from pyproj import Proj from copy import deepcopy +import geopandas as gpd +from shapely.geometry import Polygon from .default_nes import Nes @@ -127,24 +129,26 @@ class LCCNes(Nes): Returns ------- - projection : dict + projection_data : dict Dictionary with the projection data. """ if create_nes: - projection = {'data': None, - 'dimensions': (), - 'grid_mapping_name': 'lambert_conformal_conic', - 'standard_parallel': [kwargs['lat_1'], kwargs['lat_2']], - 'longitude_of_central_meridian': kwargs['lon_0'], - 'latitude_of_projection_origin': kwargs['lat_0'], - } + projection_data = {'data': None, + 'dimensions': (), + 'grid_mapping_name': 'lambert_conformal_conic', + 'standard_parallel': [kwargs['lat_1'], kwargs['lat_2']], + 'longitude_of_central_meridian': kwargs['lon_0'], + 'latitude_of_projection_origin': kwargs['lat_0'], + } else: - projection = self.variables['Lambert_conformal'] + projection_data = self.variables['Lambert_conformal'] + projection_data['standard_parallel'] = [projection_data['standard_parallel'].split(', ')[0], + projection_data['standard_parallel'].split(', ')[1]] self.free_vars('Lambert_conformal') - return projection + return projection_data def _create_dimensions(self, netcdf): """ @@ -230,23 +234,23 @@ class LCCNes(Nes): x = np.array([self._x['data']] * len(self._y['data'])) y = np.array([self._y['data']] * len(self._x['data'])).T - projection = Proj( - proj='lcc', - ellps='WGS84', - R=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) - lat_1=kwargs['lat_1'], - lat_2=kwargs['lat_2'], - lon_0=kwargs['lon_0'], - lat_0=kwargs['lat_0'], - to_meter=1, - x_0=0, - y_0=0, - a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) - k_0=1.0 - ) + self.projection = Proj( + proj='lcc', + ellps='WGS84', + R=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) + lat_1=kwargs['lat_1'], + lat_2=kwargs['lat_2'], + lon_0=kwargs['lon_0'], + lat_0=kwargs['lat_0'], + to_meter=1, + x_0=0, + y_0=0, + a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) + k_0=1.0 + ) # Calculate centre latitudes and longitudes (UTM to LCC) - centre_lon_data, centre_lat_data = projection(x, y, inverse=True) + centre_lon_data, centre_lat_data = self.projection(x, y, inverse=True) centre_lat = {'data': centre_lat_data} centre_lon = {'data': centre_lon_data} @@ -289,39 +293,39 @@ class LCCNes(Nes): inc_y = np.abs(np.mean(np.diff(self.y['data']))) # Get bounds for rotated coordinates - y_bounds = self.create_single_spatial_bounds(self.y['data'], inc_y) - x_bounds = self.create_single_spatial_bounds(self.x['data'], inc_x) + y_bnds = self.create_single_spatial_bounds(self.y['data'], inc_y) + x_bnds = 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]) + left_edge_y = np.append(y_bnds.flatten()[::2], y_bnds.flatten()[-1]) right_edge_y = np.flip(left_edge_y, 0) - top_edge_y = np.repeat(y_bounds[-1][-1], len(self.x['data']) - 1) - bottom_edge_y = np.repeat(y_bounds[0][0], len(self.x['data'])) + top_edge_y = np.repeat(y_bnds[-1][-1], len(self.x['data']) - 1) + bottom_edge_y = np.repeat(y_bnds[0][0], len(self.x['data'])) y_grid_edge = np.concatenate((left_edge_y, top_edge_y, right_edge_y, bottom_edge_y)) # Get rotated longitudes for grid edge - left_edge_x = np.repeat(x_bounds[0][0], len(self.y['data']) + 1) - top_edge_x = x_bounds.flatten()[1:-1:2] - right_edge_x = np.repeat(x_bounds[-1][-1], len(self.y['data']) + 1) - bottom_edge_x = np.flip(x_bounds.flatten()[:-1:2], 0) + left_edge_x = np.repeat(x_bnds[0][0], len(self.y['data']) + 1) + top_edge_x = x_bnds.flatten()[1:-1:2] + right_edge_x = np.repeat(x_bnds[-1][-1], len(self.y['data']) + 1) + bottom_edge_x = np.flip(x_bnds.flatten()[:-1:2], 0) x_grid_edge = np.concatenate((left_edge_x, top_edge_x, right_edge_x, bottom_edge_x)) # Get edges for regular coordinates - projection = Proj( - proj='lcc', - ellps='WGS84', - R=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) - lat_1=float(self.projection_data['standard_parallel'].split(', ')[0]), - lat_2=float(self.projection_data['standard_parallel'].split(', ')[1]), - lon_0=float(self.projection_data['longitude_of_central_meridian']), - lat_0=float(self.projection_data['latitude_of_projection_origin']), - to_meter=1, - x_0=0, - y_0=0, - a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) - k_0=1.0 - ) - grid_edge_lon_data, grid_edge_lat_data = projection(x_grid_edge, y_grid_edge, inverse=True) + self.projection = Proj( + proj='lcc', + ellps='WGS84', + R=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) + lat_1=float(self.projection_data['standard_parallel'][0]), + lat_2=float(self.projection_data['standard_parallel'][1]), + lon_0=float(self.projection_data['longitude_of_central_meridian']), + lat_0=float(self.projection_data['latitude_of_projection_origin']), + to_meter=1, + x_0=0, + y_0=0, + a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) + k_0=1.0 + ) + grid_edge_lon_data, grid_edge_lat_data = self.projection(x_grid_edge, y_grid_edge, inverse=True) # Create grid outline by stacking the edges in both coordinates model_grid_outline = np.vstack((grid_edge_lon_data, grid_edge_lat_data)).T @@ -335,17 +339,38 @@ class LCCNes(Nes): 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) - + # Calculate LCC coordinates bounds + inc_x = np.abs(np.mean(np.diff(self._x['data']))) + x_bnds = self.create_single_spatial_bounds(np.array([self._y['data']] * len(self._x['data'])).T, + inc_x, spatial_nv=4, inverse=True) + + inc_y = np.abs(np.mean(np.diff(self._y['data']))) + y_bnds = self.create_single_spatial_bounds(np.array([self._x['data']] * len(self._y['data'])), + inc_y, spatial_nv=4) + + # Transform LCC bounds to regular bounds + self.projection = Proj( + proj='lcc', + ellps='WGS84', + R=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) + lat_1=float(self.projection_data['standard_parallel'][0]), + lat_2=float(self.projection_data['standard_parallel'][1]), + lon_0=float(self.projection_data['longitude_of_central_meridian']), + lat_0=float(self.projection_data['latitude_of_projection_origin']), + to_meter=1, + x_0=0, + y_0=0, + a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) + k_0=1.0 + ) + lon_bnds, lat_bnds = self.projection(x_bnds, y_bnds, inverse=True) + + # Obtain regular coordinates bounds 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'], @@ -402,4 +427,35 @@ class LCCNes(Nes): Indicates if you want to print extra information during the process. """ - raise NotImplementedError("Grib2 format cannot be write in a Lambert Conformal Conic projection.") + raise NotImplementedError("Grib2 format cannot be written in a Lambert Conformal Conic projection.") + + def to_shapefile(self, path): + """ + Write output file with shapefile format. + + Parameters + ---------- + path : str + Path to the output file. + """ + + # Get latitude and longitude cell boundaries + if self._lat_bnds is None or self._lon_bnds is None: + self.create_spatial_bounds() + + # Reshape arrays to create geometry + aux_b_lats = self.lat_bnds.reshape((self.lat_bnds.shape[0] * self.lat_bnds.shape[1], self.lat_bnds.shape[2])) + aux_b_lons = self.lon_bnds.reshape((self.lon_bnds.shape[0] * self.lon_bnds.shape[1], self.lon_bnds.shape[2])) + + # Create dataframe cointaining all polygons + geometry = [] + for i in range(aux_b_lons.shape[0]): + geometry.append(Polygon([(aux_b_lons[i, 0], aux_b_lats[i, 0]), + (aux_b_lons[i, 1], aux_b_lats[i, 1]), + (aux_b_lons[i, 2], aux_b_lats[i, 2]), + (aux_b_lons[i, 3], aux_b_lats[i, 3]), + (aux_b_lons[i, 0], aux_b_lats[i, 0])])) + gdf = gpd.GeoDataFrame(index=range(aux_b_lons.shape[0]), geometry=geometry, crs="EPSG:4326") + gdf.to_file(path) + + return None diff --git a/nes/nc_projections/mercator_nes.py b/nes/nc_projections/mercator_nes.py index 43de48e8aad3254c26eb8c149e08eef0d63ed72c..e5272aa08d041cdcc5b18fd58dcb30c4942dbd77 100644 --- a/nes/nc_projections/mercator_nes.py +++ b/nes/nc_projections/mercator_nes.py @@ -4,6 +4,8 @@ import numpy as np from cfunits import Units from pyproj import Proj from copy import deepcopy +import geopandas as gpd +from shapely.geometry import Polygon from nes.nc_projections.default_nes import Nes @@ -88,7 +90,6 @@ class MercatorNes(Nes): self.free_vars('crs') - @staticmethod def new(comm=None, path=None, info=False, dataset=None, xarray=False, create=False, balanced=False, parallel_method='Y', avoid_first_hours=0, avoid_last_hours=0, first_level=0, last_level=None): @@ -128,23 +129,23 @@ class MercatorNes(Nes): Returns ------- - projection : dict + projection _data: dict Dictionary with the projection data. """ if create_nes: - projection = {'data': None, - 'dimensions': (), - 'grid_mapping_name': 'mercator', - 'standard_parallel': [kwargs['lat_ts']], # TODO: Check if True - 'longitude_of_projection_origin': kwargs['lon_0'], - } + projection_data = {'data': None, + 'dimensions': (), + 'grid_mapping_name': 'mercator', + 'standard_parallel': [kwargs['lat_ts']], # TODO: Check if True + 'longitude_of_projection_origin': kwargs['lon_0'], + } else: - projection = self.variables['mercator'] + projection_data = self.variables['mercator'] self.free_vars('mercator') - return projection + return projection_data def _create_dimensions(self, netcdf): """ @@ -232,16 +233,16 @@ class MercatorNes(Nes): x = np.array([self._x['data']] * len(self._y['data'])) y = np.array([self._y['data']] * len(self._x['data'])).T - projection = Proj( - proj='merc', - a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) - b=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) - lat_ts=kwargs['lat_ts'], - lon_0=kwargs['lon_0'], - ) + self.projection = Proj( + proj='merc', + a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) + b=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) + lat_ts=kwargs['lat_ts'], + lon_0=kwargs['lon_0'], + ) # Calculate centre latitudes and longitudes (UTM to Mercator) - centre_lon_data, centre_lat_data = projection(x, y, inverse=True) + centre_lon_data, centre_lat_data = self.projection(x, y, inverse=True) centre_lat = {'data': centre_lat_data} centre_lon = {'data': centre_lon_data} @@ -302,14 +303,14 @@ class MercatorNes(Nes): x_grid_edge = np.concatenate((left_edge_x, top_edge_x, right_edge_x, bottom_edge_x)) # Get edges for regular coordinates - projection = Proj( - proj='merc', - a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) - b=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) - lat_ts=float(self.projection_data['standard_parallel']), - lon_0=float(self.projection_data['longitude_of_central_meridian']), - ) - grid_edge_lon_data, grid_edge_lat_data = projection(x_grid_edge, y_grid_edge, inverse=True) + self.projection = Proj( + proj='merc', + a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) + b=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) + lat_ts=float(self.projection_data['standard_parallel'][0]), + lon_0=float(self.projection_data['longitude_of_projection_origin']), + ) + grid_edge_lon_data, grid_edge_lat_data = self.projection(x_grid_edge, y_grid_edge, inverse=True) # Create grid outline by stacking the edges in both coordinates model_grid_outline = np.vstack((grid_edge_lon_data, grid_edge_lat_data)).T @@ -323,17 +324,31 @@ class MercatorNes(Nes): 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) - + # Calculate Mercator coordinates bounds + inc_x = np.abs(np.mean(np.diff(self._x['data']))) + x_bnds = self.create_single_spatial_bounds(np.array([self._y['data']] * len(self._x['data'])).T, + inc_x, spatial_nv=4, inverse=True) + + inc_y = np.abs(np.mean(np.diff(self._y['data']))) + y_bnds = self.create_single_spatial_bounds(np.array([self._x['data']] * len(self._y['data'])), + inc_y, spatial_nv=4) + + # Transform Mercator bounds to regular bounds + self.projection = Proj( + proj='merc', + a=6378137.0, # WGS84_SEMIMAJOR_AXIS (as defined in Cartopy source code) + b=6356752.3142, # WGS84_SEMIMINOR_AXIS (as defined in Cartopy source code) + lat_ts=float(self.projection_data['standard_parallel'][0]), + lon_0=float(self.projection_data['longitude_of_projection_origin']), + ) + lon_bnds, lat_bnds = self.projection(x_bnds, y_bnds, inverse=True) + + # Obtain regular coordinates bounds 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'], @@ -389,4 +404,35 @@ class MercatorNes(Nes): Indicates if you want to print extra information during the process. """ - raise NotImplementedError("Grib2 format cannot be write in a Mercator projection.") + raise NotImplementedError("Grib2 format cannot be written in a Mercator projection.") + + def to_shapefile(self, path): + """ + Write output file with shapefile format. + + Parameters + ---------- + path : str + Path to the output file. + """ + + # Get latitude and longitude cell boundaries + if self._lat_bnds is None or self._lon_bnds is None: + self.create_spatial_bounds() + + # Reshape arrays to create geometry + aux_b_lats = self.lat_bnds.reshape((self.lat_bnds.shape[0] * self.lat_bnds.shape[1], self.lat_bnds.shape[2])) + aux_b_lons = self.lon_bnds.reshape((self.lon_bnds.shape[0] * self.lon_bnds.shape[1], self.lon_bnds.shape[2])) + + # Create dataframe cointaining all polygons + geometry = [] + for i in range(aux_b_lons.shape[0]): + geometry.append(Polygon([(aux_b_lons[i, 0], aux_b_lats[i, 0]), + (aux_b_lons[i, 1], aux_b_lats[i, 1]), + (aux_b_lons[i, 2], aux_b_lats[i, 2]), + (aux_b_lons[i, 3], aux_b_lats[i, 3]), + (aux_b_lons[i, 0], aux_b_lats[i, 0])])) + gdf = gpd.GeoDataFrame(index=range(aux_b_lons.shape[0]), geometry=geometry, crs="EPSG:4326") + gdf.to_file(path) + + return None diff --git a/nes/nc_projections/points_nes.py b/nes/nc_projections/points_nes.py index 3c0769f47ccea9d481438d57e0d81dc48e1fc8c8..a647cc035149cdf7a4fbaf736ea215da1ece81ed 100644 --- a/nes/nc_projections/points_nes.py +++ b/nes/nc_projections/points_nes.py @@ -573,24 +573,6 @@ class PointsNes(Nes): 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. - - Parameters - ---------- - path : str - Path to the output file. - grib_keys : dict - Dictionary with the grib2 keys. - grib_template_path : str - Path to the grib2 file to use as template. - 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): """ Transform a PointsNes into a PointsNesProvidentia object @@ -639,3 +621,33 @@ class PointsNes(Nes): points_nes_providentia.variables = variables return points_nes_providentia + + def to_grib2(self, path, grib_keys, grib_template_path, info=False): + """ + Write output file with grib2 format. + + Parameters + ---------- + path : str + Path to the output file. + grib_keys : dict + Dictionary with the grib2 keys. + grib_template_path : str + Path to the grib2 file to use as template. + info : bool + Indicates if you want to print extra information during the process. + """ + + raise NotImplementedError("Grib2 format cannot be written with point data.") + + def to_shapefile(self, path): + """ + Write output file with shapefile format. + + Parameters + ---------- + path : str + Path to the output file. + """ + + raise NotImplementedError("Shapefile format cannot be written with point data.") diff --git a/nes/nc_projections/rotated_nes.py b/nes/nc_projections/rotated_nes.py index d87f7e528d8a07976b6d77d61dd7ba88f25a77fd..c5b2045b924c47c4d1029f309e72efd0a1f6a819 100644 --- a/nes/nc_projections/rotated_nes.py +++ b/nes/nc_projections/rotated_nes.py @@ -4,6 +4,8 @@ import numpy as np import math from cfunits import Units from copy import deepcopy +import geopandas as gpd +from shapely.geometry import Polygon from .default_nes import Nes @@ -59,7 +61,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, @@ -128,23 +130,23 @@ class RotatedNes(Nes): Returns ------- - projection : dict + projection_data : dict Dictionary with the projection data. """ if create_nes: - projection = {'data': None, - 'dimensions': (), - 'grid_mapping_name': 'rotated_latitude_longitude', - 'grid_north_pole_latitude': 90 - kwargs['centre_lat'], - 'grid_north_pole_longitude': -180 + kwargs['centre_lon'], - } + projection_data = {'data': None, + 'dimensions': (), + 'grid_mapping_name': 'rotated_latitude_longitude', + 'grid_north_pole_latitude': 90 - kwargs['centre_lat'], + 'grid_north_pole_longitude': -180 + kwargs['centre_lon'], + } else: - projection = self.variables['rotated_pole'] + projection_data = self.variables['rotated_pole'] self.free_vars('rotated_pole') - return projection + return projection_data def _create_dimensions(self, netcdf): """ @@ -379,17 +381,24 @@ class RotatedNes(Nes): 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) + # Calculate rotated coordinates bounds + inc_rlat = np.abs(np.mean(np.diff(self._rlat['data']))) + rlat_bnds = self.create_single_spatial_bounds(np.array([self._rlat['data']] * len(self._rlon['data'])).T, + inc_rlat, spatial_nv=4, inverse=True) + + inc_rlon = np.abs(np.mean(np.diff(self._rlon['data']))) + rlon_bnds = self.create_single_spatial_bounds(np.array([self._rlon['data']] * len(self._rlat['data'])), + inc_rlon, spatial_nv=4) + # Transform rotated bounds to regular bounds + lon_bnds, lat_bnds = self.rotated2latlon(rlon_bnds, rlat_bnds) + + # Obtain regular coordinates bounds 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'], @@ -445,4 +454,34 @@ class RotatedNes(Nes): Indicates if you want to print extra information during the process. """ - raise NotImplementedError("Grib2 format cannot be write in a Rotated pole projection.") + raise NotImplementedError("Grib2 format cannot be written in a Rotated pole projection.") + + def to_shapefile(self, path): + """ + Write output file with shapefile format. + + Parameters + ---------- + path : str + Path to the output file. + """ + + if self._lat_bnds is None or self._lon_bnds is None: + self.create_spatial_bounds() + + # Reshape arrays to create geometry + aux_b_lats = self.lat_bnds.reshape((self.lat_bnds.shape[0] * self.lat_bnds.shape[1], self.lat_bnds.shape[2])) + aux_b_lons = self.lon_bnds.reshape((self.lon_bnds.shape[0] * self.lon_bnds.shape[1], self.lon_bnds.shape[2])) + + # Create dataframe cointaining all polygons + geometry = [] + for i in range(aux_b_lons.shape[0]): + geometry.append(Polygon([(aux_b_lons[i, 0], aux_b_lats[i, 0]), + (aux_b_lons[i, 1], aux_b_lats[i, 1]), + (aux_b_lons[i, 2], aux_b_lats[i, 2]), + (aux_b_lons[i, 3], aux_b_lats[i, 3]), + (aux_b_lons[i, 0], aux_b_lats[i, 0])])) + gdf = gpd.GeoDataFrame(index=range(aux_b_lons.shape[0]), geometry=geometry, crs="EPSG:4326") + gdf.to_file(path) + + return None diff --git a/tests/scalability_test_nord3v2.bash b/tests/scalability_test_nord3v2.bash index 7e398100060d08b481af1de54d51ae3525350023..c7256757d51f3597aa9da92d265745e507d8a1d3 100644 --- a/tests/scalability_test_nord3v2.bash +++ b/tests/scalability_test_nord3v2.bash @@ -15,7 +15,8 @@ module load mpi4py/3.0.3-foss-2019b-Python-3.7.4 module load filelock/3.7.1-foss-2019b-Python-3.7.4 module load pyproj/2.5.0-foss-2019b-Python-3.7.4 module load eccodes-python/0.9.5-foss-2019b-Python-3.7.4 - +module load geopandas/0.8.1-foss-2019b-Python-3.7.4 +module load Shapely/1.7.1-foss-2019b-Python-3.7.4 for nprocs in 1 2 4 8 do diff --git a/tests/test_bash_mn4.cmd b/tests/test_bash_mn4.cmd index 1aa487e0eec2726d3b903659b1ac88a48203b796..db2758fcffd54ce03e81b5a2b4e4d8af072ea07e 100644 --- a/tests/test_bash_mn4.cmd +++ b/tests/test_bash_mn4.cmd @@ -23,7 +23,8 @@ module load OpenMPI/4.0.5-GCC-8.3.0-mn4 module load filelock/3.7.1-foss-2019b-Python-3.7.4 module load eccodes-python/0.9.5-foss-2019b-Python-3.7.4 module load pyproj/2.5.0-foss-2019b-Python-3.7.4 - +module load geopandas/0.8.1-foss-2019b-Python-3.7.4 +module load Shapely/1.7.1-foss-2019b-Python-3.7.4 export PYTHONPATH=/gpfs/projects/bsc32/models/NES:${PYTHONPATH} cd /gpfs/projects/bsc32/models/NES/tests diff --git a/tests/test_bash_nord3v2.cmd b/tests/test_bash_nord3v2.cmd index c1776988be0cd24788ac45594a85edba82906e2b..da0f4d7bf1829f732d82e21237872333048060c8 100644 --- a/tests/test_bash_nord3v2.cmd +++ b/tests/test_bash_nord3v2.cmd @@ -23,6 +23,8 @@ module load mpi4py/3.0.3-foss-2019b-Python-3.7.4 module load filelock/3.7.1-foss-2019b-Python-3.7.4 module load eccodes-python/0.9.5-foss-2019b-Python-3.7.4 module load pyproj/2.5.0-foss-2019b-Python-3.7.4 +module load geopandas/0.8.1-foss-2019b-Python-3.7.4 +module load Shapely/1.7.1-foss-2019b-Python-3.7.4 export PYTHONPATH=/gpfs/projects/bsc32/models/NES:${PYTHONPATH} cd /gpfs/projects/bsc32/models/NES/tests diff --git a/tutorials/1.Introduction/1.5.Read_Write_Mercator.ipynb b/tutorials/1.Introduction/1.5.Read_Write_Mercator.ipynb index 67f9bb479f4f32d46bc68c8ff0f816ca3bd1d204..d4cb3f39016ba56ef84ad85a5204515898be6e1d 100644 --- a/tutorials/1.Introduction/1.5.Read_Write_Mercator.ipynb +++ b/tutorials/1.Introduction/1.5.Read_Write_Mercator.ipynb @@ -413,7 +413,7 @@ " lon_bnds (y, x, nv) float32 ...\n", " var_aux (time, y, x) float32 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", " mercator int32 -2147483647\n", - " cell_area (y, x) float32 1.316e+09 1.316e+09 ... 1.051e+09 1.051e+09
array([0.])
array([[-43.5182 , -43.5182 , -43.5182 , ..., -43.5182 , -43.5182 ,\n", + " cell_area (y, x) float32 1.316e+09 1.316e+09 ... 1.051e+09 1.051e+09
array([0.])
array([[-43.5182 , -43.5182 , -43.5182 , ..., -43.5182 , -43.5182 ,\n", " -43.5182 ],\n", " [-43.191082, -43.191082, -43.191082, ..., -43.191082, -43.191082,\n", " -43.191082],\n", @@ -425,7 +425,7 @@ " [ 49.31089 , 49.31089 , 49.31089 , ..., 49.31089 , 49.31089 ,\n", " 49.31089 ],\n", " [ 49.60332 , 49.60332 , 49.60332 , ..., 49.60332 , 49.60332 ,\n", - " 49.60332 ]], dtype=float32)
array([[-18.9089 , -18.459013, -18.009129, ..., 74.217415, 74.6673 ,\n", + " 49.60332 ]], dtype=float32)
array([[-18.9089 , -18.459013, -18.009129, ..., 74.217415, 74.6673 ,\n", " 75.11718 ],\n", " [-18.9089 , -18.459013, -18.009129, ..., 74.217415, 74.6673 ,\n", " 75.11718 ],\n", @@ -437,12 +437,12 @@ " [-18.9089 , -18.459013, -18.009129, ..., 74.217415, 74.6673 ,\n", " 75.11718 ],\n", " [-18.9089 , -18.459013, -18.009129, ..., 74.217415, 74.6673 ,\n", - " 75.11718 ]], dtype=float32)
array([-1.010145e+05, -5.101450e+04, -1.014500e+03, ..., 1.024899e+07,\n", - " 1.029899e+07, 1.034899e+07])
array([-5382460., -5332460., -5282460., ..., 6267540., 6317540., 6367540.])
[198240 values with dtype=float32]
[198240 values with dtype=float32]
array([[[0., 0., ..., 0., 0.],\n", + " 75.11718 ]], dtype=float32)
array([-1.010145e+05, -5.101450e+04, -1.014500e+03, ..., 1.024899e+07,\n", + " 1.029899e+07, 1.034899e+07])
array([-5382460., -5332460., -5282460., ..., 6267540., 6317540., 6367540.])
[198240 values with dtype=float32]
[198240 values with dtype=float32]
array([[[0., 0., ..., 0., 0.],\n", " [0., 0., ..., 0., 0.],\n", " ...,\n", " [0., 0., ..., 0., 0.],\n", - " [0., 0., ..., 0., 0.]]], dtype=float32)
array(-2147483647, dtype=int32)
array([[1.315942e+09, 1.315937e+09, 1.315942e+09, ..., 1.315931e+09,\n", + " [0., 0., ..., 0., 0.]]], dtype=float32)
array(-2147483647, dtype=int32)
array([[1.315942e+09, 1.315937e+09, 1.315942e+09, ..., 1.315931e+09,\n", " 1.315954e+09, 1.315931e+09],\n", " [1.330202e+09, 1.330197e+09, 1.330202e+09, ..., 1.330191e+09,\n", " 1.330214e+09, 1.330191e+09],\n", @@ -454,7 +454,7 @@ " [1.063687e+09, 1.063683e+09, 1.063687e+09, ..., 1.063678e+09,\n", " 1.063696e+09, 1.063678e+09],\n", " [1.051047e+09, 1.051043e+09, 1.051047e+09, ..., 1.051038e+09,\n", - " 1.051056e+09, 1.051038e+09]], dtype=float32)
array(['2000-01-01T00:00:00.000000000'], dtype='datetime64[ns]')
array([0.])
array([[-43.5182 , -43.5182 , -43.5182 , ..., -43.5182 , -43.5182 ,\n", + " Conventions: CF-1.7
array(['2000-01-01T00:00:00.000000000'], dtype='datetime64[ns]')
array([0.])
array([[-43.5182 , -43.5182 , -43.5182 , ..., -43.5182 , -43.5182 ,\n", " -43.5182 ],\n", " [-43.191082, -43.191082, -43.191082, ..., -43.191082, -43.191082,\n", " -43.191082],\n", @@ -1728,7 +1643,7 @@ " [ 49.31089 , 49.31089 , 49.31089 , ..., 49.31089 , 49.31089 ,\n", " 49.31089 ],\n", " [ 49.603321, 49.603321, 49.603321, ..., 49.603321, 49.603321,\n", - " 49.603321]])
array([[-18.908899, -18.459013, -18.009129, ..., 74.217415, 74.667297,\n", + " 49.603321]])
array([[-18.908899, -18.459013, -18.009129, ..., 74.217415, 74.667297,\n", " 75.11718 ],\n", " [-18.908899, -18.459013, -18.009129, ..., 74.217415, 74.667297,\n", " 75.11718 ],\n", @@ -1740,12 +1655,12 @@ " [-18.908899, -18.459013, -18.009129, ..., 74.217415, 74.667297,\n", " 75.11718 ],\n", " [-18.908899, -18.459013, -18.009129, ..., 74.217415, 74.667297,\n", - " 75.11718 ]])
array([-5382460., -5332460., -5282460., ..., 6267540., 6317540., 6367540.])
array([-1.010145e+05, -5.101450e+04, -1.014500e+03, ..., 1.024899e+07,\n", - " 1.029899e+07, 1.034899e+07])
[198240 values with dtype=float64]
[198240 values with dtype=float64]
array([[[[0., ..., 0.],\n", + " 75.11718 ]])
array([-5382460., -5332460., -5282460., ..., 6267540., 6317540., 6367540.])
array([-1.010145e+05, -5.101450e+04, -1.014500e+03, ..., 1.024899e+07,\n", + " 1.029899e+07, 1.034899e+07])
[198240 values with dtype=float64]
[198240 values with dtype=float64]
array([[[[0., ..., 0.],\n", " ...,\n", - " [0., ..., 0.]]]], dtype=float32)
array([[[[1.315942e+09, ..., 1.315931e+09],\n", + " [0., ..., 0.]]]], dtype=float32)
array([[[[1.315942e+09, ..., 1.315931e+09],\n", " ...,\n", - " [1.051047e+09, ..., 1.051038e+09]]]], dtype=float32)
array(b'', dtype='|S1')
array(b'', dtype='|S1')
array(['1996-12-31T00:00:00.000000000'], dtype='datetime64[ns]')
array([0.])
array([-27. , -26.8, -26.6, ..., 26.6, 26.8, 27. ])
array([-35. , -34.8, -34.6, ..., 34.6, 34.8, 35. ])
array([[16.350341, 16.432934, 16.515147, ..., 16.515147, 16.432934, 16.350341],\n", + " Conventions: CF-1.7
array(['1996-12-31T00:00:00.000000000'], dtype='datetime64[ns]')
array([0.])
array([-27. , -26.8, -26.6, ..., 26.6, 26.8, 27. ])
array([-35. , -34.8, -34.6, ..., 34.6, 34.8, 35. ])
array([[16.350341, 16.432934, 16.515147, ..., 16.515147, 16.432934, 16.350341],\n", " [16.527429, 16.610244, 16.692679, ..., 16.692679, 16.610244, 16.527429],\n", " [16.704473, 16.78751 , 16.870167, ..., 16.870167, 16.78751 , 16.704473],\n", " ...,\n", " [58.320945, 58.472682, 58.624312, ..., 58.624312, 58.472682, 58.320945],\n", " [58.426281, 58.578207, 58.730029, ..., 58.730029, 58.578207, 58.426281],\n", - " [58.530794, 58.682904, 58.834914, ..., 58.834914, 58.682904, 58.530794]])
array([[-22.181266, -22.01667 , -21.851799, ..., 41.851799, 42.01667 ,\n", + " [58.530794, 58.682904, 58.834914, ..., 58.834914, 58.682904, 58.530794]])
array([[-22.181266, -22.01667 , -21.851799, ..., 41.851799, 42.01667 ,\n", " 42.181266],\n", " [-22.278178, -22.113181, -21.947906, ..., 41.947906, 42.113181,\n", " 42.278178],\n", @@ -443,7 +443,7 @@ " [-67.901883, -67.722467, -67.541948, ..., 87.541948, 87.722467,\n", " 87.901883],\n", " [-68.22804 , -68.049824, -67.870513, ..., 87.870513, 88.049824,\n", - " 88.22804 ]])
array(b'', dtype='|S1')
array(b'', dtype='|S1')
array(['1996-12-31T00:00:00.000000000'], dtype='datetime64[ns]')
array([0.])
array([-795137.125, -791137.125, -787137.125, ..., 780862.875, 784862.875,\n", - " 788862.875])
array([-805847.688, -801847.688, -797847.688, ..., 770152.312, 774152.312,\n", - " 778152.312])
[157609 values with dtype=float64]
[157609 values with dtype=float64]
array(b'', dtype='|S1')
array(['1996-12-31T00:00:00.000000000'], dtype='datetime64[ns]')
array([0.])
array([-795137.125, -791137.125, -787137.125, ..., 780862.875, 784862.875,\n", + " 788862.875])
array([-805847.688, -801847.688, -797847.688, ..., 770152.312, 774152.312,\n", + " 778152.312])
[157609 values with dtype=float64]
[157609 values with dtype=float64]
array(b'', dtype='|S1')
array(['1996-12-31T00:00:00.000000000'], dtype='datetime64[ns]')
array([0.])
array([-5382460., -5332460., -5282460., ..., 6267540., 6317540., 6367540.])
array([-1.010175e+05, -5.101750e+04, -1.017500e+03, ..., 1.024898e+07,\n", - " 1.029898e+07, 1.034898e+07])
array([[-43.518201, -43.518201, -43.518201, ..., -43.518201, -43.518201,\n", - " -43.518201],\n", - " [-43.191082, -43.191082, -43.191082, ..., -43.191082, -43.191082,\n", - " -43.191082],\n", - " [-42.862201, -42.862201, -42.862201, ..., -42.862201, -42.862201,\n", - " -42.862201],\n", + " Conventions: CF-1.7
array(['1996-12-31T00:00:00.000000000'], dtype='datetime64[ns]')
array([0.])
array([-5382460., -5332460., -5282460., ..., 6267540., 6317540., 6367540.])
array([-1.010175e+05, -5.101750e+04, -1.017500e+03, ..., 1.024898e+07,\n", + " 1.029898e+07, 1.034898e+07])
array([[-43.665383, -43.665383, -43.665383, ..., -43.665383, -43.665383,\n", + " -43.665383],\n", + " [-43.33832 , -43.33832 , -43.33832 , ..., -43.33832 , -43.33832 ,\n", + " -43.33832 ],\n", + " [-43.009473, -43.009473, -43.009473, ..., -43.009473, -43.009473,\n", + " -43.009473],\n", " ...,\n", - " [ 49.016711, 49.016711, 49.016711, ..., 49.016711, 49.016711,\n", - " 49.016711],\n", - " [ 49.310889, 49.310889, 49.310889, ..., 49.310889, 49.310889,\n", - " 49.310889],\n", - " [ 49.603321, 49.603321, 49.603321, ..., 49.603321, 49.603321,\n", - " 49.603321]])
array([[-18.908926, -18.459041, -18.009155, ..., 74.217384, 74.66727 ,\n", - " 75.117155],\n", - " [-18.908926, -18.459041, -18.009155, ..., 74.217384, 74.66727 ,\n", - " 75.117155],\n", - " [-18.908926, -18.459041, -18.009155, ..., 74.217384, 74.66727 ,\n", - " 75.117155],\n", + " [ 49.159788, 49.159788, 49.159788, ..., 49.159788, 49.159788,\n", + " 49.159788],\n", + " [ 49.453582, 49.453582, 49.453582, ..., 49.453582, 49.453582,\n", + " 49.453582],\n", + " [ 49.745614, 49.745614, 49.745614, ..., 49.745614, 49.745614,\n", + " 49.745614]])
array([[-18.907765, -18.458454, -18.009143, ..., 74.099525, 74.548836,\n", + " 74.998146],\n", + " [-18.907765, -18.458454, -18.009143, ..., 74.099525, 74.548836,\n", + " 74.998146],\n", + " [-18.907765, -18.458454, -18.009143, ..., 74.099525, 74.548836,\n", + " 74.998146],\n", " ...,\n", - " [-18.908926, -18.459041, -18.009155, ..., 74.217384, 74.66727 ,\n", - " 75.117155],\n", - " [-18.908926, -18.459041, -18.009155, ..., 74.217384, 74.66727 ,\n", - " 75.117155],\n", - " [-18.908926, -18.459041, -18.009155, ..., 74.217384, 74.66727 ,\n", - " 75.117155]])
array(b'', dtype='|S1')
array(b'', dtype='|S1')
array(['2018-04-01T00:00:00.000000000', '2018-04-01T01:00:00.000000000',\n", + " Conventions: CF-1.7
array(['2018-04-01T00:00:00.000000000', '2018-04-01T01:00:00.000000000',\n", " '2018-04-01T02:00:00.000000000', ..., '2018-04-30T21:00:00.000000000',\n", " '2018-04-30T22:00:00.000000000', '2018-04-30T23:00:00.000000000'],\n", - " dtype='datetime64[ns]')
array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11.,\n", + " dtype='datetime64[ns]')
array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11.,\n", " 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23.,\n", " 24., 25., 26., 27., 28., 29., 30., 31., 32., 33., 34., 35.,\n", " 36., 37., 38., 39., 40., 41., 42., 43., 44., 45., 46., 47.,\n", @@ -1100,7 +1100,7 @@ " 132., 133., 134., 135., 136., 137., 138., 139., 140., 141., 142., 143.,\n", " 144., 145., 146., 147., 148., 149., 150., 151., 152., 153., 154., 155.,\n", " 156., 157., 158., 159., 160., 161., 162., 163., 164., 165., 166., 167.,\n", - " 168., 169., 170., 171., 172., 173., 174.])
array([-64.24006 , -54.848465, -22.103333, -31.668611, 47.766666, 46.677778,\n", + " 168., 169., 170., 171., 172., 173., 174.])
array([-64.24006 , -54.848465, -22.103333, -31.668611, 47.766666, 46.677778,\n", " 48.721111, 47.529167, 47.05407 , 46.693611, 47.348056, 47.973056,\n", " 48.878611, 48.106111, 48.371111, 48.334722, 48.050833, 47.838611,\n", " 47.040277, 47.066944, 49.877778, 50.629421, 50.503333, 41.695833,\n", @@ -1129,7 +1129,7 @@ " 56.0429 , 60.0858 , 57.816667, 64.25 , 59.728 , 45.566667,\n", " 46.428611, 46.299444, 48.933333, 49.15 , 49.05 , 47.96 ,\n", " 71.323013, 40.12498 , 19.53623 , -89.996948, 41.0541 , 21.5731 ,\n", - " -34.35348 ])
array([-5.662478e+01, -6.831069e+01, -6.560083e+01, -6.388194e+01,\n", + " -34.35348 ])
array([-5.662478e+01, -6.831069e+01, -6.560083e+01, -6.388194e+01,\n", " 1.676667e+01, 1.297222e+01, 1.594222e+01, 9.926667e+00,\n", " 1.295794e+01, 1.391500e+01, 1.588222e+01, 1.301611e+01,\n", " 1.504667e+01, 1.591944e+01, 1.554667e+01, 1.673056e+01,\n", @@ -1172,19 +1172,19 @@ " 1.547200e+01, 1.486667e+01, 1.500333e+01, 1.453861e+01,\n", " 1.958333e+01, 2.028333e+01, 2.226667e+01, 1.786056e+01,\n", " -1.566115e+02, -1.052368e+02, -1.555762e+02, -2.480000e+01,\n", - " -1.241510e+02, 1.035157e+02, 1.848968e+01])
array([[-25. , -24.8, -24.6, ..., 44.6, 44.8, 45. ],\n", + " -1.241510e+02, 1.035157e+02, 1.848968e+01])
array([[-25. , -24.8, -24.6, ..., 44.6, 44.8, 45. ],\n", " [-25. , -24.8, -24.6, ..., 44.6, 44.8, 45. ],\n", " [-25. , -24.8, -24.6, ..., 44.6, 44.8, 45. ],\n", " ...,\n", " [-25. , -24.8, -24.6, ..., 44.6, 44.8, 45. ],\n", " [-25. , -24.8, -24.6, ..., 44.6, 44.8, 45. ],\n", - " [-25. , -24.8, -24.6, ..., 44.6, 44.8, 45. ]])
array([[30. , 30. , 30. , ..., 30. , 30. , 30. ],\n", + " [-25. , -24.8, -24.6, ..., 44.6, 44.8, 45. ]])
array([[30. , 30. , 30. , ..., 30. , 30. , 30. ],\n", " [30.2, 30.2, 30.2, ..., 30.2, 30.2, 30.2],\n", " [30.4, 30.4, 30.4, ..., 30.4, 30.4, 30.4],\n", " ...,\n", " [71.6, 71.6, 71.6, ..., 71.6, 71.6, 71.6],\n", " [71.8, 71.8, 71.8, ..., 71.8, 71.8, 71.8],\n", - " [72. , 72. , 72. , ..., 72. , 72. , 72. ]])
array([-25.1, -25.1, -25.1, ..., -24.7, -24.9, -25.1])
array([29.9, 30.1, 30.3, ..., 29.9, 29.9, 29.9])
[126000 values with dtype=float64]
array([-25.1, -25.1, -25.1, ..., -24.7, -24.9, -25.1])
array([29.9, 30.1, 30.3, ..., 29.9, 29.9, 29.9])
[126000 values with dtype=float64]
array(['2018-04-01T00:00:00.000000000', '2018-04-01T01:00:00.000000000',\n", + " NCO: 4.7.2
array(['2018-04-01T00:00:00.000000000', '2018-04-01T01:00:00.000000000',\n", " '2018-04-01T02:00:00.000000000', ..., '2018-04-30T21:00:00.000000000',\n", " '2018-04-30T22:00:00.000000000', '2018-04-30T23:00:00.000000000'],\n", - " dtype='datetime64[ns]')
array([29.9 , 30.1 , 30.299999, ..., 29.9 , 29.9 , 29.9 ])
array([-25.1 , -25.1 , -25.1 , ..., -24.700001, -24.9 ,\n", - " -25.1 ])
array([-64.24006 , -54.848465, -22.103333, -31.668611, 47.766666, 46.677778,\n", + " dtype='datetime64[ns]')
array([29.9 , 30.1 , 30.299999, ..., 29.9 , 29.9 , 29.9 ])
array([-25.1 , -25.1 , -25.1 , ..., -24.700001, -24.9 ,\n", + " -25.1 ])
array([-64.24006 , -54.848465, -22.103333, -31.668611, 47.766666, 46.677778,\n", " 48.721111, 47.529167, 47.05407 , 46.693611, 47.348056, 47.973056,\n", " 48.878611, 48.106111, 48.371111, 48.334722, 48.050833, 47.838611,\n", " 47.040277, 47.066944, 49.877778, 50.629421, 50.503333, 41.695833,\n", @@ -1764,7 +1764,7 @@ " 56.0429 , 60.0858 , 57.816667, 64.25 , 59.728 , 45.566667,\n", " 46.428611, 46.299444, 48.933333, 49.15 , 49.05 , 47.96 ,\n", " 71.323013, 40.12498 , 19.53623 , -89.996948, 41.0541 , 21.5731 ,\n", - " -34.35348 ])
array([-5.662478e+01, -6.831069e+01, -6.560083e+01, -6.388194e+01,\n", + " -34.35348 ])
array([-5.662478e+01, -6.831069e+01, -6.560083e+01, -6.388194e+01,\n", " 1.676667e+01, 1.297222e+01, 1.594222e+01, 9.926667e+00,\n", " 1.295794e+01, 1.391500e+01, 1.588222e+01, 1.301611e+01,\n", " 1.504667e+01, 1.591944e+01, 1.554667e+01, 1.673056e+01,\n", @@ -1807,13 +1807,13 @@ " 1.547200e+01, 1.486667e+01, 1.500333e+01, 1.453861e+01,\n", " 1.958333e+01, 2.028333e+01, 2.226667e+01, 1.786056e+01,\n", " -1.566115e+02, -1.052368e+02, -1.555762e+02, -2.480000e+01,\n", - " -1.241510e+02, 1.035157e+02, 1.848968e+01])
array([[30. , 30. , 30. , ..., 30. , 30. , 30. ],\n", + " -1.241510e+02, 1.035157e+02, 1.848968e+01])
array([[30. , 30. , 30. , ..., 30. , 30. , 30. ],\n", " [30.200001, 30.200001, 30.200001, ..., 30.200001, 30.200001, 30.200001],\n", " [30.4 , 30.4 , 30.4 , ..., 30.4 , 30.4 , 30.4 ],\n", " ...,\n", " [71.599998, 71.599998, 71.599998, ..., 71.599998, 71.599998, 71.599998],\n", " [71.800003, 71.800003, 71.800003, ..., 71.800003, 71.800003, 71.800003],\n", - " [72. , 72. , 72. , ..., 72. , 72. , 72. ]])
array([[-25. , -24.799999, -24.6 , ..., 44.599998, 44.799999,\n", + " [72. , 72. , 72. , ..., 72. , 72. , 72. ]])
array([[-25. , -24.799999, -24.6 , ..., 44.599998, 44.799999,\n", " 45. ],\n", " [-25. , -24.799999, -24.6 , ..., 44.599998, 44.799999,\n", " 45. ],\n", @@ -1825,7 +1825,7 @@ " [-25. , -24.799999, -24.6 , ..., 44.599998, 44.799999,\n", " 45. ],\n", " [-25. , -24.799999, -24.6 , ..., 44.599998, 44.799999,\n", - " 45. ]])
[126000 values with dtype=float32]
array(['AR0001R_UVP', 'AR0002G_UVP', 'AR0004R_UVP', 'AR0005R_UVP',\n", + " 45. ]])
[126000 values with dtype=float32]
array(['AR0001R_UVP', 'AR0002G_UVP', 'AR0004R_UVP', 'AR0005R_UVP',\n", " 'AT0002R_UVP', 'AT0005R_UVP', 'AT0030R_UVP', 'AT0032R_UVP',\n", " 'AT0034G_UVP', 'AT0038R_UVP', 'AT0040R_UVP', 'AT0041R_UVP',\n", " 'AT0042R_UVP', 'AT0043R_UVP', 'AT0045R_UVP', 'AT0046R_UVP',\n", @@ -1868,7 +1868,7 @@ " 'SE0039R_UVP', 'SI0008R_UVP', 'SI0031R_UVP', 'SI0032R_UVP',\n", " 'SK0002R_UVP', 'SK0004R_UVP', 'SK0006R_UVP', 'SK0007R_UVP',\n", " 'US0008R_UVP', 'US0901R_UVP', 'US1200R_UVP', 'US6004G_UVP',\n", - " 'US6005G_UVP', 'VN0001R_UVP', 'ZA0001G_UVP'], dtype=object)