ROIs API

ROIs API#

ROI#

class planetary_coverage.rois.ROI(key, lons_e, lats, name=None, **kwargs)[source]#

Bases: AbstractItem

Region Of Interest object.

Parameters:
  • key (str or int) – Identification key.

  • lons_e ([float, ]) – Polygon coordinates east longitudes.

  • lats ([float, ]) – Polygon coordinates latitudes.

  • name (str, optional) – Region name.

  • **kwargs (str, optional) – Region description / Science objective / Observation requirement / Color…

property vertices#

ROI vertices.

property codes#

ROI path codes.

property path#

Region of interest path.

patch(**kwargs)[source]#

Region of interest patch with default color.

get_path()[source]#

ROI path.

get_alpha()[source]#

ROI default transparency.

get_fc()[source]#

ROI default facecolor.

get_ec()[source]#

ROI default edgecolor.

get_linewidth()[source]#

ROI default linewidth.

get_linestyle()[source]#

ROI default linestyle.

get_zorder()[source]#

ROI default zorder.

get_label()[source]#

ROI default label.

contains(pts)[source]#

Check if points are inside the pixel.

Parameters:

pts (numpy.ndarray) – List of geographic point(s): (lon_e, lat) or [(lon_e, lat), …]. If an object with lonlat attribute/property is provided, the intersection will be performed on these points.

Returns:

Return True if the point is inside the pixel corners, and False overwise.

Return type:

np.array

Warning

The data need to be projected on a sphere first. Here we project the ROI on a Equirectangular plane before doing the intersection.

Note

If the point is on the edge of the contour it will be excluded.

ROIsCollection#

class planetary_coverage.rois.ROIsCollection(dict=None, /, **kwargs)[source]#

Bases: AbstractCollection

ROIs collection.

ITEM#

alias of ROI

collection(**kwargs)[source]#

ROI patches collection with default ROI color.

get_paths()[source]#

Collection paths.

get_alpha()[source]#

Default transparencies.

get_facecolor()[source]#

Default facecolors.

get_edgecolor()[source]#

Default edgecolors.

get_linewidth()[source]#

Default linewidth.

get_linestyle()[source]#

Default linestyle.

get_zorder()[source]#

Default zorder.

get_label()[source]#

Default label.

contains(pts)[source]#

Check if a list of points are in the ROIs collection.

intersect(obj, outside=False)[source]#

Intersection between the trajectory and an object.

Parameters:
  • obj (any) – Trajectory-like object to intersect the ROIsCollection.

  • outside (bool, optional) – Return the invert of the intersection (default: False).

Returns:

Masked trajectory.

Return type:

ROIsCollection

Raises:

AttributeError – If the comparison object doest have a contains() test function.

ROIsCollectionWithCategories#

class planetary_coverage.rois.ROIsCollectionWithCategories(*args, **kwargs)[source]#

Bases: ROIsCollection

ROIs collection with categories.

property rois#

Collection of ROIs.

add_category(key, **kwargs)[source]#

Add/Update a category.

add_subcategory(key, **kwargs)[source]#

Add/Update a subcategory.

add_roi(key, lons_e, lats, **kwargs)[source]#

Add/Update a subcategory.

GanymedeROIs#

rois.GanymedeROIs = <Stephan2021ROIsCollection> 139 rois | 7 categories | 10 subcategories#

CallistoROIs#

rois.CallistoROIs = <Stephan2021ROIsCollection> 85 rois | 7 categories | 10 subcategories#

Stephan2021ROIsCollection#

class planetary_coverage.rois.rois_stephan_2021_pss.Stephan2021ROIsCollection(csv=None, prefix=None, target=None)[source]#

Bases: ROIsCollectionWithCategories

Abstract ROIs collection from Stephan et al. 2021 - PSS.

Source:
  • Stephan et al. (2021) PSS, doi: 10.1016/j.pss.2021.105324

Parameters:
  • csv (str or pathlib.Path) – ROIs CSV file name.

  • prefix (str, optional) – ROI key prefix.

property doi#

Stephan et al (2021) PSS doi.

key(cat, subcat=None, roi=None) str[source]#

ROI key pattern formatter.

Pattern:

  • C for category.

  • C.S for sub-category.

  • PREFIX_C_S_RR for a full ROI description.

with:

  • C the category.

  • S the sub-category.

  • R the ROI id.

  • PREFIX the ROI prefix.

Parameters:
  • cat (int or str) – Main category.

  • subcat (int or str, optional) – Sub-category. If 0 the sub-category will be omitted.

  • roi (int or str, optional) – The ROI id.

Returns:

Formatted key.

Return type:

str

load_csv()[source]#

Load ROIs from a CSV file.

property handles#

ROIs legend category handles.

GeoJsonROI#

class planetary_coverage.rois.GeoJsonROI(key, geojson, **kwargs)[source]#

Bases: ROI

GeoJson ROI object.

Parameters:
  • key (str) – Identification key.

  • geojson (str, pathlib.Path) – GeoJson file.

  • **kwargs (str, optional) – Region attribute.

Note

Only a limited number of geojson types are supported at the moment: FeatureCollection, Feature and Polygon.

property vertices#

ROI vertices.

property codes#

ROI path codes.

property geojson#

GeoJson file.

load_geojson(json)[source]#

Load GeoJson content.

Category#

class planetary_coverage.rois.Category(key, name=None, **kwargs)[source]#

Bases: AbstractItem

ROI category.

Parameters:
  • key – Identification key.

  • name (str, optional) – Category name.

  • **kwargs (str, optional) – Region description/Science objective/Observation requirement/Color.

CategoriesCollection#

class planetary_coverage.rois.CategoriesCollection(dict=None, /, **kwargs)[source]#

Bases: AbstractCollection

Categories collection.

ITEM#

alias of Category

SubCategory#

class planetary_coverage.rois.SubCategory(key, name=None, category=None, **kwargs)[source]#

Bases: AbstractItem

ROI sub-category.

Parameters:
Raises:

AttributeError: – If the category attribute is missing.

SubCategoriesCollection#

class planetary_coverage.rois.SubCategoriesCollection(dict=None, /, **kwargs)[source]#

Bases: AbstractCollection

Sub-categories collection.

ITEM#

alias of SubCategory

AbstractItem#

class planetary_coverage.rois.abstract.AbstractItem(key, name=None, **kwargs)[source]#

Bases: object

Abstract item.

Parameters:
  • key – Identification key.

  • name (str, optional) – ROI/Category/SubCategory name.

  • **kwargs (str, optional) – Region description/Science objective/Observation requirement/Color.

AbstractCollection#

class planetary_coverage.rois.abstract.AbstractCollection(dict=None, /, **kwargs)[source]#

Bases: UserDict

Abstract collection.

ITEM#

alias of AbstractItem

property count#

Count items.

keys()[source]#

Keys iterators.

items()[source]#

Keys and values iterators.