Chunk

class ncTools.chunk(t_min=None, t_max=None, z_min=None, z_max=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None)[source]

This class is used to specify a chunk in a NetCDF file that corresponds to geophysical data. The keyword used are:

Attributes

t_min (int) The minimum index along the time dimension
t_max (int) The maximum index along the time dimension
z_min (int) The minimum index along the vertical dimension
z_max (int) The maximum index along the vertical dimension
lat_min (int) The minimum index along the latitudinal dimension
lat_max (int) The maximum index along the latitudinal dimension
lon_min (int) The minimum index along the longitudinal dimension
lon_max (int) The maximum index along the longitudinal dimension
The chunk class is derived from the main python dictionnary class.  
The values associated with each keywords are set to None by default.  

Methods

copy()[source]

Copy a chunk

isempty()[source]

Test if the chunk is empty

max(dim)[source]

Return the maximum of the chunk value along one dimension

Parameters:

dim : {‘T’, ‘Z’, ‘Y’, ‘X’}

Key of the dimension

Examples

>>> chk = chunk(t_min=0, t_max=25, lat_min=23, lat_max=125, 
... lon_min=65, lon_max=243)
>>> chk.max('T')
25
>>> chk.max('Z')
>>> chk.max('Y')
125
>>> chk.max('X')
243
min(dim)[source]

Return the minimum of the chunk value along one dimension

Parameters:

dim : {‘T’, ‘Z’, ‘Y’, ‘X’}

Key of the dimension

Examples

>>> chk = chunk(t_min=0, t_max=25, lat_min=23, lat_max=125, 
... lon_min=65, lon_max=243)
>>> chk.min('T')
0
>>> chk.min('Z')
>>> chk.min('Y')
23
>>> chk.min('X')
65
size_depth()[source]

Get the size of the chunk along the depth dimension

Returns:

n_z : int

The size of the chunk along the depth dimension

Examples

>>> chk = chunk(z_min=4, z_max=7)
>>> chk.size_depth()
3
>>> chk = chunk(z_min=4)
>>> chk.size_depth()
1
size_dim(dim)[source]

Get the size of the chunk along one dimension

Parameters:

dim : {‘T’, ‘Z’, ‘Y’, ‘X’}

The key of the dimension

Returns:

n : int

The size of the chunk along the corresponding dimension

Examples

>>> chk = chunk(t_min=0, t_max=25, z_min=4, z_max=7, 
... lat_min=23, lat_max=125, lon_min=65, lon_max=243)
>>> chk.size_dim('T')
25
>>> chk.size_dim('Z')
3
>>> chk.size_dim('Y')
102
>>> chk.size_dim('X')
178
size_lat()[source]

Get the size of the chunk along the latitudinal dimension

Returns:

n_lat : int

The size of the chunk along the latitudinal dimension

Examples

>>> chk = chunk(lat_min=23, lat_max=125)
>>> chk.size_lat()
102
>>> chk = chunk(lat_max=125)
>>> chk.size_lat()
1
size_latlon()[source]

Get the size of the chunk along the latitudinal and longitudinal dimensions

Returns:

n_lat : int

The size of the chunk along the latitudinal dimension

n_lon : int

The size of the chunk along the longitudinal dimension

Examples

>>> chk = chunk(lat_min=23, lat_max=125, lon_min=65, 
... lon_max=243)
>>> chk.size_latlon()
(102, 178)
size_lon()[source]

Get the size of the chunk along the longitudinal dimension

Returns:

n_lon : int

The size of the chunk along the longitudinal dimension

Examples

>>> chk = chunk(lon_min=65, lon_max=243)
>>> chk.size_lon()
178
>>> chk = chunk(lon_min=65)
>>> chk.size_lon()
1
size_time()[source]

Get the size of the chunk along the time dimension

Returns:

n_t : int

The size of the chunk along the time dimension

Examples

>>> chk=chunk(t_min=0, t_max=25)
>>> chk.size_time()
25
>>> chk=chunk(t_max=25)
>>> chk.size_time()
1
total_size()[source]

Get the total size of the chunk

Returns:

n : int

The total size of the chunk dimension

Previous topic

ncTools content

Next topic

Geovar

This Page