pip install git+https://github.com/CIAT-DAPA/aclimatepyapi@v0.2.0
After install the package you need to set some environmente varibles to use the geoserver, first set the geoserver username
In Windows:
set "GEOSERVER_USER=[your_username]"
In Mac or Linux:
export GEOSERVER_USER="[your_username]"
Now set the geoserver password
In Windows:
set "GEOSERVER_PASSWORD=[your_password]"
In Mac or Linux:
export GEOSERVER_PASSWORD="[your_password]"
Remove
The easiest way to remove the package is:
country_id = "61e59d829d5d2486e18d2ea8" ws_list = geographic.get_geographic_ws(country_id) print(ws_list)
Historical Module
To use this module you need to import the module and create the object
from aclimate_api.historical import Historical historical = Historical(URL_API)
Get historical climatology
The method get_historical_climatology, function which gets the climatology of a selected weather station.
You can find the ids of the weather stations in the method get_geographic
stations=["58504f1a006cb93ed40eebe2","58504f1a006cb93ed40eebe3"] df = historical.get_historical_climatology(stations) print(df)
Get historical climate information
The method get_historical_historicalclimatic, function which gets the weather history of a selected weather station.
You can find the ids of the weather stations in the method get_geographic
stations=["58504f1a006cb93ed40eebe2","58504f1a006cb93ed40eebe3"] df = historical.get_historical_historicalclimatic(stations) print(df)
Get years with historical crop performance data
The method get_historical_historicalyieldyears, function which gets the years that contain historical crop performance data of the selected weather station.
You can find the ids of the weather stations in the method get_geographic
stations=["58504f1a006cb93ed40eebe2","58504f1a006cb93ed40eebe3"] df = historical.get_historical_historicalyieldyears(stations) print(df)
Get historical crop performance
The method get_historical_historicalyield, function which gets the yield data obtained through the crop model process.
You can find the ids of the weather stations in the method get_geographic
stations=["58504f1a006cb93ed40eebe2","58504f1a006cb93ed40eebe3"] years=["2022","2023"] df = historical.get_historical_historicalyield(stations, years) print(df)
Geoserver Module
To use this module you need to import the module and create the object
Get geoserver workspace
The method get_geo_workspaces, function which gets all the workspaces of the GeoServer. As arguments user is the username in geoserver and password is the geoserver password.
obj_f = geoserver.get_geo_workspaces(user, password)obj_f = geoserver.get_geo_workspaces()print(obj_f)
Get geoserver mosaic stores
The method get_geo_mosaic_name, function which gets all the mosaic stores of a specific workspace. As arguments user is the username in geoserver and password is the geoserver password.
You can find the workspace in the method get_geo_workspaces
workspace = "climate_indices_pe" obj_f = geoserver.get_geo_mosaic_name(workspace, user, password)obj_f = geoserver.get_geo_mosaic_name(workspace)print(obj_f)
Get geoserver mosaics
The method get_geo_mosaics, function which gets the desired mosaic from the GeoServer.
Get geoserver polygon stores
The method get_geo_polygon_name, function which gets all the polygon stores of a specific workspace. As arguments user is the username in geoserver and password is the geoserver password.
You can find the workspace in the method get_geo_workspaces
workspace = "administrative" obj_f = geoserver.get_geo_polygon_name(workspace, user, password)obj_f = geoserver.get_geo_polygon_name(workspace)print(obj_f)
Get geoserver shapefiles
The method get_geo_polygons, function which gets the desired shapefile from the GeoServer.
workspace = "administrative" polygon_name = "ao_adm1" shapefile = get_geo_polygons(workspace, polygon_name) print(shapefile)
Historical Module
To use this module you need to import the module and create the object
from aclimate_api.historical import Historical historical = Historical(URL_API)
Get historical climatology
The method get_historical_climatology, function which gets the climatology of a selected weather station.
You can find the ids of the weather stations in the method get_geographic
stations=["58504f1a006cb93ed40eebe2","58504f1a006cb93ed40eebe3"] df = historical.get_historical_climatology(stations) print(df)
Get historical climate information
The method get_historical_historicalclimatic, function which gets the weather history of a selected weather station.
You can find the ids of the weather stations in the method get_geographic
stations=["58504f1a006cb93ed40eebe2","58504f1a006cb93ed40eebe3"] df = historical.get_historical_historicalclimatic(stations) print(df)
Get years with historical crop performance data
The method get_historical_historicalyieldyears, function which gets the years that contain historical crop performance data of the selected weather station.
You can find the ids of the weather stations in the method get_geographic
stations=["58504f1a006cb93ed40eebe2","58504f1a006cb93ed40eebe3"] df = historical.get_historical_historicalyieldyears(stations) print(df)
Get historical crop performance
The method get_historical_historicalyield, function which gets the yield data obtained through the crop model process.
You can find the ids of the weather stations in the method get_geographic
stations=["58504f1a006cb93ed40eebe2","58504f1a006cb93ed40eebe3"] years=["2022","2023"] df = historical.get_historical_historicalyield(stations, years) print(df)
Repository management:
3 main branches are managed.
-
main: No changes should be made directly, since it is updated when pulling or pushing to the stage branch
-
stage: The changes tested and ready to be sent to production must be sent to this branch, for their subsequent process of automatic tests, merge into master and creation of the release.
-
develop: Branch where the development version of the project will be managed, normally changes will be sent to stage from this branch.