py_eddy_tracker.dataset.grid.GridDataset

class py_eddy_tracker.dataset.grid.GridDataset(filename, x_name, y_name, centered=None, indexs=None, unset=False)[source]

Bases: object

Class for basic tools on NetCDF Grid

Parameters
  • filename (str) – Filename to load

  • x_name (str) – Name of longitude coordinates

  • y_name (str) – Name of latitude coordinates

  • centered (bool,None) – Allow to know how coordinates could be used with pixel

  • indexs (dict) – A dictionary that sets indexes to use for non-coordinate dimensions

  • unset (bool) – Set to True to create an empty grid object without file

Methods

add_grid

Add a grid in handler

c_to_bounds

Centered coordinates to bounds coordinates

copy

Duplicate the variable from grid_in in grid_out

eddy_identification

Compute eddy identification on the specified grid

get_amplitude

get_uavg

Compute geostrophic speed around successive contours Returns the average

grid

Give the grid required

grid_tiles

Give the grid tiles required, without buffer system

high_filter

Return the high-pass filtered grid, by substracting to the initial grid the low-pass filtered grid (default: order=1)

is_circular

Check grid circularity

load

Load variable (data).

load_general_features

Load attrs to be stored in object

low_filter

Return the low-pass filtered grid (default: order=1)

setup_coordinates

units

Get unit from variable

write

Write dataset output with same format as input

Attributes

EARTH_RADIUS

GRAVITY

N

bounds

Give bounds

centered

contours

coordinates

dimensions

filename

global_attrs

indexs

is_centered

Give True if pixel is described with its center’s position or a corner

variables

variables_description

vars

x_bounds

x_c

x_dim

y_bounds

y_c

y_dim

EARTH_RADIUS = 6370997.0
GRAVITY = 9.807
N = 1
add_grid(varname, grid)[source]

Add a grid in handler

Parameters
  • varname (str) – name of the future grid

  • grid (array) – grid array

property bounds

Give bounds

static c_to_bounds(c)[source]

Centered coordinates to bounds coordinates

Parameters

c (array) – centered coordinates to translate

Returns

bounds coordinates

centered
contours
coordinates
copy(grid_in, grid_out)[source]

Duplicate the variable from grid_in in grid_out

Parameters
  • grid_in

  • grid_out

dimensions
eddy_identification(grid_height, uname, vname, date, step=0.005, shape_error=55, sampling=50, sampling_method='visvalingam', pixel_limit=None, precision=None, force_height_unit=None, force_speed_unit=None, **kwargs)[source]

Compute eddy identification on the specified grid

Parameters
  • grid_height (str) – Grid name of Sea Surface Height

  • uname (str) – Grid name of u speed component

  • vname (str) – Grid name of v speed component

  • date (datetime.datetime) – Date to be stored in object to date data

  • step (float,int) – Height between two layers in m

  • shape_error (float,int) – Maximal error allowed for outermost contour in %

  • sampling (int) – Number of points to store contours and speed profile

  • sampling_method (str) – Method to resample, ‘uniform’ or ‘visvalingam’

  • pixel_limit ((int,int),None) – Min and max number of pixels inside the inner and the outermost contour to be considered as an eddy

  • precision (float,None) – Truncate values at the defined precision in m

  • force_height_unit (str) – Unit used for height unit

  • force_speed_unit (str) – Unit used for speed unit

  • kwargs (dict) – Arguments given to amplitude (mle, nb_step_min, nb_step_to_be_mle). Look at py_eddy_tracker.eddy_feature.Amplitude() The amplitude threshold is given by step*nb_step_min

Returns

Return a list of 2 elements: Anticyclones and Cyclones

Return type

py_eddy_tracker.observations.observation.EddiesObservations

filename
static get_amplitude(contour, contour_height, data, anticyclonic_search=True, level=None, **kwargs)[source]
get_uavg(all_contours, centlon_e, centlat_e, original_contour, anticyclonic_search, level_start, pixel_min=3)[source]

Compute geostrophic speed around successive contours Returns the average

global_attrs
grid(varname, indexs=None)[source]

Give the grid required

Parameters
  • varname (str) – Variable to get

  • indexs (dict,None) – If defined dict must have dimensions name as key

Returns

array asked, reduced by the indexes

Return type

array

grid_tiles(varname, slice_x, slice_y)[source]

Give the grid tiles required, without buffer system

high_filter(grid_name, w_cut, **kwargs)[source]

Return the high-pass filtered grid, by substracting to the initial grid the low-pass filtered grid (default: order=1)

Parameters
  • grid_name – the name of the grid

  • w_cut (int,) – the half-power wavelength cutoff (km)

indexs
property is_centered

Give True if pixel is described with its center’s position or a corner

Returns

True if centered

Return type

bool

is_circular()[source]

Check grid circularity

load()[source]

Load variable (data). Get coordinates and setup coordinates function

load_general_features()[source]

Load attrs to be stored in object

low_filter(grid_name, w_cut, **kwargs)[source]

Return the low-pass filtered grid (default: order=1)

Parameters
  • grid_name – the name of the grid

  • w_cut (int,) – the half-power wavelength cutoff (km)

setup_coordinates()[source]
units(varname)[source]

Get unit from variable

property variables
variables_description
vars
write(filename)[source]

Write dataset output with same format as input

Parameters

filename (str) – filename used to save the grid

x_bounds
x_c
x_dim
y_bounds
y_c
y_dim