regionate.region.GriddedRegion

class regionate.region.GriddedRegion(name, lons, lats, grid, positive_in=True, mask=None, ij=None)[source]

Bases: Region

A named polygonal region that exactly conforms to the velocity faces of a C-grid ocean model.

Methods

copy([remove_duplicate_points])

Returns a copy of the Region.

initiate_from_boundary(lons, lats[, ...])

TO DO

make_counterclockwise()

Checks if the section is clockwise and flips its direction if it is to make it counterclockwise.

remove_duplicate_points([closeness_threshold])

Removes any duplicate points.

to_gr(path)

Save the GriddedRegion object in a .gr format file directory

copy(remove_duplicate_points=False)

Returns a copy of the Region.

Parameters:

remove_duplicate_points (bool) – Default: False. If True, prunes any duplicate points from the input arrays (lons, lats).

Returns:

region_copy – Copy of the region.

Return type:

regionate.region.Region

initiate_from_boundary(lons, lats, positive_in=True, mask=None)[source]

TO DO

make_counterclockwise()

Checks if the section is clockwise and flips its direction if it is to make it counterclockwise.

remove_duplicate_points(closeness_threshold=5000.0)

Removes any duplicate points.

Parameters:

closeness_threshold (float) – A short distance within which points are deemed to be identical. Default: 5.e3.

to_gr(path)[source]

Save the GriddedRegion object in a .gr format file directory

There are two key files within each .gr directory:

  • a grid.nc file that contains information about the coordinates required to create an xgcm.Grid instance

  • a boundary.nc file that contains the region’s tracer cell mask and the coordinates and indices of the corner cells that define its boundary.

To do:

  • Subdirectory for child boundary information

Parameters:

directory (path [str] -- path to directory where the .gr file) – should be saved. The filename will be [GriddedRegion.name].gr

Example

>>> gridded_region.save('../data/')