ochanticipy.datasources.fewsnet package¶
Submodules¶
ochanticipy.datasources.fewsnet.fewsnet module¶
FEWS NET processing.
Download and save the data provided by FEWS NET as provided on <https://fews.net/>.
FEWS NET is only available in a set of countries. Check their website to see which countries are included.
- class ochanticipy.datasources.fewsnet.fewsnet.FewsNet(country_config)[source]¶
Bases:
DataSourceBase class to retrieve FewsNet data.
- Parameters:
country_config (CountryConfig) – Country configuration
- download(pub_year: int, pub_month: int, clobber: bool = False) Path[source]¶
Retrieve the raw FEWS NET data.
Depending on the region and date, this data is published per region or per country. This function retrieves the country data if it exists, and else the regional data for pub_year-pub_month.
- Parameters:
pub_year (int) – publication year of the data that should be downloaded
pub_month (int) – publication month of the data that should be downloaded. This commonly refers to the month of the Current Situation period
clobber (bool, default = False) – If True, overwrites existing raw files
- Return type:
Path to the downloaded file.
Examples
>>> from ochanticipy import create_country_config, FewsNet >>> # Download FEWS NET data for ETH published in 2021-06 >>> country_config = create_country_config(iso3="eth") >>> fewsnet = FewsNet(country_config=country_config) >>> eth_fn_202106_path = fewsnet.download(pub_year=2021,pub_month=6)
- load(pub_year: int, pub_month: int, projection_period: ValidProjectionPeriods) GeoDataFrame[source]¶
Load FEWS NET data.
For the given pub_year, pub_month and projection_period.
- Parameters:
pub_year (int) – publication year of the data that should be loaded
pub_month (int) – publication month of the data that should be loaded. This refers to the first month of the Current Situation period
projection_period (str) – The projection period to be loaded. This should be CS, ML1, or ML2. Referring to Current Situation, near term projection, and medium term projection respectively.
- Return type:
Geopandas DataFrame with the specified data.
Examples
>>> from ochanticipy import create_country_config, FewsNet >>> # Load FEWS NET data for ETH published in 2021-06 of medium-term ... projection period (ML1) >>> country_config = create_country_config(iso3="eth") >>> fewsnet = FewsNet(country_config=country_config) >>> gdf_eth_fn_202106 = fewsnet.load(pub_year=2021,pub_month=6, ... projection_period = "ML1")
- class ochanticipy.datasources.fewsnet.fewsnet.ValidProjectionPeriods(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumDefine Enum for Valid Projection Periods.
Use Enum such that it can function as type-checking as well as check if user-inputed string is valid
- CS = 'CS'¶
- ML1 = 'ML1'¶
- ML2 = 'ML2'¶
Module contents¶
Functionality to process fewsnet data.