Gridsets and grids#

parcels.gridset module#

class parcels.gridset.GridSet[source]#

Bases: object

GridSet class that holds the Grids on which the Fields are defined.

Attributes
size

Methods

dimrange(dim)

Returns maximum value of a dimension (lon, lat, depth or time) on 'left' side and minimum value on 'right' side for all grids in a gridset.

add_grid

dimrange(dim)[source]#

Returns maximum value of a dimension (lon, lat, depth or time) on ‘left’ side and minimum value on ‘right’ side for all grids in a gridset. Useful for finding e.g. longitude range that overlaps on all grids in a gridset.

parcels.grid module#

class parcels.grid.CGrid[source]#

Bases: Structure

Attributes
grid
gtype
class parcels.grid.CurvilinearSGrid(lon, lat, depth, time=None, time_origin=None, mesh='flat')[source]#

Bases: CurvilinearGrid

Curvilinear S Grid.

Parameters
  • lon – 2D array containing the longitude coordinates of the grid

  • lat – 2D array containing the latitude coordinates of the grid

  • depth – 4D (time-evolving) or 3D (time-independent) array containing the vertical coordinates of the grid, which are s-coordinates. s-coordinates can be terrain-following (sigma) or iso-density (rho) layers, or any generalised vertical discretisation. The depth of each node depends then on the horizontal position (lon, lat), the number of the layer and the time is depth is a 4D array. depth array is either a 4D array[xdim][ydim][zdim][tdim] or a 3D array[xdim][ydim[zdim].

  • time – Vector containing the time coordinates of the grid

  • time_origin (parcels.tools.converters.TimeConverter) – Time origin of the time axis

  • mesh (str) –

    String indicating the type of mesh coordinates and units used during velocity interpolation:

    1. spherical (default): Lat and lon in degree, with a correction for zonal velocity U near the poles.

    2. flat: No conversion, lat/lon are assumed to be in m.

Attributes
child_ctypes_struct

Returns a ctypes struct object containing all relevant pointers and sizes for this grid.

chunk_deprecated
chunk_loaded
chunk_loaded_touched
chunk_loading_requested
chunk_not_loaded
ctypes_struct

Methods

add_periodic_halo(zonal, meridional[, halosize])

Add a 'halo' to the Grid, through extending the Grid (and lon/lat) similarly to the halo created for the Fields

add_Sdepth_periodic_halo

check_zonal_periodic

computeTimeChunk

create_grid

lon_grid_to_source

lon_grid_to_target

lon_particle_to_target

class parcels.grid.CurvilinearZGrid(lon, lat, depth=None, time=None, time_origin=None, mesh='flat')[source]#

Bases: CurvilinearGrid

Curvilinear Z Grid.

Parameters
  • lon – 2D array containing the longitude coordinates of the grid

  • lat – 2D array containing the latitude coordinates of the grid

  • depth – Vector containing the vertical coordinates of the grid, which are z-coordinates. The depth of the different layers is thus constant.

  • time – Vector containing the time coordinates of the grid

  • time_origin (parcels.tools.converters.TimeConverter) – Time origin of the time axis

  • mesh (str) –

    String indicating the type of mesh coordinates and units used during velocity interpolation:

    1. spherical (default): Lat and lon in degree, with a correction for zonal velocity U near the poles.

    2. flat: No conversion, lat/lon are assumed to be in m.

Attributes
child_ctypes_struct

Returns a ctypes struct object containing all relevant pointers and sizes for this grid.

chunk_deprecated
chunk_loaded
chunk_loaded_touched
chunk_loading_requested
chunk_not_loaded
ctypes_struct

Methods

add_periodic_halo(zonal, meridional[, halosize])

Add a 'halo' to the Grid, through extending the Grid (and lon/lat) similarly to the halo created for the Fields

add_Sdepth_periodic_halo

check_zonal_periodic

computeTimeChunk

create_grid

lon_grid_to_source

lon_grid_to_target

lon_particle_to_target

class parcels.grid.Grid(lon, lat, time, time_origin, mesh)[source]#

Bases: object

Grid class that defines a (spatial and temporal) grid on which Fields are defined.

Attributes
child_ctypes_struct

Returns a ctypes struct object containing all relevant pointers and sizes for this grid.

chunk_deprecated
chunk_loaded
chunk_loaded_touched
chunk_loading_requested
chunk_not_loaded
ctypes_struct

Methods

add_Sdepth_periodic_halo

check_zonal_periodic

computeTimeChunk

create_grid

lon_grid_to_source

lon_grid_to_target

lon_particle_to_target

property child_ctypes_struct[source]#

Returns a ctypes struct object containing all relevant pointers and sizes for this grid.

class parcels.grid.GridCode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: IntEnum

Attributes
denominator

the denominator of a rational number in lowest terms

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

Methods

as_integer_ratio(/)

Return a pair of integers, whose ratio is equal to the original int.

bit_count(/)

Number of ones in the binary representation of the absolute value of self.

bit_length(/)

Number of bits necessary to represent self in binary.

conjugate

Returns self, the complex conjugate of any int.

from_bytes(/, bytes[, byteorder, signed])

Return the integer represented by the given array of bytes.

is_integer(/)

Returns True.

to_bytes(/[, length, byteorder, signed])

Return an array of bytes representing an integer.

class parcels.grid.RectilinearSGrid(lon, lat, depth, time=None, time_origin=None, mesh='flat')[source]#

Bases: RectilinearGrid

Rectilinear S Grid. Same horizontal discretisation as a rectilinear z grid,

but with s vertical coordinates

Parameters
  • lon – Vector containing the longitude coordinates of the grid

  • lat – Vector containing the latitude coordinates of the grid

  • depth – 4D (time-evolving) or 3D (time-independent) array containing the vertical coordinates of the grid, which are s-coordinates. s-coordinates can be terrain-following (sigma) or iso-density (rho) layers, or any generalised vertical discretisation. The depth of each node depends then on the horizontal position (lon, lat), the number of the layer and the time is depth is a 4D array. depth array is either a 4D array[xdim][ydim][zdim][tdim] or a 3D array[xdim][ydim[zdim].

  • time – Vector containing the time coordinates of the grid

  • time_origin (parcels.tools.converters.TimeConverter) – Time origin of the time axis

  • mesh (str) –

    String indicating the type of mesh coordinates and units used during velocity interpolation:

    1. spherical (default): Lat and lon in degree, with a correction for zonal velocity U near the poles.

    2. flat: No conversion, lat/lon are assumed to be in m.

Attributes
child_ctypes_struct

Returns a ctypes struct object containing all relevant pointers and sizes for this grid.

chunk_deprecated
chunk_loaded
chunk_loaded_touched
chunk_loading_requested
chunk_not_loaded
ctypes_struct

Methods

add_periodic_halo(zonal, meridional[, halosize])

Add a 'halo' to the Grid, through extending the Grid (and lon/lat) similarly to the halo created for the Fields

add_Sdepth_periodic_halo

check_zonal_periodic

computeTimeChunk

create_grid

lon_grid_to_source

lon_grid_to_target

lon_particle_to_target

class parcels.grid.RectilinearZGrid(lon, lat, depth=None, time=None, time_origin=None, mesh='flat')[source]#

Bases: RectilinearGrid

Rectilinear Z Grid.

Parameters
  • lon – Vector containing the longitude coordinates of the grid

  • lat – Vector containing the latitude coordinates of the grid

  • depth – Vector containing the vertical coordinates of the grid, which are z-coordinates. The depth of the different layers is thus constant.

  • time – Vector containing the time coordinates of the grid

  • time_origin (parcels.tools.converters.TimeConverter) – Time origin of the time axis

  • mesh (str) –

    String indicating the type of mesh coordinates and units used during velocity interpolation:

    1. spherical (default): Lat and lon in degree, with a correction for zonal velocity U near the poles.

    2. flat: No conversion, lat/lon are assumed to be in m.

Attributes
child_ctypes_struct

Returns a ctypes struct object containing all relevant pointers and sizes for this grid.

chunk_deprecated
chunk_loaded
chunk_loaded_touched
chunk_loading_requested
chunk_not_loaded
ctypes_struct

Methods

add_periodic_halo(zonal, meridional[, halosize])

Add a 'halo' to the Grid, through extending the Grid (and lon/lat) similarly to the halo created for the Fields

add_Sdepth_periodic_halo

check_zonal_periodic

computeTimeChunk

create_grid

lon_grid_to_source

lon_grid_to_target

lon_particle_to_target