@@ -629,12 +629,12 @@ def from_netcdf(
629629 if len (buffer_data .shape ) == 4 :
630630 errormessage = (
631631 f"Field { filebuffer .name } expecting a data shape of [tdim={ grid .tdim } , zdim={ grid .zdim } , "
632- f"ydim={ grid .ydim - 2 * grid . meridional_halo } , xdim={ grid .xdim - 2 * grid . zonal_halo } ] "
632+ f"ydim={ grid .ydim } , xdim={ grid .xdim } ] "
633633 f"but got shape { buffer_data .shape } . Flag transpose=True could help to reorder the data."
634634 )
635635 assert buffer_data .shape [0 ] == grid .tdim , errormessage
636- assert buffer_data .shape [2 ] == grid .ydim - 2 * grid . meridional_halo , errormessage
637- assert buffer_data .shape [3 ] == grid .xdim - 2 * grid . zonal_halo , errormessage
636+ assert buffer_data .shape [2 ] == grid .ydim , errormessage
637+ assert buffer_data .shape [3 ] == grid .xdim , errormessage
638638
639639 if len (buffer_data .shape ) == 2 :
640640 data_list .append (buffer_data .reshape (sum (((len (tslice ), 1 ), buffer_data .shape ), ())))
@@ -760,28 +760,22 @@ def _reshape(self, data, transpose=False):
760760 "Flag transpose=True could help to reorder the data."
761761 )
762762 assert data .shape [0 ] == self .grid .tdim , errormessage
763- assert data .shape [2 ] == self .grid .ydim - 2 * self . grid . meridional_halo , errormessage
764- assert data .shape [3 ] == self .grid .xdim - 2 * self . grid . zonal_halo , errormessage
763+ assert data .shape [2 ] == self .grid .ydim , errormessage
764+ assert data .shape [3 ] == self .grid .xdim , errormessage
765765 if self .gridindexingtype == "pop" :
766766 assert data .shape [1 ] == self .grid .zdim or data .shape [1 ] == self .grid .zdim - 1 , errormessage
767767 else :
768768 assert data .shape [1 ] == self .grid .zdim , errormessage
769769 else :
770770 assert data .shape == (
771771 self .grid .tdim ,
772- self .grid .ydim - 2 * self . grid . meridional_halo ,
773- self .grid .xdim - 2 * self . grid . zonal_halo ,
772+ self .grid .ydim ,
773+ self .grid .xdim ,
774774 ), (
775775 f"Field { self .name } expecting a data shape of [tdim, ydim, xdim]. "
776776 "Flag transpose=True could help to reorder the data."
777777 )
778- if self .grid .meridional_halo > 0 or self .grid .zonal_halo > 0 :
779- data = self .add_periodic_halo (
780- zonal = self .grid .zonal_halo > 0 ,
781- meridional = self .grid .meridional_halo > 0 ,
782- halosize = max (self .grid .meridional_halo , self .grid .zonal_halo ),
783- data = data ,
784- )
778+
785779 return data
786780
787781 def set_scaling_factor (self , factor ):
@@ -935,54 +929,6 @@ def eval(self, time, z, y, x, particle=None, applyConversion=True):
935929 else :
936930 return value
937931
938- def add_periodic_halo (self , zonal , meridional , halosize = 5 , data = None ):
939- """Add a 'halo' to all Fields in a FieldSet.
940-
941- Add a 'halo' to all Fields in a FieldSet, through extending the Field (and lon/lat)
942- by copying a small portion of the field on one side of the domain to the other.
943- Before adding a periodic halo to the Field, it has to be added to the Grid on which the Field depends
944-
945- See `this tutorial <../examples/tutorial_periodic_boundaries.ipynb>`__
946- for a detailed explanation on how to set up periodic boundaries
947-
948- Parameters
949- ----------
950- zonal : bool
951- Create a halo in zonal direction.
952- meridional : bool
953- Create a halo in meridional direction.
954- halosize : int
955- Size of the halo (in grid points). Default is 5 grid points
956- data :
957- if data is not None, the periodic halo will be achieved on data instead of self.data and data will be returned (Default value = None)
958- """
959- dataNone = not isinstance (data , np .ndarray )
960- if self .grid .defer_load and dataNone :
961- return
962- data = self .data if dataNone else data
963- if zonal :
964- if len (data .shape ) == 3 :
965- data = np .concatenate ((data [:, :, - halosize :], data , data [:, :, 0 :halosize ]), axis = len (data .shape ) - 1 )
966- assert data .shape [2 ] == self .grid .xdim , "Third dim must be x."
967- else :
968- data = np .concatenate (
969- (data [:, :, :, - halosize :], data , data [:, :, :, 0 :halosize ]), axis = len (data .shape ) - 1
970- )
971- assert data .shape [3 ] == self .grid .xdim , "Fourth dim must be x."
972- if meridional :
973- if len (data .shape ) == 3 :
974- data = np .concatenate ((data [:, - halosize :, :], data , data [:, 0 :halosize , :]), axis = len (data .shape ) - 2 )
975- assert data .shape [1 ] == self .grid .ydim , "Second dim must be y."
976- else :
977- data = np .concatenate (
978- (data [:, :, - halosize :, :], data , data [:, :, 0 :halosize , :]), axis = len (data .shape ) - 2
979- )
980- assert data .shape [2 ] == self .grid .ydim , "Third dim must be y."
981- if dataNone :
982- self .data = data
983- else :
984- return data
985-
986932 def write (self , filename , varname = None ):
987933 """Write a :class:`Field` to a netcdf file.
988934
0 commit comments