diff --git a/CHANGELOG.md b/CHANGELOG.md index 5017be67964bf562dddc6adc320d69a8489baf10..663be2ab22b5baecb9c68ea7bc130c2a3472d6dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,16 @@ # NES CHANGELOG +### 1.1.1 +* Release date: ??? +* Changes and new features: + * Bugs fixing: + * Bug on `cell_methods` serial write ([#53](https://earth.bsc.es/gitlab/es/NES/-/issues/53)) + ### 1.1.0 * Release date: 2023/03/02 * Changes and new features: * Improve Lat-Lon to Cartesian coordinates method (used in Providentia). + * Horizontal interpolation: Conservative * Function to_shapefile() to create shapefiles from a NES object without losing data from the original grid and being able to select the time and level. * Function from_shapefile() to create a new grid with data from a shapefile after doing a spatial join. * Function create_shapefile() can now be used in parallel. diff --git a/nes/nc_projections/default_nes.py b/nes/nc_projections/default_nes.py index a5cdb8af2f83571d2f81aef7e09b4e1cb9f2d313..da83b2b923929004314b5a81417bb33b94b2d4fb 100644 --- a/nes/nc_projections/default_nes.py +++ b/nes/nc_projections/default_nes.py @@ -342,7 +342,7 @@ class Nes(object): """ d = self.__dict__ - state = {k: d[k] for k in d if k not in ['comm', 'variables', 'netcdf']} + state = {k: d[k] for k in d if k not in ['comm', 'variables', 'netcdf', 'cell_measures']} return state @@ -380,8 +380,10 @@ class Nes(object): nessy.netcdf = None if copy_vars: nessy.variables = nessy._get_lazy_variables() + nessy.cell_measures = deepcopy(self.cell_measures) else: nessy.variables = {} + nessy.cell_measures = {} return nessy @@ -2388,11 +2390,13 @@ class Nes(object): else: # if serial: if serial and self.size > 1: - data = self._gather_data() + data = self._gather_data(self.variables) + c_measures = self._gather_data(self.cell_measures) if self.master: new_nc = self.copy(copy_vars=False) new_nc.set_communicator(MPI.COMM_SELF) new_nc.variables = data + new_nc.cell_measures = c_measures if type == 'NES': new_nc.__to_netcdf_py(path) elif type == 'CAMS_RA': @@ -2924,7 +2928,7 @@ class Nes(object): return data_list - def _gather_data(self): + def _gather_data(self, data_to_gather): """ Gather all the variable data into the MPI rank 0 to perform a serial write. @@ -2934,7 +2938,7 @@ class Nes(object): Variables dictionary with all the data from all the ranks. """ - data_list = deepcopy(self.variables) + data_list = deepcopy(data_to_gather) for var_name in data_list.keys(): if self.info and self.master: print("Gathering {0}".format(var_name)) diff --git a/tests/2.4-test_cell_area.py b/tests/2.4-test_cell_area.py index 4c9b152c2c1b7e7dc9c0d25b06eaa10a8b79a4cb..fde0b56a3fcb4992c7a4e3f877caeabe3c864518 100644 --- a/tests/2.4-test_cell_area.py +++ b/tests/2.4-test_cell_area.py @@ -192,3 +192,4 @@ del nessy if rank == 0: result.to_csv(result_path) +