Region

class spy4cast.stypes.Region(lat0: float | int, latf: float | int, lon0: float | int, lonf: float | int, month0: Month | int, monthf: Month | int, year0: int, yearf: int, sy: int | None = None, day0: int | None = None, dayf: int | None = None)

Bases: object

Dataclass to create a Region

A region is the way of slicing datasets that is convenient to the user and the API

Note

The developers of this API are aware that the correct spelling for slice is with a c. However, slice is a built-in function in python and in the start of the development of this poject was better to use region. This is the reason why this class is spelled with s (it wouldn’t conflict with slice right now because it is capitalised, but it looks good enough, right?)

Attributes Summary

lat0

Minimum latitude

latf

Maximum latitude

lon0

Minimum longitud

lonf

Maximum longitud

month0

Starting month of the season to select (included)

monthf

Ending month of the season to select (included)

sy

DEPRECATED.

year0

Starting year of the period to select (included)

yearf

Ending year of the period to select (included)

Methods Summary

as_numpy()

Converts region to np array with fields: lat0, latf, lon0, lonf, month0, monthf, year0, yearf, sy

default([month0, monthf, year0, yearf, sy, ...])

Alternartive constructor that creates a Region that has the largest spatial region and season possible

from_numpy(arr)

Alternative constructor for region: lat0, latf, lon0, lonf, month0, monthf, year0, yearf, sy

Attributes Documentation

lat0: float | int = None

Minimum latitude

latf: float | int = None

Maximum latitude

lon0: float | int = None

Minimum longitud

lonf: float | int = None

Maximum longitud

month0: Month | int = None

Starting month of the season to select (included)

monthf: Month | int = None

Ending month of the season to select (included)

sy: int | None = None

DEPRECATED. Selected year used in methodologies like anom where you can only plot a given year

year0: int = None

Starting year of the period to select (included)

yearf: int = None

Ending year of the period to select (included)

Methods Documentation

as_numpy() ndarray[Any, dtype[float32 | uint64]]

Converts region to np array with fields: lat0, latf, lon0, lonf, month0, monthf, year0, yearf, sy

classmethod default(month0: int = Month.JAN, monthf: int = Month.DEC, year0: int = 0, yearf: int = 2000, sy: int | None = None, day0: int | None = None, dayf: int | None = None) Region

Alternartive constructor that creates a Region that has the largest spatial region and season possible

It is useful if you want to create fast a Region where you conly want to modify the initial and final year for example

Return type:

Region(-90, 90, -180, 180, month0, monthf, year0, yearf, sy)

classmethod from_numpy(arr: ndarray[Any, dtype[float32 | uint64]]) Region

Alternative constructor for region: lat0, latf, lon0, lonf, month0, monthf, year0, yearf, sy