Skip to contents

The Climate Data API provides access to historical temperature and precipitation data. These data are separate from the outputs of the GCMs, and they are based on gridded climatologies from the Climate Research Unit.


get_historical_data(locator, cvar, time_scale)



The ISO3 country code that you want data about. ( or the basin ID [1-468]. The historical period for country is 1901 - 2009, and 1960 - 2009 for basin


The climate variable you're interested in. "pr" for precipitation, "tas" for temperature in celcius.


The time scale you want to return values on. Must be "month", "year" or "decade"


a dataframe with historical climate data


The time_scale parameter returns a different number of variables depending on the input timescale. Month will return 12 values, a historical average for that month across all years. Year will return yearly averages for each year, and decade will return decade averages.