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:
objectDataclass 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
Minimum latitude
Maximum latitude
Minimum longitud
Maximum longitud
Starting month of the season to select (included)
Ending month of the season to select (included)
DEPRECATED.
Starting year of the period to select (included)
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
- 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)