From 6f5e7471f29df16930b3b47e53b34d65c2a6a387 Mon Sep 17 00:00:00 2001 From: ctena Date: Thu, 30 Mar 2023 16:10:05 +0200 Subject: [PATCH] Changed NetCDF grid_mapping variable type from char to integer --- CHANGELOG.md | 1 + nes/nc_projections/latlon_nes.py | 3 +-- nes/nc_projections/lcc_nes.py | 4 ++-- nes/nc_projections/mercator_nes.py | 2 +- nes/nc_projections/rotated_nes.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6c5396..32190a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * Bug on `cell_methods` serial write ([#53](https://earth.bsc.es/gitlab/es/NES/-/issues/53)) * Bug on avoid_first_hours that where not filtered after read the dimensions ([#59](https://earth.bsc.es/gitlab/es/NES/-/issues/59)) * Bug while reading masked data. + * grid_mapping NetCDF variable as integer instead of character. ### 1.1.0 * Release date: 2023/03/02 diff --git a/nes/nc_projections/latlon_nes.py b/nes/nc_projections/latlon_nes.py index b044d98..91b7dce 100644 --- a/nes/nc_projections/latlon_nes.py +++ b/nes/nc_projections/latlon_nes.py @@ -245,8 +245,7 @@ class LatLonNes(Nes): netcdf4-python Dataset. """ - mapping = netcdf.createVariable('crs', 'c') - # mapping = netcdf.createVariable('crs', 'i') + mapping = netcdf.createVariable('crs', 'i') mapping.grid_mapping_name = "latitude_longitude" mapping.semi_major_axis = 6371000.0 mapping.inverse_flattening = 0 diff --git a/nes/nc_projections/lcc_nes.py b/nes/nc_projections/lcc_nes.py index b5a679e..34cb9cb 100644 --- a/nes/nc_projections/lcc_nes.py +++ b/nes/nc_projections/lcc_nes.py @@ -415,7 +415,7 @@ class LCCNes(Nes): netCDF4-python variable object. """ - var.grid_mapping = 'Lambert_conformal' + var.grid_mapping = 'Lambert_Conformal' var.coordinates = "lat lon" return None @@ -431,7 +431,7 @@ class LCCNes(Nes): """ if self.projection_data is not None: - mapping = netcdf.createVariable('Lambert_conformal', 'c') + mapping = netcdf.createVariable('Lambert_Conformal', 'i') mapping.grid_mapping_name = self.projection_data['grid_mapping_name'] mapping.standard_parallel = self.projection_data['standard_parallel'] mapping.longitude_of_central_meridian = self.projection_data['longitude_of_central_meridian'] diff --git a/nes/nc_projections/mercator_nes.py b/nes/nc_projections/mercator_nes.py index b752e8d..249c0bc 100644 --- a/nes/nc_projections/mercator_nes.py +++ b/nes/nc_projections/mercator_nes.py @@ -408,7 +408,7 @@ class MercatorNes(Nes): """ if self.projection_data is not None: - mapping = netcdf.createVariable('mercator', 'c') + mapping = netcdf.createVariable('mercator', 'i') mapping.grid_mapping_name = self.projection_data['grid_mapping_name'] mapping.standard_parallel = self.projection_data['standard_parallel'] mapping.longitude_of_projection_origin = self.projection_data['longitude_of_projection_origin'] diff --git a/nes/nc_projections/rotated_nes.py b/nes/nc_projections/rotated_nes.py index 66dc2b7..ec62611 100644 --- a/nes/nc_projections/rotated_nes.py +++ b/nes/nc_projections/rotated_nes.py @@ -459,7 +459,7 @@ class RotatedNes(Nes): """ if self.projection_data is not None: - mapping = netcdf.createVariable('rotated_pole', 'c') + mapping = netcdf.createVariable('rotated_pole', 'i') mapping.grid_mapping_name = self.projection_data['grid_mapping_name'] mapping.grid_north_pole_latitude = self.projection_data['grid_north_pole_latitude'] mapping.grid_north_pole_longitude = self.projection_data['grid_north_pole_longitude'] -- GitLab